From 71215bac75ecfdd0f7e814e1eae5bb91113e2278 Mon Sep 17 00:00:00 2001 From: APIs and Common Services team Date: Thu, 21 Mar 2024 00:47:14 +0000 Subject: [PATCH] Automated SDK update This updates the SDK from internal repo commit segmentio/public-api@bd08e59d. --- README.md | 8 +- docs/DeliveryOverviewApi.md | 468 +++++ pom.xml | 2 +- .../java/com/segment/publicapi/ApiClient.java | 2 +- .../com/segment/publicapi/Configuration.java | 2 +- src/main/java/com/segment/publicapi/JSON.java | 16 + .../publicapi/api/DeliveryOverviewApi.java | 1533 +++++++++++++++++ .../models/DeliveryOverviewFilterBy.java | 355 ++++ .../DeliveryOverviewMetricsDatapoint.java | 272 +++ .../DeliveryOverviewMetricsDataset.java | 439 +++++ ...GetDeliveryOverviewMetricsAlphaOutput.java | 300 ++++ ...etricsFromDeliveryOverview200Response.java | 217 +++ 12 files changed, 3607 insertions(+), 7 deletions(-) create mode 100644 docs/DeliveryOverviewApi.md create mode 100644 src/main/java/com/segment/publicapi/api/DeliveryOverviewApi.java create mode 100644 src/main/java/com/segment/publicapi/models/DeliveryOverviewFilterBy.java create mode 100644 src/main/java/com/segment/publicapi/models/DeliveryOverviewMetricsDatapoint.java create mode 100644 src/main/java/com/segment/publicapi/models/DeliveryOverviewMetricsDataset.java create mode 100644 src/main/java/com/segment/publicapi/models/GetDeliveryOverviewMetricsAlphaOutput.java create mode 100644 src/main/java/com/segment/publicapi/models/GetEgressFailedMetricsFromDeliveryOverview200Response.java diff --git a/README.md b/README.md index 1dd94fed..ca5c3149 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: 45.0.0 +Latest API and SDK version: 46.0.0 ## Requirements @@ -28,7 +28,7 @@ Add this dependency to your project's POM: com.segment.publicapi segment-publicapi - 45.0.0 + 46.0.0 compile ``` @@ -44,7 +44,7 @@ Add this dependency to your project's build file: } dependencies { - implementation "com.segment.publicapi:segment-publicapi:45.0.0" + implementation "com.segment.publicapi:segment-publicapi:46.0.0" } ``` @@ -58,7 +58,7 @@ mvn clean package Then manually install the following JARs: -* `target/segment-publicapi-45.0.0.jar` +* `target/segment-publicapi-46.0.0.jar` * `target/lib/*.jar` You are now ready to start making calls to Public API! diff --git a/docs/DeliveryOverviewApi.md b/docs/DeliveryOverviewApi.md new file mode 100644 index 00000000..5c660adf --- /dev/null +++ b/docs/DeliveryOverviewApi.md @@ -0,0 +1,468 @@ +# DeliveryOverviewApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getEgressFailedMetricsFromDeliveryOverview**](DeliveryOverviewApi.md#getEgressFailedMetricsFromDeliveryOverview) | **GET** /delivery-overview/failed-delivery | Get Egress Failed Metrics from Delivery Overview | +| [**getEgressSuccessMetricsFromDeliveryOverview**](DeliveryOverviewApi.md#getEgressSuccessMetricsFromDeliveryOverview) | **GET** /delivery-overview/successful-delivery | Get Egress Success Metrics from Delivery Overview | +| [**getFilteredAtDestinationMetricsFromDeliveryOverview**](DeliveryOverviewApi.md#getFilteredAtDestinationMetricsFromDeliveryOverview) | **GET** /delivery-overview/filtered-at-destination | Get Filtered At Destination Metrics from Delivery Overview | +| [**getFilteredAtSourceMetricsFromDeliveryOverview**](DeliveryOverviewApi.md#getFilteredAtSourceMetricsFromDeliveryOverview) | **GET** /delivery-overview/filtered-at-source | Get Filtered At Source Metrics from Delivery Overview | +| [**getIngressFailedMetricsFromDeliveryOverview**](DeliveryOverviewApi.md#getIngressFailedMetricsFromDeliveryOverview) | **GET** /delivery-overview/failed-on-ingest | Get Ingress Failed Metrics from Delivery Overview | +| [**getIngressSuccessMetricsFromDeliveryOverview**](DeliveryOverviewApi.md#getIngressSuccessMetricsFromDeliveryOverview) | **GET** /delivery-overview/successfully-received | Get Ingress Success Metrics from Delivery Overview | + + + +## Operation: getEgressFailedMetricsFromDeliveryOverview + +> GetEgressFailedMetricsFromDeliveryOverview200Response getEgressFailedMetricsFromDeliveryOverview(sourceId, destinationConfigId, startTime, endTime, groupBy, granularity, filter, pagination, subscriptionId) + +Get Egress Failed Metrics from Delivery Overview + +Get events that failed to be delivered to Destination. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeliveryOverviewApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeliveryOverviewApi apiInstance = new DeliveryOverviewApi(defaultClient); + String sourceId = "rh5BDZp6QDHvXFCkibm1pR"; // String | The sourceId for the workspace. This parameter exists in alpha. + String destinationConfigId = "fP7qoQw2HTWt9WdMr718gn"; // String | The ID tied to a workspace destination. DestinationConfigId is required for Filtered at Destination, Failed Delivery, and Successful Delivery steps. This parameter exists in alpha. + String startTime = "2024-01-01T00:00:00Z"; // String | The ISO8601 formatted timestamp corresponding to the beginning of the requested timeframe, inclusive. This parameter exists in alpha. + String endTime = "2024-01-03T00:00:00Z"; // String | The ISO8601 formatted timestamp corresponding to the end of the requested timeframe, noninclusive. This parameter exists in alpha. + List groupBy = Arrays.asList(); // List | A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `eventName`, `eventType`, `discardReason`, and `appVersion`. This parameter exists in alpha. + String granularity = "day"; // String | The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in alpha. + DeliveryOverviewFilterBy filter = new DeliveryOverviewFilterBy(); // DeliveryOverviewFilterBy | An optional filter for `eventName`, `eventType`, `discardReason`, and/or `appVersion` that can be applied in addition to a `groupBy`. Example: `filter: {discardReason: ['discard1'], eventName: ['name1', 'name2'], eventType: ['type1']}`. This parameter exists in alpha. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Params to specify the page cursor and count. This parameter exists in alpha. + String subscriptionId = "subscriptionId_example"; // String | An optional filter for actions destinations, to filter by a specific action. This parameter exists in alpha. + try { + GetEgressFailedMetricsFromDeliveryOverview200Response result = apiInstance.getEgressFailedMetricsFromDeliveryOverview(sourceId, destinationConfigId, startTime, endTime, groupBy, granularity, filter, pagination, subscriptionId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeliveryOverviewApi#getEgressFailedMetricsFromDeliveryOverview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| The sourceId for the workspace. This parameter exists in alpha. | | +| **destinationConfigId** | **String**| The ID tied to a workspace destination. DestinationConfigId is required for Filtered at Destination, Failed Delivery, and Successful Delivery steps. This parameter exists in alpha. | | +| **startTime** | **String**| The ISO8601 formatted timestamp corresponding to the beginning of the requested timeframe, inclusive. This parameter exists in alpha. | | +| **endTime** | **String**| The ISO8601 formatted timestamp corresponding to the end of the requested timeframe, noninclusive. This parameter exists in alpha. | | +| **groupBy** | [**List<String>**](String.md)| A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `eventName`, `eventType`, `discardReason`, and `appVersion`. This parameter exists in alpha. | [optional] | +| **granularity** | **String**| The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in alpha. | [enum: day, hour, minute] | +| **filter** | [**DeliveryOverviewFilterBy**](.md)| An optional filter for `eventName`, `eventType`, `discardReason`, and/or `appVersion` that can be applied in addition to a `groupBy`. Example: `filter: {discardReason: ['discard1'], eventName: ['name1', 'name2'], eventType: ['type1']}`. This parameter exists in alpha. | [optional] | +| **pagination** | [**PaginationInput**](.md)| Params to specify the page cursor and count. This parameter exists in alpha. | | +| **subscriptionId** | **String**| An optional filter for actions destinations, to filter by a specific action. This parameter exists in alpha. | [optional] | + +### Return type + +[**GetEgressFailedMetricsFromDeliveryOverview200Response**](GetEgressFailedMetricsFromDeliveryOverview200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getEgressSuccessMetricsFromDeliveryOverview + +> GetEgressFailedMetricsFromDeliveryOverview200Response getEgressSuccessMetricsFromDeliveryOverview() + +Get Egress Success Metrics from Delivery Overview + +Get events successfully delivered to Destination. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeliveryOverviewApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeliveryOverviewApi apiInstance = new DeliveryOverviewApi(defaultClient); + try { + GetEgressFailedMetricsFromDeliveryOverview200Response result = apiInstance.getEgressSuccessMetricsFromDeliveryOverview(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeliveryOverviewApi#getEgressSuccessMetricsFromDeliveryOverview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**GetEgressFailedMetricsFromDeliveryOverview200Response**](GetEgressFailedMetricsFromDeliveryOverview200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getFilteredAtDestinationMetricsFromDeliveryOverview + +> GetEgressFailedMetricsFromDeliveryOverview200Response getFilteredAtDestinationMetricsFromDeliveryOverview() + +Get Filtered At Destination Metrics from Delivery Overview + +Get events that were filtered at Destination. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeliveryOverviewApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeliveryOverviewApi apiInstance = new DeliveryOverviewApi(defaultClient); + try { + GetEgressFailedMetricsFromDeliveryOverview200Response result = apiInstance.getFilteredAtDestinationMetricsFromDeliveryOverview(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeliveryOverviewApi#getFilteredAtDestinationMetricsFromDeliveryOverview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**GetEgressFailedMetricsFromDeliveryOverview200Response**](GetEgressFailedMetricsFromDeliveryOverview200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getFilteredAtSourceMetricsFromDeliveryOverview + +> GetEgressFailedMetricsFromDeliveryOverview200Response getFilteredAtSourceMetricsFromDeliveryOverview(sourceId, destinationConfigId, startTime, endTime, groupBy, granularity, filter, pagination, subscriptionId) + +Get Filtered At Source Metrics from Delivery Overview + +Get events that were filtered at Source. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeliveryOverviewApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeliveryOverviewApi apiInstance = new DeliveryOverviewApi(defaultClient); + String sourceId = "rh5BDZp6QDHvXFCkibm1pR"; // String | The sourceId for the workspace. This parameter exists in alpha. + String destinationConfigId = "destinationConfigId_example"; // String | The ID tied to a workspace destination. This parameter exists in alpha. + String startTime = "2024-01-01T00:00:00Z"; // String | The ISO8601 formatted timestamp corresponding to the beginning of the requested timeframe, inclusive. This parameter exists in alpha. + String endTime = "2024-01-03T00:00:00Z"; // String | The ISO8601 formatted timestamp corresponding to the end of the requested timeframe, noninclusive. This parameter exists in alpha. + List groupBy = Arrays.asList(); // List | A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `eventName`, `eventType`, `discardReason`, and `appVersion`. This parameter exists in alpha. + String granularity = "day"; // String | The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in alpha. + DeliveryOverviewFilterBy filter = new DeliveryOverviewFilterBy(); // DeliveryOverviewFilterBy | An optional filter for `eventName`, `eventType`, `discardReason`, and/or `appVersion` that can be applied in addition to a `groupBy`. Example: `filter: {discardReason: ['discard1'], eventName: ['name1', 'name2'], eventType: ['type1']}`. This parameter exists in alpha. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Optional params to specify the page cursor and count. This parameter exists in alpha. + String subscriptionId = "subscriptionId_example"; // String | An optional filter for actions destinations, to filter by a specific action. This parameter exists in alpha. + try { + GetEgressFailedMetricsFromDeliveryOverview200Response result = apiInstance.getFilteredAtSourceMetricsFromDeliveryOverview(sourceId, destinationConfigId, startTime, endTime, groupBy, granularity, filter, pagination, subscriptionId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeliveryOverviewApi#getFilteredAtSourceMetricsFromDeliveryOverview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| The sourceId for the workspace. This parameter exists in alpha. | | +| **destinationConfigId** | **String**| The ID tied to a workspace destination. This parameter exists in alpha. | [optional] | +| **startTime** | **String**| The ISO8601 formatted timestamp corresponding to the beginning of the requested timeframe, inclusive. This parameter exists in alpha. | | +| **endTime** | **String**| The ISO8601 formatted timestamp corresponding to the end of the requested timeframe, noninclusive. This parameter exists in alpha. | | +| **groupBy** | [**List<String>**](String.md)| A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `eventName`, `eventType`, `discardReason`, and `appVersion`. This parameter exists in alpha. | [optional] | +| **granularity** | **String**| The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in alpha. | [enum: day, hour, minute] | +| **filter** | [**DeliveryOverviewFilterBy**](.md)| An optional filter for `eventName`, `eventType`, `discardReason`, and/or `appVersion` that can be applied in addition to a `groupBy`. Example: `filter: {discardReason: ['discard1'], eventName: ['name1', 'name2'], eventType: ['type1']}`. This parameter exists in alpha. | [optional] | +| **pagination** | [**PaginationInput**](.md)| Optional params to specify the page cursor and count. This parameter exists in alpha. | | +| **subscriptionId** | **String**| An optional filter for actions destinations, to filter by a specific action. This parameter exists in alpha. | [optional] | + +### Return type + +[**GetEgressFailedMetricsFromDeliveryOverview200Response**](GetEgressFailedMetricsFromDeliveryOverview200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getIngressFailedMetricsFromDeliveryOverview + +> GetEgressFailedMetricsFromDeliveryOverview200Response getIngressFailedMetricsFromDeliveryOverview() + +Get Ingress Failed Metrics from Delivery Overview + +Get events that failed on ingest. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeliveryOverviewApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeliveryOverviewApi apiInstance = new DeliveryOverviewApi(defaultClient); + try { + GetEgressFailedMetricsFromDeliveryOverview200Response result = apiInstance.getIngressFailedMetricsFromDeliveryOverview(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeliveryOverviewApi#getIngressFailedMetricsFromDeliveryOverview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**GetEgressFailedMetricsFromDeliveryOverview200Response**](GetEgressFailedMetricsFromDeliveryOverview200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getIngressSuccessMetricsFromDeliveryOverview + +> GetEgressFailedMetricsFromDeliveryOverview200Response getIngressSuccessMetricsFromDeliveryOverview() + +Get Ingress Success Metrics from Delivery Overview + +Get events that were successfully received by Segment. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeliveryOverviewApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeliveryOverviewApi apiInstance = new DeliveryOverviewApi(defaultClient); + try { + GetEgressFailedMetricsFromDeliveryOverview200Response result = apiInstance.getIngressSuccessMetricsFromDeliveryOverview(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeliveryOverviewApi#getIngressSuccessMetricsFromDeliveryOverview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**GetEgressFailedMetricsFromDeliveryOverview200Response**](GetEgressFailedMetricsFromDeliveryOverview200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/pom.xml b/pom.xml index f676b411..83a69b28 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ segment-publicapi jar segment-publicapi - 45.0.0 + 46.0.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 09131501..ccddb186 100644 --- a/src/main/java/com/segment/publicapi/ApiClient.java +++ b/src/main/java/com/segment/publicapi/ApiClient.java @@ -123,7 +123,7 @@ private void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("Public API SDK 45.0.0 (Java)"); + setUserAgent("Public API SDK 46.0.0 (Java)"); authentications = new HashMap(); } diff --git a/src/main/java/com/segment/publicapi/Configuration.java b/src/main/java/com/segment/publicapi/Configuration.java index 4b0acda9..3a3d768e 100644 --- a/src/main/java/com/segment/publicapi/Configuration.java +++ b/src/main/java/com/segment/publicapi/Configuration.java @@ -12,7 +12,7 @@ package com.segment.publicapi; public class Configuration { - public static final String VERSION = "45.0.0"; + public static final String VERSION = "46.0.0"; private static ApiClient defaultApiClient = new ApiClient(); diff --git a/src/main/java/com/segment/publicapi/JSON.java b/src/main/java/com/segment/publicapi/JSON.java index 2df4ff07..668bb5f9 100644 --- a/src/main/java/com/segment/publicapi/JSON.java +++ b/src/main/java/com/segment/publicapi/JSON.java @@ -479,6 +479,15 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.segment.publicapi.models.DeliveryMetricsSummaryBeta .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeliveryOverviewFilterBy + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeliveryOverviewMetricsDatapoint + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeliveryOverviewMetricsDataset + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.segment.publicapi.models.DestinationFilterActionV1 .CustomTypeAdapterFactory()); @@ -597,6 +606,9 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.segment.publicapi.models.GetDailyWorkspaceMTUUsageV1Output .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetDeliveryOverviewMetricsAlphaOutput + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.segment.publicapi.models.GetDestination200Response .CustomTypeAdapterFactory()); @@ -614,6 +626,10 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.segment.publicapi.models.GetDestinationsCatalogV1Output .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models + .GetEgressFailedMetricsFromDeliveryOverview200Response + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.segment.publicapi.models.GetEventsVolumeFromWorkspace200Response .CustomTypeAdapterFactory()); diff --git a/src/main/java/com/segment/publicapi/api/DeliveryOverviewApi.java b/src/main/java/com/segment/publicapi/api/DeliveryOverviewApi.java new file mode 100644 index 00000000..240193e3 --- /dev/null +++ b/src/main/java/com/segment/publicapi/api/DeliveryOverviewApi.java @@ -0,0 +1,1533 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. 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.DeliveryOverviewFilterBy; +import com.segment.publicapi.models.GetEgressFailedMetricsFromDeliveryOverview200Response; +import com.segment.publicapi.models.PaginationInput; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DeliveryOverviewApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DeliveryOverviewApi() { + this(Configuration.getDefaultApiClient()); + } + + public DeliveryOverviewApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getEgressFailedMetricsFromDeliveryOverview + * + * @param sourceId The sourceId for the workspace. This parameter exists in alpha. (required) + * @param destinationConfigId The ID tied to a workspace destination. DestinationConfigId is + * required for Filtered at Destination, Failed Delivery, and Successful Delivery steps. + * This parameter exists in alpha. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested timeframe, inclusive. This parameter exists in alpha. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested + * timeframe, noninclusive. This parameter exists in alpha. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `eventName`, `eventType`, + * `discardReason`, and `appVersion`. This parameter exists in alpha. + * (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * alpha. (required) + * @param filter An optional filter for `eventName`, `eventType`, + * `discardReason`, and/or `appVersion` that can be applied in addition + * to a `groupBy`. Example: `filter: {discardReason: ['discard1'], + * eventName: ['name1', 'name2'], eventType: ['type1']}`. This + * parameter exists in alpha. (optional) + * @param pagination Params to specify the page cursor and count. This parameter exists in + * alpha. (required) + * @param subscriptionId An optional filter for actions destinations, to filter by a specific + * action. This parameter exists in alpha. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getEgressFailedMetricsFromDeliveryOverviewCall( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewFilterBy filter, + PaginationInput pagination, + String subscriptionId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/delivery-overview/failed-delivery"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (sourceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sourceId", sourceId)); + } + + if (destinationConfigId != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("destinationConfigId", destinationConfigId)); + } + + if (startTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("startTime", startTime)); + } + + if (endTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("endTime", endTime)); + } + + if (groupBy != null) { + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs("csv", "groupBy", groupBy)); + } + + if (granularity != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("granularity", granularity)); + } + + if (filter != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter", filter)); + } + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + if (subscriptionId != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("subscriptionId", subscriptionId)); + } + + 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 getEgressFailedMetricsFromDeliveryOverviewValidateBeforeCall( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewFilterBy filter, + PaginationInput pagination, + String subscriptionId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'sourceId' is set + if (sourceId == null) { + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " getEgressFailedMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'destinationConfigId' is set + if (destinationConfigId == null) { + throw new ApiException( + "Missing the required parameter 'destinationConfigId' when calling" + + " getEgressFailedMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'startTime' is set + if (startTime == null) { + throw new ApiException( + "Missing the required parameter 'startTime' when calling" + + " getEgressFailedMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'endTime' is set + if (endTime == null) { + throw new ApiException( + "Missing the required parameter 'endTime' when calling" + + " getEgressFailedMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'granularity' is set + if (granularity == null) { + throw new ApiException( + "Missing the required parameter 'granularity' when calling" + + " getEgressFailedMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'pagination' is set + if (pagination == null) { + throw new ApiException( + "Missing the required parameter 'pagination' when calling" + + " getEgressFailedMetricsFromDeliveryOverview(Async)"); + } + + return getEgressFailedMetricsFromDeliveryOverviewCall( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + subscriptionId, + _callback); + } + + /** + * Get Egress Failed Metrics from Delivery Overview Get events that failed to be delivered to + * Destination. + * + * @param sourceId The sourceId for the workspace. This parameter exists in alpha. (required) + * @param destinationConfigId The ID tied to a workspace destination. DestinationConfigId is + * required for Filtered at Destination, Failed Delivery, and Successful Delivery steps. + * This parameter exists in alpha. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested timeframe, inclusive. This parameter exists in alpha. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested + * timeframe, noninclusive. This parameter exists in alpha. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `eventName`, `eventType`, + * `discardReason`, and `appVersion`. This parameter exists in alpha. + * (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * alpha. (required) + * @param filter An optional filter for `eventName`, `eventType`, + * `discardReason`, and/or `appVersion` that can be applied in addition + * to a `groupBy`. Example: `filter: {discardReason: ['discard1'], + * eventName: ['name1', 'name2'], eventType: ['type1']}`. This + * parameter exists in alpha. (optional) + * @param pagination Params to specify the page cursor and count. This parameter exists in + * alpha. (required) + * @param subscriptionId An optional filter for actions destinations, to filter by a specific + * action. This parameter exists in alpha. (optional) + * @return GetEgressFailedMetricsFromDeliveryOverview200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetEgressFailedMetricsFromDeliveryOverview200Response + getEgressFailedMetricsFromDeliveryOverview( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewFilterBy filter, + PaginationInput pagination, + String subscriptionId) + throws ApiException { + ApiResponse localVarResp = + getEgressFailedMetricsFromDeliveryOverviewWithHttpInfo( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + subscriptionId); + return localVarResp.getData(); + } + + /** + * Get Egress Failed Metrics from Delivery Overview Get events that failed to be delivered to + * Destination. + * + * @param sourceId The sourceId for the workspace. This parameter exists in alpha. (required) + * @param destinationConfigId The ID tied to a workspace destination. DestinationConfigId is + * required for Filtered at Destination, Failed Delivery, and Successful Delivery steps. + * This parameter exists in alpha. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested timeframe, inclusive. This parameter exists in alpha. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested + * timeframe, noninclusive. This parameter exists in alpha. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `eventName`, `eventType`, + * `discardReason`, and `appVersion`. This parameter exists in alpha. + * (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * alpha. (required) + * @param filter An optional filter for `eventName`, `eventType`, + * `discardReason`, and/or `appVersion` that can be applied in addition + * to a `groupBy`. Example: `filter: {discardReason: ['discard1'], + * eventName: ['name1', 'name2'], eventType: ['type1']}`. This + * parameter exists in alpha. (optional) + * @param pagination Params to specify the page cursor and count. This parameter exists in + * alpha. (required) + * @param subscriptionId An optional filter for actions destinations, to filter by a specific + * action. This parameter exists in alpha. (optional) + * @return ApiResponse<GetEgressFailedMetricsFromDeliveryOverview200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + getEgressFailedMetricsFromDeliveryOverviewWithHttpInfo( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewFilterBy filter, + PaginationInput pagination, + String subscriptionId) + throws ApiException { + okhttp3.Call localVarCall = + getEgressFailedMetricsFromDeliveryOverviewValidateBeforeCall( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + subscriptionId, + null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Egress Failed Metrics from Delivery Overview (asynchronously) Get events that failed to + * be delivered to Destination. + * + * @param sourceId The sourceId for the workspace. This parameter exists in alpha. (required) + * @param destinationConfigId The ID tied to a workspace destination. DestinationConfigId is + * required for Filtered at Destination, Failed Delivery, and Successful Delivery steps. + * This parameter exists in alpha. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested timeframe, inclusive. This parameter exists in alpha. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested + * timeframe, noninclusive. This parameter exists in alpha. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `eventName`, `eventType`, + * `discardReason`, and `appVersion`. This parameter exists in alpha. + * (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * alpha. (required) + * @param filter An optional filter for `eventName`, `eventType`, + * `discardReason`, and/or `appVersion` that can be applied in addition + * to a `groupBy`. Example: `filter: {discardReason: ['discard1'], + * eventName: ['name1', 'name2'], eventType: ['type1']}`. This + * parameter exists in alpha. (optional) + * @param pagination Params to specify the page cursor and count. This parameter exists in + * alpha. (required) + * @param subscriptionId An optional filter for actions destinations, to filter by a specific + * action. This parameter exists in alpha. (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getEgressFailedMetricsFromDeliveryOverviewAsync( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewFilterBy filter, + PaginationInput pagination, + String subscriptionId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getEgressFailedMetricsFromDeliveryOverviewValidateBeforeCall( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + subscriptionId, + _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getEgressSuccessMetricsFromDeliveryOverview + * + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getEgressSuccessMetricsFromDeliveryOverviewCall(final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/delivery-overview/successful-delivery"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + 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 getEgressSuccessMetricsFromDeliveryOverviewValidateBeforeCall( + final ApiCallback _callback) throws ApiException { + return getEgressSuccessMetricsFromDeliveryOverviewCall(_callback); + } + + /** + * Get Egress Success Metrics from Delivery Overview Get events successfully delivered to + * Destination. + * + * @return GetEgressFailedMetricsFromDeliveryOverview200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetEgressFailedMetricsFromDeliveryOverview200Response + getEgressSuccessMetricsFromDeliveryOverview() throws ApiException { + ApiResponse localVarResp = + getEgressSuccessMetricsFromDeliveryOverviewWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get Egress Success Metrics from Delivery Overview Get events successfully delivered to + * Destination. + * + * @return ApiResponse<GetEgressFailedMetricsFromDeliveryOverview200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + getEgressSuccessMetricsFromDeliveryOverviewWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = + getEgressSuccessMetricsFromDeliveryOverviewValidateBeforeCall(null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Egress Success Metrics from Delivery Overview (asynchronously) Get events successfully + * delivered to Destination. + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getEgressSuccessMetricsFromDeliveryOverviewAsync( + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getEgressSuccessMetricsFromDeliveryOverviewValidateBeforeCall(_callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getFilteredAtDestinationMetricsFromDeliveryOverview + * + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getFilteredAtDestinationMetricsFromDeliveryOverviewCall( + final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/delivery-overview/filtered-at-destination"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + 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 getFilteredAtDestinationMetricsFromDeliveryOverviewValidateBeforeCall( + final ApiCallback _callback) throws ApiException { + return getFilteredAtDestinationMetricsFromDeliveryOverviewCall(_callback); + } + + /** + * Get Filtered At Destination Metrics from Delivery Overview Get events that were filtered at + * Destination. + * + * @return GetEgressFailedMetricsFromDeliveryOverview200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetEgressFailedMetricsFromDeliveryOverview200Response + getFilteredAtDestinationMetricsFromDeliveryOverview() throws ApiException { + ApiResponse localVarResp = + getFilteredAtDestinationMetricsFromDeliveryOverviewWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get Filtered At Destination Metrics from Delivery Overview Get events that were filtered at + * Destination. + * + * @return ApiResponse<GetEgressFailedMetricsFromDeliveryOverview200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + getFilteredAtDestinationMetricsFromDeliveryOverviewWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = + getFilteredAtDestinationMetricsFromDeliveryOverviewValidateBeforeCall(null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Filtered At Destination Metrics from Delivery Overview (asynchronously) Get events that + * were filtered at Destination. + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getFilteredAtDestinationMetricsFromDeliveryOverviewAsync( + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getFilteredAtDestinationMetricsFromDeliveryOverviewValidateBeforeCall(_callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getFilteredAtSourceMetricsFromDeliveryOverview + * + * @param sourceId The sourceId for the workspace. This parameter exists in alpha. (required) + * @param destinationConfigId The ID tied to a workspace destination. This parameter exists in + * alpha. (optional) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested timeframe, inclusive. This parameter exists in alpha. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested + * timeframe, noninclusive. This parameter exists in alpha. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `eventName`, `eventType`, + * `discardReason`, and `appVersion`. This parameter exists in alpha. + * (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * alpha. (required) + * @param filter An optional filter for `eventName`, `eventType`, + * `discardReason`, and/or `appVersion` that can be applied in addition + * to a `groupBy`. Example: `filter: {discardReason: ['discard1'], + * eventName: ['name1', 'name2'], eventType: ['type1']}`. This + * parameter exists in alpha. (optional) + * @param pagination Optional params to specify the page cursor and count. This parameter exists + * in alpha. (required) + * @param subscriptionId An optional filter for actions destinations, to filter by a specific + * action. This parameter exists in alpha. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getFilteredAtSourceMetricsFromDeliveryOverviewCall( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewFilterBy filter, + PaginationInput pagination, + String subscriptionId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/delivery-overview/filtered-at-source"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (sourceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sourceId", sourceId)); + } + + if (destinationConfigId != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("destinationConfigId", destinationConfigId)); + } + + if (startTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("startTime", startTime)); + } + + if (endTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("endTime", endTime)); + } + + if (groupBy != null) { + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs("csv", "groupBy", groupBy)); + } + + if (granularity != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("granularity", granularity)); + } + + if (filter != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter", filter)); + } + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + if (subscriptionId != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("subscriptionId", subscriptionId)); + } + + 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 getFilteredAtSourceMetricsFromDeliveryOverviewValidateBeforeCall( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewFilterBy filter, + PaginationInput pagination, + String subscriptionId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'sourceId' is set + if (sourceId == null) { + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " getFilteredAtSourceMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'startTime' is set + if (startTime == null) { + throw new ApiException( + "Missing the required parameter 'startTime' when calling" + + " getFilteredAtSourceMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'endTime' is set + if (endTime == null) { + throw new ApiException( + "Missing the required parameter 'endTime' when calling" + + " getFilteredAtSourceMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'granularity' is set + if (granularity == null) { + throw new ApiException( + "Missing the required parameter 'granularity' when calling" + + " getFilteredAtSourceMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'pagination' is set + if (pagination == null) { + throw new ApiException( + "Missing the required parameter 'pagination' when calling" + + " getFilteredAtSourceMetricsFromDeliveryOverview(Async)"); + } + + return getFilteredAtSourceMetricsFromDeliveryOverviewCall( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + subscriptionId, + _callback); + } + + /** + * Get Filtered At Source Metrics from Delivery Overview Get events that were filtered at + * Source. + * + * @param sourceId The sourceId for the workspace. This parameter exists in alpha. (required) + * @param destinationConfigId The ID tied to a workspace destination. This parameter exists in + * alpha. (optional) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested timeframe, inclusive. This parameter exists in alpha. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested + * timeframe, noninclusive. This parameter exists in alpha. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `eventName`, `eventType`, + * `discardReason`, and `appVersion`. This parameter exists in alpha. + * (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * alpha. (required) + * @param filter An optional filter for `eventName`, `eventType`, + * `discardReason`, and/or `appVersion` that can be applied in addition + * to a `groupBy`. Example: `filter: {discardReason: ['discard1'], + * eventName: ['name1', 'name2'], eventType: ['type1']}`. This + * parameter exists in alpha. (optional) + * @param pagination Optional params to specify the page cursor and count. This parameter exists + * in alpha. (required) + * @param subscriptionId An optional filter for actions destinations, to filter by a specific + * action. This parameter exists in alpha. (optional) + * @return GetEgressFailedMetricsFromDeliveryOverview200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetEgressFailedMetricsFromDeliveryOverview200Response + getFilteredAtSourceMetricsFromDeliveryOverview( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewFilterBy filter, + PaginationInput pagination, + String subscriptionId) + throws ApiException { + ApiResponse localVarResp = + getFilteredAtSourceMetricsFromDeliveryOverviewWithHttpInfo( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + subscriptionId); + return localVarResp.getData(); + } + + /** + * Get Filtered At Source Metrics from Delivery Overview Get events that were filtered at + * Source. + * + * @param sourceId The sourceId for the workspace. This parameter exists in alpha. (required) + * @param destinationConfigId The ID tied to a workspace destination. This parameter exists in + * alpha. (optional) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested timeframe, inclusive. This parameter exists in alpha. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested + * timeframe, noninclusive. This parameter exists in alpha. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `eventName`, `eventType`, + * `discardReason`, and `appVersion`. This parameter exists in alpha. + * (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * alpha. (required) + * @param filter An optional filter for `eventName`, `eventType`, + * `discardReason`, and/or `appVersion` that can be applied in addition + * to a `groupBy`. Example: `filter: {discardReason: ['discard1'], + * eventName: ['name1', 'name2'], eventType: ['type1']}`. This + * parameter exists in alpha. (optional) + * @param pagination Optional params to specify the page cursor and count. This parameter exists + * in alpha. (required) + * @param subscriptionId An optional filter for actions destinations, to filter by a specific + * action. This parameter exists in alpha. (optional) + * @return ApiResponse<GetEgressFailedMetricsFromDeliveryOverview200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + getFilteredAtSourceMetricsFromDeliveryOverviewWithHttpInfo( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewFilterBy filter, + PaginationInput pagination, + String subscriptionId) + throws ApiException { + okhttp3.Call localVarCall = + getFilteredAtSourceMetricsFromDeliveryOverviewValidateBeforeCall( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + subscriptionId, + null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Filtered At Source Metrics from Delivery Overview (asynchronously) Get events that were + * filtered at Source. + * + * @param sourceId The sourceId for the workspace. This parameter exists in alpha. (required) + * @param destinationConfigId The ID tied to a workspace destination. This parameter exists in + * alpha. (optional) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested timeframe, inclusive. This parameter exists in alpha. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested + * timeframe, noninclusive. This parameter exists in alpha. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `eventName`, `eventType`, + * `discardReason`, and `appVersion`. This parameter exists in alpha. + * (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * alpha. (required) + * @param filter An optional filter for `eventName`, `eventType`, + * `discardReason`, and/or `appVersion` that can be applied in addition + * to a `groupBy`. Example: `filter: {discardReason: ['discard1'], + * eventName: ['name1', 'name2'], eventType: ['type1']}`. This + * parameter exists in alpha. (optional) + * @param pagination Optional params to specify the page cursor and count. This parameter exists + * in alpha. (required) + * @param subscriptionId An optional filter for actions destinations, to filter by a specific + * action. This parameter exists in alpha. (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getFilteredAtSourceMetricsFromDeliveryOverviewAsync( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewFilterBy filter, + PaginationInput pagination, + String subscriptionId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getFilteredAtSourceMetricsFromDeliveryOverviewValidateBeforeCall( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + subscriptionId, + _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getIngressFailedMetricsFromDeliveryOverview + * + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getIngressFailedMetricsFromDeliveryOverviewCall(final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/delivery-overview/failed-on-ingest"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + 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 getIngressFailedMetricsFromDeliveryOverviewValidateBeforeCall( + final ApiCallback _callback) throws ApiException { + return getIngressFailedMetricsFromDeliveryOverviewCall(_callback); + } + + /** + * Get Ingress Failed Metrics from Delivery Overview Get events that failed on ingest. + * + * @return GetEgressFailedMetricsFromDeliveryOverview200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetEgressFailedMetricsFromDeliveryOverview200Response + getIngressFailedMetricsFromDeliveryOverview() throws ApiException { + ApiResponse localVarResp = + getIngressFailedMetricsFromDeliveryOverviewWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get Ingress Failed Metrics from Delivery Overview Get events that failed on ingest. + * + * @return ApiResponse<GetEgressFailedMetricsFromDeliveryOverview200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + getIngressFailedMetricsFromDeliveryOverviewWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = + getIngressFailedMetricsFromDeliveryOverviewValidateBeforeCall(null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Ingress Failed Metrics from Delivery Overview (asynchronously) Get events that failed on + * ingest. + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getIngressFailedMetricsFromDeliveryOverviewAsync( + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getIngressFailedMetricsFromDeliveryOverviewValidateBeforeCall(_callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getIngressSuccessMetricsFromDeliveryOverview + * + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getIngressSuccessMetricsFromDeliveryOverviewCall( + final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/delivery-overview/successfully-received"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + 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 getIngressSuccessMetricsFromDeliveryOverviewValidateBeforeCall( + final ApiCallback _callback) throws ApiException { + return getIngressSuccessMetricsFromDeliveryOverviewCall(_callback); + } + + /** + * Get Ingress Success Metrics from Delivery Overview Get events that were successfully received + * by Segment. + * + * @return GetEgressFailedMetricsFromDeliveryOverview200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetEgressFailedMetricsFromDeliveryOverview200Response + getIngressSuccessMetricsFromDeliveryOverview() throws ApiException { + ApiResponse localVarResp = + getIngressSuccessMetricsFromDeliveryOverviewWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get Ingress Success Metrics from Delivery Overview Get events that were successfully received + * by Segment. + * + * @return ApiResponse<GetEgressFailedMetricsFromDeliveryOverview200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + getIngressSuccessMetricsFromDeliveryOverviewWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = + getIngressSuccessMetricsFromDeliveryOverviewValidateBeforeCall(null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Ingress Success Metrics from Delivery Overview (asynchronously) Get events that were + * successfully received by Segment. + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getIngressSuccessMetricsFromDeliveryOverviewAsync( + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getIngressSuccessMetricsFromDeliveryOverviewValidateBeforeCall(_callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeliveryOverviewFilterBy.java b/src/main/java/com/segment/publicapi/models/DeliveryOverviewFilterBy.java new file mode 100644 index 00000000..4d359d23 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DeliveryOverviewFilterBy.java @@ -0,0 +1,355 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** + * The `DeliveryOverviewFilterBy` object is a map of the filterable fields and their + * values. + */ +public class DeliveryOverviewFilterBy { + public static final String SERIALIZED_NAME_DISCARD_REASON = "discardReason"; + + @SerializedName(SERIALIZED_NAME_DISCARD_REASON) + private List discardReason; + + public static final String SERIALIZED_NAME_EVENT_NAME = "eventName"; + + @SerializedName(SERIALIZED_NAME_EVENT_NAME) + private List eventName; + + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private List eventType; + + public static final String SERIALIZED_NAME_APP_VERSION = "appVersion"; + + @SerializedName(SERIALIZED_NAME_APP_VERSION) + private List appVersion; + + public DeliveryOverviewFilterBy() {} + + public DeliveryOverviewFilterBy discardReason(List discardReason) { + + this.discardReason = discardReason; + return this; + } + + public DeliveryOverviewFilterBy addDiscardReasonItem(String discardReasonItem) { + if (this.discardReason == null) { + this.discardReason = new ArrayList<>(); + } + this.discardReason.add(discardReasonItem); + return this; + } + + /** + * A list of strings of discard reasons. Can be used to filter all Source and Destination steps, + * except for Successfully Received. If you would like to view retry attempts for a successful + * delivery, you can filter from `successes.attempt.1` to + * `successes.attempt.10`. See Discard Record Documentation for valid error codes. + * + * @return discardReason + */ + @javax.annotation.Nullable + public List getDiscardReason() { + return discardReason; + } + + public void setDiscardReason(List discardReason) { + this.discardReason = discardReason; + } + + public DeliveryOverviewFilterBy eventName(List eventName) { + + this.eventName = eventName; + return this; + } + + public DeliveryOverviewFilterBy addEventNameItem(String eventNameItem) { + if (this.eventName == null) { + this.eventName = new ArrayList<>(); + } + this.eventName.add(eventNameItem); + return this; + } + + /** + * A list of strings of event names. + * + * @return eventName + */ + @javax.annotation.Nullable + public List getEventName() { + return eventName; + } + + public void setEventName(List eventName) { + this.eventName = eventName; + } + + public DeliveryOverviewFilterBy eventType(List eventType) { + + this.eventType = eventType; + return this; + } + + public DeliveryOverviewFilterBy addEventTypeItem(String eventTypeItem) { + if (this.eventType == null) { + this.eventType = new ArrayList<>(); + } + this.eventType.add(eventTypeItem); + return this; + } + + /** + * A list of strings of event types. Valid options are: `alias`, `group`, + * `identify`, `page`, `screen`, and `track`. + * + * @return eventType + */ + @javax.annotation.Nullable + public List getEventType() { + return eventType; + } + + public void setEventType(List eventType) { + this.eventType = eventType; + } + + public DeliveryOverviewFilterBy appVersion(List appVersion) { + + this.appVersion = appVersion; + return this; + } + + public DeliveryOverviewFilterBy addAppVersionItem(String appVersionItem) { + if (this.appVersion == null) { + this.appVersion = new ArrayList<>(); + } + this.appVersion.add(appVersionItem); + return this; + } + + /** + * A list of strings of app versions. + * + * @return appVersion + */ + @javax.annotation.Nullable + public List getAppVersion() { + return appVersion; + } + + public void setAppVersion(List appVersion) { + this.appVersion = appVersion; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryOverviewFilterBy deliveryOverviewFilterBy = (DeliveryOverviewFilterBy) o; + return Objects.equals(this.discardReason, deliveryOverviewFilterBy.discardReason) + && Objects.equals(this.eventName, deliveryOverviewFilterBy.eventName) + && Objects.equals(this.eventType, deliveryOverviewFilterBy.eventType) + && Objects.equals(this.appVersion, deliveryOverviewFilterBy.appVersion); + } + + @Override + public int hashCode() { + return Objects.hash(discardReason, eventName, eventType, appVersion); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryOverviewFilterBy {\n"); + sb.append(" discardReason: ").append(toIndentedString(discardReason)).append("\n"); + sb.append(" eventName: ").append(toIndentedString(eventName)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" appVersion: ").append(toIndentedString(appVersion)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("discardReason"); + openapiFields.add("eventName"); + openapiFields.add("eventType"); + openapiFields.add("appVersion"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliveryOverviewFilterBy + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryOverviewFilterBy.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeliveryOverviewFilterBy is not found" + + " in the empty JSON string", + DeliveryOverviewFilterBy.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryOverviewFilterBy.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeliveryOverviewFilterBy` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("discardReason") != null + && !jsonObj.get("discardReason").isJsonNull() + && !jsonObj.get("discardReason").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `discardReason` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("discardReason").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("eventName") != null + && !jsonObj.get("eventName").isJsonNull() + && !jsonObj.get("eventName").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `eventName` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("eventName").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("eventType") != null + && !jsonObj.get("eventType").isJsonNull() + && !jsonObj.get("eventType").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `eventType` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("eventType").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("appVersion") != null + && !jsonObj.get("appVersion").isJsonNull() + && !jsonObj.get("appVersion").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `appVersion` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("appVersion").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryOverviewFilterBy.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliveryOverviewFilterBy' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeliveryOverviewFilterBy.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliveryOverviewFilterBy value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryOverviewFilterBy read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryOverviewFilterBy given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryOverviewFilterBy + * @throws IOException if the JSON string is invalid with respect to DeliveryOverviewFilterBy + */ + public static DeliveryOverviewFilterBy fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliveryOverviewFilterBy.class); + } + + /** + * Convert an instance of DeliveryOverviewFilterBy to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeliveryOverviewMetricsDatapoint.java b/src/main/java/com/segment/publicapi/models/DeliveryOverviewMetricsDatapoint.java new file mode 100644 index 00000000..a1112503 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DeliveryOverviewMetricsDatapoint.java @@ -0,0 +1,272 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Series within DeliveryOverviewMetricsDataset. */ +public class DeliveryOverviewMetricsDatapoint { + public static final String SERIALIZED_NAME_TIME = "time"; + + @SerializedName(SERIALIZED_NAME_TIME) + private String time; + + public static final String SERIALIZED_NAME_COUNT = "count"; + + @SerializedName(SERIALIZED_NAME_COUNT) + private BigDecimal count; + + public static final String SERIALIZED_NAME_RETRY_COUNT = "retryCount"; + + @SerializedName(SERIALIZED_NAME_RETRY_COUNT) + private BigDecimal retryCount; + + public DeliveryOverviewMetricsDatapoint() {} + + public DeliveryOverviewMetricsDatapoint time(String time) { + + this.time = time; + return this; + } + + /** + * The timestamp corresponding to the beginning of the window given by the requested + * granularity. + * + * @return time + */ + @javax.annotation.Nonnull + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public DeliveryOverviewMetricsDatapoint count(BigDecimal count) { + + this.count = count; + return this; + } + + /** + * Holds the number of events within the specified granularity and groupBy options. + * + * @return count + */ + @javax.annotation.Nonnull + public BigDecimal getCount() { + return count; + } + + public void setCount(BigDecimal count) { + this.count = count; + } + + public DeliveryOverviewMetricsDatapoint retryCount(BigDecimal retryCount) { + + this.retryCount = retryCount; + return this; + } + + /** + * The number of retried events that were successfully delivered. + * + * @return retryCount + */ + @javax.annotation.Nullable + public BigDecimal getRetryCount() { + return retryCount; + } + + public void setRetryCount(BigDecimal retryCount) { + this.retryCount = retryCount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryOverviewMetricsDatapoint deliveryOverviewMetricsDatapoint = + (DeliveryOverviewMetricsDatapoint) o; + return Objects.equals(this.time, deliveryOverviewMetricsDatapoint.time) + && Objects.equals(this.count, deliveryOverviewMetricsDatapoint.count) + && Objects.equals(this.retryCount, deliveryOverviewMetricsDatapoint.retryCount); + } + + @Override + public int hashCode() { + return Objects.hash(time, count, retryCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryOverviewMetricsDatapoint {\n"); + sb.append(" time: ").append(toIndentedString(time)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" retryCount: ").append(toIndentedString(retryCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("time"); + openapiFields.add("count"); + openapiFields.add("retryCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("time"); + openapiRequiredFields.add("count"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DeliveryOverviewMetricsDatapoint + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryOverviewMetricsDatapoint.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeliveryOverviewMetricsDatapoint is" + + " not found in the empty JSON string", + DeliveryOverviewMetricsDatapoint.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryOverviewMetricsDatapoint.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeliveryOverviewMetricsDatapoint` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeliveryOverviewMetricsDatapoint.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("time").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `time` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("time").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryOverviewMetricsDatapoint.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliveryOverviewMetricsDatapoint' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DeliveryOverviewMetricsDatapoint.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliveryOverviewMetricsDatapoint value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryOverviewMetricsDatapoint read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryOverviewMetricsDatapoint given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryOverviewMetricsDatapoint + * @throws IOException if the JSON string is invalid with respect to + * DeliveryOverviewMetricsDatapoint + */ + public static DeliveryOverviewMetricsDatapoint fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliveryOverviewMetricsDatapoint.class); + } + + /** + * Convert an instance of DeliveryOverviewMetricsDatapoint to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeliveryOverviewMetricsDataset.java b/src/main/java/com/segment/publicapi/models/DeliveryOverviewMetricsDataset.java new file mode 100644 index 00000000..1dfc720b --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DeliveryOverviewMetricsDataset.java @@ -0,0 +1,439 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Dataset within GetDeliveryOverviewMetricsAlphaOutput. */ +public class DeliveryOverviewMetricsDataset { + public static final String SERIALIZED_NAME_EVENT_NAME = "eventName"; + + @SerializedName(SERIALIZED_NAME_EVENT_NAME) + private String eventName; + + public static final String SERIALIZED_NAME_APP_VERSION = "appVersion"; + + @SerializedName(SERIALIZED_NAME_APP_VERSION) + private String appVersion; + + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_DISCARD_REASON = "discardReason"; + + @SerializedName(SERIALIZED_NAME_DISCARD_REASON) + private String discardReason; + + public static final String SERIALIZED_NAME_TOTAL = "total"; + + @SerializedName(SERIALIZED_NAME_TOTAL) + private BigDecimal total; + + public static final String SERIALIZED_NAME_SERIES = "series"; + + @SerializedName(SERIALIZED_NAME_SERIES) + private List series = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TOTAL_RETRY_COUNT = "totalRetryCount"; + + @SerializedName(SERIALIZED_NAME_TOTAL_RETRY_COUNT) + private BigDecimal totalRetryCount; + + public DeliveryOverviewMetricsDataset() {} + + public DeliveryOverviewMetricsDataset eventName(String eventName) { + + this.eventName = eventName; + return this; + } + + /** + * The name of the event if groupBy[] included 'eventName' in the request. + * + * @return eventName + */ + @javax.annotation.Nullable + public String getEventName() { + return eventName; + } + + public void setEventName(String eventName) { + this.eventName = eventName; + } + + public DeliveryOverviewMetricsDataset appVersion(String appVersion) { + + this.appVersion = appVersion; + return this; + } + + /** + * The version of the app if groupBy[] included 'appVersion' in the request. + * + * @return appVersion + */ + @javax.annotation.Nullable + public String getAppVersion() { + return appVersion; + } + + public void setAppVersion(String appVersion) { + this.appVersion = appVersion; + } + + public DeliveryOverviewMetricsDataset eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type if groupBy[] included 'eventType' in the request. + * + * @return eventType + */ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + public DeliveryOverviewMetricsDataset discardReason(String discardReason) { + + this.discardReason = discardReason; + return this; + } + + /** + * The discard reason for dropped events if groupBy[] included 'discardReason' in the + * request. + * + * @return discardReason + */ + @javax.annotation.Nullable + public String getDiscardReason() { + return discardReason; + } + + public void setDiscardReason(String discardReason) { + this.discardReason = discardReason; + } + + public DeliveryOverviewMetricsDataset total(BigDecimal total) { + + this.total = total; + return this; + } + + /** + * Holds the count of all event counts over the timeframe of the series. + * + * @return total + */ + @javax.annotation.Nonnull + public BigDecimal getTotal() { + return total; + } + + public void setTotal(BigDecimal total) { + this.total = total; + } + + public DeliveryOverviewMetricsDataset series(List series) { + + this.series = series; + return this; + } + + public DeliveryOverviewMetricsDataset addSeriesItem( + DeliveryOverviewMetricsDatapoint seriesItem) { + if (this.series == null) { + this.series = new ArrayList<>(); + } + this.series.add(seriesItem); + return this; + } + + /** + * A list of the event counts broken down by the requested granularity, timeframe, and groupBy + * options. + * + * @return series + */ + @javax.annotation.Nonnull + public List getSeries() { + return series; + } + + public void setSeries(List series) { + this.series = series; + } + + public DeliveryOverviewMetricsDataset totalRetryCount(BigDecimal totalRetryCount) { + + this.totalRetryCount = totalRetryCount; + return this; + } + + /** + * The number of events successfully delivered upon retry. + * + * @return totalRetryCount + */ + @javax.annotation.Nullable + public BigDecimal getTotalRetryCount() { + return totalRetryCount; + } + + public void setTotalRetryCount(BigDecimal totalRetryCount) { + this.totalRetryCount = totalRetryCount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryOverviewMetricsDataset deliveryOverviewMetricsDataset = + (DeliveryOverviewMetricsDataset) o; + return Objects.equals(this.eventName, deliveryOverviewMetricsDataset.eventName) + && Objects.equals(this.appVersion, deliveryOverviewMetricsDataset.appVersion) + && Objects.equals(this.eventType, deliveryOverviewMetricsDataset.eventType) + && Objects.equals(this.discardReason, deliveryOverviewMetricsDataset.discardReason) + && Objects.equals(this.total, deliveryOverviewMetricsDataset.total) + && Objects.equals(this.series, deliveryOverviewMetricsDataset.series) + && Objects.equals( + this.totalRetryCount, deliveryOverviewMetricsDataset.totalRetryCount); + } + + @Override + public int hashCode() { + return Objects.hash( + eventName, appVersion, eventType, discardReason, total, series, totalRetryCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryOverviewMetricsDataset {\n"); + sb.append(" eventName: ").append(toIndentedString(eventName)).append("\n"); + sb.append(" appVersion: ").append(toIndentedString(appVersion)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" discardReason: ").append(toIndentedString(discardReason)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" series: ").append(toIndentedString(series)).append("\n"); + sb.append(" totalRetryCount: ").append(toIndentedString(totalRetryCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventName"); + openapiFields.add("appVersion"); + openapiFields.add("eventType"); + openapiFields.add("discardReason"); + openapiFields.add("total"); + openapiFields.add("series"); + openapiFields.add("totalRetryCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("total"); + openapiRequiredFields.add("series"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DeliveryOverviewMetricsDataset + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryOverviewMetricsDataset.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeliveryOverviewMetricsDataset is not" + + " found in the empty JSON string", + DeliveryOverviewMetricsDataset.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryOverviewMetricsDataset.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeliveryOverviewMetricsDataset` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeliveryOverviewMetricsDataset.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventName") != null && !jsonObj.get("eventName").isJsonNull()) + && !jsonObj.get("eventName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `eventName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("eventName").toString())); + } + if ((jsonObj.get("appVersion") != null && !jsonObj.get("appVersion").isJsonNull()) + && !jsonObj.get("appVersion").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `appVersion` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("appVersion").toString())); + } + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) + && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `eventType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("discardReason") != null && !jsonObj.get("discardReason").isJsonNull()) + && !jsonObj.get("discardReason").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `discardReason` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("discardReason").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("series").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `series` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("series").toString())); + } + + JsonArray jsonArrayseries = jsonObj.getAsJsonArray("series"); + // validate the required field `series` (array) + for (int i = 0; i < jsonArrayseries.size(); i++) { + DeliveryOverviewMetricsDatapoint.validateJsonElement(jsonArrayseries.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryOverviewMetricsDataset.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliveryOverviewMetricsDataset' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DeliveryOverviewMetricsDataset.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliveryOverviewMetricsDataset value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryOverviewMetricsDataset read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryOverviewMetricsDataset given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryOverviewMetricsDataset + * @throws IOException if the JSON string is invalid with respect to + * DeliveryOverviewMetricsDataset + */ + public static DeliveryOverviewMetricsDataset fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliveryOverviewMetricsDataset.class); + } + + /** + * Convert an instance of DeliveryOverviewMetricsDataset to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetDeliveryOverviewMetricsAlphaOutput.java b/src/main/java/com/segment/publicapi/models/GetDeliveryOverviewMetricsAlphaOutput.java new file mode 100644 index 00000000..4b319ecb --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetDeliveryOverviewMetricsAlphaOutput.java @@ -0,0 +1,300 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Output of the Delivery Overview public api endpoints. */ +public class GetDeliveryOverviewMetricsAlphaOutput { + public static final String SERIALIZED_NAME_TOTAL = "total"; + + @SerializedName(SERIALIZED_NAME_TOTAL) + private BigDecimal total; + + public static final String SERIALIZED_NAME_DATASET = "dataset"; + + @SerializedName(SERIALIZED_NAME_DATASET) + private List dataset = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PAGINATION = "pagination"; + + @SerializedName(SERIALIZED_NAME_PAGINATION) + private PaginationOutput pagination; + + public GetDeliveryOverviewMetricsAlphaOutput() {} + + public GetDeliveryOverviewMetricsAlphaOutput total(BigDecimal total) { + + this.total = total; + return this; + } + + /** + * The total number of events for the returned dataset. + * + * @return total + */ + @javax.annotation.Nonnull + public BigDecimal getTotal() { + return total; + } + + public void setTotal(BigDecimal total) { + this.total = total; + } + + public GetDeliveryOverviewMetricsAlphaOutput dataset( + List dataset) { + + this.dataset = dataset; + return this; + } + + public GetDeliveryOverviewMetricsAlphaOutput addDatasetItem( + DeliveryOverviewMetricsDataset datasetItem) { + if (this.dataset == null) { + this.dataset = new ArrayList<>(); + } + this.dataset.add(datasetItem); + return this; + } + + /** + * Represents the list of series broken down by the dimensions and timeframe requested. + * + * @return dataset + */ + @javax.annotation.Nonnull + public List getDataset() { + return dataset; + } + + public void setDataset(List dataset) { + this.dataset = dataset; + } + + public GetDeliveryOverviewMetricsAlphaOutput pagination(PaginationOutput pagination) { + + this.pagination = pagination; + return this; + } + + /** + * Get pagination + * + * @return pagination + */ + @javax.annotation.Nonnull + public PaginationOutput getPagination() { + return pagination; + } + + public void setPagination(PaginationOutput pagination) { + this.pagination = pagination; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDeliveryOverviewMetricsAlphaOutput getDeliveryOverviewMetricsAlphaOutput = + (GetDeliveryOverviewMetricsAlphaOutput) o; + return Objects.equals(this.total, getDeliveryOverviewMetricsAlphaOutput.total) + && Objects.equals(this.dataset, getDeliveryOverviewMetricsAlphaOutput.dataset) + && Objects.equals( + this.pagination, getDeliveryOverviewMetricsAlphaOutput.pagination); + } + + @Override + public int hashCode() { + return Objects.hash(total, dataset, pagination); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDeliveryOverviewMetricsAlphaOutput {\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" dataset: ").append(toIndentedString(dataset)).append("\n"); + sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("total"); + openapiFields.add("dataset"); + openapiFields.add("pagination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("total"); + openapiRequiredFields.add("dataset"); + openapiRequiredFields.add("pagination"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDeliveryOverviewMetricsAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDeliveryOverviewMetricsAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetDeliveryOverviewMetricsAlphaOutput" + + " is not found in the empty JSON string", + GetDeliveryOverviewMetricsAlphaOutput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDeliveryOverviewMetricsAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetDeliveryOverviewMetricsAlphaOutput` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetDeliveryOverviewMetricsAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("dataset").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `dataset` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("dataset").toString())); + } + + JsonArray jsonArraydataset = jsonObj.getAsJsonArray("dataset"); + // validate the required field `dataset` (array) + for (int i = 0; i < jsonArraydataset.size(); i++) { + DeliveryOverviewMetricsDataset.validateJsonElement(jsonArraydataset.get(i)); + } + ; + // validate the required field `pagination` + PaginationOutput.validateJsonElement(jsonObj.get("pagination")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDeliveryOverviewMetricsAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDeliveryOverviewMetricsAlphaOutput' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetDeliveryOverviewMetricsAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetDeliveryOverviewMetricsAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDeliveryOverviewMetricsAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDeliveryOverviewMetricsAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDeliveryOverviewMetricsAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * GetDeliveryOverviewMetricsAlphaOutput + */ + public static GetDeliveryOverviewMetricsAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetDeliveryOverviewMetricsAlphaOutput.class); + } + + /** + * Convert an instance of GetDeliveryOverviewMetricsAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetEgressFailedMetricsFromDeliveryOverview200Response.java b/src/main/java/com/segment/publicapi/models/GetEgressFailedMetricsFromDeliveryOverview200Response.java new file mode 100644 index 00000000..6b1ca501 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetEgressFailedMetricsFromDeliveryOverview200Response.java @@ -0,0 +1,217 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** GetEgressFailedMetricsFromDeliveryOverview200Response */ +public class GetEgressFailedMetricsFromDeliveryOverview200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private GetDeliveryOverviewMetricsAlphaOutput data; + + public GetEgressFailedMetricsFromDeliveryOverview200Response() {} + + public GetEgressFailedMetricsFromDeliveryOverview200Response data( + GetDeliveryOverviewMetricsAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetDeliveryOverviewMetricsAlphaOutput getData() { + return data; + } + + public void setData(GetDeliveryOverviewMetricsAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetEgressFailedMetricsFromDeliveryOverview200Response + getEgressFailedMetricsFromDeliveryOverview200Response = + (GetEgressFailedMetricsFromDeliveryOverview200Response) o; + return Objects.equals( + this.data, getEgressFailedMetricsFromDeliveryOverview200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetEgressFailedMetricsFromDeliveryOverview200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetEgressFailedMetricsFromDeliveryOverview200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetEgressFailedMetricsFromDeliveryOverview200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetEgressFailedMetricsFromDeliveryOverview200Response is" + + " not found in the empty JSON string", + GetEgressFailedMetricsFromDeliveryOverview200Response + .openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetEgressFailedMetricsFromDeliveryOverview200Response.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetEgressFailedMetricsFromDeliveryOverview200Response`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + GetDeliveryOverviewMetricsAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetEgressFailedMetricsFromDeliveryOverview200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetEgressFailedMetricsFromDeliveryOverview200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + GetEgressFailedMetricsFromDeliveryOverview200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + GetEgressFailedMetricsFromDeliveryOverview200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetEgressFailedMetricsFromDeliveryOverview200Response read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetEgressFailedMetricsFromDeliveryOverview200Response given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of GetEgressFailedMetricsFromDeliveryOverview200Response + * @throws IOException if the JSON string is invalid with respect to + * GetEgressFailedMetricsFromDeliveryOverview200Response + */ + public static GetEgressFailedMetricsFromDeliveryOverview200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, GetEgressFailedMetricsFromDeliveryOverview200Response.class); + } + + /** + * Convert an instance of GetEgressFailedMetricsFromDeliveryOverview200Response to an JSON + * string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +}