diff --git a/README.md b/README.md index 918c30b1..6ecc4cc9 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ All endpoints in the API follow REST conventions and use standard HTTP methods. See the next sections for more information on how to use the Segment Public API Java SDK. -Latest API and SDK version: 36.1.1 +Latest API and SDK version: 36.2.0 ## Requirements @@ -28,7 +28,7 @@ Add this dependency to your project's POM: com.segment.publicapi segment-publicapi - 36.1.1 + 36.2.0 compile ``` @@ -44,7 +44,7 @@ Add this dependency to your project's build file: } dependencies { - implementation "com.segment.publicapi:segment-publicapi:36.1.1" + implementation "com.segment.publicapi:segment-publicapi:36.2.0" } ``` @@ -58,7 +58,7 @@ mvn clean package Then manually install the following JARs: -* `target/segment-publicapi-36.1.1.jar` +* `target/segment-publicapi-36.2.0.jar` * `target/lib/*.jar` You are now ready to start making calls to Public API! diff --git a/pom.xml b/pom.xml index 00425dc8..b925423e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ segment-publicapi jar segment-publicapi - 36.1.1 + 36.2.0 https://segment.com/docs/api/public-api/ Segment Public API diff --git a/src/main/java/com/segment/publicapi/ApiClient.java b/src/main/java/com/segment/publicapi/ApiClient.java index 6902f22d..1d2f0beb 100644 --- a/src/main/java/com/segment/publicapi/ApiClient.java +++ b/src/main/java/com/segment/publicapi/ApiClient.java @@ -124,7 +124,7 @@ private void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("Public API SDK 36.1.1 (Java)"); + setUserAgent("Public API SDK 36.2.0 (Java)"); authentications = new HashMap(); } diff --git a/src/main/java/com/segment/publicapi/JSON.java b/src/main/java/com/segment/publicapi/JSON.java index 39eed4e2..bb47364c 100644 --- a/src/main/java/com/segment/publicapi/JSON.java +++ b/src/main/java/com/segment/publicapi/JSON.java @@ -164,6 +164,10 @@ private static Class getClassByDiscriminator( .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.segment.publicapi.models.AllowedLabelBeta.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.Audience.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AudienceSummary.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.segment.publicapi.models.AuditEventV1.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( @@ -179,6 +183,10 @@ private static Class getClassByDiscriminator( new com.segment.publicapi.models.BreakdownBeta.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.segment.publicapi.models.CommonSourceSettingsV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ComputedTrait.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ComputedTraitSummary.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.segment.publicapi.models.Contact.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( @@ -556,6 +564,16 @@ private static Class getClassByDiscriminator( 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.GetAudienceAlphaOutput.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()); @@ -775,12 +793,24 @@ private static Class getClassByDiscriminator( new com.segment.publicapi.models.LabelAlpha.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.segment.publicapi.models.LabelV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListAudiences200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListAudiencesAlphaOutput + .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()); @@ -1081,6 +1111,18 @@ private static Class getClassByDiscriminator( new com.segment.publicapi.models.Regulation.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.segment.publicapi.models.RegulationListEntryV1.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()); @@ -1312,6 +1354,24 @@ private static Class getClassByDiscriminator( new com.segment.publicapi.models.TransformationBeta.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.segment.publicapi.models.TransformationV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateAudienceForSpace200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateAudienceForSpaceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateAudienceForSpaceInput + .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()); 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..f4e92d61 --- /dev/null +++ b/src/main/java/com/segment/publicapi/api/AudiencesApi.java @@ -0,0 +1,921 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. 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.GetAudience200Response; +import com.segment.publicapi.models.ListAudiences200Response; +import com.segment.publicapi.models.PaginationInput; +import com.segment.publicapi.models.RemoveAudienceFromSpace200Response; +import com.segment.publicapi.models.UpdateAudienceForSpace200Response; +import com.segment.publicapi.models.UpdateAudienceForSpaceInput; +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 getAudience + * + * @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 getAudienceCall(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}" + .replaceAll( + "\\{" + "spaceId" + "\\}", + localVarApiClient.escapeString(spaceId.toString())) + .replaceAll( + "\\{" + "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 getAudienceValidateBeforeCall( + 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 getAudience(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling getAudience(Async)"); + } + + okhttp3.Call localVarCall = getAudienceCall(spaceId, id, _callback); + return localVarCall; + } + + /** + * Get Audience Returns the Audience by id and spaceId. • This endpoint is in **Alpha** testing. + * Please submit any feedback by sending 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 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) throws ApiException { + ApiResponse localVarResp = getAudienceWithHttpInfo(spaceId, id); + return localVarResp.getData(); + } + + /** + * Get Audience Returns the Audience by id and spaceId. • This endpoint is in **Alpha** testing. + * Please submit any feedback by sending 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<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) + throws ApiException { + okhttp3.Call localVarCall = getAudienceValidateBeforeCall(spaceId, id, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Audience (asynchronously) Returns the Audience by id and spaceId. • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending 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 getAudienceAsync( + String spaceId, String id, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getAudienceValidateBeforeCall(spaceId, id, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for listAudiences + * + * @param spaceId (required) + * @param pagination Information about the pagination of this response. 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 listAudiencesCall( + 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}/audiences" + .replaceAll( + "\\{" + "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 listAudiencesValidateBeforeCall( + 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 listAudiences(Async)"); + } + + // verify the required parameter 'pagination' is set + if (pagination == null) { + throw new ApiException( + "Missing the required parameter 'pagination' when calling" + + " listAudiences(Async)"); + } + + okhttp3.Call localVarCall = listAudiencesCall(spaceId, pagination, _callback); + return localVarCall; + } + + /** + * List Audiences Returns Audiences by spaceId. • This endpoint is in **Alpha** testing. Please + * submit any feedback by sending 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 pagination Information about the pagination of this response. This parameter exists in + * alpha. (required) + * @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, PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + listAudiencesWithHttpInfo(spaceId, pagination); + return localVarResp.getData(); + } + + /** + * List Audiences Returns Audiences by spaceId. • This endpoint is in **Alpha** testing. Please + * submit any feedback by sending 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 pagination Information about the pagination of this response. This parameter exists in + * alpha. (required) + * @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, PaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = listAudiencesValidateBeforeCall(spaceId, pagination, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Audiences (asynchronously) Returns Audiences by spaceId. • This endpoint is in **Alpha** + * testing. Please submit any feedback by sending 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 pagination Information about the pagination of this response. 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 listAudiencesAsync( + String spaceId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = listAudiencesValidateBeforeCall(spaceId, pagination, _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}" + .replaceAll( + "\\{" + "spaceId" + "\\}", + localVarApiClient.escapeString(spaceId.toString())) + .replaceAll( + "\\{" + "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)"); + } + + okhttp3.Call localVarCall = removeAudienceFromSpaceCall(spaceId, id, _callback); + return localVarCall; + } + + /** + * Remove Audience from Space Deletes an Audience by id and spaceId. • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending 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 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 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 updateAudienceForSpaceInput (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, + UpdateAudienceForSpaceInput updateAudienceForSpaceInput, + 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 = updateAudienceForSpaceInput; + + // create path and map variables + String localVarPath = + "/spaces/{spaceId}/audiences/{id}" + .replaceAll( + "\\{" + "spaceId" + "\\}", + localVarApiClient.escapeString(spaceId.toString())) + .replaceAll( + "\\{" + "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, + UpdateAudienceForSpaceInput updateAudienceForSpaceInput, + 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 'updateAudienceForSpaceInput' is set + if (updateAudienceForSpaceInput == null) { + throw new ApiException( + "Missing the required parameter 'updateAudienceForSpaceInput' when calling" + + " updateAudienceForSpace(Async)"); + } + + okhttp3.Call localVarCall = + updateAudienceForSpaceCall(spaceId, id, updateAudienceForSpaceInput, _callback); + return localVarCall; + } + + /** + * Update Audience for Space Updates the enabled status for an audience • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending 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). + * 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 updateAudienceForSpaceInput (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, UpdateAudienceForSpaceInput updateAudienceForSpaceInput) + throws ApiException { + ApiResponse localVarResp = + updateAudienceForSpaceWithHttpInfo(spaceId, id, updateAudienceForSpaceInput); + return localVarResp.getData(); + } + + /** + * Update Audience for Space Updates the enabled status for an audience • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending 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). + * 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 updateAudienceForSpaceInput (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, UpdateAudienceForSpaceInput updateAudienceForSpaceInput) + throws ApiException { + okhttp3.Call localVarCall = + updateAudienceForSpaceValidateBeforeCall( + spaceId, id, updateAudienceForSpaceInput, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Audience for Space (asynchronously) Updates the enabled status for an audience • This + * endpoint is in **Alpha** testing. Please submit any feedback by sending 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). + * 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 updateAudienceForSpaceInput (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, + UpdateAudienceForSpaceInput updateAudienceForSpaceInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateAudienceForSpaceValidateBeforeCall( + spaceId, id, updateAudienceForSpaceInput, _callback); + 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..7909ad29 --- /dev/null +++ b/src/main/java/com/segment/publicapi/api/ComputedTraitsApi.java @@ -0,0 +1,939 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. 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.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 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}" + .replaceAll( + "\\{" + "spaceId" + "\\}", + localVarApiClient.escapeString(spaceId.toString())) + .replaceAll( + "\\{" + "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)"); + } + + okhttp3.Call localVarCall = getComputedTraitCall(spaceId, id, _callback); + return localVarCall; + } + + /** + * Get Computed Trait Returns the Computed Trait by id and spaceId • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending 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 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 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. 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 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" + .replaceAll( + "\\{" + "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)"); + } + + // verify the required parameter 'pagination' is set + if (pagination == null) { + throw new ApiException( + "Missing the required parameter 'pagination' when calling" + + " listComputedTraits(Async)"); + } + + okhttp3.Call localVarCall = listComputedTraitsCall(spaceId, pagination, _callback); + return localVarCall; + } + + /** + * List Computed Traits Returns Computed Traits by spaceId. • This endpoint is in **Alpha** + * testing. Please submit any feedback by sending 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. This parameter exists in + * alpha. (required) + * @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 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. This parameter exists in + * alpha. (required) + * @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 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. 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 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}" + .replaceAll( + "\\{" + "spaceId" + "\\}", + localVarApiClient.escapeString(spaceId.toString())) + .replaceAll( + "\\{" + "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)"); + } + + okhttp3.Call localVarCall = removeComputedTraitFromSpaceCall(spaceId, id, _callback); + return localVarCall; + } + + /** + * 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 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 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 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}" + .replaceAll( + "\\{" + "spaceId" + "\\}", + localVarApiClient.escapeString(spaceId.toString())) + .replaceAll( + "\\{" + "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)"); + } + + okhttp3.Call localVarCall = + updateComputedTraitForSpaceCall( + spaceId, id, updateComputedTraitForSpaceAlphaInput, _callback); + return localVarCall; + } + + /** + * Update Computed Trait for Space Updates the enabled status for a computed trait. • This + * endpoint is in **Alpha** testing. Please submit any feedback by sending 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). + * 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 enabled status for a computed trait. • This + * endpoint is in **Alpha** testing. Please submit any feedback by sending 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). + * 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 enabled status for a computed + * trait. • This endpoint is in **Alpha** testing. Please submit any feedback by sending 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). + * 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/models/Audience.java b/src/main/java/com/segment/publicapi/models/Audience.java new file mode 100644 index 00000000..2b085c47 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/Audience.java @@ -0,0 +1,546 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** The audience summary output. */ +@ApiModel(description = "The audience summary output.") +public class Audience { + 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_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 Audience() {} + + public Audience id(String id) { + + this.id = id; + return this; + } + + /** + * Audience id. + * + * @return id + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Audience id.") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Audience spaceId(String spaceId) { + + this.spaceId = spaceId; + return this; + } + + /** + * Space id for the audience. + * + * @return spaceId + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Space id for the audience.") + public String getSpaceId() { + return spaceId; + } + + public void setSpaceId(String spaceId) { + this.spaceId = spaceId; + } + + public Audience name(String name) { + + this.name = name; + return this; + } + + /** + * Name of the audience. + * + * @return name + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Name of the audience.") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Audience description(String description) { + + this.description = description; + return this; + } + + /** + * Description of the audience. + * + * @return description + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Description of the audience.") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Audience key(String key) { + + this.key = key; + return this; + } + + /** + * Key for the audience. + * + * @return key + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Key for the audience.") + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public Audience enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Enabled/disabled status for the audience. + * + * @return enabled + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Enabled/disabled status for the audience.") + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public Audience createdBy(String createdBy) { + + this.createdBy = createdBy; + return this; + } + + /** + * User id who created the audience. + * + * @return createdBy + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "User id who created the audience.") + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Audience updatedBy(String updatedBy) { + + this.updatedBy = updatedBy; + return this; + } + + /** + * User id who last updated the audience. + * + * @return updatedBy + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "User id who last updated the audience.") + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Audience createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Date the audience was created. + * + * @return createdAt + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Date the audience was created.") + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + public Audience updatedAt(String updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Date the audience was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Date the audience was last updated.") + 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; + } + Audience audience = (Audience) o; + return Objects.equals(this.id, audience.id) + && Objects.equals(this.spaceId, audience.spaceId) + && Objects.equals(this.name, audience.name) + && Objects.equals(this.description, audience.description) + && Objects.equals(this.key, audience.key) + && Objects.equals(this.enabled, audience.enabled) + && Objects.equals(this.createdBy, audience.createdBy) + && Objects.equals(this.updatedBy, audience.updatedBy) + && Objects.equals(this.createdAt, audience.createdAt) + && Objects.equals(this.updatedAt, audience.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + spaceId, + name, + description, + key, + enabled, + createdBy, + updatedBy, + createdAt, + updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Audience {\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(" 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("id"); + openapiFields.add("spaceId"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("key"); + openapiFields.add("enabled"); + 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("id"); + openapiRequiredFields.add("spaceId"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("key"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("createdBy"); + openapiRequiredFields.add("updatedBy"); + 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 Audience + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!Audience.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in Audience is not found in the empty" + + " JSON string", + Audience.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (Entry entry : entries) { + if (!Audience.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `Audience`" + + " properties. JSON: %s", + entry.getKey(), jsonObj.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Audience.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("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").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("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 (!Audience.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Audience' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Audience.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Audience value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Audience read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.nullSafe(); + } + } + + /** + * Create an instance of Audience given an JSON string + * + * @param jsonString JSON string + * @return An instance of Audience + * @throws IOException if the JSON string is invalid with respect to Audience + */ + public static Audience fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Audience.class); + } + + /** + * Convert an instance of Audience to 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..cb21bf50 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AudienceSummary.java @@ -0,0 +1,547 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** Defines an Audience. */ +@ApiModel(description = "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_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 AudienceSummary() {} + + public AudienceSummary id(String id) { + + this.id = id; + return this; + } + + /** + * Audience id. + * + * @return id + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Audience id.") + 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 + @ApiModelProperty(required = true, value = "Space id for the audience.") + 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 + @ApiModelProperty(required = true, value = "Name of the audience.") + 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.Nonnull + @ApiModelProperty(required = true, value = "Description of the audience.") + 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 + @ApiModelProperty(required = true, value = "Key for the audience.") + 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 + @ApiModelProperty(required = true, value = "Enabled/disabled status for the audience.") + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public AudienceSummary createdBy(String createdBy) { + + this.createdBy = createdBy; + return this; + } + + /** + * User id who created the audience. + * + * @return createdBy + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "User id who created the audience.") + 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 + @ApiModelProperty(required = true, value = "User id who last updated the audience.") + 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 + @ApiModelProperty(required = true, value = "Date the audience was created.") + 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 + @ApiModelProperty(required = true, value = "Date the audience was last updated.") + 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; + } + 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.createdBy, audienceSummary.createdBy) + && Objects.equals(this.updatedBy, audienceSummary.updatedBy) + && Objects.equals(this.createdAt, audienceSummary.createdAt) + && Objects.equals(this.updatedAt, audienceSummary.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + spaceId, + name, + description, + key, + enabled, + createdBy, + updatedBy, + createdAt, + updatedAt); + } + + @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(" 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("id"); + openapiFields.add("spaceId"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("key"); + openapiFields.add("enabled"); + 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("id"); + openapiRequiredFields.add("spaceId"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("key"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("createdBy"); + openapiRequiredFields.add("updatedBy"); + 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 AudienceSummary + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!AudienceSummary.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object 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 = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (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(), jsonObj.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AudienceSummary.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("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").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("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 (!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 { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.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/ComputedTrait.java b/src/main/java/com/segment/publicapi/models/ComputedTrait.java new file mode 100644 index 00000000..71624541 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/ComputedTrait.java @@ -0,0 +1,546 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** The computed trait summary output. */ +@ApiModel(description = "The computed trait summary output.") +public class ComputedTrait { + 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_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 ComputedTrait() {} + + public ComputedTrait id(String id) { + + this.id = id; + return this; + } + + /** + * Computed trait id. + * + * @return id + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Computed trait id.") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ComputedTrait spaceId(String spaceId) { + + this.spaceId = spaceId; + return this; + } + + /** + * Space id for the computed trait. + * + * @return spaceId + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Space id for the computed trait.") + public String getSpaceId() { + return spaceId; + } + + public void setSpaceId(String spaceId) { + this.spaceId = spaceId; + } + + public ComputedTrait name(String name) { + + this.name = name; + return this; + } + + /** + * Name of the computed trait. + * + * @return name + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Name of the computed trait.") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ComputedTrait description(String description) { + + this.description = description; + return this; + } + + /** + * Description of the computed trait. + * + * @return description + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Description of the computed trait.") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public ComputedTrait key(String key) { + + this.key = key; + return this; + } + + /** + * Key for the computed trait. + * + * @return key + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Key for the computed trait.") + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public ComputedTrait enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Enabled/disabled status for the computed trait. + * + * @return enabled + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Enabled/disabled status for the computed trait.") + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public ComputedTrait createdBy(String createdBy) { + + this.createdBy = createdBy; + return this; + } + + /** + * User id who created the computed trait. + * + * @return createdBy + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "User id who created the computed trait.") + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public ComputedTrait updatedBy(String updatedBy) { + + this.updatedBy = updatedBy; + return this; + } + + /** + * User id who last updated the computed trait. + * + * @return updatedBy + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "User id who last updated the computed trait.") + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public ComputedTrait createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * The timestamp of the computed trait's creation. + * + * @return createdAt + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "The timestamp of the computed trait's creation.") + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + public ComputedTrait updatedAt(String updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * The timestamp of the computed trait's last change. + * + * @return updatedAt + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "The timestamp of the computed trait'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; + } + ComputedTrait computedTrait = (ComputedTrait) o; + return Objects.equals(this.id, computedTrait.id) + && Objects.equals(this.spaceId, computedTrait.spaceId) + && Objects.equals(this.name, computedTrait.name) + && Objects.equals(this.description, computedTrait.description) + && Objects.equals(this.key, computedTrait.key) + && Objects.equals(this.enabled, computedTrait.enabled) + && Objects.equals(this.createdBy, computedTrait.createdBy) + && Objects.equals(this.updatedBy, computedTrait.updatedBy) + && Objects.equals(this.createdAt, computedTrait.createdAt) + && Objects.equals(this.updatedAt, computedTrait.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + spaceId, + name, + description, + key, + enabled, + createdBy, + updatedBy, + createdAt, + updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ComputedTrait {\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(" 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("id"); + openapiFields.add("spaceId"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("key"); + openapiFields.add("enabled"); + 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("id"); + openapiRequiredFields.add("spaceId"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("key"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("createdBy"); + openapiRequiredFields.add("updatedBy"); + 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 ComputedTrait + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ComputedTrait.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ComputedTrait is not found in the" + + " empty JSON string", + ComputedTrait.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (Entry entry : entries) { + if (!ComputedTrait.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ComputedTrait` properties. JSON: %s", + entry.getKey(), jsonObj.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ComputedTrait.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("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").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("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 (!ComputedTrait.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ComputedTrait' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ComputedTrait.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ComputedTrait value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ComputedTrait read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ComputedTrait given an JSON string + * + * @param jsonString JSON string + * @return An instance of ComputedTrait + * @throws IOException if the JSON string is invalid with respect to ComputedTrait + */ + public static ComputedTrait fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ComputedTrait.class); + } + + /** + * Convert an instance of ComputedTrait to 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..e330303e --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/ComputedTraitSummary.java @@ -0,0 +1,547 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** Defines a Computed trait. */ +@ApiModel(description = "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_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 ComputedTraitSummary() {} + + public ComputedTraitSummary id(String id) { + + this.id = id; + return this; + } + + /** + * Computed trait id. + * + * @return id + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Computed trait id.") + 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 + @ApiModelProperty(required = true, value = "Space id for the computed trait.") + 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 + @ApiModelProperty(required = true, value = "Name of the computed trait.") + 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.Nonnull + @ApiModelProperty(required = true, value = "Description of the computed trait.") + 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 + @ApiModelProperty(required = true, value = "Key for the computed trait.") + 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 + @ApiModelProperty(required = true, value = "Enabled/disabled status for the computed trait.") + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public ComputedTraitSummary createdBy(String createdBy) { + + this.createdBy = createdBy; + return this; + } + + /** + * User id who created the computed trait. + * + * @return createdBy + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "User id who created the computed trait.") + 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 + @ApiModelProperty(required = true, value = "User id who last updated the computed trait.") + 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 + @ApiModelProperty(required = true, value = "The timestamp of the computed trait's creation.") + 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 + @ApiModelProperty(required = true, value = "The timestamp of the computed trait'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; + } + 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.createdBy, computedTraitSummary.createdBy) + && Objects.equals(this.updatedBy, computedTraitSummary.updatedBy) + && Objects.equals(this.createdAt, computedTraitSummary.createdAt) + && Objects.equals(this.updatedAt, computedTraitSummary.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + spaceId, + name, + description, + key, + enabled, + createdBy, + updatedBy, + createdAt, + updatedAt); + } + + @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(" 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("id"); + openapiFields.add("spaceId"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("key"); + openapiFields.add("enabled"); + 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("id"); + openapiRequiredFields.add("spaceId"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("key"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("createdBy"); + openapiRequiredFields.add("updatedBy"); + 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 ComputedTraitSummary + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ComputedTraitSummary.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object 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 = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (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(), jsonObj.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ComputedTraitSummary.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("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").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("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 (!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 { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.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/GetAudience200Response.java b/src/main/java/com/segment/publicapi/models/GetAudience200Response.java new file mode 100644 index 00000000..fb719310 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetAudience200Response.java @@ -0,0 +1,191 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. 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 io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +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 GetAudienceAlphaOutput data; + + public GetAudience200Response() {} + + public GetAudience200Response data(GetAudienceAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + 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; + } + 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 Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to GetAudience200Response + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!GetAudience200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object 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 = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (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(), jsonObj.toString())); + } + } + } + + 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 { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.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/GetAudienceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/GetAudienceAlphaOutput.java new file mode 100644 index 00000000..425598b3 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetAudienceAlphaOutput.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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** Audience output for update. */ +@ApiModel(description = "Audience output for update.") +public class GetAudienceAlphaOutput { + public static final String SERIALIZED_NAME_AUDIENCE = "audience"; + + @SerializedName(SERIALIZED_NAME_AUDIENCE) + private Audience audience; + + public GetAudienceAlphaOutput() {} + + public GetAudienceAlphaOutput audience(Audience audience) { + + this.audience = audience; + return this; + } + + /** + * Get audience + * + * @return audience + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + public Audience getAudience() { + return audience; + } + + public void setAudience(Audience 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 Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to GetAudienceAlphaOutput + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!GetAudienceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object 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 = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (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(), jsonObj.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetAudienceAlphaOutput.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 (!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 { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.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/GetComputedTrait200Response.java b/src/main/java/com/segment/publicapi/models/GetComputedTrait200Response.java new file mode 100644 index 00000000..e66b7d4c --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetComputedTrait200Response.java @@ -0,0 +1,192 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. 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 io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +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 + @ApiModelProperty(value = "") + 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 Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to GetComputedTrait200Response + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!GetComputedTrait200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object 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 = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (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(), jsonObj.toString())); + } + } + } + + 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 { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.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..2940b617 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetComputedTraitAlphaOutput.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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** Computed Trait output for get and update. */ +@ApiModel(description = "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 ComputedTrait computedTrait; + + public GetComputedTraitAlphaOutput() {} + + public GetComputedTraitAlphaOutput computedTrait(ComputedTrait computedTrait) { + + this.computedTrait = computedTrait; + return this; + } + + /** + * Get computedTrait + * + * @return computedTrait + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + public ComputedTrait getComputedTrait() { + return computedTrait; + } + + public void setComputedTrait(ComputedTrait 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 Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to GetComputedTraitAlphaOutput + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!GetComputedTraitAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object 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 = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (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(), jsonObj.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetComputedTraitAlphaOutput.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 (!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 { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.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/GetSubscriptionRequest.java b/src/main/java/com/segment/publicapi/models/GetSubscriptionRequest.java index 26dfd8bc..7fdeb2c9 100644 --- a/src/main/java/com/segment/publicapi/models/GetSubscriptionRequest.java +++ b/src/main/java/com/segment/publicapi/models/GetSubscriptionRequest.java @@ -40,8 +40,12 @@ public class GetSubscriptionRequest { /** Type is communication medium used. */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { + ANDROID_PUSH("ANDROID_PUSH"), + EMAIL("EMAIL"), + IOS_PUSH("IOS_PUSH"), + SMS("SMS"), WHATSAPP("WHATSAPP"); diff --git a/src/main/java/com/segment/publicapi/models/ListAudiences200Response.java b/src/main/java/com/segment/publicapi/models/ListAudiences200Response.java new file mode 100644 index 00000000..984032ac --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/ListAudiences200Response.java @@ -0,0 +1,192 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. 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 io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** ListAudiences200Response */ +public class ListAudiences200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private ListAudiencesAlphaOutput data; + + public ListAudiences200Response() {} + + public ListAudiences200Response data(ListAudiencesAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + public ListAudiencesAlphaOutput getData() { + return data; + } + + public void setData(ListAudiencesAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListAudiences200Response listAudiences200Response = (ListAudiences200Response) o; + return Objects.equals(this.data, listAudiences200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListAudiences200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of 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 ListAudiences200Response + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ListAudiences200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ListAudiences200Response is not found" + + " in the empty JSON string", + ListAudiences200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (Entry entry : entries) { + if (!ListAudiences200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ListAudiences200Response` properties. JSON: %s", + entry.getKey(), jsonObj.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListAudiences200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListAudiences200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ListAudiences200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListAudiences200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListAudiences200Response read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListAudiences200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListAudiences200Response + * @throws IOException if the JSON string is invalid with respect to ListAudiences200Response + */ + public static ListAudiences200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListAudiences200Response.class); + } + + /** + * Convert an instance of ListAudiences200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/ListAudiencesAlphaOutput.java b/src/main/java/com/segment/publicapi/models/ListAudiencesAlphaOutput.java new file mode 100644 index 00000000..590af909 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/ListAudiencesAlphaOutput.java @@ -0,0 +1,253 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** List audiences endpoint output. */ +@ApiModel(description = "List audiences endpoint output.") +public class ListAudiencesAlphaOutput { + public static final String SERIALIZED_NAME_AUDIENCES = "audiences"; + + @SerializedName(SERIALIZED_NAME_AUDIENCES) + private List audiences = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PAGINATION = "pagination"; + + @SerializedName(SERIALIZED_NAME_PAGINATION) + private Pagination pagination; + + public ListAudiencesAlphaOutput() {} + + public ListAudiencesAlphaOutput audiences(List audiences) { + + this.audiences = audiences; + return this; + } + + public ListAudiencesAlphaOutput addAudiencesItem(AudienceSummary audiencesItem) { + this.audiences.add(audiencesItem); + return this; + } + + /** + * A list of audience summary results. + * + * @return audiences + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "A list of audience summary results.") + public List getAudiences() { + return audiences; + } + + public void setAudiences(List audiences) { + this.audiences = audiences; + } + + public ListAudiencesAlphaOutput pagination(Pagination pagination) { + + this.pagination = pagination; + return this; + } + + /** + * Get pagination + * + * @return pagination + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + public Pagination getPagination() { + return pagination; + } + + public void setPagination(Pagination pagination) { + this.pagination = pagination; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListAudiencesAlphaOutput listAudiencesAlphaOutput = (ListAudiencesAlphaOutput) o; + return Objects.equals(this.audiences, listAudiencesAlphaOutput.audiences) + && Objects.equals(this.pagination, listAudiencesAlphaOutput.pagination); + } + + @Override + public int hashCode() { + return Objects.hash(audiences, pagination); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListAudiencesAlphaOutput {\n"); + sb.append(" audiences: ").append(toIndentedString(audiences)).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("audiences"); + openapiFields.add("pagination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("audiences"); + 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 ListAudiencesAlphaOutput + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ListAudiencesAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ListAudiencesAlphaOutput is not found" + + " in the empty JSON string", + ListAudiencesAlphaOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (Entry entry : entries) { + if (!ListAudiencesAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ListAudiencesAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonObj.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ListAudiencesAlphaOutput.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("audiences").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `audiences` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("audiences").toString())); + } + + JsonArray jsonArrayaudiences = jsonObj.getAsJsonArray("audiences"); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListAudiencesAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListAudiencesAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ListAudiencesAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListAudiencesAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListAudiencesAlphaOutput read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListAudiencesAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListAudiencesAlphaOutput + * @throws IOException if the JSON string is invalid with respect to ListAudiencesAlphaOutput + */ + public static ListAudiencesAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListAudiencesAlphaOutput.class); + } + + /** + * Convert an instance of ListAudiencesAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/ListComputedTraits200Response.java b/src/main/java/com/segment/publicapi/models/ListComputedTraits200Response.java new file mode 100644 index 00000000..936cbc5d --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/ListComputedTraits200Response.java @@ -0,0 +1,197 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. 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 io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** ListComputedTraits200Response */ +public class ListComputedTraits200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private ListComputedTraitsAlphaOutput data; + + public ListComputedTraits200Response() {} + + public ListComputedTraits200Response data(ListComputedTraitsAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + public ListComputedTraitsAlphaOutput getData() { + return data; + } + + public void setData(ListComputedTraitsAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListComputedTraits200Response listComputedTraits200Response = + (ListComputedTraits200Response) o; + return Objects.equals(this.data, listComputedTraits200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListComputedTraits200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of 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 + * ListComputedTraits200Response + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ListComputedTraits200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ListComputedTraits200Response is not" + + " found in the empty JSON string", + ListComputedTraits200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (Entry entry : entries) { + if (!ListComputedTraits200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ListComputedTraits200Response` properties. JSON: %s", + entry.getKey(), jsonObj.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListComputedTraits200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListComputedTraits200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ListComputedTraits200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListComputedTraits200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListComputedTraits200Response read(JsonReader in) + throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListComputedTraits200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListComputedTraits200Response + * @throws IOException if the JSON string is invalid with respect to + * ListComputedTraits200Response + */ + public static ListComputedTraits200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListComputedTraits200Response.class); + } + + /** + * Convert an instance of ListComputedTraits200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/ListComputedTraitsAlphaOutput.java b/src/main/java/com/segment/publicapi/models/ListComputedTraitsAlphaOutput.java new file mode 100644 index 00000000..17eec196 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/ListComputedTraitsAlphaOutput.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.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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** List computed traits endpoint output. */ +@ApiModel(description = "List computed traits endpoint output.") +public class ListComputedTraitsAlphaOutput { + public static final String SERIALIZED_NAME_COMPUTED_TRAITS = "computedTraits"; + + @SerializedName(SERIALIZED_NAME_COMPUTED_TRAITS) + private List computedTraits = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PAGINATION = "pagination"; + + @SerializedName(SERIALIZED_NAME_PAGINATION) + private Pagination pagination; + + public ListComputedTraitsAlphaOutput() {} + + public ListComputedTraitsAlphaOutput computedTraits(List computedTraits) { + + this.computedTraits = computedTraits; + return this; + } + + public ListComputedTraitsAlphaOutput addComputedTraitsItem( + ComputedTraitSummary computedTraitsItem) { + this.computedTraits.add(computedTraitsItem); + return this; + } + + /** + * A list of computed trait summary results. + * + * @return computedTraits + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "A list of computed trait summary results.") + public List getComputedTraits() { + return computedTraits; + } + + public void setComputedTraits(List computedTraits) { + this.computedTraits = computedTraits; + } + + public ListComputedTraitsAlphaOutput pagination(Pagination pagination) { + + this.pagination = pagination; + return this; + } + + /** + * Get pagination + * + * @return pagination + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + public Pagination getPagination() { + return pagination; + } + + public void setPagination(Pagination pagination) { + this.pagination = pagination; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListComputedTraitsAlphaOutput listComputedTraitsAlphaOutput = + (ListComputedTraitsAlphaOutput) o; + return Objects.equals(this.computedTraits, listComputedTraitsAlphaOutput.computedTraits) + && Objects.equals(this.pagination, listComputedTraitsAlphaOutput.pagination); + } + + @Override + public int hashCode() { + return Objects.hash(computedTraits, pagination); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListComputedTraitsAlphaOutput {\n"); + sb.append(" computedTraits: ").append(toIndentedString(computedTraits)).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("computedTraits"); + openapiFields.add("pagination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("computedTraits"); + 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 + * ListComputedTraitsAlphaOutput + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ListComputedTraitsAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ListComputedTraitsAlphaOutput is not" + + " found in the empty JSON string", + ListComputedTraitsAlphaOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (Entry entry : entries) { + if (!ListComputedTraitsAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ListComputedTraitsAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonObj.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ListComputedTraitsAlphaOutput.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("computedTraits").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `computedTraits` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("computedTraits").toString())); + } + + JsonArray jsonArraycomputedTraits = jsonObj.getAsJsonArray("computedTraits"); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListComputedTraitsAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListComputedTraitsAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ListComputedTraitsAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListComputedTraitsAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListComputedTraitsAlphaOutput read(JsonReader in) + throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListComputedTraitsAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListComputedTraitsAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * ListComputedTraitsAlphaOutput + */ + public static ListComputedTraitsAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListComputedTraitsAlphaOutput.class); + } + + /** + * Convert an instance of ListComputedTraitsAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/MessagesSubscriptionRequest.java b/src/main/java/com/segment/publicapi/models/MessagesSubscriptionRequest.java index 99cf361a..b01616f2 100644 --- a/src/main/java/com/segment/publicapi/models/MessagesSubscriptionRequest.java +++ b/src/main/java/com/segment/publicapi/models/MessagesSubscriptionRequest.java @@ -43,8 +43,12 @@ public class MessagesSubscriptionRequest { /** Type is communication medium used. */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { + ANDROID_PUSH("ANDROID_PUSH"), + EMAIL("EMAIL"), + IOS_PUSH("IOS_PUSH"), + SMS("SMS"), WHATSAPP("WHATSAPP"); diff --git a/src/main/java/com/segment/publicapi/models/RemoveAudienceFromSpace200Response.java b/src/main/java/com/segment/publicapi/models/RemoveAudienceFromSpace200Response.java new file mode 100644 index 00000000..fc93f5a8 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/RemoveAudienceFromSpace200Response.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 io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** RemoveAudienceFromSpace200Response */ +public class RemoveAudienceFromSpace200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private RemoveAudienceFromSpaceAlphaOutput data; + + public RemoveAudienceFromSpace200Response() {} + + public RemoveAudienceFromSpace200Response data(RemoveAudienceFromSpaceAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + public RemoveAudienceFromSpaceAlphaOutput getData() { + return data; + } + + public void setData(RemoveAudienceFromSpaceAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RemoveAudienceFromSpace200Response removeAudienceFromSpace200Response = + (RemoveAudienceFromSpace200Response) o; + return Objects.equals(this.data, removeAudienceFromSpace200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RemoveAudienceFromSpace200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of 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 + * RemoveAudienceFromSpace200Response + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!RemoveAudienceFromSpace200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in RemoveAudienceFromSpace200Response is" + + " not found in the empty JSON string", + RemoveAudienceFromSpace200Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (Entry entry : entries) { + if (!RemoveAudienceFromSpace200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `RemoveAudienceFromSpace200Response` properties. JSON: %s", + entry.getKey(), jsonObj.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RemoveAudienceFromSpace200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RemoveAudienceFromSpace200Response' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(RemoveAudienceFromSpace200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RemoveAudienceFromSpace200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RemoveAudienceFromSpace200Response read(JsonReader in) + throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.nullSafe(); + } + } + + /** + * Create an instance of RemoveAudienceFromSpace200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of RemoveAudienceFromSpace200Response + * @throws IOException if the JSON string is invalid with respect to + * RemoveAudienceFromSpace200Response + */ + public static RemoveAudienceFromSpace200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, RemoveAudienceFromSpace200Response.class); + } + + /** + * Convert an instance of RemoveAudienceFromSpace200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/RemoveAudienceFromSpaceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/RemoveAudienceFromSpaceAlphaOutput.java new file mode 100644 index 00000000..9b77ee03 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/RemoveAudienceFromSpaceAlphaOutput.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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** Delete audience endpoint output. */ +@ApiModel(description = "Delete audience endpoint output.") +public class RemoveAudienceFromSpaceAlphaOutput { + /** 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 RemoveAudienceFromSpaceAlphaOutput() {} + + public RemoveAudienceFromSpaceAlphaOutput status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * The status of the operation. + * + * @return status + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "The status of the operation.") + 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; + } + RemoveAudienceFromSpaceAlphaOutput removeAudienceFromSpaceAlphaOutput = + (RemoveAudienceFromSpaceAlphaOutput) o; + return Objects.equals(this.status, removeAudienceFromSpaceAlphaOutput.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RemoveAudienceFromSpaceAlphaOutput {\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 Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to + * RemoveAudienceFromSpaceAlphaOutput + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!RemoveAudienceFromSpaceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in RemoveAudienceFromSpaceAlphaOutput is" + + " not found in the empty JSON string", + RemoveAudienceFromSpaceAlphaOutput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (Entry entry : entries) { + if (!RemoveAudienceFromSpaceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `RemoveAudienceFromSpaceAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonObj.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RemoveAudienceFromSpaceAlphaOutput.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("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 (!RemoveAudienceFromSpaceAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RemoveAudienceFromSpaceAlphaOutput' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(RemoveAudienceFromSpaceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RemoveAudienceFromSpaceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RemoveAudienceFromSpaceAlphaOutput read(JsonReader in) + throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.nullSafe(); + } + } + + /** + * Create an instance of RemoveAudienceFromSpaceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of RemoveAudienceFromSpaceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * RemoveAudienceFromSpaceAlphaOutput + */ + public static RemoveAudienceFromSpaceAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, RemoveAudienceFromSpaceAlphaOutput.class); + } + + /** + * Convert an instance of RemoveAudienceFromSpaceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/RemoveComputedTraitFromSpace200Response.java b/src/main/java/com/segment/publicapi/models/RemoveComputedTraitFromSpace200Response.java new file mode 100644 index 00000000..c75ef599 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/RemoveComputedTraitFromSpace200Response.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 io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** RemoveComputedTraitFromSpace200Response */ +public class RemoveComputedTraitFromSpace200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private RemoveComputedTraitFromSpaceAlphaOutput data; + + public RemoveComputedTraitFromSpace200Response() {} + + public RemoveComputedTraitFromSpace200Response data( + RemoveComputedTraitFromSpaceAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + public RemoveComputedTraitFromSpaceAlphaOutput getData() { + return data; + } + + public void setData(RemoveComputedTraitFromSpaceAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RemoveComputedTraitFromSpace200Response removeComputedTraitFromSpace200Response = + (RemoveComputedTraitFromSpace200Response) o; + return Objects.equals(this.data, removeComputedTraitFromSpace200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RemoveComputedTraitFromSpace200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of 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 + * RemoveComputedTraitFromSpace200Response + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!RemoveComputedTraitFromSpace200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " RemoveComputedTraitFromSpace200Response is not found in the" + + " empty JSON string", + RemoveComputedTraitFromSpace200Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (Entry entry : entries) { + if (!RemoveComputedTraitFromSpace200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `RemoveComputedTraitFromSpace200Response` properties. JSON:" + + " %s", + entry.getKey(), jsonObj.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RemoveComputedTraitFromSpace200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'RemoveComputedTraitFromSpace200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(RemoveComputedTraitFromSpace200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, RemoveComputedTraitFromSpace200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RemoveComputedTraitFromSpace200Response read(JsonReader in) + throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.nullSafe(); + } + } + + /** + * Create an instance of RemoveComputedTraitFromSpace200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of RemoveComputedTraitFromSpace200Response + * @throws IOException if the JSON string is invalid with respect to + * RemoveComputedTraitFromSpace200Response + */ + public static RemoveComputedTraitFromSpace200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, RemoveComputedTraitFromSpace200Response.class); + } + + /** + * Convert an instance of RemoveComputedTraitFromSpace200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/RemoveComputedTraitFromSpaceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/RemoveComputedTraitFromSpaceAlphaOutput.java new file mode 100644 index 00000000..10af6e84 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/RemoveComputedTraitFromSpaceAlphaOutput.java @@ -0,0 +1,268 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** Delete computed trait endpoint output. */ +@ApiModel(description = "Delete computed trait endpoint output.") +public class RemoveComputedTraitFromSpaceAlphaOutput { + /** 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 RemoveComputedTraitFromSpaceAlphaOutput() {} + + public RemoveComputedTraitFromSpaceAlphaOutput status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * The status of the operation. + * + * @return status + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "The status of the operation.") + 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; + } + RemoveComputedTraitFromSpaceAlphaOutput removeComputedTraitFromSpaceAlphaOutput = + (RemoveComputedTraitFromSpaceAlphaOutput) o; + return Objects.equals(this.status, removeComputedTraitFromSpaceAlphaOutput.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RemoveComputedTraitFromSpaceAlphaOutput {\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 Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to + * RemoveComputedTraitFromSpaceAlphaOutput + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!RemoveComputedTraitFromSpaceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " RemoveComputedTraitFromSpaceAlphaOutput is not found in the" + + " empty JSON string", + RemoveComputedTraitFromSpaceAlphaOutput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (Entry entry : entries) { + if (!RemoveComputedTraitFromSpaceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `RemoveComputedTraitFromSpaceAlphaOutput` properties. JSON:" + + " %s", + entry.getKey(), jsonObj.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RemoveComputedTraitFromSpaceAlphaOutput.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("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 (!RemoveComputedTraitFromSpaceAlphaOutput.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'RemoveComputedTraitFromSpaceAlphaOutput' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(RemoveComputedTraitFromSpaceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, RemoveComputedTraitFromSpaceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RemoveComputedTraitFromSpaceAlphaOutput read(JsonReader in) + throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.nullSafe(); + } + } + + /** + * Create an instance of RemoveComputedTraitFromSpaceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of RemoveComputedTraitFromSpaceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * RemoveComputedTraitFromSpaceAlphaOutput + */ + public static RemoveComputedTraitFromSpaceAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, RemoveComputedTraitFromSpaceAlphaOutput.class); + } + + /** + * Convert an instance of RemoveComputedTraitFromSpaceAlphaOutput to 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..e9820fd9 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateAudienceForSpace200Response.java @@ -0,0 +1,198 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. 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 io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +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 + @ApiModelProperty(value = "") + 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 Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to + * UpdateAudienceForSpace200Response + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!UpdateAudienceForSpace200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object 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 = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (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(), jsonObj.toString())); + } + } + } + + 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 { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.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/UpdateAudienceForSpaceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/UpdateAudienceForSpaceAlphaOutput.java new file mode 100644 index 00000000..0ad08cf1 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateAudienceForSpaceAlphaOutput.java @@ -0,0 +1,211 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. 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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** Audience output for get. */ +@ApiModel(description = "Audience output for get.") +public class UpdateAudienceForSpaceAlphaOutput { + public static final String SERIALIZED_NAME_AUDIENCE = "audience"; + + @SerializedName(SERIALIZED_NAME_AUDIENCE) + private Audience audience; + + public UpdateAudienceForSpaceAlphaOutput() {} + + public UpdateAudienceForSpaceAlphaOutput audience(Audience audience) { + + this.audience = audience; + return this; + } + + /** + * Get audience + * + * @return audience + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + public Audience getAudience() { + return audience; + } + + public void setAudience(Audience 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 Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to + * UpdateAudienceForSpaceAlphaOutput + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!UpdateAudienceForSpaceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object 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 = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (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(), jsonObj.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateAudienceForSpaceAlphaOutput.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 (!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 { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.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/UpdateAudienceForSpaceInput.java b/src/main/java/com/segment/publicapi/models/UpdateAudienceForSpaceInput.java new file mode 100644 index 00000000..9a42b1f4 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateAudienceForSpaceInput.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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** Input to update an audience. */ +@ApiModel(description = "Input to update an audience.") +public class UpdateAudienceForSpaceInput { + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public UpdateAudienceForSpaceInput() {} + + public UpdateAudienceForSpaceInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Enabled/disabled status for the audience. + * + * @return enabled + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Enabled/disabled status for the audience.") + 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; + } + UpdateAudienceForSpaceInput updateAudienceForSpaceInput = (UpdateAudienceForSpaceInput) o; + return Objects.equals(this.enabled, updateAudienceForSpaceInput.enabled); + } + + @Override + public int hashCode() { + return Objects.hash(enabled); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateAudienceForSpaceInput {\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("enabled"); + + // 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 UpdateAudienceForSpaceInput + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!UpdateAudienceForSpaceInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateAudienceForSpaceInput is not" + + " found in the empty JSON string", + UpdateAudienceForSpaceInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (Entry entry : entries) { + if (!UpdateAudienceForSpaceInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateAudienceForSpaceInput` properties. JSON: %s", + entry.getKey(), jsonObj.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateAudienceForSpaceInput.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 (!UpdateAudienceForSpaceInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateAudienceForSpaceInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateAudienceForSpaceInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateAudienceForSpaceInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateAudienceForSpaceInput read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateAudienceForSpaceInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateAudienceForSpaceInput + * @throws IOException if the JSON string is invalid with respect to UpdateAudienceForSpaceInput + */ + public static UpdateAudienceForSpaceInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateAudienceForSpaceInput.class); + } + + /** + * Convert an instance of UpdateAudienceForSpaceInput to 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..dbe239a2 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateComputedTraitForSpace200Response.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 io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +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 + @ApiModelProperty(value = "") + 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 Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to + * UpdateComputedTraitForSpace200Response + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!UpdateComputedTraitForSpace200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object 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 = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (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(), jsonObj.toString())); + } + } + } + + 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 { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.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..5556639e --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateComputedTraitForSpaceAlphaInput.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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** Input to update a computed trait. */ +@ApiModel(description = "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 UpdateComputedTraitForSpaceAlphaInput() {} + + public UpdateComputedTraitForSpaceAlphaInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Enabled/disabled status for the computed trait. + * + * @return enabled + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Enabled/disabled status for the computed trait.") + 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; + } + UpdateComputedTraitForSpaceAlphaInput updateComputedTraitForSpaceAlphaInput = + (UpdateComputedTraitForSpaceAlphaInput) o; + return Objects.equals(this.enabled, updateComputedTraitForSpaceAlphaInput.enabled); + } + + @Override + public int hashCode() { + return Objects.hash(enabled); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateComputedTraitForSpaceAlphaInput {\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("enabled"); + + // 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 + * UpdateComputedTraitForSpaceAlphaInput + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!UpdateComputedTraitForSpaceAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object 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 = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (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(), jsonObj.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateComputedTraitForSpaceAlphaInput.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 (!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 { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.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..e779fe28 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateComputedTraitForSpaceAlphaOutput.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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; + +/** Computed Trait output for get and update. */ +@ApiModel(description = "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 ComputedTrait computedTrait; + + public UpdateComputedTraitForSpaceAlphaOutput() {} + + public UpdateComputedTraitForSpaceAlphaOutput computedTrait(ComputedTrait computedTrait) { + + this.computedTrait = computedTrait; + return this; + } + + /** + * Get computedTrait + * + * @return computedTrait + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + public ComputedTrait getComputedTrait() { + return computedTrait; + } + + public void setComputedTrait(ComputedTrait 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 Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to + * UpdateComputedTraitForSpaceAlphaOutput + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!UpdateComputedTraitForSpaceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON object 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 = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (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(), jsonObj.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateComputedTraitForSpaceAlphaOutput.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 (!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 { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + }.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); + } +}