From 7ee1a6bc1d9280fea2e5991771307cbd36c55b50 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 4 Jun 2026 20:53:45 +0000 Subject: [PATCH] Regenerate client from commit d198067 of spec repo --- .generator/schemas/v2/openapi.yaml | 688 +++++++++++++++ examples/v2/forms/CreateAndPublishForm.java | 45 + examples/v2/forms/CreateForm.java | 45 + examples/v2/forms/DeleteForm.java | 34 + examples/v2/forms/GetForm.java | 34 + examples/v2/forms/ListForms.java | 25 + .../com/datadog/api/client/ApiClient.java | 5 + .../datadog/api/client/v2/api/FormsApi.java | 833 ++++++++++++++++++ .../api/client/v2/model/CreateFormData.java | 178 ++++ .../v2/model/CreateFormDataAttributes.java | 329 +++++++ .../client/v2/model/CreateFormRequest.java | 145 +++ .../api/client/v2/model/DeleteFormData.java | 176 ++++ .../client/v2/model/DeleteFormResponse.java | 136 +++ .../datadog/api/client/v2/model/FormData.java | 210 +++++ .../client/v2/model/FormDataAttributes.java | 636 +++++++++++++ .../model/FormDatastoreConfigAttributes.java | 212 +++++ .../v2/model/FormPublicationAttributes.java | 381 ++++++++ .../api/client/v2/model/FormResponse.java | 144 +++ .../datadog/api/client/v2/model/FormType.java | 53 ++ .../v2/model/FormVersionAttributes.java | 461 ++++++++++ .../api/client/v2/model/FormVersionState.java | 55 ++ .../api/client/v2/model/FormsResponse.java | 154 ++++ .../Create_a_form_returns_OK_response.freeze | 1 + .../v2/Create_a_form_returns_OK_response.json | 58 ++ ..._publish_a_form_returns_OK_response.freeze | 1 + ...nd_publish_a_form_returns_OK_response.json | 58 ++ .../Delete_a_form_returns_OK_response.freeze | 1 + .../v2/Delete_a_form_returns_OK_response.json | 84 ++ ...t_a_form_returns_Not_Found_response.freeze | 1 + ...Get_a_form_returns_Not_Found_response.json | 28 + .../v2/Get_a_form_returns_OK_response.freeze | 1 + .../v2/Get_a_form_returns_OK_response.json | 84 ++ .../v2/List_forms_returns_OK_response.freeze | 1 + .../v2/List_forms_returns_OK_response.json | 84 ++ .../datadog/api/client/v2/api/forms.feature | 107 +++ .../com/datadog/api/client/v2/api/given.json | 24 + .../com/datadog/api/client/v2/api/undo.json | 44 + 37 files changed, 5556 insertions(+) create mode 100644 examples/v2/forms/CreateAndPublishForm.java create mode 100644 examples/v2/forms/CreateForm.java create mode 100644 examples/v2/forms/DeleteForm.java create mode 100644 examples/v2/forms/GetForm.java create mode 100644 examples/v2/forms/ListForms.java create mode 100644 src/main/java/com/datadog/api/client/v2/api/FormsApi.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CreateFormData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CreateFormDataAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CreateFormRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DeleteFormData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DeleteFormResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FormData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FormDataAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FormDatastoreConfigAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FormPublicationAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FormResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FormType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FormVersionAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FormVersionState.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FormsResponse.java create mode 100644 src/test/resources/cassettes/features/v2/Create_a_form_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Create_a_form_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/Create_and_publish_a_form_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Create_and_publish_a_form_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/Delete_a_form_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Delete_a_form_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/Get_a_form_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Get_a_form_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/Get_a_form_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Get_a_form_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/List_forms_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/List_forms_returns_OK_response.json create mode 100644 src/test/resources/com/datadog/api/client/v2/api/forms.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 85c26314849..1fc1870d338 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -23049,6 +23049,63 @@ components: required: - data type: object + CreateFormData: + description: The data for creating a form. + properties: + attributes: + $ref: "#/components/schemas/CreateFormDataAttributes" + type: + $ref: "#/components/schemas/FormType" + required: + - attributes + - type + type: object + CreateFormDataAttributes: + description: The attributes for creating a form. + properties: + anonymous: + description: Whether the form accepts anonymous submissions. + example: false + type: boolean + data_definition: + additionalProperties: {} + description: The data definition of the form. + example: {} + type: object + description: + description: The description of the form. + example: A form to collect user feedback. + type: string + idp_survey: + description: Whether the form is an IDP survey. + example: false + type: boolean + name: + description: The name of the form. + example: User Feedback Form + type: string + single_response: + description: Whether each user can only submit one response. + example: false + type: boolean + ui_definition: + additionalProperties: {} + description: The UI definition of the form. + example: {} + type: object + required: + - data_definition + - name + - ui_definition + type: object + CreateFormRequest: + description: A request to create a form. + properties: + data: + $ref: "#/components/schemas/CreateFormData" + required: + - data + type: object CreateIncidentNotificationRuleRequest: description: Create request for a notification rule. properties: @@ -28864,6 +28921,26 @@ components: required: - data type: object + DeleteFormData: + description: The data returned when a form is deleted. + properties: + id: + description: The ID of the deleted form. + example: 844dfd88-aa84-4db4-8979-e7bdbb9c1dc3 + format: uuid + type: string + type: + $ref: "#/components/schemas/FormType" + required: + - id + - type + type: object + DeleteFormResponse: + description: A response returned after deleting a form. + properties: + data: + $ref: "#/components/schemas/DeleteFormData" + type: object DeletedSuiteResponseData: description: Data object for a deleted Synthetic test suite. properties: @@ -36570,6 +36647,201 @@ components: - type - attributes type: object + FormData: + description: A form resource object. + properties: + attributes: + $ref: "#/components/schemas/FormDataAttributes" + id: + description: The ID of the form. + example: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + format: uuid + type: string + type: + $ref: "#/components/schemas/FormType" + required: + - id + - type + - attributes + type: object + FormDataAttributes: + description: The attributes of a form. + properties: + active: + description: Whether the form is currently active. + example: true + type: boolean + anonymous: + description: Whether the form accepts anonymous submissions. + example: false + type: boolean + created_at: + description: The time at which the form was created. + example: "2026-05-29T20:06:13.677353Z" + format: date-time + type: string + datastore_config: + $ref: "#/components/schemas/FormDatastoreConfigAttributes" + description: + description: The description of the form. + example: A form to collect user feedback. + type: string + end_date: + description: The date and time at which the form stops accepting responses. + example: + format: date-time + nullable: true + type: string + has_submitted: + description: Whether the current user has already submitted this form. Only present for forms with `single_response` set to `true`. + nullable: true + type: boolean + idp_survey: + description: Whether the form is an IDP survey. + example: false + type: boolean + modified_at: + description: The time at which the form was last modified. + example: "2026-05-29T20:06:13.677353Z" + format: date-time + type: string + name: + description: The name of the form. + example: User Feedback Form + type: string + org_id: + description: The ID of the organization that owns this form. + example: 2 + format: int64 + type: integer + publication: + $ref: "#/components/schemas/FormPublicationAttributes" + self_service: + description: Whether the form is available in the self-service catalog. + example: false + type: boolean + single_response: + description: Whether each user can only submit one response. + example: false + type: boolean + user_id: + description: The ID of the user who created this form. + example: 10001 + format: int64 + type: integer + user_uuid: + description: The UUID of the user who created this form. + example: 1fc709aa-be19-4539-a47d-52a30d78a978 + format: uuid + type: string + version: + $ref: "#/components/schemas/FormVersionAttributes" + required: + - active + - anonymous + - created_at + - datastore_config + - description + - idp_survey + - modified_at + - name + - org_id + - self_service + - single_response + - user_id + - user_uuid + type: object + FormDataList: + description: A list of form resource objects. + items: + $ref: "#/components/schemas/FormData" + type: array + FormDatastoreConfigAttributes: + description: The datastore configuration for a form. + properties: + datastore_id: + description: The ID of the datastore. + example: 5108ea24-dd83-4696-9caa-f069f73d0fad + format: uuid + type: string + primary_column_name: + description: The name of the primary column in the datastore. + example: id + type: string + primary_key_generation_strategy: + description: The strategy used to generate primary keys in the datastore. + example: none + type: string + required: + - datastore_id + - primary_column_name + - primary_key_generation_strategy + type: object + FormPublicationAttributes: + description: The attributes of a form publication. + properties: + created_at: + description: The time at which the publication was created. + example: "2026-05-29T20:06:13.677353Z" + format: date-time + type: string + form_id: + description: The ID of the form. + example: afc67600-0511-43b1-9b18-578fb4979bd3 + format: uuid + type: string + form_version: + description: The version number that was published. + example: 1 + format: int64 + type: integer + id: + description: The ID of the form publication. + example: "42" + type: string + modified_at: + description: The time at which the publication was last modified. + example: "2026-05-29T20:06:13.677353Z" + format: date-time + type: string + org_id: + description: The ID of the organization that owns this publication. + example: 2 + format: int64 + type: integer + publish_seq: + description: The sequential publication number for this form. + example: 1 + format: int64 + type: integer + user_id: + description: The ID of the user who created this publication. + example: 10001 + format: int64 + type: integer + user_uuid: + description: The UUID of the user who created this publication. + example: 1fc709aa-be19-4539-a47d-52a30d78a978 + format: uuid + type: string + required: + - created_at + - form_id + - form_version + - modified_at + - org_id + - publish_seq + - user_id + - user_uuid + type: object + FormResponse: + description: A response containing a single form. + properties: + data: + $ref: "#/components/schemas/FormData" + required: + - data + type: object FormTrigger: description: "Trigger a workflow from a Form." properties: @@ -36588,6 +36860,95 @@ components: required: - formTrigger type: object + FormType: + description: The resource type for a form. + enum: + - forms + example: forms + type: string + x-enum-varnames: + - FORMS + FormVersionAttributes: + description: The attributes of a form version. + properties: + created_at: + description: The time at which the version was created. + example: "2026-05-29T20:06:14.895921Z" + format: date-time + type: string + data_definition: + additionalProperties: {} + description: The data definition for this version. + type: object + definition_signature: + description: The signature of the version definition. + example: '{"signature":"b7f312957a80cea2c8c9950532b205a90a3f8a7ebb7e52fc25437a25d903d545","version":1}' + type: string + etag: + description: The ETag for optimistic concurrency control. + example: b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d + nullable: true + type: string + id: + description: The ID of the form version. + example: "126" + type: string + modified_at: + description: The time at which the version was last modified. + example: "2026-05-29T20:06:14.949163Z" + format: date-time + type: string + state: + $ref: "#/components/schemas/FormVersionState" + ui_definition: + additionalProperties: {} + description: The UI definition for this version. + type: object + user_id: + description: The ID of the user who created this version. + example: 10001 + format: int64 + type: integer + user_uuid: + description: The UUID of the user who created this version. + example: 1fc709aa-be19-4539-a47d-52a30d78a978 + format: uuid + type: string + version: + description: The sequential version number. + example: 1 + format: int64 + type: integer + required: + - created_at + - data_definition + - definition_signature + - etag + - modified_at + - state + - ui_definition + - user_id + - user_uuid + - version + type: object + FormVersionState: + description: The state of a form version. + enum: + - draft + - frozen + example: frozen + type: string + x-enum-varnames: + - DRAFT + - FROZEN + FormsResponse: + description: A response containing a list of forms. + properties: + data: + $ref: "#/components/schemas/FormDataList" + required: + - data + type: object FormulaLimit: description: |- Message for specifying limits to the number of values returned by a query. @@ -123892,6 +124253,330 @@ paths: permissions: - feature_flag_config_write - feature_flag_environment_config_read + /api/v2/forms: + get: + description: Get all forms for the authenticated user's organization. + operationId: ListForms + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + active: true + anonymous: false + created_at: "2026-05-29T20:06:14.895284Z" + datastore_config: + datastore_id: 00000000-0000-0000-0000-000000000000 + primary_column_name: "" + primary_key_generation_strategy: "" + description: A form to collect user feedback. + end_date: + idp_survey: false + modified_at: "2026-05-29T20:06:14.895285Z" + name: User Feedback Form + org_id: 2 + self_service: false + single_response: false + user_id: 10001 + user_uuid: 1fc709aa-be19-4539-a47d-52a30d78a978 + id: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + type: forms + schema: + $ref: "#/components/schemas/FormsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List forms + tags: + - Forms + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Create a new form. + operationId: CreateForm + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + anonymous: false + data_definition: {} + description: A form to collect user feedback. + idp_survey: false + name: User Feedback Form + single_response: false + ui_definition: {} + type: forms + schema: + $ref: "#/components/schemas/CreateFormRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + active: true + anonymous: false + created_at: "2026-05-29T20:06:14.895284Z" + datastore_config: + datastore_id: 5108ea24-dd83-4696-9caa-f069f73d0fad + primary_column_name: id + primary_key_generation_strategy: none + description: A form to collect user feedback. + end_date: + idp_survey: false + modified_at: "2026-05-29T20:06:14.895285Z" + name: User Feedback Form + org_id: 2 + self_service: false + single_response: false + user_id: 10001 + user_uuid: 1fc709aa-be19-4539-a47d-52a30d78a978 + id: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + type: forms + schema: + $ref: "#/components/schemas/FormResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create a form + tags: + - Forms + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/forms/create_and_publish: + post: + description: Creates a new form and immediately publishes its initial version. + operationId: CreateAndPublishForm + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + anonymous: false + data_definition: {} + description: A form to collect user feedback. + idp_survey: false + name: User Feedback Form + single_response: false + ui_definition: {} + type: forms + schema: + $ref: "#/components/schemas/CreateFormRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + active: true + anonymous: false + created_at: "2026-05-29T20:06:14.895284Z" + datastore_config: + datastore_id: 5108ea24-dd83-4696-9caa-f069f73d0fad + primary_column_name: id + primary_key_generation_strategy: none + description: A form to collect user feedback. + end_date: + idp_survey: false + modified_at: "2026-05-29T20:06:14.895285Z" + name: User Feedback Form + org_id: 2 + self_service: false + single_response: false + user_id: 10001 + user_uuid: 1fc709aa-be19-4539-a47d-52a30d78a978 + id: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + type: forms + schema: + $ref: "#/components/schemas/FormResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create and publish a form + tags: + - Forms + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/forms/{form_id}: + delete: + description: Delete a form by its ID. + operationId: DeleteForm + parameters: + - description: The ID of the form. + example: 844dfd88-aa84-4db4-8979-e7bdbb9c1dc3 + in: path + name: form_id + required: true + schema: + format: uuid + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + id: 844dfd88-aa84-4db4-8979-e7bdbb9c1dc3 + type: forms + schema: + $ref: "#/components/schemas/DeleteFormResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Delete a form + tags: + - Forms + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Get a form by its ID. + operationId: GetForm + parameters: + - description: The ID of the form. + example: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + in: path + name: form_id + required: true + schema: + format: uuid + type: string + - description: The version of the form to retrieve. Use 'latest' for the most recent draft, 'published' for the last published version, or a specific version number. + in: query + name: version + required: false + schema: + default: latest + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + active: true + anonymous: false + created_at: "2026-05-29T20:06:14.895284Z" + datastore_config: + datastore_id: 5108ea24-dd83-4696-9caa-f069f73d0fad + primary_column_name: id + primary_key_generation_strategy: none + description: A form to collect user feedback. + end_date: + idp_survey: false + modified_at: "2026-05-29T20:06:14.895285Z" + name: User Feedback Form + org_id: 2 + self_service: false + single_response: false + user_id: 10001 + user_uuid: 1fc709aa-be19-4539-a47d-52a30d78a978 + id: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + type: forms + schema: + $ref: "#/components/schemas/FormResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get a form + tags: + - Forms + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/hamr: get: description: |- @@ -178614,6 +179299,9 @@ tags: Package Upgrade Deployments (`/upgrade`): - Upgrade the Datadog Agent to specific versions name: Fleet Automation + - description: |- + The Datadog Forms API lets you create and manage forms within the App Builder platform. You can configure form settings, manage versions, publish forms, and handle sharing configurations. + name: Forms - description: |- Configure your Datadog-Google Cloud Platform (GCP) integration directly through the Datadog API. Read more about the [Datadog-Google Cloud Platform integration](https://docs.datadoghq.com/integrations/google_cloud_platform). diff --git a/examples/v2/forms/CreateAndPublishForm.java b/examples/v2/forms/CreateAndPublishForm.java new file mode 100644 index 00000000000..99270470c4b --- /dev/null +++ b/examples/v2/forms/CreateAndPublishForm.java @@ -0,0 +1,45 @@ +// Create and publish a form returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FormsApi; +import com.datadog.api.client.v2.model.CreateFormData; +import com.datadog.api.client.v2.model.CreateFormDataAttributes; +import com.datadog.api.client.v2.model.CreateFormRequest; +import com.datadog.api.client.v2.model.FormResponse; +import com.datadog.api.client.v2.model.FormType; +import java.util.Map; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createAndPublishForm", true); + FormsApi apiInstance = new FormsApi(defaultClient); + + CreateFormRequest body = + new CreateFormRequest() + .data( + new CreateFormData() + .attributes( + new CreateFormDataAttributes() + .anonymous(false) + .dataDefinition(Map.ofEntries()) + .description("A form to collect user feedback.") + .idpSurvey(false) + .name("User Feedback Form") + .singleResponse(false) + .uiDefinition(Map.ofEntries())) + .type(FormType.FORMS)); + + try { + FormResponse result = apiInstance.createAndPublishForm(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FormsApi#createAndPublishForm"); + 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/examples/v2/forms/CreateForm.java b/examples/v2/forms/CreateForm.java new file mode 100644 index 00000000000..d83ca37a33d --- /dev/null +++ b/examples/v2/forms/CreateForm.java @@ -0,0 +1,45 @@ +// Create a form returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FormsApi; +import com.datadog.api.client.v2.model.CreateFormData; +import com.datadog.api.client.v2.model.CreateFormDataAttributes; +import com.datadog.api.client.v2.model.CreateFormRequest; +import com.datadog.api.client.v2.model.FormResponse; +import com.datadog.api.client.v2.model.FormType; +import java.util.Map; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createForm", true); + FormsApi apiInstance = new FormsApi(defaultClient); + + CreateFormRequest body = + new CreateFormRequest() + .data( + new CreateFormData() + .attributes( + new CreateFormDataAttributes() + .anonymous(false) + .dataDefinition(Map.ofEntries()) + .description("A form to collect user feedback.") + .idpSurvey(false) + .name("User Feedback Form") + .singleResponse(false) + .uiDefinition(Map.ofEntries())) + .type(FormType.FORMS)); + + try { + FormResponse result = apiInstance.createForm(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FormsApi#createForm"); + 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/examples/v2/forms/DeleteForm.java b/examples/v2/forms/DeleteForm.java new file mode 100644 index 00000000000..bc1026c6949 --- /dev/null +++ b/examples/v2/forms/DeleteForm.java @@ -0,0 +1,34 @@ +// Delete a form returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FormsApi; +import com.datadog.api.client.v2.model.DeleteFormResponse; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.deleteForm", true); + FormsApi apiInstance = new FormsApi(defaultClient); + + // there is a valid "form" in the system + UUID FORM_DATA_ID = null; + try { + FORM_DATA_ID = UUID.fromString(System.getenv("FORM_DATA_ID")); + } catch (IllegalArgumentException e) { + System.err.println("Error parsing UUID: " + e.getMessage()); + } + + try { + DeleteFormResponse result = apiInstance.deleteForm(FORM_DATA_ID); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FormsApi#deleteForm"); + 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/examples/v2/forms/GetForm.java b/examples/v2/forms/GetForm.java new file mode 100644 index 00000000000..8f11f283ee3 --- /dev/null +++ b/examples/v2/forms/GetForm.java @@ -0,0 +1,34 @@ +// Get a form returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FormsApi; +import com.datadog.api.client.v2.model.FormResponse; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getForm", true); + FormsApi apiInstance = new FormsApi(defaultClient); + + // there is a valid "form" in the system + UUID FORM_DATA_ID = null; + try { + FORM_DATA_ID = UUID.fromString(System.getenv("FORM_DATA_ID")); + } catch (IllegalArgumentException e) { + System.err.println("Error parsing UUID: " + e.getMessage()); + } + + try { + FormResponse result = apiInstance.getForm(FORM_DATA_ID); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FormsApi#getForm"); + 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/examples/v2/forms/ListForms.java b/examples/v2/forms/ListForms.java new file mode 100644 index 00000000000..4712389e19e --- /dev/null +++ b/examples/v2/forms/ListForms.java @@ -0,0 +1,25 @@ +// List forms returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FormsApi; +import com.datadog.api.client.v2.model.FormsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listForms", true); + FormsApi apiInstance = new FormsApi(defaultClient); + + try { + FormsResponse result = apiInstance.listForms(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FormsApi#listForms"); + 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 f4d0070951f..236dada3e0e 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -996,6 +996,11 @@ public class ApiClient { put("v2.triggerDeploymentGatesEvaluation", false); put("v2.updateDeploymentGate", false); put("v2.updateDeploymentRule", false); + put("v2.createAndPublishForm", false); + put("v2.createForm", false); + put("v2.deleteForm", false); + put("v2.getForm", false); + put("v2.listForms", false); put("v2.createHamrOrgConnection", false); put("v2.getHamrOrgConnection", false); put("v2.deleteEntityIntegrationConfig", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/FormsApi.java b/src/main/java/com/datadog/api/client/v2/api/FormsApi.java new file mode 100644 index 00000000000..d46a4801cd8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/FormsApi.java @@ -0,0 +1,833 @@ +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.CreateFormRequest; +import com.datadog.api.client.v2.model.DeleteFormResponse; +import com.datadog.api.client.v2.model.FormResponse; +import com.datadog.api.client.v2.model.FormsResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FormsApi { + private ApiClient apiClient; + + public FormsApi() { + this(ApiClient.getDefaultApiClient()); + } + + public FormsApi(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; + } + + /** + * Create and publish a form. + * + *

See {@link #createAndPublishFormWithHttpInfo}. + * + * @param body (required) + * @return FormResponse + * @throws ApiException if fails to make API call + */ + public FormResponse createAndPublishForm(CreateFormRequest body) throws ApiException { + return createAndPublishFormWithHttpInfo(body).getData(); + } + + /** + * Create and publish a form. + * + *

See {@link #createAndPublishFormWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<FormResponse> + */ + public CompletableFuture createAndPublishFormAsync(CreateFormRequest body) { + return createAndPublishFormWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Creates a new form and immediately publishes its initial version. + * + * @param body (required) + * @return ApiResponse<FormResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
429 Too many requests -
+ */ + public ApiResponse createAndPublishFormWithHttpInfo(CreateFormRequest body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "createAndPublishForm"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createAndPublishForm"); + } + // create path and map variables + String localVarPath = "/api/v2/forms/create_and_publish"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FormsApi.createAndPublishForm", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create and publish a form. + * + *

See {@link #createAndPublishFormWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<FormResponse>> + */ + public CompletableFuture> createAndPublishFormWithHttpInfoAsync( + CreateFormRequest body) { + // Check if unstable operation is enabled + String operationId = "createAndPublishForm"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + 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 createAndPublishForm")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/forms/create_and_publish"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FormsApi.createAndPublishForm", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } 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() {}); + } + + /** + * Create a form. + * + *

See {@link #createFormWithHttpInfo}. + * + * @param body (required) + * @return FormResponse + * @throws ApiException if fails to make API call + */ + public FormResponse createForm(CreateFormRequest body) throws ApiException { + return createFormWithHttpInfo(body).getData(); + } + + /** + * Create a form. + * + *

See {@link #createFormWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<FormResponse> + */ + public CompletableFuture createFormAsync(CreateFormRequest body) { + return createFormWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a new form. + * + * @param body (required) + * @return ApiResponse<FormResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
429 Too many requests -
+ */ + public ApiResponse createFormWithHttpInfo(CreateFormRequest body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "createForm"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createForm"); + } + // create path and map variables + String localVarPath = "/api/v2/forms"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FormsApi.createForm", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a form. + * + *

See {@link #createFormWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<FormResponse>> + */ + public CompletableFuture> createFormWithHttpInfoAsync( + CreateFormRequest body) { + // Check if unstable operation is enabled + String operationId = "createForm"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + 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 createForm")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/forms"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FormsApi.createForm", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } 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() {}); + } + + /** + * Delete a form. + * + *

See {@link #deleteFormWithHttpInfo}. + * + * @param formId The ID of the form. (required) + * @return DeleteFormResponse + * @throws ApiException if fails to make API call + */ + public DeleteFormResponse deleteForm(UUID formId) throws ApiException { + return deleteFormWithHttpInfo(formId).getData(); + } + + /** + * Delete a form. + * + *

See {@link #deleteFormWithHttpInfoAsync}. + * + * @param formId The ID of the form. (required) + * @return CompletableFuture<DeleteFormResponse> + */ + public CompletableFuture deleteFormAsync(UUID formId) { + return deleteFormWithHttpInfoAsync(formId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete a form by its ID. + * + * @param formId The ID of the form. (required) + * @return ApiResponse<DeleteFormResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
429 Too many requests -
+ */ + public ApiResponse deleteFormWithHttpInfo(UUID formId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteForm"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'formId' is set + if (formId == null) { + throw new ApiException( + 400, "Missing the required parameter 'formId' when calling deleteForm"); + } + // create path and map variables + String localVarPath = + "/api/v2/forms/{form_id}" + .replaceAll("\\{" + "form_id" + "\\}", apiClient.escapeString(formId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FormsApi.deleteForm", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Delete a form. + * + *

See {@link #deleteFormWithHttpInfo}. + * + * @param formId The ID of the form. (required) + * @return CompletableFuture<ApiResponse<DeleteFormResponse>> + */ + public CompletableFuture> deleteFormWithHttpInfoAsync( + UUID formId) { + // Check if unstable operation is enabled + String operationId = "deleteForm"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'formId' is set + if (formId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(400, "Missing the required parameter 'formId' when calling deleteForm")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/forms/{form_id}" + .replaceAll("\\{" + "form_id" + "\\}", apiClient.escapeString(formId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FormsApi.deleteForm", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to getForm. */ + public static class GetFormOptionalParameters { + private String version; + + /** + * Set version. + * + * @param version The version of the form to retrieve. Use 'latest' for the most recent draft, + * 'published' for the last published version, or a specific version number. (optional, + * default to "latest") + * @return GetFormOptionalParameters + */ + public GetFormOptionalParameters version(String version) { + this.version = version; + return this; + } + } + + /** + * Get a form. + * + *

See {@link #getFormWithHttpInfo}. + * + * @param formId The ID of the form. (required) + * @return FormResponse + * @throws ApiException if fails to make API call + */ + public FormResponse getForm(UUID formId) throws ApiException { + return getFormWithHttpInfo(formId, new GetFormOptionalParameters()).getData(); + } + + /** + * Get a form. + * + *

See {@link #getFormWithHttpInfoAsync}. + * + * @param formId The ID of the form. (required) + * @return CompletableFuture<FormResponse> + */ + public CompletableFuture getFormAsync(UUID formId) { + return getFormWithHttpInfoAsync(formId, new GetFormOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a form. + * + *

See {@link #getFormWithHttpInfo}. + * + * @param formId The ID of the form. (required) + * @param parameters Optional parameters for the request. + * @return FormResponse + * @throws ApiException if fails to make API call + */ + public FormResponse getForm(UUID formId, GetFormOptionalParameters parameters) + throws ApiException { + return getFormWithHttpInfo(formId, parameters).getData(); + } + + /** + * Get a form. + * + *

See {@link #getFormWithHttpInfoAsync}. + * + * @param formId The ID of the form. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<FormResponse> + */ + public CompletableFuture getFormAsync( + UUID formId, GetFormOptionalParameters parameters) { + return getFormWithHttpInfoAsync(formId, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a form by its ID. + * + * @param formId The ID of the form. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<FormResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getFormWithHttpInfo( + UUID formId, GetFormOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getForm"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'formId' is set + if (formId == null) { + throw new ApiException(400, "Missing the required parameter 'formId' when calling getForm"); + } + String version = parameters.version; + // create path and map variables + String localVarPath = + "/api/v2/forms/{form_id}" + .replaceAll("\\{" + "form_id" + "\\}", apiClient.escapeString(formId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "version", version)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FormsApi.getForm", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a form. + * + *

See {@link #getFormWithHttpInfo}. + * + * @param formId The ID of the form. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<FormResponse>> + */ + public CompletableFuture> getFormWithHttpInfoAsync( + UUID formId, GetFormOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "getForm"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'formId' is set + if (formId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(400, "Missing the required parameter 'formId' when calling getForm")); + return result; + } + String version = parameters.version; + // create path and map variables + String localVarPath = + "/api/v2/forms/{form_id}" + .replaceAll("\\{" + "form_id" + "\\}", apiClient.escapeString(formId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "version", version)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FormsApi.getForm", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List forms. + * + *

See {@link #listFormsWithHttpInfo}. + * + * @return FormsResponse + * @throws ApiException if fails to make API call + */ + public FormsResponse listForms() throws ApiException { + return listFormsWithHttpInfo().getData(); + } + + /** + * List forms. + * + *

See {@link #listFormsWithHttpInfoAsync}. + * + * @return CompletableFuture<FormsResponse> + */ + public CompletableFuture listFormsAsync() { + return listFormsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all forms for the authenticated user's organization. + * + * @return ApiResponse<FormsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
429 Too many requests -
+ */ + public ApiResponse listFormsWithHttpInfo() throws ApiException { + // Check if unstable operation is enabled + String operationId = "listForms"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/forms"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FormsApi.listForms", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List forms. + * + *

See {@link #listFormsWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<FormsResponse>> + */ + public CompletableFuture> listFormsWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "listForms"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/forms"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FormsApi.listForms", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateFormData.java b/src/main/java/com/datadog/api/client/v2/model/CreateFormData.java new file mode 100644 index 00000000000..9d98bb529ff --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateFormData.java @@ -0,0 +1,178 @@ +/* + * 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 data for creating a form. */ +@JsonPropertyOrder({CreateFormData.JSON_PROPERTY_ATTRIBUTES, CreateFormData.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateFormData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CreateFormDataAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FormType type; + + public CreateFormData() {} + + @JsonCreator + public CreateFormData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + CreateFormDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FormType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CreateFormData attributes(CreateFormDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes for creating a form. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreateFormDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CreateFormDataAttributes attributes) { + this.attributes = attributes; + } + + public CreateFormData type(FormType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The resource type for a form. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FormType getType() { + return type; + } + + public void setType(FormType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * 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 CreateFormData + */ + @JsonAnySetter + public CreateFormData 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 CreateFormData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFormData createFormData = (CreateFormData) o; + return Objects.equals(this.attributes, createFormData.attributes) + && Objects.equals(this.type, createFormData.type) + && Objects.equals(this.additionalProperties, createFormData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFormData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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/CreateFormDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CreateFormDataAttributes.java new file mode 100644 index 00000000000..a6e9fff5f11 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateFormDataAttributes.java @@ -0,0 +1,329 @@ +/* + * 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 attributes for creating a form. */ +@JsonPropertyOrder({ + CreateFormDataAttributes.JSON_PROPERTY_ANONYMOUS, + CreateFormDataAttributes.JSON_PROPERTY_DATA_DEFINITION, + CreateFormDataAttributes.JSON_PROPERTY_DESCRIPTION, + CreateFormDataAttributes.JSON_PROPERTY_IDP_SURVEY, + CreateFormDataAttributes.JSON_PROPERTY_NAME, + CreateFormDataAttributes.JSON_PROPERTY_SINGLE_RESPONSE, + CreateFormDataAttributes.JSON_PROPERTY_UI_DEFINITION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateFormDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ANONYMOUS = "anonymous"; + private Boolean anonymous; + + public static final String JSON_PROPERTY_DATA_DEFINITION = "data_definition"; + private Map dataDefinition = new HashMap(); + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_IDP_SURVEY = "idp_survey"; + private Boolean idpSurvey; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SINGLE_RESPONSE = "single_response"; + private Boolean singleResponse; + + public static final String JSON_PROPERTY_UI_DEFINITION = "ui_definition"; + private Map uiDefinition = new HashMap(); + + public CreateFormDataAttributes() {} + + @JsonCreator + public CreateFormDataAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA_DEFINITION) + Map dataDefinition, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_UI_DEFINITION) + Map uiDefinition) { + this.dataDefinition = dataDefinition; + this.name = name; + this.uiDefinition = uiDefinition; + } + + public CreateFormDataAttributes anonymous(Boolean anonymous) { + this.anonymous = anonymous; + return this; + } + + /** + * Whether the form accepts anonymous submissions. + * + * @return anonymous + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ANONYMOUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getAnonymous() { + return anonymous; + } + + public void setAnonymous(Boolean anonymous) { + this.anonymous = anonymous; + } + + public CreateFormDataAttributes dataDefinition(Map dataDefinition) { + this.dataDefinition = dataDefinition; + return this; + } + + public CreateFormDataAttributes putDataDefinitionItem(String key, Object dataDefinitionItem) { + this.dataDefinition.put(key, dataDefinitionItem); + return this; + } + + /** + * The data definition of the form. + * + * @return dataDefinition + */ + @JsonProperty(JSON_PROPERTY_DATA_DEFINITION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Map getDataDefinition() { + return dataDefinition; + } + + public void setDataDefinition(Map dataDefinition) { + this.dataDefinition = dataDefinition; + } + + public CreateFormDataAttributes description(String description) { + this.description = description; + return this; + } + + /** + * The description of the form. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public CreateFormDataAttributes idpSurvey(Boolean idpSurvey) { + this.idpSurvey = idpSurvey; + return this; + } + + /** + * Whether the form is an IDP survey. + * + * @return idpSurvey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IDP_SURVEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIdpSurvey() { + return idpSurvey; + } + + public void setIdpSurvey(Boolean idpSurvey) { + this.idpSurvey = idpSurvey; + } + + public CreateFormDataAttributes name(String name) { + this.name = name; + return this; + } + + /** + * The name of the form. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CreateFormDataAttributes singleResponse(Boolean singleResponse) { + this.singleResponse = singleResponse; + return this; + } + + /** + * Whether each user can only submit one response. + * + * @return singleResponse + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SINGLE_RESPONSE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getSingleResponse() { + return singleResponse; + } + + public void setSingleResponse(Boolean singleResponse) { + this.singleResponse = singleResponse; + } + + public CreateFormDataAttributes uiDefinition(Map uiDefinition) { + this.uiDefinition = uiDefinition; + return this; + } + + public CreateFormDataAttributes putUiDefinitionItem(String key, Object uiDefinitionItem) { + this.uiDefinition.put(key, uiDefinitionItem); + return this; + } + + /** + * The UI definition of the form. + * + * @return uiDefinition + */ + @JsonProperty(JSON_PROPERTY_UI_DEFINITION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Map getUiDefinition() { + return uiDefinition; + } + + public void setUiDefinition(Map uiDefinition) { + this.uiDefinition = uiDefinition; + } + + /** + * 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 CreateFormDataAttributes + */ + @JsonAnySetter + public CreateFormDataAttributes 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 CreateFormDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFormDataAttributes createFormDataAttributes = (CreateFormDataAttributes) o; + return Objects.equals(this.anonymous, createFormDataAttributes.anonymous) + && Objects.equals(this.dataDefinition, createFormDataAttributes.dataDefinition) + && Objects.equals(this.description, createFormDataAttributes.description) + && Objects.equals(this.idpSurvey, createFormDataAttributes.idpSurvey) + && Objects.equals(this.name, createFormDataAttributes.name) + && Objects.equals(this.singleResponse, createFormDataAttributes.singleResponse) + && Objects.equals(this.uiDefinition, createFormDataAttributes.uiDefinition) + && Objects.equals(this.additionalProperties, createFormDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + anonymous, + dataDefinition, + description, + idpSurvey, + name, + singleResponse, + uiDefinition, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFormDataAttributes {\n"); + sb.append(" anonymous: ").append(toIndentedString(anonymous)).append("\n"); + sb.append(" dataDefinition: ").append(toIndentedString(dataDefinition)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" idpSurvey: ").append(toIndentedString(idpSurvey)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" singleResponse: ").append(toIndentedString(singleResponse)).append("\n"); + sb.append(" uiDefinition: ").append(toIndentedString(uiDefinition)).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/CreateFormRequest.java b/src/main/java/com/datadog/api/client/v2/model/CreateFormRequest.java new file mode 100644 index 00000000000..81350b0da7a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateFormRequest.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; + +/** A request to create a form. */ +@JsonPropertyOrder({CreateFormRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateFormRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CreateFormData data; + + public CreateFormRequest() {} + + @JsonCreator + public CreateFormRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) CreateFormData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public CreateFormRequest data(CreateFormData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data for creating a form. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreateFormData getData() { + return data; + } + + public void setData(CreateFormData data) { + this.data = data; + } + + /** + * 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 CreateFormRequest + */ + @JsonAnySetter + public CreateFormRequest 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 CreateFormRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFormRequest createFormRequest = (CreateFormRequest) o; + return Objects.equals(this.data, createFormRequest.data) + && Objects.equals(this.additionalProperties, createFormRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFormRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).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/DeleteFormData.java b/src/main/java/com/datadog/api/client/v2/model/DeleteFormData.java new file mode 100644 index 00000000000..e73fb602f85 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DeleteFormData.java @@ -0,0 +1,176 @@ +/* + * 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; +import java.util.UUID; + +/** The data returned when a form is deleted. */ +@JsonPropertyOrder({DeleteFormData.JSON_PROPERTY_ID, DeleteFormData.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DeleteFormData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FormType type; + + public DeleteFormData() {} + + @JsonCreator + public DeleteFormData( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FormType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public DeleteFormData id(UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the deleted form. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public DeleteFormData type(FormType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The resource type for a form. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FormType getType() { + return type; + } + + public void setType(FormType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * 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 DeleteFormData + */ + @JsonAnySetter + public DeleteFormData 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 DeleteFormData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteFormData deleteFormData = (DeleteFormData) o; + return Objects.equals(this.id, deleteFormData.id) + && Objects.equals(this.type, deleteFormData.type) + && Objects.equals(this.additionalProperties, deleteFormData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteFormData {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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/DeleteFormResponse.java b/src/main/java/com/datadog/api/client/v2/model/DeleteFormResponse.java new file mode 100644 index 00000000000..889bce44d6d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DeleteFormResponse.java @@ -0,0 +1,136 @@ +/* + * 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; + +/** A response returned after deleting a form. */ +@JsonPropertyOrder({DeleteFormResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DeleteFormResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private DeleteFormData data; + + public DeleteFormResponse data(DeleteFormData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data returned when a form is deleted. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DeleteFormData getData() { + return data; + } + + public void setData(DeleteFormData data) { + this.data = data; + } + + /** + * 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 DeleteFormResponse + */ + @JsonAnySetter + public DeleteFormResponse 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 DeleteFormResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteFormResponse deleteFormResponse = (DeleteFormResponse) o; + return Objects.equals(this.data, deleteFormResponse.data) + && Objects.equals(this.additionalProperties, deleteFormResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteFormResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).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/FormData.java b/src/main/java/com/datadog/api/client/v2/model/FormData.java new file mode 100644 index 00000000000..d46d416336b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FormData.java @@ -0,0 +1,210 @@ +/* + * 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; +import java.util.UUID; + +/** A form resource object. */ +@JsonPropertyOrder({ + FormData.JSON_PROPERTY_ATTRIBUTES, + FormData.JSON_PROPERTY_ID, + FormData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FormData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private FormDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FormType type; + + public FormData() {} + + @JsonCreator + public FormData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + FormDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FormType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public FormData attributes(FormDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a form. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FormDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(FormDataAttributes attributes) { + this.attributes = attributes; + } + + public FormData id(UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the form. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public FormData type(FormType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The resource type for a form. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FormType getType() { + return type; + } + + public void setType(FormType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * 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 FormData + */ + @JsonAnySetter + public FormData 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 FormData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormData formData = (FormData) o; + return Objects.equals(this.attributes, formData.attributes) + && Objects.equals(this.id, formData.id) + && Objects.equals(this.type, formData.type) + && Objects.equals(this.additionalProperties, formData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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/FormDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/FormDataAttributes.java new file mode 100644 index 00000000000..5dfad5a181b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FormDataAttributes.java @@ -0,0 +1,636 @@ +/* + * 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.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The attributes of a form. */ +@JsonPropertyOrder({ + FormDataAttributes.JSON_PROPERTY_ACTIVE, + FormDataAttributes.JSON_PROPERTY_ANONYMOUS, + FormDataAttributes.JSON_PROPERTY_CREATED_AT, + FormDataAttributes.JSON_PROPERTY_DATASTORE_CONFIG, + FormDataAttributes.JSON_PROPERTY_DESCRIPTION, + FormDataAttributes.JSON_PROPERTY_END_DATE, + FormDataAttributes.JSON_PROPERTY_HAS_SUBMITTED, + FormDataAttributes.JSON_PROPERTY_IDP_SURVEY, + FormDataAttributes.JSON_PROPERTY_MODIFIED_AT, + FormDataAttributes.JSON_PROPERTY_NAME, + FormDataAttributes.JSON_PROPERTY_ORG_ID, + FormDataAttributes.JSON_PROPERTY_PUBLICATION, + FormDataAttributes.JSON_PROPERTY_SELF_SERVICE, + FormDataAttributes.JSON_PROPERTY_SINGLE_RESPONSE, + FormDataAttributes.JSON_PROPERTY_USER_ID, + FormDataAttributes.JSON_PROPERTY_USER_UUID, + FormDataAttributes.JSON_PROPERTY_VERSION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FormDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACTIVE = "active"; + private Boolean active; + + public static final String JSON_PROPERTY_ANONYMOUS = "anonymous"; + private Boolean anonymous; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_DATASTORE_CONFIG = "datastore_config"; + private FormDatastoreConfigAttributes datastoreConfig; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_END_DATE = "end_date"; + private JsonNullable endDate = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_HAS_SUBMITTED = "has_submitted"; + private JsonNullable hasSubmitted = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_IDP_SURVEY = "idp_survey"; + private Boolean idpSurvey; + + public static final String JSON_PROPERTY_MODIFIED_AT = "modified_at"; + private OffsetDateTime modifiedAt; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_ORG_ID = "org_id"; + private Long orgId; + + public static final String JSON_PROPERTY_PUBLICATION = "publication"; + private FormPublicationAttributes publication; + + public static final String JSON_PROPERTY_SELF_SERVICE = "self_service"; + private Boolean selfService; + + public static final String JSON_PROPERTY_SINGLE_RESPONSE = "single_response"; + private Boolean singleResponse; + + public static final String JSON_PROPERTY_USER_ID = "user_id"; + private Long userId; + + public static final String JSON_PROPERTY_USER_UUID = "user_uuid"; + private UUID userUuid; + + public static final String JSON_PROPERTY_VERSION = "version"; + private FormVersionAttributes version; + + public FormDataAttributes() {} + + @JsonCreator + public FormDataAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ACTIVE) Boolean active, + @JsonProperty(required = true, value = JSON_PROPERTY_ANONYMOUS) Boolean anonymous, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_DATASTORE_CONFIG) + FormDatastoreConfigAttributes datastoreConfig, + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_IDP_SURVEY) Boolean idpSurvey, + @JsonProperty(required = true, value = JSON_PROPERTY_MODIFIED_AT) OffsetDateTime modifiedAt, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_ORG_ID) Long orgId, + @JsonProperty(required = true, value = JSON_PROPERTY_SELF_SERVICE) Boolean selfService, + @JsonProperty(required = true, value = JSON_PROPERTY_SINGLE_RESPONSE) Boolean singleResponse, + @JsonProperty(required = true, value = JSON_PROPERTY_USER_ID) Long userId, + @JsonProperty(required = true, value = JSON_PROPERTY_USER_UUID) UUID userUuid) { + this.active = active; + this.anonymous = anonymous; + this.createdAt = createdAt; + this.datastoreConfig = datastoreConfig; + this.unparsed |= datastoreConfig.unparsed; + this.description = description; + this.idpSurvey = idpSurvey; + this.modifiedAt = modifiedAt; + this.name = name; + this.orgId = orgId; + this.selfService = selfService; + this.singleResponse = singleResponse; + this.userId = userId; + this.userUuid = userUuid; + } + + public FormDataAttributes active(Boolean active) { + this.active = active; + return this; + } + + /** + * Whether the form is currently active. + * + * @return active + */ + @JsonProperty(JSON_PROPERTY_ACTIVE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + public FormDataAttributes anonymous(Boolean anonymous) { + this.anonymous = anonymous; + return this; + } + + /** + * Whether the form accepts anonymous submissions. + * + * @return anonymous + */ + @JsonProperty(JSON_PROPERTY_ANONYMOUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getAnonymous() { + return anonymous; + } + + public void setAnonymous(Boolean anonymous) { + this.anonymous = anonymous; + } + + public FormDataAttributes createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The time at which the form was created. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public FormDataAttributes datastoreConfig(FormDatastoreConfigAttributes datastoreConfig) { + this.datastoreConfig = datastoreConfig; + this.unparsed |= datastoreConfig.unparsed; + return this; + } + + /** + * The datastore configuration for a form. + * + * @return datastoreConfig + */ + @JsonProperty(JSON_PROPERTY_DATASTORE_CONFIG) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FormDatastoreConfigAttributes getDatastoreConfig() { + return datastoreConfig; + } + + public void setDatastoreConfig(FormDatastoreConfigAttributes datastoreConfig) { + this.datastoreConfig = datastoreConfig; + } + + public FormDataAttributes description(String description) { + this.description = description; + return this; + } + + /** + * The description of the form. + * + * @return description + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public FormDataAttributes endDate(OffsetDateTime endDate) { + this.endDate = JsonNullable.of(endDate); + return this; + } + + /** + * The date and time at which the form stops accepting responses. + * + * @return endDate + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getEndDate() { + return endDate.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_END_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getEndDate_JsonNullable() { + return endDate; + } + + @JsonProperty(JSON_PROPERTY_END_DATE) + public void setEndDate_JsonNullable(JsonNullable endDate) { + this.endDate = endDate; + } + + public void setEndDate(OffsetDateTime endDate) { + this.endDate = JsonNullable.of(endDate); + } + + public FormDataAttributes hasSubmitted(Boolean hasSubmitted) { + this.hasSubmitted = JsonNullable.of(hasSubmitted); + return this; + } + + /** + * Whether the current user has already submitted this form. Only present for forms with + * single_response set to true. + * + * @return hasSubmitted + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Boolean getHasSubmitted() { + return hasSubmitted.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_HAS_SUBMITTED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getHasSubmitted_JsonNullable() { + return hasSubmitted; + } + + @JsonProperty(JSON_PROPERTY_HAS_SUBMITTED) + public void setHasSubmitted_JsonNullable(JsonNullable hasSubmitted) { + this.hasSubmitted = hasSubmitted; + } + + public void setHasSubmitted(Boolean hasSubmitted) { + this.hasSubmitted = JsonNullable.of(hasSubmitted); + } + + public FormDataAttributes idpSurvey(Boolean idpSurvey) { + this.idpSurvey = idpSurvey; + return this; + } + + /** + * Whether the form is an IDP survey. + * + * @return idpSurvey + */ + @JsonProperty(JSON_PROPERTY_IDP_SURVEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIdpSurvey() { + return idpSurvey; + } + + public void setIdpSurvey(Boolean idpSurvey) { + this.idpSurvey = idpSurvey; + } + + public FormDataAttributes modifiedAt(OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + return this; + } + + /** + * The time at which the form was last modified. + * + * @return modifiedAt + */ + @JsonProperty(JSON_PROPERTY_MODIFIED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + } + + public FormDataAttributes name(String name) { + this.name = name; + return this; + } + + /** + * The name of the form. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public FormDataAttributes orgId(Long orgId) { + this.orgId = orgId; + return this; + } + + /** + * The ID of the organization that owns this form. + * + * @return orgId + */ + @JsonProperty(JSON_PROPERTY_ORG_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getOrgId() { + return orgId; + } + + public void setOrgId(Long orgId) { + this.orgId = orgId; + } + + public FormDataAttributes publication(FormPublicationAttributes publication) { + this.publication = publication; + this.unparsed |= publication.unparsed; + return this; + } + + /** + * The attributes of a form publication. + * + * @return publication + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PUBLICATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FormPublicationAttributes getPublication() { + return publication; + } + + public void setPublication(FormPublicationAttributes publication) { + this.publication = publication; + } + + public FormDataAttributes selfService(Boolean selfService) { + this.selfService = selfService; + return this; + } + + /** + * Whether the form is available in the self-service catalog. + * + * @return selfService + */ + @JsonProperty(JSON_PROPERTY_SELF_SERVICE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getSelfService() { + return selfService; + } + + public void setSelfService(Boolean selfService) { + this.selfService = selfService; + } + + public FormDataAttributes singleResponse(Boolean singleResponse) { + this.singleResponse = singleResponse; + return this; + } + + /** + * Whether each user can only submit one response. + * + * @return singleResponse + */ + @JsonProperty(JSON_PROPERTY_SINGLE_RESPONSE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getSingleResponse() { + return singleResponse; + } + + public void setSingleResponse(Boolean singleResponse) { + this.singleResponse = singleResponse; + } + + public FormDataAttributes userId(Long userId) { + this.userId = userId; + return this; + } + + /** + * The ID of the user who created this form. + * + * @return userId + */ + @JsonProperty(JSON_PROPERTY_USER_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public FormDataAttributes userUuid(UUID userUuid) { + this.userUuid = userUuid; + return this; + } + + /** + * The UUID of the user who created this form. + * + * @return userUuid + */ + @JsonProperty(JSON_PROPERTY_USER_UUID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getUserUuid() { + return userUuid; + } + + public void setUserUuid(UUID userUuid) { + this.userUuid = userUuid; + } + + public FormDataAttributes version(FormVersionAttributes version) { + this.version = version; + this.unparsed |= version.unparsed; + return this; + } + + /** + * The attributes of a form version. + * + * @return version + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FormVersionAttributes getVersion() { + return version; + } + + public void setVersion(FormVersionAttributes version) { + this.version = version; + } + + /** + * 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 FormDataAttributes + */ + @JsonAnySetter + public FormDataAttributes 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 FormDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormDataAttributes formDataAttributes = (FormDataAttributes) o; + return Objects.equals(this.active, formDataAttributes.active) + && Objects.equals(this.anonymous, formDataAttributes.anonymous) + && Objects.equals(this.createdAt, formDataAttributes.createdAt) + && Objects.equals(this.datastoreConfig, formDataAttributes.datastoreConfig) + && Objects.equals(this.description, formDataAttributes.description) + && Objects.equals(this.endDate, formDataAttributes.endDate) + && Objects.equals(this.hasSubmitted, formDataAttributes.hasSubmitted) + && Objects.equals(this.idpSurvey, formDataAttributes.idpSurvey) + && Objects.equals(this.modifiedAt, formDataAttributes.modifiedAt) + && Objects.equals(this.name, formDataAttributes.name) + && Objects.equals(this.orgId, formDataAttributes.orgId) + && Objects.equals(this.publication, formDataAttributes.publication) + && Objects.equals(this.selfService, formDataAttributes.selfService) + && Objects.equals(this.singleResponse, formDataAttributes.singleResponse) + && Objects.equals(this.userId, formDataAttributes.userId) + && Objects.equals(this.userUuid, formDataAttributes.userUuid) + && Objects.equals(this.version, formDataAttributes.version) + && Objects.equals(this.additionalProperties, formDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + active, + anonymous, + createdAt, + datastoreConfig, + description, + endDate, + hasSubmitted, + idpSurvey, + modifiedAt, + name, + orgId, + publication, + selfService, + singleResponse, + userId, + userUuid, + version, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormDataAttributes {\n"); + sb.append(" active: ").append(toIndentedString(active)).append("\n"); + sb.append(" anonymous: ").append(toIndentedString(anonymous)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" datastoreConfig: ").append(toIndentedString(datastoreConfig)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" endDate: ").append(toIndentedString(endDate)).append("\n"); + sb.append(" hasSubmitted: ").append(toIndentedString(hasSubmitted)).append("\n"); + sb.append(" idpSurvey: ").append(toIndentedString(idpSurvey)).append("\n"); + sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" orgId: ").append(toIndentedString(orgId)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append(" selfService: ").append(toIndentedString(selfService)).append("\n"); + sb.append(" singleResponse: ").append(toIndentedString(singleResponse)).append("\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" userUuid: ").append(toIndentedString(userUuid)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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/FormDatastoreConfigAttributes.java b/src/main/java/com/datadog/api/client/v2/model/FormDatastoreConfigAttributes.java new file mode 100644 index 00000000000..081e58b163f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FormDatastoreConfigAttributes.java @@ -0,0 +1,212 @@ +/* + * 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; +import java.util.UUID; + +/** The datastore configuration for a form. */ +@JsonPropertyOrder({ + FormDatastoreConfigAttributes.JSON_PROPERTY_DATASTORE_ID, + FormDatastoreConfigAttributes.JSON_PROPERTY_PRIMARY_COLUMN_NAME, + FormDatastoreConfigAttributes.JSON_PROPERTY_PRIMARY_KEY_GENERATION_STRATEGY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FormDatastoreConfigAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATASTORE_ID = "datastore_id"; + private UUID datastoreId; + + public static final String JSON_PROPERTY_PRIMARY_COLUMN_NAME = "primary_column_name"; + private String primaryColumnName; + + public static final String JSON_PROPERTY_PRIMARY_KEY_GENERATION_STRATEGY = + "primary_key_generation_strategy"; + private String primaryKeyGenerationStrategy; + + public FormDatastoreConfigAttributes() {} + + @JsonCreator + public FormDatastoreConfigAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_DATASTORE_ID) UUID datastoreId, + @JsonProperty(required = true, value = JSON_PROPERTY_PRIMARY_COLUMN_NAME) + String primaryColumnName, + @JsonProperty(required = true, value = JSON_PROPERTY_PRIMARY_KEY_GENERATION_STRATEGY) + String primaryKeyGenerationStrategy) { + this.datastoreId = datastoreId; + this.primaryColumnName = primaryColumnName; + this.primaryKeyGenerationStrategy = primaryKeyGenerationStrategy; + } + + public FormDatastoreConfigAttributes datastoreId(UUID datastoreId) { + this.datastoreId = datastoreId; + return this; + } + + /** + * The ID of the datastore. + * + * @return datastoreId + */ + @JsonProperty(JSON_PROPERTY_DATASTORE_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getDatastoreId() { + return datastoreId; + } + + public void setDatastoreId(UUID datastoreId) { + this.datastoreId = datastoreId; + } + + public FormDatastoreConfigAttributes primaryColumnName(String primaryColumnName) { + this.primaryColumnName = primaryColumnName; + return this; + } + + /** + * The name of the primary column in the datastore. + * + * @return primaryColumnName + */ + @JsonProperty(JSON_PROPERTY_PRIMARY_COLUMN_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPrimaryColumnName() { + return primaryColumnName; + } + + public void setPrimaryColumnName(String primaryColumnName) { + this.primaryColumnName = primaryColumnName; + } + + public FormDatastoreConfigAttributes primaryKeyGenerationStrategy( + String primaryKeyGenerationStrategy) { + this.primaryKeyGenerationStrategy = primaryKeyGenerationStrategy; + return this; + } + + /** + * The strategy used to generate primary keys in the datastore. + * + * @return primaryKeyGenerationStrategy + */ + @JsonProperty(JSON_PROPERTY_PRIMARY_KEY_GENERATION_STRATEGY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPrimaryKeyGenerationStrategy() { + return primaryKeyGenerationStrategy; + } + + public void setPrimaryKeyGenerationStrategy(String primaryKeyGenerationStrategy) { + this.primaryKeyGenerationStrategy = primaryKeyGenerationStrategy; + } + + /** + * 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 FormDatastoreConfigAttributes + */ + @JsonAnySetter + public FormDatastoreConfigAttributes 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 FormDatastoreConfigAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormDatastoreConfigAttributes formDatastoreConfigAttributes = (FormDatastoreConfigAttributes) o; + return Objects.equals(this.datastoreId, formDatastoreConfigAttributes.datastoreId) + && Objects.equals(this.primaryColumnName, formDatastoreConfigAttributes.primaryColumnName) + && Objects.equals( + this.primaryKeyGenerationStrategy, + formDatastoreConfigAttributes.primaryKeyGenerationStrategy) + && Objects.equals( + this.additionalProperties, formDatastoreConfigAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + datastoreId, primaryColumnName, primaryKeyGenerationStrategy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormDatastoreConfigAttributes {\n"); + sb.append(" datastoreId: ").append(toIndentedString(datastoreId)).append("\n"); + sb.append(" primaryColumnName: ").append(toIndentedString(primaryColumnName)).append("\n"); + sb.append(" primaryKeyGenerationStrategy: ") + .append(toIndentedString(primaryKeyGenerationStrategy)) + .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/FormPublicationAttributes.java b/src/main/java/com/datadog/api/client/v2/model/FormPublicationAttributes.java new file mode 100644 index 00000000000..eaebc848ef1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FormPublicationAttributes.java @@ -0,0 +1,381 @@ +/* + * 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.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** The attributes of a form publication. */ +@JsonPropertyOrder({ + FormPublicationAttributes.JSON_PROPERTY_CREATED_AT, + FormPublicationAttributes.JSON_PROPERTY_FORM_ID, + FormPublicationAttributes.JSON_PROPERTY_FORM_VERSION, + FormPublicationAttributes.JSON_PROPERTY_ID, + FormPublicationAttributes.JSON_PROPERTY_MODIFIED_AT, + FormPublicationAttributes.JSON_PROPERTY_ORG_ID, + FormPublicationAttributes.JSON_PROPERTY_PUBLISH_SEQ, + FormPublicationAttributes.JSON_PROPERTY_USER_ID, + FormPublicationAttributes.JSON_PROPERTY_USER_UUID +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FormPublicationAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_FORM_ID = "form_id"; + private UUID formId; + + public static final String JSON_PROPERTY_FORM_VERSION = "form_version"; + private Long formVersion; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_MODIFIED_AT = "modified_at"; + private OffsetDateTime modifiedAt; + + public static final String JSON_PROPERTY_ORG_ID = "org_id"; + private Long orgId; + + public static final String JSON_PROPERTY_PUBLISH_SEQ = "publish_seq"; + private Long publishSeq; + + public static final String JSON_PROPERTY_USER_ID = "user_id"; + private Long userId; + + public static final String JSON_PROPERTY_USER_UUID = "user_uuid"; + private UUID userUuid; + + public FormPublicationAttributes() {} + + @JsonCreator + public FormPublicationAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_FORM_ID) UUID formId, + @JsonProperty(required = true, value = JSON_PROPERTY_FORM_VERSION) Long formVersion, + @JsonProperty(required = true, value = JSON_PROPERTY_MODIFIED_AT) OffsetDateTime modifiedAt, + @JsonProperty(required = true, value = JSON_PROPERTY_ORG_ID) Long orgId, + @JsonProperty(required = true, value = JSON_PROPERTY_PUBLISH_SEQ) Long publishSeq, + @JsonProperty(required = true, value = JSON_PROPERTY_USER_ID) Long userId, + @JsonProperty(required = true, value = JSON_PROPERTY_USER_UUID) UUID userUuid) { + this.createdAt = createdAt; + this.formId = formId; + this.formVersion = formVersion; + this.modifiedAt = modifiedAt; + this.orgId = orgId; + this.publishSeq = publishSeq; + this.userId = userId; + this.userUuid = userUuid; + } + + public FormPublicationAttributes createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The time at which the publication was created. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public FormPublicationAttributes formId(UUID formId) { + this.formId = formId; + return this; + } + + /** + * The ID of the form. + * + * @return formId + */ + @JsonProperty(JSON_PROPERTY_FORM_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getFormId() { + return formId; + } + + public void setFormId(UUID formId) { + this.formId = formId; + } + + public FormPublicationAttributes formVersion(Long formVersion) { + this.formVersion = formVersion; + return this; + } + + /** + * The version number that was published. + * + * @return formVersion + */ + @JsonProperty(JSON_PROPERTY_FORM_VERSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getFormVersion() { + return formVersion; + } + + public void setFormVersion(Long formVersion) { + this.formVersion = formVersion; + } + + public FormPublicationAttributes id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the form publication. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public FormPublicationAttributes modifiedAt(OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + return this; + } + + /** + * The time at which the publication was last modified. + * + * @return modifiedAt + */ + @JsonProperty(JSON_PROPERTY_MODIFIED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + } + + public FormPublicationAttributes orgId(Long orgId) { + this.orgId = orgId; + return this; + } + + /** + * The ID of the organization that owns this publication. + * + * @return orgId + */ + @JsonProperty(JSON_PROPERTY_ORG_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getOrgId() { + return orgId; + } + + public void setOrgId(Long orgId) { + this.orgId = orgId; + } + + public FormPublicationAttributes publishSeq(Long publishSeq) { + this.publishSeq = publishSeq; + return this; + } + + /** + * The sequential publication number for this form. + * + * @return publishSeq + */ + @JsonProperty(JSON_PROPERTY_PUBLISH_SEQ) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getPublishSeq() { + return publishSeq; + } + + public void setPublishSeq(Long publishSeq) { + this.publishSeq = publishSeq; + } + + public FormPublicationAttributes userId(Long userId) { + this.userId = userId; + return this; + } + + /** + * The ID of the user who created this publication. + * + * @return userId + */ + @JsonProperty(JSON_PROPERTY_USER_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public FormPublicationAttributes userUuid(UUID userUuid) { + this.userUuid = userUuid; + return this; + } + + /** + * The UUID of the user who created this publication. + * + * @return userUuid + */ + @JsonProperty(JSON_PROPERTY_USER_UUID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getUserUuid() { + return userUuid; + } + + public void setUserUuid(UUID userUuid) { + this.userUuid = userUuid; + } + + /** + * 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 FormPublicationAttributes + */ + @JsonAnySetter + public FormPublicationAttributes 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 FormPublicationAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormPublicationAttributes formPublicationAttributes = (FormPublicationAttributes) o; + return Objects.equals(this.createdAt, formPublicationAttributes.createdAt) + && Objects.equals(this.formId, formPublicationAttributes.formId) + && Objects.equals(this.formVersion, formPublicationAttributes.formVersion) + && Objects.equals(this.id, formPublicationAttributes.id) + && Objects.equals(this.modifiedAt, formPublicationAttributes.modifiedAt) + && Objects.equals(this.orgId, formPublicationAttributes.orgId) + && Objects.equals(this.publishSeq, formPublicationAttributes.publishSeq) + && Objects.equals(this.userId, formPublicationAttributes.userId) + && Objects.equals(this.userUuid, formPublicationAttributes.userUuid) + && Objects.equals( + this.additionalProperties, formPublicationAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + formId, + formVersion, + id, + modifiedAt, + orgId, + publishSeq, + userId, + userUuid, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormPublicationAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" formId: ").append(toIndentedString(formId)).append("\n"); + sb.append(" formVersion: ").append(toIndentedString(formVersion)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); + sb.append(" orgId: ").append(toIndentedString(orgId)).append("\n"); + sb.append(" publishSeq: ").append(toIndentedString(publishSeq)).append("\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" userUuid: ").append(toIndentedString(userUuid)).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/FormResponse.java b/src/main/java/com/datadog/api/client/v2/model/FormResponse.java new file mode 100644 index 00000000000..f43beeeba5f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FormResponse.java @@ -0,0 +1,144 @@ +/* + * 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 response containing a single form. */ +@JsonPropertyOrder({FormResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FormResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private FormData data; + + public FormResponse() {} + + @JsonCreator + public FormResponse(@JsonProperty(required = true, value = JSON_PROPERTY_DATA) FormData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public FormResponse data(FormData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A form resource object. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FormData getData() { + return data; + } + + public void setData(FormData data) { + this.data = data; + } + + /** + * 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 FormResponse + */ + @JsonAnySetter + public FormResponse 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 FormResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormResponse formResponse = (FormResponse) o; + return Objects.equals(this.data, formResponse.data) + && Objects.equals(this.additionalProperties, formResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).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/FormType.java b/src/main/java/com/datadog/api/client/v2/model/FormType.java new file mode 100644 index 00000000000..d2b02269dee --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FormType.java @@ -0,0 +1,53 @@ +/* + * 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 resource type for a form. */ +@JsonSerialize(using = FormType.FormTypeSerializer.class) +public class FormType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("forms")); + + public static final FormType FORMS = new FormType("forms"); + + FormType(String value) { + super(value, allowedValues); + } + + public static class FormTypeSerializer extends StdSerializer { + public FormTypeSerializer(Class t) { + super(t); + } + + public FormTypeSerializer() { + this(null); + } + + @Override + public void serialize(FormType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FormType fromValue(String value) { + return new FormType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FormVersionAttributes.java b/src/main/java/com/datadog/api/client/v2/model/FormVersionAttributes.java new file mode 100644 index 00000000000..c79f1c6bcac --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FormVersionAttributes.java @@ -0,0 +1,461 @@ +/* + * 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.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** The attributes of a form version. */ +@JsonPropertyOrder({ + FormVersionAttributes.JSON_PROPERTY_CREATED_AT, + FormVersionAttributes.JSON_PROPERTY_DATA_DEFINITION, + FormVersionAttributes.JSON_PROPERTY_DEFINITION_SIGNATURE, + FormVersionAttributes.JSON_PROPERTY_ETAG, + FormVersionAttributes.JSON_PROPERTY_ID, + FormVersionAttributes.JSON_PROPERTY_MODIFIED_AT, + FormVersionAttributes.JSON_PROPERTY_STATE, + FormVersionAttributes.JSON_PROPERTY_UI_DEFINITION, + FormVersionAttributes.JSON_PROPERTY_USER_ID, + FormVersionAttributes.JSON_PROPERTY_USER_UUID, + FormVersionAttributes.JSON_PROPERTY_VERSION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FormVersionAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_DATA_DEFINITION = "data_definition"; + private Map dataDefinition = new HashMap(); + + public static final String JSON_PROPERTY_DEFINITION_SIGNATURE = "definition_signature"; + private String definitionSignature; + + public static final String JSON_PROPERTY_ETAG = "etag"; + private String etag; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_MODIFIED_AT = "modified_at"; + private OffsetDateTime modifiedAt; + + public static final String JSON_PROPERTY_STATE = "state"; + private FormVersionState state; + + public static final String JSON_PROPERTY_UI_DEFINITION = "ui_definition"; + private Map uiDefinition = new HashMap(); + + public static final String JSON_PROPERTY_USER_ID = "user_id"; + private Long userId; + + public static final String JSON_PROPERTY_USER_UUID = "user_uuid"; + private UUID userUuid; + + public static final String JSON_PROPERTY_VERSION = "version"; + private Long version; + + public FormVersionAttributes() {} + + @JsonCreator + public FormVersionAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_DATA_DEFINITION) + Map dataDefinition, + @JsonProperty(required = true, value = JSON_PROPERTY_DEFINITION_SIGNATURE) + String definitionSignature, + @JsonProperty(required = true, value = JSON_PROPERTY_ETAG) String etag, + @JsonProperty(required = true, value = JSON_PROPERTY_MODIFIED_AT) OffsetDateTime modifiedAt, + @JsonProperty(required = true, value = JSON_PROPERTY_STATE) FormVersionState state, + @JsonProperty(required = true, value = JSON_PROPERTY_UI_DEFINITION) + Map uiDefinition, + @JsonProperty(required = true, value = JSON_PROPERTY_USER_ID) Long userId, + @JsonProperty(required = true, value = JSON_PROPERTY_USER_UUID) UUID userUuid, + @JsonProperty(required = true, value = JSON_PROPERTY_VERSION) Long version) { + this.createdAt = createdAt; + this.dataDefinition = dataDefinition; + this.definitionSignature = definitionSignature; + this.etag = etag; + if (etag != null) {} + this.modifiedAt = modifiedAt; + this.state = state; + this.unparsed |= !state.isValid(); + this.uiDefinition = uiDefinition; + this.userId = userId; + this.userUuid = userUuid; + this.version = version; + } + + public FormVersionAttributes createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The time at which the version was created. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public FormVersionAttributes dataDefinition(Map dataDefinition) { + this.dataDefinition = dataDefinition; + return this; + } + + public FormVersionAttributes putDataDefinitionItem(String key, Object dataDefinitionItem) { + this.dataDefinition.put(key, dataDefinitionItem); + return this; + } + + /** + * The data definition for this version. + * + * @return dataDefinition + */ + @JsonProperty(JSON_PROPERTY_DATA_DEFINITION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Map getDataDefinition() { + return dataDefinition; + } + + public void setDataDefinition(Map dataDefinition) { + this.dataDefinition = dataDefinition; + } + + public FormVersionAttributes definitionSignature(String definitionSignature) { + this.definitionSignature = definitionSignature; + return this; + } + + /** + * The signature of the version definition. + * + * @return definitionSignature + */ + @JsonProperty(JSON_PROPERTY_DEFINITION_SIGNATURE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDefinitionSignature() { + return definitionSignature; + } + + public void setDefinitionSignature(String definitionSignature) { + this.definitionSignature = definitionSignature; + } + + public FormVersionAttributes etag(String etag) { + this.etag = etag; + if (etag != null) {} + return this; + } + + /** + * The ETag for optimistic concurrency control. + * + * @return etag + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ETAG) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getEtag() { + return etag; + } + + public void setEtag(String etag) { + this.etag = etag; + } + + public FormVersionAttributes id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the form version. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public FormVersionAttributes modifiedAt(OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + return this; + } + + /** + * The time at which the version was last modified. + * + * @return modifiedAt + */ + @JsonProperty(JSON_PROPERTY_MODIFIED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + } + + public FormVersionAttributes state(FormVersionState state) { + this.state = state; + this.unparsed |= !state.isValid(); + return this; + } + + /** + * The state of a form version. + * + * @return state + */ + @JsonProperty(JSON_PROPERTY_STATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FormVersionState getState() { + return state; + } + + public void setState(FormVersionState state) { + if (!state.isValid()) { + this.unparsed = true; + } + this.state = state; + } + + public FormVersionAttributes uiDefinition(Map uiDefinition) { + this.uiDefinition = uiDefinition; + return this; + } + + public FormVersionAttributes putUiDefinitionItem(String key, Object uiDefinitionItem) { + this.uiDefinition.put(key, uiDefinitionItem); + return this; + } + + /** + * The UI definition for this version. + * + * @return uiDefinition + */ + @JsonProperty(JSON_PROPERTY_UI_DEFINITION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Map getUiDefinition() { + return uiDefinition; + } + + public void setUiDefinition(Map uiDefinition) { + this.uiDefinition = uiDefinition; + } + + public FormVersionAttributes userId(Long userId) { + this.userId = userId; + return this; + } + + /** + * The ID of the user who created this version. + * + * @return userId + */ + @JsonProperty(JSON_PROPERTY_USER_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public FormVersionAttributes userUuid(UUID userUuid) { + this.userUuid = userUuid; + return this; + } + + /** + * The UUID of the user who created this version. + * + * @return userUuid + */ + @JsonProperty(JSON_PROPERTY_USER_UUID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getUserUuid() { + return userUuid; + } + + public void setUserUuid(UUID userUuid) { + this.userUuid = userUuid; + } + + public FormVersionAttributes version(Long version) { + this.version = version; + return this; + } + + /** + * The sequential version number. + * + * @return version + */ + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + + /** + * 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 FormVersionAttributes + */ + @JsonAnySetter + public FormVersionAttributes 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 FormVersionAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormVersionAttributes formVersionAttributes = (FormVersionAttributes) o; + return Objects.equals(this.createdAt, formVersionAttributes.createdAt) + && Objects.equals(this.dataDefinition, formVersionAttributes.dataDefinition) + && Objects.equals(this.definitionSignature, formVersionAttributes.definitionSignature) + && Objects.equals(this.etag, formVersionAttributes.etag) + && Objects.equals(this.id, formVersionAttributes.id) + && Objects.equals(this.modifiedAt, formVersionAttributes.modifiedAt) + && Objects.equals(this.state, formVersionAttributes.state) + && Objects.equals(this.uiDefinition, formVersionAttributes.uiDefinition) + && Objects.equals(this.userId, formVersionAttributes.userId) + && Objects.equals(this.userUuid, formVersionAttributes.userUuid) + && Objects.equals(this.version, formVersionAttributes.version) + && Objects.equals(this.additionalProperties, formVersionAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + dataDefinition, + definitionSignature, + etag, + id, + modifiedAt, + state, + uiDefinition, + userId, + userUuid, + version, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormVersionAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" dataDefinition: ").append(toIndentedString(dataDefinition)).append("\n"); + sb.append(" definitionSignature: ") + .append(toIndentedString(definitionSignature)) + .append("\n"); + sb.append(" etag: ").append(toIndentedString(etag)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" uiDefinition: ").append(toIndentedString(uiDefinition)).append("\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" userUuid: ").append(toIndentedString(userUuid)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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/FormVersionState.java b/src/main/java/com/datadog/api/client/v2/model/FormVersionState.java new file mode 100644 index 00000000000..201232f3259 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FormVersionState.java @@ -0,0 +1,55 @@ +/* + * 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 state of a form version. */ +@JsonSerialize(using = FormVersionState.FormVersionStateSerializer.class) +public class FormVersionState extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("draft", "frozen")); + + public static final FormVersionState DRAFT = new FormVersionState("draft"); + public static final FormVersionState FROZEN = new FormVersionState("frozen"); + + FormVersionState(String value) { + super(value, allowedValues); + } + + public static class FormVersionStateSerializer extends StdSerializer { + public FormVersionStateSerializer(Class t) { + super(t); + } + + public FormVersionStateSerializer() { + this(null); + } + + @Override + public void serialize(FormVersionState value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FormVersionState fromValue(String value) { + return new FormVersionState(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FormsResponse.java b/src/main/java/com/datadog/api/client/v2/model/FormsResponse.java new file mode 100644 index 00000000000..d3f49163bac --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FormsResponse.java @@ -0,0 +1,154 @@ +/* + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A response containing a list of forms. */ +@JsonPropertyOrder({FormsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FormsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public FormsResponse() {} + + @JsonCreator + public FormsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + } + + public FormsResponse data(List data) { + this.data = data; + for (FormData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public FormsResponse addDataItem(FormData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * A list of form resource objects. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * 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 FormsResponse + */ + @JsonAnySetter + public FormsResponse 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 FormsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormsResponse formsResponse = (FormsResponse) o; + return Objects.equals(this.data, formsResponse.data) + && Objects.equals(this.additionalProperties, formsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).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/cassettes/features/v2/Create_a_form_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_form_returns_OK_response.freeze new file mode 100644 index 00000000000..094857b451b --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_form_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-06-04T18:34:02.931Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_form_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_form_returns_OK_response.json new file mode 100644 index 00000000000..c9aa226af3e --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_form_returns_OK_response.json @@ -0,0 +1,58 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"anonymous\":false,\"data_definition\":{},\"description\":\"A form to collect user feedback.\",\"idp_survey\":false,\"name\":\"User Feedback Form\",\"single_response\":false,\"ui_definition\":{}},\"type\":\"forms\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/forms", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"edb7d6d5-e21c-4fd0-845d-679317b5c2c9\",\"type\":\"forms\",\"attributes\":{\"active\":true,\"anonymous\":false,\"created_at\":\"2026-06-04T18:34:04.103183Z\",\"datastore_config\":{\"datastore_id\":\"7cc8dadd-3529-4d0f-b8cb-f8c11c165867\",\"primary_column_name\":\"id\",\"primary_key_generation_strategy\":\"none\"},\"description\":\"A form to collect user feedback.\",\"idp_survey\":false,\"modified_at\":\"2026-06-04T18:34:04.103183Z\",\"name\":\"User Feedback Form\",\"org_id\":321813,\"self_service\":false,\"single_response\":false,\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"version\":{\"id\":\"354653\",\"state\":\"draft\",\"version\":1,\"etag\":\"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d\",\"definition_signature\":\"{\\\"signature\\\":\\\"{\\\\\\\"version\\\\\\\":2,\\\\\\\"algorithm\\\\\\\":\\\\\\\"ecdsa-p384\\\\\\\",\\\\\\\"pubkey\\\\\\\":\\\\\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\\\\\",\\\\\\\"timestamp\\\\\\\":1780598044,\\\\\\\"proof\\\\\\\":\\\\\\\"MGQCMHsaS9oy6ZDzhUZuJQAYiivxgo9XKx5NjTW/0wafPecXBQ3lr27bKejXr4ihAuwxsgIwPfgedZacZ4t3Qg8p0+jrXH5MBdZx9hrat8mijVibYuLUd2n+bxaY0xcghHKwbtu4\\\\\\\"}\\\",\\\"version\\\":1}\",\"data_definition\":{},\"ui_definition\":{},\"created_at\":\"2026-06-04T18:34:04.103183Z\",\"modified_at\":\"2026-06-04T18:34:04.103183Z\",\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c7b9653a-f05b-6a5e-f658-7992c466b12a" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/forms/edb7d6d5-e21c-4fd0-845d-679317b5c2c9", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"edb7d6d5-e21c-4fd0-845d-679317b5c2c9\",\"type\":\"forms\"}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "dd1cc462-5a8e-953b-c117-9686481feb95" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_and_publish_a_form_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_and_publish_a_form_returns_OK_response.freeze new file mode 100644 index 00000000000..0add2d175dc --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_and_publish_a_form_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-06-04T18:34:04.703Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_and_publish_a_form_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_and_publish_a_form_returns_OK_response.json new file mode 100644 index 00000000000..ee9a8f5aa73 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_and_publish_a_form_returns_OK_response.json @@ -0,0 +1,58 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"anonymous\":false,\"data_definition\":{},\"description\":\"A form to collect user feedback.\",\"idp_survey\":false,\"name\":\"User Feedback Form\",\"single_response\":false,\"ui_definition\":{}},\"type\":\"forms\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/forms/create_and_publish", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"65318f43-ac0f-4990-add8-9847eee98fd8\",\"type\":\"forms\",\"attributes\":{\"active\":true,\"anonymous\":false,\"created_at\":\"2026-06-04T18:34:05.178222Z\",\"datastore_config\":{\"datastore_id\":\"c89fc16a-53fb-4439-a007-1ebec095b1b7\",\"primary_column_name\":\"id\",\"primary_key_generation_strategy\":\"none\"},\"description\":\"A form to collect user feedback.\",\"idp_survey\":false,\"modified_at\":\"2026-06-04T18:34:05.178222Z\",\"name\":\"User Feedback Form\",\"org_id\":321813,\"publication\":{\"id\":\"357922\",\"org_id\":321813,\"form_id\":\"65318f43-ac0f-4990-add8-9847eee98fd8\",\"publish_seq\":1,\"form_version\":1,\"created_at\":\"2026-06-04T18:34:05.178222Z\",\"modified_at\":\"2026-06-04T18:34:05.178222Z\",\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"},\"self_service\":false,\"single_response\":false,\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"version\":{\"id\":\"354654\",\"state\":\"frozen\",\"version\":1,\"etag\":\"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d\",\"definition_signature\":\"{\\\"signature\\\":\\\"{\\\\\\\"version\\\\\\\":2,\\\\\\\"algorithm\\\\\\\":\\\\\\\"ecdsa-p384\\\\\\\",\\\\\\\"pubkey\\\\\\\":\\\\\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\\\\\",\\\\\\\"timestamp\\\\\\\":1780598045,\\\\\\\"proof\\\\\\\":\\\\\\\"MGYCMQCPPczYtNvj1RLjrQkIrQNHHVgB3nxFIjn5jgwUE0tweuTV1kZnaYYUg+gl1Eh5+tMCMQCajq1cy1MaWEbzHA0EcDC6LjyQ5ajqqngb3RMQwzP8ewvsh+uzkPD2v6AHjnW115o=\\\\\\\"}\\\",\\\"version\\\":1}\",\"data_definition\":{},\"ui_definition\":{},\"created_at\":\"2026-06-04T18:34:05.178222Z\",\"modified_at\":\"2026-06-04T18:34:05.178222Z\",\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "7e286d1b-6d68-4a13-2ce3-8d507aceb865" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/forms/65318f43-ac0f-4990-add8-9847eee98fd8", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"65318f43-ac0f-4990-add8-9847eee98fd8\",\"type\":\"forms\"}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "63619055-3e4d-34f5-f014-3ac3ec30e651" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_form_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Delete_a_form_returns_OK_response.freeze new file mode 100644 index 00000000000..602659c5aad --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_a_form_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-06-04T18:34:05.786Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_form_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Delete_a_form_returns_OK_response.json new file mode 100644 index 00000000000..5454c88a60f --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_a_form_returns_OK_response.json @@ -0,0 +1,84 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"anonymous\":false,\"data_definition\":{},\"description\":\"A simple test form.\",\"idp_survey\":false,\"name\":\"Test-Delete_a_form_returns_OK_response-1780598045\",\"single_response\":false,\"ui_definition\":{}},\"type\":\"forms\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/forms", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"257a9d32-6ed0-429b-9745-75366363caf3\",\"type\":\"forms\",\"attributes\":{\"active\":true,\"anonymous\":false,\"created_at\":\"2026-06-04T18:34:06.128238Z\",\"datastore_config\":{\"datastore_id\":\"1e33b83f-0733-454e-9404-c032a479548e\",\"primary_column_name\":\"id\",\"primary_key_generation_strategy\":\"none\"},\"description\":\"A simple test form.\",\"idp_survey\":false,\"modified_at\":\"2026-06-04T18:34:06.128238Z\",\"name\":\"Test-Delete_a_form_returns_OK_response-1780598045\",\"org_id\":321813,\"self_service\":false,\"single_response\":false,\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"version\":{\"id\":\"354655\",\"state\":\"draft\",\"version\":1,\"etag\":\"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d\",\"definition_signature\":\"{\\\"signature\\\":\\\"{\\\\\\\"version\\\\\\\":2,\\\\\\\"algorithm\\\\\\\":\\\\\\\"ecdsa-p384\\\\\\\",\\\\\\\"pubkey\\\\\\\":\\\\\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\\\\\",\\\\\\\"timestamp\\\\\\\":1780598046,\\\\\\\"proof\\\\\\\":\\\\\\\"MGQCMDR3p4Wc6qLinT0JK9tT2I3NBvYMx43pPcUuCOyMapne99sS2RJe0woOU68I0GbQvwIwQMw7OQruNsIuTNJxK0zthVCFnXaxLASIvl2NsyomT9s/p2cgEzOY4T+XyRl6i27c\\\\\\\"}\\\",\\\"version\\\":1}\",\"data_definition\":{},\"ui_definition\":{},\"created_at\":\"2026-06-04T18:34:06.128238Z\",\"modified_at\":\"2026-06-04T18:34:06.128238Z\",\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "ab7636c2-f5ca-c908-802f-67d1277347c4" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/forms/257a9d32-6ed0-429b-9745-75366363caf3", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"257a9d32-6ed0-429b-9745-75366363caf3\",\"type\":\"forms\"}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "a3020ceb-8abf-f343-154d-92379a034bd8" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/forms/257a9d32-6ed0-429b-9745-75366363caf3", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "a3020ceb-8abf-f343-154d-92379a034bd9" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_form_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_form_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..9e0e0d98675 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_form_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2026-06-04T18:34:06.925Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_form_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Get_a_form_returns_Not_Found_response.json new file mode 100644 index 00000000000..e0fcc7d9ece --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_form_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/forms/00000000-0000-0000-0000-000000000001", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"404\",\"id\":\"bccf11bd-13c7-4911-9c00-58c00b6f8f52\",\"title\":\"form not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "fbaad038-e9e1-74cb-9fb5-595fa4e2c4fc" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_form_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_form_returns_OK_response.freeze new file mode 100644 index 00000000000..aea0ca127d2 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_form_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-06-04T18:34:07.294Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_form_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_a_form_returns_OK_response.json new file mode 100644 index 00000000000..55a66fb81d0 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_form_returns_OK_response.json @@ -0,0 +1,84 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"anonymous\":false,\"data_definition\":{},\"description\":\"A simple test form.\",\"idp_survey\":false,\"name\":\"Test-Get_a_form_returns_OK_response-1780598047\",\"single_response\":false,\"ui_definition\":{}},\"type\":\"forms\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/forms", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"b42493d4-fbd0-4139-b4b9-4815f414621d\",\"type\":\"forms\",\"attributes\":{\"active\":true,\"anonymous\":false,\"created_at\":\"2026-06-04T18:34:07.632566Z\",\"datastore_config\":{\"datastore_id\":\"9aace6ce-ee9d-4c81-b176-22bed53ff080\",\"primary_column_name\":\"id\",\"primary_key_generation_strategy\":\"none\"},\"description\":\"A simple test form.\",\"idp_survey\":false,\"modified_at\":\"2026-06-04T18:34:07.632566Z\",\"name\":\"Test-Get_a_form_returns_OK_response-1780598047\",\"org_id\":321813,\"self_service\":false,\"single_response\":false,\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"version\":{\"id\":\"354656\",\"state\":\"draft\",\"version\":1,\"etag\":\"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d\",\"definition_signature\":\"{\\\"signature\\\":\\\"{\\\\\\\"version\\\\\\\":2,\\\\\\\"algorithm\\\\\\\":\\\\\\\"ecdsa-p384\\\\\\\",\\\\\\\"pubkey\\\\\\\":\\\\\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\\\\\",\\\\\\\"timestamp\\\\\\\":1780598047,\\\\\\\"proof\\\\\\\":\\\\\\\"MGUCMQCkP+Usa2zK0v4SsSDBHsE4p88u025oyaRrAnNTiTXLwGr3K0W4/MAFeeosBwZonE0CMGYsqH/GAJUKeY0ZZGl8GZp2QeY1l3byimzWXRLf36CHhuB1Pshv/7bi0WoYYCOQIg==\\\\\\\"}\\\",\\\"version\\\":1}\",\"data_definition\":{},\"ui_definition\":{},\"created_at\":\"2026-06-04T18:34:07.632566Z\",\"modified_at\":\"2026-06-04T18:34:07.632566Z\",\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "31855e93-017d-b162-bfc7-3044f874a8de" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/forms/b42493d4-fbd0-4139-b4b9-4815f414621d", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"b42493d4-fbd0-4139-b4b9-4815f414621d\",\"type\":\"forms\",\"attributes\":{\"active\":true,\"anonymous\":false,\"created_at\":\"2026-06-04T18:34:07.632566Z\",\"datastore_config\":{\"datastore_id\":\"9aace6ce-ee9d-4c81-b176-22bed53ff080\",\"primary_column_name\":\"id\",\"primary_key_generation_strategy\":\"none\"},\"description\":\"A simple test form.\",\"idp_survey\":false,\"modified_at\":\"2026-06-04T18:34:07.632566Z\",\"name\":\"Test-Get_a_form_returns_OK_response-1780598047\",\"org_id\":321813,\"self_service\":false,\"single_response\":false,\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"version\":{\"id\":\"354656\",\"state\":\"draft\",\"version\":1,\"etag\":\"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d\",\"definition_signature\":\"{\\\"signature\\\":\\\"{\\\\\\\"version\\\\\\\":2,\\\\\\\"algorithm\\\\\\\":\\\\\\\"ecdsa-p384\\\\\\\",\\\\\\\"pubkey\\\\\\\":\\\\\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\\\\\",\\\\\\\"timestamp\\\\\\\":1780598047,\\\\\\\"proof\\\\\\\":\\\\\\\"MGUCMQCkP+Usa2zK0v4SsSDBHsE4p88u025oyaRrAnNTiTXLwGr3K0W4/MAFeeosBwZonE0CMGYsqH/GAJUKeY0ZZGl8GZp2QeY1l3byimzWXRLf36CHhuB1Pshv/7bi0WoYYCOQIg==\\\\\\\"}\\\",\\\"version\\\":1}\",\"data_definition\":{},\"ui_definition\":{},\"created_at\":\"2026-06-04T18:34:07.632566Z\",\"modified_at\":\"2026-06-04T18:34:07.632566Z\",\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "b6e46709-27bc-8da3-66b7-7dba52e57b6f" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/forms/b42493d4-fbd0-4139-b4b9-4815f414621d", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"b42493d4-fbd0-4139-b4b9-4815f414621d\",\"type\":\"forms\"}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5f925f51-498a-16af-ec30-3fbe5e667002" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_forms_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/List_forms_returns_OK_response.freeze new file mode 100644 index 00000000000..e1050a989d0 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_forms_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-06-04T18:34:08.479Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_forms_returns_OK_response.json b/src/test/resources/cassettes/features/v2/List_forms_returns_OK_response.json new file mode 100644 index 00000000000..e6b82facc4f --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_forms_returns_OK_response.json @@ -0,0 +1,84 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"anonymous\":false,\"data_definition\":{},\"description\":\"A simple test form.\",\"idp_survey\":false,\"name\":\"Test-List_forms_returns_OK_response-1780598048\",\"single_response\":false,\"ui_definition\":{}},\"type\":\"forms\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/forms", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"d71d1aef-539d-4951-b98e-ff4c0c4f97bb\",\"type\":\"forms\",\"attributes\":{\"active\":true,\"anonymous\":false,\"created_at\":\"2026-06-04T18:34:08.937305Z\",\"datastore_config\":{\"datastore_id\":\"76b9f7b4-99d8-4a55-b95c-260cac22820d\",\"primary_column_name\":\"id\",\"primary_key_generation_strategy\":\"none\"},\"description\":\"A simple test form.\",\"idp_survey\":false,\"modified_at\":\"2026-06-04T18:34:08.937305Z\",\"name\":\"Test-List_forms_returns_OK_response-1780598048\",\"org_id\":321813,\"self_service\":false,\"single_response\":false,\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"version\":{\"id\":\"354657\",\"state\":\"draft\",\"version\":1,\"etag\":\"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d\",\"definition_signature\":\"{\\\"signature\\\":\\\"{\\\\\\\"version\\\\\\\":2,\\\\\\\"algorithm\\\\\\\":\\\\\\\"ecdsa-p384\\\\\\\",\\\\\\\"pubkey\\\\\\\":\\\\\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\\\\\",\\\\\\\"timestamp\\\\\\\":1780598048,\\\\\\\"proof\\\\\\\":\\\\\\\"MGUCMBSAXvYX++PAyywDBLlJsqgHq1ug3WLtMqKQRwx50qdAdj1UP1W58NnN9/DP70HavAIxANwA4guivHrOqlL36ETzde//0mI55MJ8Yv0ynU2p+QhqCSuJEHHgUUWjk0wYKJuZog==\\\\\\\"}\\\",\\\"version\\\":1}\",\"data_definition\":{},\"ui_definition\":{},\"created_at\":\"2026-06-04T18:34:08.937305Z\",\"modified_at\":\"2026-06-04T18:34:08.937305Z\",\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "b8c5d04b-935e-1acc-18d5-cda2d8504cef" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/forms", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[{\"id\":\"7af864d6-8c2f-41e5-b80d-1be56ea33d23\",\"type\":\"forms\",\"attributes\":{\"active\":true,\"anonymous\":false,\"created_at\":\"2026-06-04T18:05:41.512876Z\",\"datastore_config\":{\"datastore_id\":\"543a7e0e-0f0f-4b14-8911-2f20df5f1b07\",\"primary_column_name\":\"id\",\"primary_key_generation_strategy\":\"none\"},\"description\":\"A form to collect user feedback.\",\"idp_survey\":false,\"modified_at\":\"2026-06-04T18:05:41.512876Z\",\"name\":\"User Feedback Form\",\"org_id\":321813,\"self_service\":false,\"single_response\":false,\"user_id\":1445416,\"user_uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"b2953c07-9385-4de2-9cd3-af3f5d6c7d09\",\"type\":\"forms\",\"attributes\":{\"active\":true,\"anonymous\":false,\"created_at\":\"2026-06-04T18:15:44.116619Z\",\"datastore_config\":{\"datastore_id\":\"77b4b384-27d6-4619-bb55-1b2158d0080b\",\"primary_column_name\":\"id\",\"primary_key_generation_strategy\":\"none\"},\"description\":\"A form to collect user feedback.\",\"idp_survey\":false,\"modified_at\":\"2026-06-04T18:15:44.116619Z\",\"name\":\"User Feedback Form\",\"org_id\":321813,\"self_service\":false,\"single_response\":false,\"user_id\":1445416,\"user_uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"d71d1aef-539d-4951-b98e-ff4c0c4f97bb\",\"type\":\"forms\",\"attributes\":{\"active\":true,\"anonymous\":false,\"created_at\":\"2026-06-04T18:34:08.937305Z\",\"datastore_config\":{\"datastore_id\":\"76b9f7b4-99d8-4a55-b95c-260cac22820d\",\"primary_column_name\":\"id\",\"primary_key_generation_strategy\":\"none\"},\"description\":\"A simple test form.\",\"idp_survey\":false,\"modified_at\":\"2026-06-04T18:34:08.937305Z\",\"name\":\"Test-List_forms_returns_OK_response-1780598048\",\"org_id\":321813,\"self_service\":false,\"single_response\":false,\"user_id\":2320499,\"user_uuid\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "814ac7be-8e0e-03fc-d33a-37cc6b75bd49" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/forms/d71d1aef-539d-4951-b98e-ff4c0c4f97bb", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"d71d1aef-539d-4951-b98e-ff4c0c4f97bb\",\"type\":\"forms\"}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "38d9b220-dd17-4836-c888-45bded33c544" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/forms.feature b/src/test/resources/com/datadog/api/client/v2/api/forms.feature new file mode 100644 index 00000000000..185bf26324f --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/forms.feature @@ -0,0 +1,107 @@ +@endpoint(forms) @endpoint(forms-v2) +Feature: Forms + The Datadog Forms API lets you create and manage forms within the App + Builder platform. You can configure form settings, manage versions, + publish forms, and handle sharing configurations. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Forms" API + + @generated @skip @team:DataDog/app-builder-backend + Scenario: Create a form returns "Bad Request" response + Given operation "CreateForm" enabled + And new "CreateForm" request + And body with value {"data": {"attributes": {"anonymous": false, "data_definition": {}, "description": "A form to collect user feedback.", "idp_survey": false, "name": "User Feedback Form", "single_response": false, "ui_definition": {}}, "type": "forms"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Create a form returns "OK" response + Given operation "CreateForm" enabled + And new "CreateForm" request + And body with value {"data": {"attributes": {"anonymous": false, "data_definition": {}, "description": "A form to collect user feedback.", "idp_survey": false, "name": "User Feedback Form", "single_response": false, "ui_definition": {}}, "type": "forms"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/app-builder-backend + Scenario: Create and publish a form returns "Bad Request" response + Given operation "CreateAndPublishForm" enabled + And new "CreateAndPublishForm" request + And body with value {"data": {"attributes": {"anonymous": false, "data_definition": {}, "description": "A form to collect user feedback.", "idp_survey": false, "name": "User Feedback Form", "single_response": false, "ui_definition": {}}, "type": "forms"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Create and publish a form returns "OK" response + Given operation "CreateAndPublishForm" enabled + And new "CreateAndPublishForm" request + And body with value {"data": {"attributes": {"anonymous": false, "data_definition": {}, "description": "A form to collect user feedback.", "idp_survey": false, "name": "User Feedback Form", "single_response": false, "ui_definition": {}}, "type": "forms"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/app-builder-backend + Scenario: Delete a form returns "Bad Request" response + Given operation "DeleteForm" enabled + And new "DeleteForm" request + And request contains "form_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Delete a form returns "OK" response + Given operation "DeleteForm" enabled + And there is a valid "form" in the system + And new "DeleteForm" request + And request contains "form_id" parameter from "form.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.id" has the same value as "form.data.id" + And the response "data.type" is equal to "forms" + + @generated @skip @team:DataDog/app-builder-backend + Scenario: Get a form returns "Bad Request" response + Given operation "GetForm" enabled + And new "GetForm" request + And request contains "form_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Get a form returns "Not Found" response + Given operation "GetForm" enabled + And new "GetForm" request + And request contains "form_id" parameter with value "00000000-0000-0000-0000-000000000001" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/app-builder-backend + Scenario: Get a form returns "OK" response + Given operation "GetForm" enabled + And there is a valid "form" in the system + And new "GetForm" request + And request contains "form_id" parameter from "form.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.id" has the same value as "form.data.id" + And the response "data.type" is equal to "forms" + And the response "data.attributes.name" is equal to "{{ unique }}" + + @generated @skip @team:DataDog/app-builder-backend + Scenario: List forms returns "Bad Request" response + Given operation "ListForms" enabled + And new "ListForms" request + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: List forms returns "OK" response + Given operation "ListForms" enabled + And there is a valid "form" in the system + And new "ListForms" request + When the request is sent + Then the response status is 200 OK + And the response "data" has item with field "id" with value "{{ form.data.id }}" + And the response "data" has item with field "type" with value "forms" + And the response "data" has item with field "attributes.name" with value "{{ unique }}" diff --git a/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index 097f6a07d55..c516f8069f8 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/given.json @@ -498,6 +498,30 @@ "tag": "Feature Flags", "operationId": "UpdateAllocationsForFeatureFlagInEnvironment" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"forms\",\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"description\": \"A simple test form.\",\n \"anonymous\": false,\n \"single_response\": false,\n \"idp_survey\": false,\n \"data_definition\": {},\n \"ui_definition\": {}\n }\n }\n}" + } + ], + "step": "there is a valid \"form\" in the system", + "key": "form", + "tag": "Forms", + "operationId": "CreateForm" + }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"forms\",\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"description\": \"A simple test form.\",\n \"anonymous\": false,\n \"single_response\": false,\n \"idp_survey\": false,\n \"data_definition\": {},\n \"ui_definition\": {}\n }\n }\n}" + } + ], + "step": "there is a valid \"form_published\" in the system", + "key": "form_published", + "tag": "Forms", + "operationId": "CreateAndPublishForm" + }, { "parameters": [ { 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 a2ff6ce184c..f482235ffe9 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 @@ -2609,6 +2609,50 @@ "type": "unsafe" } }, + "ListForms": { + "tag": "Forms", + "undo": { + "type": "safe" + } + }, + "CreateForm": { + "tag": "Forms", + "undo": { + "operationId": "DeleteForm", + "parameters": [ + { + "name": "form_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "CreateAndPublishForm": { + "tag": "Forms", + "undo": { + "operationId": "DeleteForm", + "parameters": [ + { + "name": "form_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteForm": { + "tag": "Forms", + "undo": { + "type": "idempotent" + } + }, + "GetForm": { + "tag": "Forms", + "undo": { + "type": "safe" + } + }, "GetHamrOrgConnection": { "tag": "High Availability MultiRegion", "undo": {