diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index abac03b8a87..1d7a005fe3d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -41237,6 +41237,114 @@ components: type: string x-enum-varnames: - PROCESS + ProductAnalyticsServerSideEventError: + description: Error details. + properties: + detail: + description: Error message. + example: Malformed payload + type: string + status: + description: Error code. + example: '400' + type: string + title: + description: Error title. + example: Bad Request + type: string + type: object + ProductAnalyticsServerSideEventErrors: + description: Error response. + properties: + errors: + description: Structured errors. + items: + $ref: '#/components/schemas/ProductAnalyticsServerSideEventError' + type: array + type: object + ProductAnalyticsServerSideEventItem: + description: A Product Analytics server-side event. + properties: + account: + $ref: '#/components/schemas/ProductAnalyticsServerSideEventItemAccount' + application: + $ref: '#/components/schemas/ProductAnalyticsServerSideEventItemApplication' + event: + $ref: '#/components/schemas/ProductAnalyticsServerSideEventItemEvent' + session: + $ref: '#/components/schemas/ProductAnalyticsServerSideEventItemSession' + type: + $ref: '#/components/schemas/ProductAnalyticsServerSideEventItemType' + usr: + $ref: '#/components/schemas/ProductAnalyticsServerSideEventItemUsr' + required: + - application + - event + - type + type: object + ProductAnalyticsServerSideEventItemAccount: + description: The account linked to your event. + properties: + id: + description: The account ID used in Datadog. + example: account-67890 + type: string + required: + - id + type: object + ProductAnalyticsServerSideEventItemApplication: + description: The application in which you want to send your events. + properties: + id: + description: 'The application ID of your application. It can be found in + your + + [application management page](https://app.datadoghq.com/rum/list).' + example: 123abcde-123a-123b-1234-123456789abc + type: string + required: + - id + type: object + ProductAnalyticsServerSideEventItemEvent: + description: Fields used for the event. + properties: + name: + description: The name of your event, which is used for search in the same + way as view or action names. + example: payment.processed + type: string + required: + - name + type: object + ProductAnalyticsServerSideEventItemSession: + description: The session linked to your event. + properties: + id: + description: The session ID captured by the SDK. + example: session-abcdef + type: string + required: + - id + type: object + ProductAnalyticsServerSideEventItemType: + description: The type of Product Analytics event. Must be `server` for server-side + events. + enum: + - server + example: server + type: string + x-enum-varnames: + - SERVER + ProductAnalyticsServerSideEventItemUsr: + description: The user linked to your event. + properties: + id: + description: The user ID used in Datadog. + example: user-12345 + type: string + required: + - id + type: object Project: description: A Project properties: @@ -78009,6 +78117,218 @@ paths: x-permission: operator: OPEN permissions: [] + /api/v2/prodlytics: + post: + description: 'Send server-side events to Product Analytics. Server-side events + are retained for 15 months. + + + Server-Side events in Product Analytics are helpful for tracking events that + occur on the server, + + as opposed to client-side events, which are captured by Real User Monitoring + (RUM) SDKs. + + This allows for a more comprehensive view of the user journey by including + actions that happen on the server. + + Typical examples could be `checkout.completed` or `payment.processed`. + + + Ingested server-side events are integrated into Product Analytics to allow + users to select and filter + + these events in the event picker, similar to how views or actions are handled. + + + **Requirements:** + + - At least one of `usr`, `account`, or `session` must be provided with a valid + ID. + + - The `application.id` must reference a Product Analytics-enabled application. + + + **Custom Attributes:** + + Any additional fields in the payload are flattened and searchable as facets. + + For example, a payload with `{"customer": {"tier": "premium"}}` is searchable + with + + the syntax `@customer.tier:premium` in Datadog. + + + The status codes answered by the HTTP API are: + + - 202: Accepted: The request has been accepted for processing + + - 400: Bad request (likely an issue in the payload formatting) + + - 401: Unauthorized (likely a missing API Key) + + - 403: Permission issue (likely using an invalid API Key) + + - 408: Request Timeout, request should be retried after some time + + - 413: Payload too large (batch is above 5MB uncompressed) + + - 429: Too Many Requests, request should be retried after some time + + - 500: Internal Server Error, the server encountered an unexpected condition + that prevented it from fulfilling the request, request should be retried after + some time + + - 503: Service Unavailable, the server is not ready to handle the request + probably because it is overloaded, request should be retried after some time' + operationId: SubmitProductAnalyticsEvent + requestBody: + content: + application/json: + examples: + event-with-account: + description: Send a server-side event linked to an account. + summary: Event with account ID + value: + account: + id: account-456 + application: + id: 123abcde-123a-123b-1234-123456789abc + event: + name: checkout.completed + type: server + event-with-custom-attributes: + description: Send a server-side event with additional custom attributes. + summary: Event with custom attributes + value: + application: + id: 123abcde-123a-123b-1234-123456789abc + customer: + tier: premium + event: + name: payment.processed + type: server + usr: + id: '123' + event-with-session: + description: Send a server-side event linked to a session. + summary: Event with session ID + value: + application: + id: 123abcde-123a-123b-1234-123456789abc + event: + name: form.submitted + session: + id: session-789 + type: server + simple-event-with-user: + description: Send a server-side event linked to a user. + summary: Simple event with user ID + value: + application: + id: 123abcde-123a-123b-1234-123456789abc + event: + name: payment.processed + type: server + usr: + id: '123' + schema: + $ref: '#/components/schemas/ProductAnalyticsServerSideEventItem' + description: Server-side event to send (JSON format). + required: true + responses: + '202': + content: + application/json: + schema: + type: object + description: Request accepted for processing (always 202 empty JSON). + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ProductAnalyticsServerSideEventErrors' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/ProductAnalyticsServerSideEventErrors' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/ProductAnalyticsServerSideEventErrors' + description: Forbidden + '408': + content: + application/json: + schema: + $ref: '#/components/schemas/ProductAnalyticsServerSideEventErrors' + description: Request Timeout + '413': + content: + application/json: + schema: + $ref: '#/components/schemas/ProductAnalyticsServerSideEventErrors' + description: Payload Too Large + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/ProductAnalyticsServerSideEventErrors' + description: Too Many Requests + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/ProductAnalyticsServerSideEventErrors' + description: Internal Server Error + '503': + content: + application/json: + schema: + $ref: '#/components/schemas/ProductAnalyticsServerSideEventErrors' + description: Service Unavailable + security: + - apiKeyAuth: [] + servers: + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: The regional site for customers. + enum: + - datadoghq.com + - us3.datadoghq.com + - us5.datadoghq.com + - ap1.datadoghq.com + - ap2.datadoghq.com + - datadoghq.eu + subdomain: + default: browser-intake + description: The subdomain where the API is deployed. + - url: '{protocol}://{name}' + variables: + name: + default: browser-intake-datadoghq.com + description: Full site DNS name. + protocol: + default: https + description: The protocol for accessing the API. + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: Any Datadog deployment. + subdomain: + default: browser-intake + description: The subdomain where the API is deployed. + summary: Send server-side events + tags: + - Product Analytics + x-codegen-request-body-name: body /api/v2/product-analytics/accounts/facet_info: post: description: Get facet information for account attributes including possible @@ -90205,6 +90525,18 @@ tags: See the [Live Processes page](https://docs.datadoghq.com/infrastructure/process/) for more information. name: Processes +- description: 'Send server-side events to Product Analytics. Server-Side Events Ingestion + allows you to collect custom events + + from any server-side source, and retains events for 15 months. Server-side events + are helpful for understanding + + causes of a funnel drop-off which are external to the client-side (for example, + payment processing error). + + See the [Product Analytics page](https://docs.datadoghq.com/product_analytics/) + for more information.' + name: Product Analytics - description: Manage your Real User Monitoring (RUM) applications, and search or aggregate your RUM events over HTTP. See the [RUM & Session Replay page](https://docs.datadoghq.com/real_user_monitoring/) for more information diff --git a/examples/v2/product-analytics/SubmitProductAnalyticsEvent.java b/examples/v2/product-analytics/SubmitProductAnalyticsEvent.java new file mode 100644 index 00000000000..edc12cb9af2 --- /dev/null +++ b/examples/v2/product-analytics/SubmitProductAnalyticsEvent.java @@ -0,0 +1,41 @@ +// Send server-side events returns "Request accepted for processing (always 202 empty JSON)." +// response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ProductAnalyticsApi; +import com.datadog.api.client.v2.model.ProductAnalyticsServerSideEventItem; +import com.datadog.api.client.v2.model.ProductAnalyticsServerSideEventItemAccount; +import com.datadog.api.client.v2.model.ProductAnalyticsServerSideEventItemApplication; +import com.datadog.api.client.v2.model.ProductAnalyticsServerSideEventItemEvent; +import com.datadog.api.client.v2.model.ProductAnalyticsServerSideEventItemSession; +import com.datadog.api.client.v2.model.ProductAnalyticsServerSideEventItemType; +import com.datadog.api.client.v2.model.ProductAnalyticsServerSideEventItemUsr; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ProductAnalyticsApi apiInstance = new ProductAnalyticsApi(defaultClient); + + ProductAnalyticsServerSideEventItem body = + new ProductAnalyticsServerSideEventItem() + .account(new ProductAnalyticsServerSideEventItemAccount().id("account-67890")) + .application( + new ProductAnalyticsServerSideEventItemApplication() + .id("123abcde-123a-123b-1234-123456789abc")) + .event(new ProductAnalyticsServerSideEventItemEvent().name("payment.processed")) + .session(new ProductAnalyticsServerSideEventItemSession().id("session-abcdef")) + .type(ProductAnalyticsServerSideEventItemType.SERVER) + .usr(new ProductAnalyticsServerSideEventItemUsr().id("user-12345")); + + try { + apiInstance.submitProductAnalyticsEvent(body); + } catch (ApiException e) { + System.err.println("Exception when calling ProductAnalyticsApi#submitProductAnalyticsEvent"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index d9c3f82eb2b..439a59c339c 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -666,6 +666,74 @@ public class ApiClient { new HashSet())); } })))); + put( + "v2.ProductAnalyticsApi.submitProductAnalyticsEvent", + new ArrayList( + Arrays.asList( + new ServerConfiguration( + "https://{subdomain}.{site}", + "No description provided", + new HashMap() { + { + put( + "site", + new ServerVariable( + "The regional site for customers.", + "datadoghq.com", + new HashSet( + Arrays.asList( + "datadoghq.com", + "us3.datadoghq.com", + "us5.datadoghq.com", + "ap1.datadoghq.com", + "ap2.datadoghq.com", + "datadoghq.eu")))); + put( + "subdomain", + new ServerVariable( + "The subdomain where the API is deployed.", + "browser-intake", + new HashSet())); + } + }), + new ServerConfiguration( + "{protocol}://{name}", + "No description provided", + new HashMap() { + { + put( + "name", + new ServerVariable( + "Full site DNS name.", + "browser-intake-datadoghq.com", + new HashSet())); + put( + "protocol", + new ServerVariable( + "The protocol for accessing the API.", + "https", + new HashSet())); + } + }), + new ServerConfiguration( + "https://{subdomain}.{site}", + "No description provided", + new HashMap() { + { + put( + "site", + new ServerVariable( + "Any Datadog deployment.", + "datadoghq.com", + new HashSet())); + put( + "subdomain", + new ServerVariable( + "The subdomain where the API is deployed.", + "browser-intake", + new HashSet())); + } + })))); } }; protected Map operationServerIndex = new HashMap(); diff --git a/src/main/java/com/datadog/api/client/v2/api/ProductAnalyticsApi.java b/src/main/java/com/datadog/api/client/v2/api/ProductAnalyticsApi.java new file mode 100644 index 00000000000..4059a272fdb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/ProductAnalyticsApi.java @@ -0,0 +1,211 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.ProductAnalyticsServerSideEventItem; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProductAnalyticsApi { + private ApiClient apiClient; + + public ProductAnalyticsApi() { + this(ApiClient.getDefaultApiClient()); + } + + public ProductAnalyticsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Send server-side events. + * + *

See {@link #submitProductAnalyticsEventWithHttpInfo}. + * + * @param body Server-side event to send (JSON format). (required) + * @return Object + * @throws ApiException if fails to make API call + */ + public Object submitProductAnalyticsEvent(ProductAnalyticsServerSideEventItem body) + throws ApiException { + return submitProductAnalyticsEventWithHttpInfo(body).getData(); + } + + /** + * Send server-side events. + * + *

See {@link #submitProductAnalyticsEventWithHttpInfoAsync}. + * + * @param body Server-side event to send (JSON format). (required) + * @return CompletableFuture<Object> + */ + public CompletableFuture submitProductAnalyticsEventAsync( + ProductAnalyticsServerSideEventItem body) { + return submitProductAnalyticsEventWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Send server-side events to Product Analytics. Server-side events are retained for 15 months. + * + *

Server-Side events in Product Analytics are helpful for tracking events that occur on the + * server, as opposed to client-side events, which are captured by Real User Monitoring (RUM) + * SDKs. This allows for a more comprehensive view of the user journey by including actions that + * happen on the server. Typical examples could be checkout.completed or + * payment.processed. + * + *

Ingested server-side events are integrated into Product Analytics to allow users to select + * and filter these events in the event picker, similar to how views or actions are handled. + * + *

Requirements: - At least one of usr, account, or + * session must be provided with a valid ID. - The application.id must + * reference a Product Analytics-enabled application. + * + *

Custom Attributes: Any additional fields in the payload are flattened and + * searchable as facets. For example, a payload with {"customer": {"tier": "premium"}} + * is searchable with the syntax @customer.tier:premium in Datadog. + * + *

The status codes answered by the HTTP API are: - 202: Accepted: The request has been + * accepted for processing - 400: Bad request (likely an issue in the payload formatting) - 401: + * Unauthorized (likely a missing API Key) - 403: Permission issue (likely using an invalid API + * Key) - 408: Request Timeout, request should be retried after some time - 413: Payload too large + * (batch is above 5MB uncompressed) - 429: Too Many Requests, request should be retried after + * some time - 500: Internal Server Error, the server encountered an unexpected condition that + * prevented it from fulfilling the request, request should be retried after some time - 503: + * Service Unavailable, the server is not ready to handle the request probably because it is + * overloaded, request should be retried after some time + * + * @param body Server-side event to send (JSON format). (required) + * @return ApiResponse<Object> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
202 Request accepted for processing (always 202 empty JSON). -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
408 Request Timeout -
413 Payload Too Large -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public ApiResponse submitProductAnalyticsEventWithHttpInfo( + ProductAnalyticsServerSideEventItem body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling submitProductAnalyticsEvent"); + } + // create path and map variables + String localVarPath = "/api/v2/prodlytics"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ProductAnalyticsApi.submitProductAnalyticsEvent", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Send server-side events. + * + *

See {@link #submitProductAnalyticsEventWithHttpInfo}. + * + * @param body Server-side event to send (JSON format). (required) + * @return CompletableFuture<ApiResponse<Object>> + */ + public CompletableFuture> submitProductAnalyticsEventWithHttpInfoAsync( + ProductAnalyticsServerSideEventItem body) { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling submitProductAnalyticsEvent")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/prodlytics"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ProductAnalyticsApi.submitProductAnalyticsEvent", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventError.java b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventError.java new file mode 100644 index 00000000000..2e454a74ed1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventError.java @@ -0,0 +1,193 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Error details. */ +@JsonPropertyOrder({ + ProductAnalyticsServerSideEventError.JSON_PROPERTY_DETAIL, + ProductAnalyticsServerSideEventError.JSON_PROPERTY_STATUS, + ProductAnalyticsServerSideEventError.JSON_PROPERTY_TITLE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProductAnalyticsServerSideEventError { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DETAIL = "detail"; + private String detail; + + public static final String JSON_PROPERTY_STATUS = "status"; + private String status; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public ProductAnalyticsServerSideEventError detail(String detail) { + this.detail = detail; + return this; + } + + /** + * Error message. + * + * @return detail + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DETAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDetail() { + return detail; + } + + public void setDetail(String detail) { + this.detail = detail; + } + + public ProductAnalyticsServerSideEventError status(String status) { + this.status = status; + return this; + } + + /** + * Error code. + * + * @return status + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public ProductAnalyticsServerSideEventError title(String title) { + this.title = title; + return this; + } + + /** + * Error title. + * + * @return title + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ProductAnalyticsServerSideEventError + */ + @JsonAnySetter + public ProductAnalyticsServerSideEventError putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ProductAnalyticsServerSideEventError object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductAnalyticsServerSideEventError productAnalyticsServerSideEventError = + (ProductAnalyticsServerSideEventError) o; + return Objects.equals(this.detail, productAnalyticsServerSideEventError.detail) + && Objects.equals(this.status, productAnalyticsServerSideEventError.status) + && Objects.equals(this.title, productAnalyticsServerSideEventError.title) + && Objects.equals( + this.additionalProperties, productAnalyticsServerSideEventError.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(detail, status, title, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductAnalyticsServerSideEventError {\n"); + sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventErrors.java b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventErrors.java new file mode 100644 index 00000000000..4f75d4b4d75 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventErrors.java @@ -0,0 +1,153 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Error response. */ +@JsonPropertyOrder({ProductAnalyticsServerSideEventErrors.JSON_PROPERTY_ERRORS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProductAnalyticsServerSideEventErrors { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ERRORS = "errors"; + private List errors = null; + + public ProductAnalyticsServerSideEventErrors errors( + List errors) { + this.errors = errors; + for (ProductAnalyticsServerSideEventError item : errors) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ProductAnalyticsServerSideEventErrors addErrorsItem( + ProductAnalyticsServerSideEventError errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + this.unparsed |= errorsItem.unparsed; + return this; + } + + /** + * Structured errors. + * + * @return errors + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ERRORS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getErrors() { + return errors; + } + + public void setErrors(List errors) { + this.errors = errors; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ProductAnalyticsServerSideEventErrors + */ + @JsonAnySetter + public ProductAnalyticsServerSideEventErrors putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ProductAnalyticsServerSideEventErrors object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductAnalyticsServerSideEventErrors productAnalyticsServerSideEventErrors = + (ProductAnalyticsServerSideEventErrors) o; + return Objects.equals(this.errors, productAnalyticsServerSideEventErrors.errors) + && Objects.equals( + this.additionalProperties, productAnalyticsServerSideEventErrors.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(errors, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductAnalyticsServerSideEventErrors {\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItem.java b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItem.java new file mode 100644 index 00000000000..43006951ad3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItem.java @@ -0,0 +1,302 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A Product Analytics server-side event. */ +@JsonPropertyOrder({ + ProductAnalyticsServerSideEventItem.JSON_PROPERTY_ACCOUNT, + ProductAnalyticsServerSideEventItem.JSON_PROPERTY_APPLICATION, + ProductAnalyticsServerSideEventItem.JSON_PROPERTY_EVENT, + ProductAnalyticsServerSideEventItem.JSON_PROPERTY_SESSION, + ProductAnalyticsServerSideEventItem.JSON_PROPERTY_TYPE, + ProductAnalyticsServerSideEventItem.JSON_PROPERTY_USR +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProductAnalyticsServerSideEventItem { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCOUNT = "account"; + private ProductAnalyticsServerSideEventItemAccount account; + + public static final String JSON_PROPERTY_APPLICATION = "application"; + private ProductAnalyticsServerSideEventItemApplication application; + + public static final String JSON_PROPERTY_EVENT = "event"; + private ProductAnalyticsServerSideEventItemEvent event; + + public static final String JSON_PROPERTY_SESSION = "session"; + private ProductAnalyticsServerSideEventItemSession session; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ProductAnalyticsServerSideEventItemType type; + + public static final String JSON_PROPERTY_USR = "usr"; + private ProductAnalyticsServerSideEventItemUsr usr; + + public ProductAnalyticsServerSideEventItem() {} + + @JsonCreator + public ProductAnalyticsServerSideEventItem( + @JsonProperty(required = true, value = JSON_PROPERTY_APPLICATION) + ProductAnalyticsServerSideEventItemApplication application, + @JsonProperty(required = true, value = JSON_PROPERTY_EVENT) + ProductAnalyticsServerSideEventItemEvent event, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + ProductAnalyticsServerSideEventItemType type) { + this.application = application; + this.unparsed |= application.unparsed; + this.event = event; + this.unparsed |= event.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ProductAnalyticsServerSideEventItem account( + ProductAnalyticsServerSideEventItemAccount account) { + this.account = account; + this.unparsed |= account.unparsed; + return this; + } + + /** + * The account linked to your event. + * + * @return account + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ACCOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ProductAnalyticsServerSideEventItemAccount getAccount() { + return account; + } + + public void setAccount(ProductAnalyticsServerSideEventItemAccount account) { + this.account = account; + } + + public ProductAnalyticsServerSideEventItem application( + ProductAnalyticsServerSideEventItemApplication application) { + this.application = application; + this.unparsed |= application.unparsed; + return this; + } + + /** + * The application in which you want to send your events. + * + * @return application + */ + @JsonProperty(JSON_PROPERTY_APPLICATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ProductAnalyticsServerSideEventItemApplication getApplication() { + return application; + } + + public void setApplication(ProductAnalyticsServerSideEventItemApplication application) { + this.application = application; + } + + public ProductAnalyticsServerSideEventItem event(ProductAnalyticsServerSideEventItemEvent event) { + this.event = event; + this.unparsed |= event.unparsed; + return this; + } + + /** + * Fields used for the event. + * + * @return event + */ + @JsonProperty(JSON_PROPERTY_EVENT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ProductAnalyticsServerSideEventItemEvent getEvent() { + return event; + } + + public void setEvent(ProductAnalyticsServerSideEventItemEvent event) { + this.event = event; + } + + public ProductAnalyticsServerSideEventItem session( + ProductAnalyticsServerSideEventItemSession session) { + this.session = session; + this.unparsed |= session.unparsed; + return this; + } + + /** + * The session linked to your event. + * + * @return session + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SESSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ProductAnalyticsServerSideEventItemSession getSession() { + return session; + } + + public void setSession(ProductAnalyticsServerSideEventItemSession session) { + this.session = session; + } + + public ProductAnalyticsServerSideEventItem type(ProductAnalyticsServerSideEventItemType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of Product Analytics event. Must be server for server-side events. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ProductAnalyticsServerSideEventItemType getType() { + return type; + } + + public void setType(ProductAnalyticsServerSideEventItemType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + public ProductAnalyticsServerSideEventItem usr(ProductAnalyticsServerSideEventItemUsr usr) { + this.usr = usr; + this.unparsed |= usr.unparsed; + return this; + } + + /** + * The user linked to your event. + * + * @return usr + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_USR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ProductAnalyticsServerSideEventItemUsr getUsr() { + return usr; + } + + public void setUsr(ProductAnalyticsServerSideEventItemUsr usr) { + this.usr = usr; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ProductAnalyticsServerSideEventItem + */ + @JsonAnySetter + public ProductAnalyticsServerSideEventItem putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ProductAnalyticsServerSideEventItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductAnalyticsServerSideEventItem productAnalyticsServerSideEventItem = + (ProductAnalyticsServerSideEventItem) o; + return Objects.equals(this.account, productAnalyticsServerSideEventItem.account) + && Objects.equals(this.application, productAnalyticsServerSideEventItem.application) + && Objects.equals(this.event, productAnalyticsServerSideEventItem.event) + && Objects.equals(this.session, productAnalyticsServerSideEventItem.session) + && Objects.equals(this.type, productAnalyticsServerSideEventItem.type) + && Objects.equals(this.usr, productAnalyticsServerSideEventItem.usr) + && Objects.equals( + this.additionalProperties, productAnalyticsServerSideEventItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(account, application, event, session, type, usr, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductAnalyticsServerSideEventItem {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" application: ").append(toIndentedString(application)).append("\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append(" session: ").append(toIndentedString(session)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" usr: ").append(toIndentedString(usr)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemAccount.java b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemAccount.java new file mode 100644 index 00000000000..1ac4f8dc549 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemAccount.java @@ -0,0 +1,147 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The account linked to your event. */ +@JsonPropertyOrder({ProductAnalyticsServerSideEventItemAccount.JSON_PROPERTY_ID}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProductAnalyticsServerSideEventItemAccount { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public ProductAnalyticsServerSideEventItemAccount() {} + + @JsonCreator + public ProductAnalyticsServerSideEventItemAccount( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id) { + this.id = id; + } + + public ProductAnalyticsServerSideEventItemAccount id(String id) { + this.id = id; + return this; + } + + /** + * The account ID used in Datadog. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ProductAnalyticsServerSideEventItemAccount + */ + @JsonAnySetter + public ProductAnalyticsServerSideEventItemAccount putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ProductAnalyticsServerSideEventItemAccount object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductAnalyticsServerSideEventItemAccount productAnalyticsServerSideEventItemAccount = + (ProductAnalyticsServerSideEventItemAccount) o; + return Objects.equals(this.id, productAnalyticsServerSideEventItemAccount.id) + && Objects.equals( + this.additionalProperties, + productAnalyticsServerSideEventItemAccount.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductAnalyticsServerSideEventItemAccount {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemApplication.java b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemApplication.java new file mode 100644 index 00000000000..f56761e1876 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemApplication.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The application in which you want to send your events. */ +@JsonPropertyOrder({ProductAnalyticsServerSideEventItemApplication.JSON_PROPERTY_ID}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProductAnalyticsServerSideEventItemApplication { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public ProductAnalyticsServerSideEventItemApplication() {} + + @JsonCreator + public ProductAnalyticsServerSideEventItemApplication( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id) { + this.id = id; + } + + public ProductAnalyticsServerSideEventItemApplication id(String id) { + this.id = id; + return this; + } + + /** + * The application ID of your application. It can be found in your application management page. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ProductAnalyticsServerSideEventItemApplication + */ + @JsonAnySetter + public ProductAnalyticsServerSideEventItemApplication putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ProductAnalyticsServerSideEventItemApplication object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductAnalyticsServerSideEventItemApplication productAnalyticsServerSideEventItemApplication = + (ProductAnalyticsServerSideEventItemApplication) o; + return Objects.equals(this.id, productAnalyticsServerSideEventItemApplication.id) + && Objects.equals( + this.additionalProperties, + productAnalyticsServerSideEventItemApplication.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductAnalyticsServerSideEventItemApplication {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemEvent.java b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemEvent.java new file mode 100644 index 00000000000..a2effe0f8e0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemEvent.java @@ -0,0 +1,146 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Fields used for the event. */ +@JsonPropertyOrder({ProductAnalyticsServerSideEventItemEvent.JSON_PROPERTY_NAME}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProductAnalyticsServerSideEventItemEvent { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public ProductAnalyticsServerSideEventItemEvent() {} + + @JsonCreator + public ProductAnalyticsServerSideEventItemEvent( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.name = name; + } + + public ProductAnalyticsServerSideEventItemEvent name(String name) { + this.name = name; + return this; + } + + /** + * The name of your event, which is used for search in the same way as view or action names. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ProductAnalyticsServerSideEventItemEvent + */ + @JsonAnySetter + public ProductAnalyticsServerSideEventItemEvent putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ProductAnalyticsServerSideEventItemEvent object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductAnalyticsServerSideEventItemEvent productAnalyticsServerSideEventItemEvent = + (ProductAnalyticsServerSideEventItemEvent) o; + return Objects.equals(this.name, productAnalyticsServerSideEventItemEvent.name) + && Objects.equals( + this.additionalProperties, + productAnalyticsServerSideEventItemEvent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductAnalyticsServerSideEventItemEvent {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemSession.java b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemSession.java new file mode 100644 index 00000000000..989be82fc91 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemSession.java @@ -0,0 +1,147 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The session linked to your event. */ +@JsonPropertyOrder({ProductAnalyticsServerSideEventItemSession.JSON_PROPERTY_ID}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProductAnalyticsServerSideEventItemSession { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public ProductAnalyticsServerSideEventItemSession() {} + + @JsonCreator + public ProductAnalyticsServerSideEventItemSession( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id) { + this.id = id; + } + + public ProductAnalyticsServerSideEventItemSession id(String id) { + this.id = id; + return this; + } + + /** + * The session ID captured by the SDK. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ProductAnalyticsServerSideEventItemSession + */ + @JsonAnySetter + public ProductAnalyticsServerSideEventItemSession putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ProductAnalyticsServerSideEventItemSession object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductAnalyticsServerSideEventItemSession productAnalyticsServerSideEventItemSession = + (ProductAnalyticsServerSideEventItemSession) o; + return Objects.equals(this.id, productAnalyticsServerSideEventItemSession.id) + && Objects.equals( + this.additionalProperties, + productAnalyticsServerSideEventItemSession.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductAnalyticsServerSideEventItemSession {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemType.java b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemType.java new file mode 100644 index 00000000000..6817bffe0e9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemType.java @@ -0,0 +1,62 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The type of Product Analytics event. Must be server for server-side events. */ +@JsonSerialize( + using = + ProductAnalyticsServerSideEventItemType.ProductAnalyticsServerSideEventItemTypeSerializer + .class) +public class ProductAnalyticsServerSideEventItemType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("server")); + + public static final ProductAnalyticsServerSideEventItemType SERVER = + new ProductAnalyticsServerSideEventItemType("server"); + + ProductAnalyticsServerSideEventItemType(String value) { + super(value, allowedValues); + } + + public static class ProductAnalyticsServerSideEventItemTypeSerializer + extends StdSerializer { + public ProductAnalyticsServerSideEventItemTypeSerializer( + Class t) { + super(t); + } + + public ProductAnalyticsServerSideEventItemTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ProductAnalyticsServerSideEventItemType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ProductAnalyticsServerSideEventItemType fromValue(String value) { + return new ProductAnalyticsServerSideEventItemType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemUsr.java b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemUsr.java new file mode 100644 index 00000000000..48ddc8459cf --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProductAnalyticsServerSideEventItemUsr.java @@ -0,0 +1,145 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The user linked to your event. */ +@JsonPropertyOrder({ProductAnalyticsServerSideEventItemUsr.JSON_PROPERTY_ID}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProductAnalyticsServerSideEventItemUsr { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public ProductAnalyticsServerSideEventItemUsr() {} + + @JsonCreator + public ProductAnalyticsServerSideEventItemUsr( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id) { + this.id = id; + } + + public ProductAnalyticsServerSideEventItemUsr id(String id) { + this.id = id; + return this; + } + + /** + * The user ID used in Datadog. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ProductAnalyticsServerSideEventItemUsr + */ + @JsonAnySetter + public ProductAnalyticsServerSideEventItemUsr putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ProductAnalyticsServerSideEventItemUsr object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductAnalyticsServerSideEventItemUsr productAnalyticsServerSideEventItemUsr = + (ProductAnalyticsServerSideEventItemUsr) o; + return Objects.equals(this.id, productAnalyticsServerSideEventItemUsr.id) + && Objects.equals( + this.additionalProperties, productAnalyticsServerSideEventItemUsr.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductAnalyticsServerSideEventItemUsr {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/product_analytics.feature b/src/test/resources/com/datadog/api/client/v2/api/product_analytics.feature new file mode 100644 index 00000000000..a915c213041 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/product_analytics.feature @@ -0,0 +1,35 @@ +@endpoint(product-analytics) @endpoint(product-analytics-v2) +Feature: Product Analytics + Send server-side events to Product Analytics. Server-Side Events Ingestion + allows you to collect custom events from any server-side source, and + retains events for 15 months. Server-side events are helpful for + understanding causes of a funnel drop-off which are external to the + client-side (for example, payment processing error). See the [Product + Analytics page](https://docs.datadoghq.com/product_analytics/) for more + information. + + Background: + Given a valid "apiKeyAuth" key in the system + And an instance of "ProductAnalytics" API + And new "SubmitProductAnalyticsEvent" request + And body with value {"account": {"id": "account-67890"}, "application": {"id": "123abcde-123a-123b-1234-123456789abc"}, "event": {"name": "payment.processed"}, "session": {"id": "session-abcdef"}, "type": "server", "usr": {"id": "user-12345"}} + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Send server-side events returns "Bad Request" response + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Send server-side events returns "Payload Too Large" response + When the request is sent + Then the response status is 413 Payload Too Large + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Send server-side events returns "Request Timeout" response + When the request is sent + Then the response status is 408 Request Timeout + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Send server-side events returns "Request accepted for processing (always 202 empty JSON)." response + When the request is sent + Then the response status is 202 Request accepted for processing (always 202 empty JSON). diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index eb43f26dbec..0867c10cd71 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -3133,6 +3133,12 @@ "type": "safe" } }, + "SubmitProductAnalyticsEvent": { + "tag": "Product Analytics", + "undo": { + "type": "safe" + } + }, "GetAccountFacetInfo": { "tag": "Rum Audience Management", "undo": {