diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b9a63afce0a1..59e19780a684 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -51317,6 +51317,713 @@ components: $ref: '#/components/schemas/RumRetentionFilterData' type: array type: object + RumSegmentCreateAttributes: + description: Attributes for creating a new segment. + properties: + data_query: + $ref: '#/components/schemas/RumSegmentDataQuery' + description: + description: A description of the segment. + example: Users who visited the homepage. + type: string + name: + description: The name of the segment. + example: My Segment + type: string + tags: + description: A list of tags for the segment. + example: + - team:frontend + items: + type: string + type: array + required: + - name + - data_query + type: object + RumSegmentCreateData: + description: Data object for a segment creation request. + properties: + attributes: + $ref: '#/components/schemas/RumSegmentCreateAttributes' + type: + $ref: '#/components/schemas/RumSegmentResourceType' + required: + - type + - attributes + type: object + RumSegmentCreateRequest: + description: Request body for creating a new segment. + properties: + data: + $ref: '#/components/schemas/RumSegmentCreateData' + required: + - data + type: object + RumSegmentDataQuery: + description: Query definition for the segment. Contains one or more query blocks + and an optional combination formula. + properties: + combination: + description: Boolean expression combining multiple query blocks. + example: (logs && apm_home) && NOT(apm_trace) + type: string + event_platforms: + description: List of event platform query blocks. + items: + $ref: '#/components/schemas/RumSegmentEventPlatform' + type: array + journeys: + description: List of journey-based query blocks. + items: + $ref: '#/components/schemas/RumSegmentJourney' + type: array + reference_tables: + description: List of reference table query blocks. + items: + $ref: '#/components/schemas/RumSegmentReferenceTable' + type: array + static: + description: List of static user list blocks. + items: + $ref: '#/components/schemas/RumSegmentStaticEntry' + type: array + templates: + description: List of template-based query blocks. + items: + $ref: '#/components/schemas/RumSegmentTemplateInstance' + type: array + type: object + RumSegmentDeleteAttributes: + description: Attributes of a deleted segment response. + properties: + disabled_at: + description: The timestamp when the segment was disabled in RFC 3339 format. + example: '2024-03-15T10:30:00Z' + format: date-time + type: string + disabled_by: + $ref: '#/components/schemas/RumSegmentUser' + name: + description: The name of the deleted segment. + example: My Segment + type: string + uuid: + description: The unique identifier of the deleted segment. + example: a1b2c3d4-1234-5678-9abc-123456789abc + type: string + required: + - uuid + - name + - disabled_at + - disabled_by + type: object + RumSegmentDeleteData: + description: Data object for a deleted segment response. + properties: + attributes: + $ref: '#/components/schemas/RumSegmentDeleteAttributes' + id: + description: Unique identifier for the deleted segment. + example: a1b2c3d4-1234-5678-9abc-123456789abc + type: string + type: + $ref: '#/components/schemas/RumSegmentDeleteType' + required: + - id + - type + - attributes + type: object + RumSegmentDeleteResponse: + description: Response for a segment deletion. + properties: + data: + $ref: '#/components/schemas/RumSegmentDeleteData' + required: + - data + type: object + RumSegmentDeleteType: + description: Type of the deleted segment resource. + enum: + - deleted_segment + example: deleted_segment + type: string + x-enum-varnames: + - DELETED_SEGMENT + RumSegmentEventPlatform: + description: An event platform query block within a segment data query. + properties: + facet: + description: The facet to extract user identifiers from. + example: '@usr.id' + type: string + from: + description: The start of the time range in milliseconds since epoch. + example: 1709888355000 + format: int64 + type: integer + name: + description: The name of this query block. + example: logs + type: string + query: + description: The search query for filtering events. + example: '@type:view @view.url_path:/logs' + type: string + to: + description: The end of the time range in milliseconds since epoch. + example: 1710493155000 + format: int64 + type: integer + required: + - name + - query + - facet + type: object + RumSegmentJourney: + description: A journey-based query block within a segment data query. + properties: + conversion_type: + description: The type of conversion to track. + example: any + type: string + group_by: + description: The facet to group journey results by. + example: '@usr.id' + type: string + name: + description: The name of this journey query block. + example: my_journey + type: string + search: + description: The search query for filtering events. + example: '@type:view' + type: string + type: object + RumSegmentListResponse: + description: Response for listing segments. + properties: + data: + description: The list of segments. + items: + $ref: '#/components/schemas/RumSegmentResponseData' + type: array + required: + - data + type: object + RumSegmentReferenceTable: + description: A reference table query block within a segment data query. + properties: + columns: + description: The columns to include from the reference table. + items: + $ref: '#/components/schemas/RumSegmentReferenceTableColumn' + type: array + filter_query: + description: An optional filter query for the reference table data. + example: '' + type: string + join_condition: + $ref: '#/components/schemas/RumSegmentReferenceTableJoinCondition' + name: + description: The name of this query block. + example: my_ref_table + type: string + table_name: + description: The name of the reference table. + example: my_table + type: string + required: + - name + - table_name + - columns + - join_condition + type: object + RumSegmentReferenceTableColumn: + description: A column definition in a reference table query block. + properties: + name: + description: The name of the column. + example: user_id + type: string + required: + - name + type: object + RumSegmentReferenceTableJoinCondition: + description: The join condition for a reference table query block. + properties: + column_name: + description: The reference table column to join on. + example: user_id + type: string + facet: + description: The RUM facet to join on. + example: '@usr.id' + type: string + required: + - facet + - column_name + type: object + RumSegmentResourceType: + description: Type of the segment resource. + enum: + - segment + example: segment + type: string + x-enum-varnames: + - SEGMENT + RumSegmentResponse: + description: Response containing a single segment. + properties: + data: + $ref: '#/components/schemas/RumSegmentResponseData' + required: + - data + type: object + RumSegmentResponseAttributes: + description: Attributes of a segment in a response. + properties: + created_at: + description: The creation timestamp in RFC 3339 format. + example: '2024-03-15T10:30:00Z' + format: date-time + type: string + created_by: + $ref: '#/components/schemas/RumSegmentUser' + data_query: + $ref: '#/components/schemas/RumSegmentDataQuery' + description: + description: A description of the segment. + example: Users who visited the homepage. + type: string + modified_at: + description: The last modification timestamp in RFC 3339 format. + example: '2024-03-15T10:30:00Z' + format: date-time + type: string + modified_by: + $ref: '#/components/schemas/RumSegmentUser' + name: + description: The name of the segment. + example: My Segment + type: string + org_id: + description: The organization identifier. + example: 123456 + format: int64 + type: integer + row_count: + description: The number of users in the segment. + example: 500 + format: int64 + type: integer + source: + $ref: '#/components/schemas/RumSegmentSource' + tags: + description: A list of tags for the segment. + example: + - team:frontend + items: + type: string + type: array + type: + $ref: '#/components/schemas/RumSegmentSegmentType' + uuid: + description: The unique identifier of the segment. + example: a1b2c3d4-1234-5678-9abc-123456789abc + type: string + version: + description: The version number of the segment. + example: 1 + format: int64 + type: integer + required: + - uuid + - org_id + - name + - description + - data_query + - created_by + - modified_by + - created_at + - modified_at + - row_count + - version + - tags + - type + - source + type: object + RumSegmentResponseData: + description: Data object for a segment in a response. + properties: + attributes: + $ref: '#/components/schemas/RumSegmentResponseAttributes' + id: + description: The unique identifier of the segment. + example: a1b2c3d4-1234-5678-9abc-123456789abc + type: string + type: + $ref: '#/components/schemas/RumSegmentResourceType' + required: + - id + - type + - attributes + type: object + RumSegmentSegmentType: + description: The type of a segment based on its data query configuration. + enum: + - static + - event_platform + - combination + - journeys + - reference_table + - templates + example: event_platform + type: string + x-enum-varnames: + - STATIC + - EVENT_PLATFORM + - COMBINATION + - JOURNEYS + - REFERENCE_TABLE + - TEMPLATES + RumSegmentSource: + description: The source of a segment. + enum: + - user_created + - initial + example: user_created + type: string + x-enum-varnames: + - USER_CREATED + - INITIAL + RumSegmentStaticEntry: + description: A static user list entry within a segment data query. + properties: + id: + description: The identifier of the static list. + example: static-list-1 + type: string + name: + description: The name of the static list. + example: My Static List + type: string + user_count: + description: The number of users in the static list. + example: 500 + format: int64 + type: integer + required: + - id + - name + - user_count + type: object + RumSegmentTemplateInstance: + description: A template-based query block within a segment data query. + properties: + from: + description: The start of the time range in milliseconds since epoch. + example: 1709888355000 + format: int64 + type: integer + parameters: + additionalProperties: + type: string + description: The template parameters as key-value pairs. + example: + threshold: '5' + type: object + template_id: + description: The identifier of the template. + example: stickiness-v1 + type: string + to: + description: The end of the time range in milliseconds since epoch. + example: 1710493155000 + format: int64 + type: integer + required: + - template_id + type: object + RumSegmentTemplateListResponse: + description: Response for listing segment templates. + properties: + data: + description: The list of segment templates. + items: + $ref: '#/components/schemas/RumSegmentTemplateResponseData' + type: array + required: + - data + type: object + RumSegmentTemplateParameterDef: + description: A parameter definition for a segment template. + properties: + default: + description: The default value for the parameter. + example: '5' + type: string + description: + description: A description of the parameter. + example: The minimum number of sessions. + type: string + validate: + description: Validation rules for the parameter. + example: required + type: string + required: + - description + - default + - validate + type: object + RumSegmentTemplateResourceType: + description: Type of the segment template resource. + enum: + - template_metadata + example: template_metadata + type: string + x-enum-varnames: + - TEMPLATE_METADATA + RumSegmentTemplateResponseAttributes: + description: Attributes of a segment template in a response. + properties: + category: + description: The category of the template. + example: engagement + type: string + created_at: + description: The creation timestamp in RFC 3339 format. + example: '2024-01-01T00:00:00Z' + format: date-time + type: string + description: + description: A description of the template. + example: Users who visited at least N times. + type: string + modified_at: + description: The last modification timestamp in RFC 3339 format. + example: '2024-01-01T00:00:00Z' + format: date-time + type: string + name: + description: The name of the template. + example: stickiness-v1 + type: string + parameters: + additionalProperties: + $ref: '#/components/schemas/RumSegmentTemplateParameterDef' + description: The template parameter definitions. + type: object + status: + $ref: '#/components/schemas/RumSegmentTemplateStatus' + version: + description: The version number of the template. + example: 1 + format: int64 + type: integer + required: + - name + - description + - category + - parameters + - status + - version + - created_at + - modified_at + type: object + RumSegmentTemplateResponseData: + description: Data object for a segment template in a response. + properties: + attributes: + $ref: '#/components/schemas/RumSegmentTemplateResponseAttributes' + id: + description: The unique identifier of the template. + example: stickiness-v1 + type: string + type: + $ref: '#/components/schemas/RumSegmentTemplateResourceType' + required: + - id + - type + - attributes + type: object + RumSegmentTemplateStatus: + description: The status of a segment template. + enum: + - active + - deprecated + - archived + example: active + type: string + x-enum-varnames: + - ACTIVE + - DEPRECATED + - ARCHIVED + RumSegmentUpdateAttributes: + description: Attributes for updating a segment. All fields are optional. + properties: + data_query: + $ref: '#/components/schemas/RumSegmentDataQuery' + description: + description: The updated description of the segment. + example: Updated description. + type: string + name: + description: The updated name of the segment. + example: Updated Segment Name + type: string + tags: + description: The updated list of tags for the segment. + example: + - team:backend + items: + type: string + type: array + type: object + RumSegmentUpdateData: + description: Data object for a segment update request. + properties: + attributes: + $ref: '#/components/schemas/RumSegmentUpdateAttributes' + id: + description: The identifier of the segment to update. + example: a1b2c3d4-1234-5678-9abc-123456789abc + type: string + type: + $ref: '#/components/schemas/RumSegmentResourceType' + required: + - id + - type + - attributes + type: object + RumSegmentUpdateRequest: + description: Request body for updating a segment. + properties: + data: + $ref: '#/components/schemas/RumSegmentUpdateData' + required: + - data + type: object + RumSegmentUser: + description: A user who performed an action on a segment. + properties: + handle: + description: The email handle of the user. + example: john.doe@example.com + type: string + icon: + description: The URL of the user icon. + example: https://example.com/icon.png + type: string + id: + description: The numeric identifier of the user. + example: '12' + type: string + name: + description: The display name of the user. + example: John Doe + type: string + uuid: + description: The unique identifier of the user. + example: user-uuid-123 + type: string + required: + - id + - uuid + - name + - handle + - icon + type: object + RumStaticSegmentCreateAttributes: + description: Attributes for creating a new static segment. + properties: + description: + description: A description of the static segment. + example: Users from a specific journey. + type: string + journey_query_object: + $ref: '#/components/schemas/RumStaticSegmentJourneyQueryObject' + name: + description: The name of the static segment. + example: My Static Segment + type: string + tags: + description: A list of tags for the static segment. + example: + - team:frontend + items: + type: string + type: array + required: + - name + - description + - journey_query_object + type: object + RumStaticSegmentCreateData: + description: Data object for a static segment creation request. + properties: + attributes: + $ref: '#/components/schemas/RumStaticSegmentCreateAttributes' + type: + $ref: '#/components/schemas/RumStaticSegmentRequestType' + required: + - type + - attributes + type: object + RumStaticSegmentCreateRequest: + description: Request body for creating a new static segment. + properties: + data: + $ref: '#/components/schemas/RumStaticSegmentCreateData' + required: + - data + type: object + RumStaticSegmentJourneyFilter: + description: A filter within a journey query node. + properties: + attribute: + description: The attribute to filter on. + example: '@type' + type: string + value: + description: The value to match. + example: view + type: string + required: + - attribute + - value + type: object + RumStaticSegmentJourneyNode: + description: A node in a journey query object. + properties: + filters: + description: The list of filters for this node. + items: + $ref: '#/components/schemas/RumStaticSegmentJourneyFilter' + type: array + required: + - filters + type: object + RumStaticSegmentJourneyQueryObject: + description: The journey query object used to compute the static segment user + list. + properties: + nodes: + description: The list of journey nodes defining the query. + items: + $ref: '#/components/schemas/RumStaticSegmentJourneyNode' + type: array + required: + - nodes + type: object + RumStaticSegmentRequestType: + description: Type of the static segment creation request resource. + enum: + - create_static_segment_request + example: create_static_segment_request + type: string + x-enum-varnames: + - CREATE_STATIC_SEGMENT_REQUEST RunRetentionFilterName: description: The name of a RUM retention filter. example: Retention filter for session @@ -93185,6 +93892,329 @@ paths: summary: List rum replay viewership history sessions tags: - Rum Replay Viewership + /api/v2/rum/segment: + get: + description: List all user segments for the current organization. Supports sorting + and pagination. + operationId: ListRumSegments + parameters: + - description: Sort order for the segments list. + in: query + name: sort + required: false + schema: + example: name + type: string + - description: Maximum number of segments to return. + in: query + name: limit + required: false + schema: + example: 25 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RumSegmentListResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List all RUM segments + tags: + - RUM User Segments + 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 user segment for the current organization. + operationId: CreateRumSegment + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RumSegmentCreateRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/RumSegmentResponse' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Conflict + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create a RUM segment + tags: + - RUM User Segments + 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/rum/segment/initialize: + post: + description: Initialize default segments for the current organization. This + creates a set of predefined segments if they do not already exist. + operationId: InitializeRumSegments + responses: + '200': + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Initialize RUM segments + tags: + - RUM User Segments + 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/rum/segment/static: + post: + description: Create a new static user segment from a journey query. Static segments + contain a fixed list of users computed from the query at creation time. + operationId: CreateRumStaticSegment + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RumStaticSegmentCreateRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/RumSegmentResponse' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Conflict + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create a static RUM segment + tags: + - RUM User Segments + 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/rum/segment/templates: + get: + description: List all available segment templates. Templates provide predefined + segment configurations that can be customized with parameters. + operationId: ListRumSegmentTemplates + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RumSegmentTemplateListResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List RUM segment templates + tags: + - RUM User Segments + 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/rum/segment/{segment_id}: + delete: + description: Delete a user segment by its identifier. + operationId: DeleteRumSegment + parameters: + - description: The identifier of the segment. + in: path + name: segment_id + required: true + schema: + example: a1b2c3d4-1234-5678-9abc-123456789abc + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RumSegmentDeleteResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete a RUM segment + tags: + - RUM User Segments + 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 specific user segment by its identifier. + operationId: GetRumSegment + parameters: + - description: The identifier of the segment. + in: path + name: segment_id + required: true + schema: + example: a1b2c3d4-1234-5678-9abc-123456789abc + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RumSegmentResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get a RUM segment + tags: + - RUM User Segments + 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/).' + put: + description: Update an existing user segment. All fields in the request body + are optional. + operationId: UpdateRumSegment + parameters: + - description: The identifier of the segment. + in: path + name: segment_id + required: true + schema: + example: a1b2c3d4-1234-5678-9abc-123456789abc + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RumSegmentUpdateRequest' + required: true + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Conflict + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update a RUM segment + tags: + - RUM User Segments + 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/saml_configurations/idp_metadata: post: description: 'Endpoint for uploading IdP metadata for SAML setup. @@ -104793,6 +105823,8 @@ tags: aggregate your RUM events over HTTP. See the [RUM & Session Replay page](https://docs.datadoghq.com/real_user_monitoring/) for more information name: RUM +- description: Manage RUM user segments for audience targeting and analysis. + name: RUM User Segments - description: View and manage Reference Tables in your organization. name: Reference Tables - description: 'A restriction policy defines the access control rules for a resource, diff --git a/features/v2/rum_user_segments.feature b/features/v2/rum_user_segments.feature new file mode 100644 index 000000000000..7a6305c6e00f --- /dev/null +++ b/features/v2/rum_user_segments.feature @@ -0,0 +1,167 @@ +@endpoint(rum-user-segments) @endpoint(rum-user-segments-v2) +Feature: RUM User Segments + Manage RUM user segments for audience targeting and analysis. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "RUMUserSegments" API + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Create a RUM segment returns "Bad Request" response + Given operation "CreateRumSegment" enabled + And new "CreateRumSegment" request + And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Users who visited the homepage.", "name": "My Segment", "tags": ["team:frontend"]}, "type": "segment"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Create a RUM segment returns "Conflict" response + Given operation "CreateRumSegment" enabled + And new "CreateRumSegment" request + And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Users who visited the homepage.", "name": "My Segment", "tags": ["team:frontend"]}, "type": "segment"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Create a RUM segment returns "Created" response + Given operation "CreateRumSegment" enabled + And new "CreateRumSegment" request + And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Users who visited the homepage.", "name": "My Segment", "tags": ["team:frontend"]}, "type": "segment"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Create a static RUM segment returns "Bad Request" response + Given operation "CreateRumStaticSegment" enabled + And new "CreateRumStaticSegment" request + And body with value {"data": {"attributes": {"description": "Users from a specific journey.", "journey_query_object": {"nodes": [{"filters": [{"attribute": "@type", "value": "view"}]}]}, "name": "My Static Segment", "tags": ["team:frontend"]}, "type": "create_static_segment_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Create a static RUM segment returns "Conflict" response + Given operation "CreateRumStaticSegment" enabled + And new "CreateRumStaticSegment" request + And body with value {"data": {"attributes": {"description": "Users from a specific journey.", "journey_query_object": {"nodes": [{"filters": [{"attribute": "@type", "value": "view"}]}]}, "name": "My Static Segment", "tags": ["team:frontend"]}, "type": "create_static_segment_request"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Create a static RUM segment returns "Created" response + Given operation "CreateRumStaticSegment" enabled + And new "CreateRumStaticSegment" request + And body with value {"data": {"attributes": {"description": "Users from a specific journey.", "journey_query_object": {"nodes": [{"filters": [{"attribute": "@type", "value": "view"}]}]}, "name": "My Static Segment", "tags": ["team:frontend"]}, "type": "create_static_segment_request"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Delete a RUM segment returns "Not Found" response + Given operation "DeleteRumSegment" enabled + And new "DeleteRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Delete a RUM segment returns "OK" response + Given operation "DeleteRumSegment" enabled + And new "DeleteRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Get a RUM segment returns "Bad Request" response + Given operation "GetRumSegment" enabled + And new "GetRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Get a RUM segment returns "Not Found" response + Given operation "GetRumSegment" enabled + And new "GetRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Get a RUM segment returns "OK" response + Given operation "GetRumSegment" enabled + And new "GetRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Initialize RUM segments returns "OK" response + Given operation "InitializeRumSegments" enabled + And new "InitializeRumSegments" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: List RUM segment templates returns "Bad Request" response + Given operation "ListRumSegmentTemplates" enabled + And new "ListRumSegmentTemplates" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: List RUM segment templates returns "OK" response + Given operation "ListRumSegmentTemplates" enabled + And new "ListRumSegmentTemplates" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: List all RUM segments returns "Bad Request" response + Given operation "ListRumSegments" enabled + And new "ListRumSegments" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: List all RUM segments returns "OK" response + Given operation "ListRumSegments" enabled + And new "ListRumSegments" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Update a RUM segment returns "Bad Request" response + Given operation "UpdateRumSegment" enabled + And new "UpdateRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Updated description.", "name": "Updated Segment Name", "tags": ["team:backend"]}, "id": "a1b2c3d4-1234-5678-9abc-123456789abc", "type": "segment"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Update a RUM segment returns "Conflict" response + Given operation "UpdateRumSegment" enabled + And new "UpdateRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Updated description.", "name": "Updated Segment Name", "tags": ["team:backend"]}, "id": "a1b2c3d4-1234-5678-9abc-123456789abc", "type": "segment"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Update a RUM segment returns "No Content" response + Given operation "UpdateRumSegment" enabled + And new "UpdateRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Updated description.", "name": "Updated Segment Name", "tags": ["team:backend"]}, "id": "a1b2c3d4-1234-5678-9abc-123456789abc", "type": "segment"}} + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/product-analytics-backend + Scenario: Update a RUM segment returns "Not Found" response + Given operation "UpdateRumSegment" enabled + And new "UpdateRumSegment" request + And request contains "segment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"data_query": {"combination": "(logs && apm_home) && NOT(apm_trace)", "event_platforms": [{"facet": "@usr.id", "from": 1709888355000, "name": "logs", "query": "@type:view @view.url_path:/logs", "to": 1710493155000}], "journeys": [{"conversion_type": "any", "group_by": "@usr.id", "name": "my_journey", "search": "@type:view"}], "reference_tables": [{"columns": [{"name": "user_id"}], "filter_query": "", "join_condition": {"column_name": "user_id", "facet": "@usr.id"}, "name": "my_ref_table", "table_name": "my_table"}], "static": [{"id": "static-list-1", "name": "My Static List", "user_count": 500}], "templates": [{"from": 1709888355000, "parameters": {"threshold": "5"}, "template_id": "stickiness-v1", "to": 1710493155000}]}, "description": "Updated description.", "name": "Updated Segment Name", "tags": ["team:backend"]}, "id": "a1b2c3d4-1234-5678-9abc-123456789abc", "type": "segment"}} + When the request is sent + Then the response status is 404 Not Found diff --git a/features/v2/undo.json b/features/v2/undo.json index 2f0af9dca771..6514777da204 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -4249,6 +4249,68 @@ "type": "safe" } }, + "ListRumSegments": { + "tag": "RUM User Segments", + "undo": { + "type": "safe" + } + }, + "CreateRumSegment": { + "tag": "RUM User Segments", + "undo": { + "operationId": "DeleteRumSegment", + "parameters": [ + { + "name": "segment_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "InitializeRumSegments": { + "tag": "RUM User Segments", + "undo": { + "type": "idempotent" + } + }, + "CreateRumStaticSegment": { + "tag": "RUM User Segments", + "undo": { + "operationId": "DeleteRumSegment", + "parameters": [ + { + "name": "segment_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "ListRumSegmentTemplates": { + "tag": "RUM User Segments", + "undo": { + "type": "safe" + } + }, + "DeleteRumSegment": { + "tag": "RUM User Segments", + "undo": { + "type": "idempotent" + } + }, + "GetRumSegment": { + "tag": "RUM User Segments", + "undo": { + "type": "safe" + } + }, + "UpdateRumSegment": { + "tag": "RUM User Segments", + "undo": { + "type": "idempotent" + } + }, "UploadIdPMetadata": { "tag": "Organizations", "undo": { diff --git a/packages/datadog-api-client/README.md b/packages/datadog-api-client/README.md index be8ca414e55e..0f51f79b4aac 100644 --- a/packages/datadog-api-client/README.md +++ b/packages/datadog-api-client/README.md @@ -434,6 +434,7 @@ apiInstance | Rum Replay Sessions | @datadog/datadog-api-client-rum-replay-sessions | [README.md](../../services/rum-replay-sessions/README.md) | | Rum Replay Viewership | @datadog/datadog-api-client-rum-replay-viewership | [README.md](../../services/rum-replay-viewership/README.md) | | Rum Retention Filters | @datadog/datadog-api-client-rum-retention-filters | [README.md](../../services/rum-retention-filters/README.md) | +| RUM User Segments | @datadog/datadog-api-client-rum-user-segments | [README.md](../../services/rum-user-segments/README.md) | | Seats | @datadog/datadog-api-client-seats | [README.md](../../services/seats/README.md) | | Security Monitoring | @datadog/datadog-api-client-security-monitoring | [README.md](../../services/security-monitoring/README.md) | | Sensitive Data Scanner | @datadog/datadog-api-client-sensitive-data-scanner | [README.md](../../services/sensitive-data-scanner/README.md) | diff --git a/private/bdd_runner/src/support/scenarios_model_mapping.ts b/private/bdd_runner/src/support/scenarios_model_mapping.ts index 0fc2d50bffec..68e72df6d7fb 100644 --- a/private/bdd_runner/src/support/scenarios_model_mapping.ts +++ b/private/bdd_runner/src/support/scenarios_model_mapping.ts @@ -9460,6 +9460,62 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "ViewershipHistorySessionArray", }, + "RUMUserSegmentsApi.V2.ListRumSegments": { + sort: { + type: "string", + format: "", + }, + limit: { + type: "number", + format: "", + }, + operationResponseType: "RumSegmentListResponse", + }, + "RUMUserSegmentsApi.V2.CreateRumSegment": { + body: { + type: "RumSegmentCreateRequest", + format: "", + }, + operationResponseType: "RumSegmentResponse", + }, + "RUMUserSegmentsApi.V2.InitializeRumSegments": { + operationResponseType: "{}", + }, + "RUMUserSegmentsApi.V2.CreateRumStaticSegment": { + body: { + type: "RumStaticSegmentCreateRequest", + format: "", + }, + operationResponseType: "RumSegmentResponse", + }, + "RUMUserSegmentsApi.V2.ListRumSegmentTemplates": { + operationResponseType: "RumSegmentTemplateListResponse", + }, + "RUMUserSegmentsApi.V2.GetRumSegment": { + segmentId: { + type: "string", + format: "", + }, + operationResponseType: "RumSegmentResponse", + }, + "RUMUserSegmentsApi.V2.UpdateRumSegment": { + segmentId: { + type: "string", + format: "", + }, + body: { + type: "RumSegmentUpdateRequest", + format: "", + }, + operationResponseType: "{}", + }, + "RUMUserSegmentsApi.V2.DeleteRumSegment": { + segmentId: { + type: "string", + format: "", + }, + operationResponseType: "RumSegmentDeleteResponse", + }, "ServiceScorecardsApi.V2.ListScorecardOutcomes": { pageSize: { type: "number", diff --git a/services/rum_user_segments/.yarnrc.yml b/services/rum_user_segments/.yarnrc.yml new file mode 100644 index 000000000000..3186f3f0795a --- /dev/null +++ b/services/rum_user_segments/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/services/rum_user_segments/README.md b/services/rum_user_segments/README.md new file mode 100644 index 000000000000..2d84abd01fd5 --- /dev/null +++ b/services/rum_user_segments/README.md @@ -0,0 +1,44 @@ +# @datadog/datadog-api-client-rum-user-segments + +## Description + +Manage RUM user segments for audience targeting and analysis. + +## Navigation + +- [Installation](#installation) +- [Getting Started](#getting-started) + +## Installation + +```sh +# NPM +npm install @datadog/datadog-api-client-rum-user-segments +# Yarn +yarn add @datadog/datadog-api-client-rum-user-segments +``` + +## Getting Started +```ts +import { createConfiguration } from "@datadog/datadog-api-client"; +import { RUMUserSegmentsApiV2 } from "@datadog/datadog-api-client-rum-user-segments"; +import { v2 } from "@datadog/datadog-api-client-rum-user-segments"; + +const configuration = createConfiguration(); +// Enable unstable operations +const configurationOpts = { + unstableOperations: { + "RUMUserSegmentsApi.v2.listRumSegments": true + } +} + +const configuration = createConfiguration(configurationOpts); +const apiInstance = new RUMUserSegmentsApiV2(configuration); +const params = {/* parameters */}; + +apiInstance.listRumSegments(params).then((data) => { + console.log("API called successfully. Returned data: " + JSON.stringify(data)); +}).catch((error) => { + console.error("Error calling API: " + error); +}); +``` \ No newline at end of file diff --git a/services/rum_user_segments/package.json b/services/rum_user_segments/package.json new file mode 100644 index 000000000000..d690cd7773b6 --- /dev/null +++ b/services/rum_user_segments/package.json @@ -0,0 +1,43 @@ +{ + "name": "@datadog/datadog-api-client-rum-user-segments", + "description": "", + "author": "", + "keywords": [ + "api", + "fetch", + "typescript" + ], + "license": "Apache-2.0", + "licenses": [ + { + "type": "Apache-2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/DataDog/datadog-api-client-typescript.git", + "directory": "services/rum-user-segments" + }, + "files": [ + "dist/**/*" + ], + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "scripts": { + "prepack": "yarn workspace @datadog/datadog-api-client build && yarn build", + "build": "yarn generate-version-files && tsc", + "generate-version-files": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version)\" > src/version.ts" + }, + "dependencies": { + "@datadog/datadog-api-client": "^2.0.0-beta.2" + }, + "devDependencies": { + "typescript": "5.8.3" + }, + "engines": { + "node": ">=18.0.0" + }, + "version": "0.0.1", + "packageManager": "yarn@4.9.1" +} diff --git a/services/rum_user_segments/src/index.ts b/services/rum_user_segments/src/index.ts new file mode 100644 index 000000000000..7880ce2578e1 --- /dev/null +++ b/services/rum_user_segments/src/index.ts @@ -0,0 +1,3 @@ +export * as v2 from "./v2"; + +export { RUMUserSegmentsApi as RUMUserSegmentsApiV2 } from "./v2/RUMUserSegmentsApi"; diff --git a/services/rum_user_segments/src/v2/RUMUserSegmentsApi.ts b/services/rum_user_segments/src/v2/RUMUserSegmentsApi.ts new file mode 100644 index 000000000000..9494876fe22d --- /dev/null +++ b/services/rum_user_segments/src/v2/RUMUserSegmentsApi.ts @@ -0,0 +1,1321 @@ +import { + ApiException, + BaseAPIRequestFactory, + BaseServerConfiguration, + buildUserAgent, + Configuration, + createConfiguration, + deserialize, + getPreferredMediaType, + HttpMethod, + isBrowser, + logger, + normalizeMediaType, + parse, + RequiredError, + RequestContext, + ResponseContext, + serialize, + ServerConfiguration, + stringify, + applySecurityAuthentication, +} from "@datadog/datadog-api-client"; + +import { TypingInfo } from "./models/TypingInfo"; +import { APIErrorResponse } from "./models/APIErrorResponse"; +import { JSONAPIErrorResponse } from "./models/JSONAPIErrorResponse"; +import { RumSegmentCreateRequest } from "./models/RumSegmentCreateRequest"; +import { RumSegmentDeleteResponse } from "./models/RumSegmentDeleteResponse"; +import { RumSegmentListResponse } from "./models/RumSegmentListResponse"; +import { RumSegmentResponse } from "./models/RumSegmentResponse"; +import { RumSegmentTemplateListResponse } from "./models/RumSegmentTemplateListResponse"; +import { RumSegmentUpdateRequest } from "./models/RumSegmentUpdateRequest"; +import { RumStaticSegmentCreateRequest } from "./models/RumStaticSegmentCreateRequest"; +import { version } from "../version"; + +export class RUMUserSegmentsApiRequestFactory extends BaseAPIRequestFactory { + public userAgent: string | undefined; + + public constructor(configuration: Configuration) { + super(configuration); + if (!isBrowser) { + this.userAgent = buildUserAgent("rum-user-segments", version); + } + } + public async createRumSegment( + body: RumSegmentCreateRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if (!_config.unstableOperations["RUMUserSegmentsApi.v2.createRumSegment"]) { + throw new Error( + "Unstable operation 'createRumSegment' is disabled. Enable it by setting `configuration.unstableOperations['RUMUserSegmentsApi.v2.createRumSegment'] = true`", + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "createRumSegment"); + } + + // Path Params + const localVarPath = "/api/v2/rum/segment"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "RUMUserSegmentsApi.v2.createRumSegment", + RUMUserSegmentsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.POST, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "RumSegmentCreateRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async createRumStaticSegment( + body: RumStaticSegmentCreateRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations[ + "RUMUserSegmentsApi.v2.createRumStaticSegment" + ] + ) { + throw new Error( + "Unstable operation 'createRumStaticSegment' is disabled. Enable it by setting `configuration.unstableOperations['RUMUserSegmentsApi.v2.createRumStaticSegment'] = true`", + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "createRumStaticSegment"); + } + + // Path Params + const localVarPath = "/api/v2/rum/segment/static"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "RUMUserSegmentsApi.v2.createRumStaticSegment", + RUMUserSegmentsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.POST, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "RumStaticSegmentCreateRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async deleteRumSegment( + segmentId: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if (!_config.unstableOperations["RUMUserSegmentsApi.v2.deleteRumSegment"]) { + throw new Error( + "Unstable operation 'deleteRumSegment' is disabled. Enable it by setting `configuration.unstableOperations['RUMUserSegmentsApi.v2.deleteRumSegment'] = true`", + ); + } + + // verify required parameter 'segmentId' is not null or undefined + if (segmentId === null || segmentId === undefined) { + throw new RequiredError("segmentId", "deleteRumSegment"); + } + + // Path Params + const localVarPath = "/api/v2/rum/segment/{segment_id}".replace( + "{segment_id}", + encodeURIComponent(String(segmentId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "RUMUserSegmentsApi.v2.deleteRumSegment", + RUMUserSegmentsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.DELETE, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async getRumSegment( + segmentId: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if (!_config.unstableOperations["RUMUserSegmentsApi.v2.getRumSegment"]) { + throw new Error( + "Unstable operation 'getRumSegment' is disabled. Enable it by setting `configuration.unstableOperations['RUMUserSegmentsApi.v2.getRumSegment'] = true`", + ); + } + + // verify required parameter 'segmentId' is not null or undefined + if (segmentId === null || segmentId === undefined) { + throw new RequiredError("segmentId", "getRumSegment"); + } + + // Path Params + const localVarPath = "/api/v2/rum/segment/{segment_id}".replace( + "{segment_id}", + encodeURIComponent(String(segmentId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "RUMUserSegmentsApi.v2.getRumSegment", + RUMUserSegmentsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async initializeRumSegments( + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations["RUMUserSegmentsApi.v2.initializeRumSegments"] + ) { + throw new Error( + "Unstable operation 'initializeRumSegments' is disabled. Enable it by setting `configuration.unstableOperations['RUMUserSegmentsApi.v2.initializeRumSegments'] = true`", + ); + } + + // Path Params + const localVarPath = "/api/v2/rum/segment/initialize"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "RUMUserSegmentsApi.v2.initializeRumSegments", + RUMUserSegmentsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.POST, + overrides, + ); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async listRumSegments( + sort?: string, + limit?: number, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if (!_config.unstableOperations["RUMUserSegmentsApi.v2.listRumSegments"]) { + throw new Error( + "Unstable operation 'listRumSegments' is disabled. Enable it by setting `configuration.unstableOperations['RUMUserSegmentsApi.v2.listRumSegments'] = true`", + ); + } + + // Path Params + const localVarPath = "/api/v2/rum/segment"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "RUMUserSegmentsApi.v2.listRumSegments", + RUMUserSegmentsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Query Params + if (sort !== undefined) { + requestContext.setQueryParam( + "sort", + serialize(sort, TypingInfo, "string", ""), + "", + ); + } + if (limit !== undefined) { + requestContext.setQueryParam( + "limit", + serialize(limit, TypingInfo, "number", ""), + "", + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async listRumSegmentTemplates( + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations[ + "RUMUserSegmentsApi.v2.listRumSegmentTemplates" + ] + ) { + throw new Error( + "Unstable operation 'listRumSegmentTemplates' is disabled. Enable it by setting `configuration.unstableOperations['RUMUserSegmentsApi.v2.listRumSegmentTemplates'] = true`", + ); + } + + // Path Params + const localVarPath = "/api/v2/rum/segment/templates"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "RUMUserSegmentsApi.v2.listRumSegmentTemplates", + RUMUserSegmentsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async updateRumSegment( + segmentId: string, + body: RumSegmentUpdateRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if (!_config.unstableOperations["RUMUserSegmentsApi.v2.updateRumSegment"]) { + throw new Error( + "Unstable operation 'updateRumSegment' is disabled. Enable it by setting `configuration.unstableOperations['RUMUserSegmentsApi.v2.updateRumSegment'] = true`", + ); + } + + // verify required parameter 'segmentId' is not null or undefined + if (segmentId === null || segmentId === undefined) { + throw new RequiredError("segmentId", "updateRumSegment"); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "updateRumSegment"); + } + + // Path Params + const localVarPath = "/api/v2/rum/segment/{segment_id}".replace( + "{segment_id}", + encodeURIComponent(String(segmentId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "RUMUserSegmentsApi.v2.updateRumSegment", + RUMUserSegmentsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.PUT, + overrides, + ); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "RumSegmentUpdateRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } +} + +export class RUMUserSegmentsApiResponseProcessor { + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createRumSegment + * @throws ApiException if the response code was not in [200, 299] + */ + public async createRumSegment( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 201) { + const body: RumSegmentResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "RumSegmentResponse", + ) as RumSegmentResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 409 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: RumSegmentResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "RumSegmentResponse", + "", + ) as RumSegmentResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createRumStaticSegment + * @throws ApiException if the response code was not in [200, 299] + */ + public async createRumStaticSegment( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 201) { + const body: RumSegmentResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "RumSegmentResponse", + ) as RumSegmentResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 409 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: RumSegmentResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "RumSegmentResponse", + "", + ) as RumSegmentResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteRumSegment + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteRumSegment( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: RumSegmentDeleteResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "RumSegmentDeleteResponse", + ) as RumSegmentDeleteResponse; + return body; + } + if (response.httpStatusCode === 403 || response.httpStatusCode === 404) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: RumSegmentDeleteResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "RumSegmentDeleteResponse", + "", + ) as RumSegmentDeleteResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getRumSegment + * @throws ApiException if the response code was not in [200, 299] + */ + public async getRumSegment( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: RumSegmentResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "RumSegmentResponse", + ) as RumSegmentResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: RumSegmentResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "RumSegmentResponse", + "", + ) as RumSegmentResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to initializeRumSegments + * @throws ApiException if the response code was not in [200, 299] + */ + public async initializeRumSegments(response: ResponseContext): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + return; + } + if (response.httpStatusCode === 403) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listRumSegments + * @throws ApiException if the response code was not in [200, 299] + */ + public async listRumSegments( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: RumSegmentListResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "RumSegmentListResponse", + ) as RumSegmentListResponse; + return body; + } + if (response.httpStatusCode === 400 || response.httpStatusCode === 403) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: RumSegmentListResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "RumSegmentListResponse", + "", + ) as RumSegmentListResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listRumSegmentTemplates + * @throws ApiException if the response code was not in [200, 299] + */ + public async listRumSegmentTemplates( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: RumSegmentTemplateListResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "RumSegmentTemplateListResponse", + ) as RumSegmentTemplateListResponse; + return body; + } + if (response.httpStatusCode === 400 || response.httpStatusCode === 403) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: RumSegmentTemplateListResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "RumSegmentTemplateListResponse", + "", + ) as RumSegmentTemplateListResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to updateRumSegment + * @throws ApiException if the response code was not in [200, 299] + */ + public async updateRumSegment(response: ResponseContext): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 204) { + return; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 409 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } +} + +export interface RUMUserSegmentsApiCreateRumSegmentRequest { + /** + * @type RumSegmentCreateRequest + */ + body: RumSegmentCreateRequest; +} + +export interface RUMUserSegmentsApiCreateRumStaticSegmentRequest { + /** + * @type RumStaticSegmentCreateRequest + */ + body: RumStaticSegmentCreateRequest; +} + +export interface RUMUserSegmentsApiDeleteRumSegmentRequest { + /** + * The identifier of the segment. + * @type string + */ + segmentId: string; +} + +export interface RUMUserSegmentsApiGetRumSegmentRequest { + /** + * The identifier of the segment. + * @type string + */ + segmentId: string; +} + +export interface RUMUserSegmentsApiListRumSegmentsRequest { + /** + * Sort order for the segments list. + * @type string + */ + sort?: string; + /** + * Maximum number of segments to return. + * @type number + */ + limit?: number; +} + +export interface RUMUserSegmentsApiUpdateRumSegmentRequest { + /** + * The identifier of the segment. + * @type string + */ + segmentId: string; + /** + * @type RumSegmentUpdateRequest + */ + body: RumSegmentUpdateRequest; +} + +export class RUMUserSegmentsApi { + private requestFactory: RUMUserSegmentsApiRequestFactory; + private responseProcessor: RUMUserSegmentsApiResponseProcessor; + private configuration: Configuration; + + static operationServers: { [key: string]: BaseServerConfiguration[] } = {}; + + public constructor( + configuration?: Configuration, + requestFactory?: RUMUserSegmentsApiRequestFactory, + responseProcessor?: RUMUserSegmentsApiResponseProcessor, + ) { + this.configuration = configuration || createConfiguration(); + this.requestFactory = + requestFactory || + new RUMUserSegmentsApiRequestFactory(this.configuration); + this.responseProcessor = + responseProcessor || new RUMUserSegmentsApiResponseProcessor(); + } + + /** + * Create a new user segment for the current organization. + * @param param The request object + */ + public createRumSegment( + param: RUMUserSegmentsApiCreateRumSegmentRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.createRumSegment( + param.body, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.createRumSegment(responseContext); + }); + }); + } + + /** + * Create a new static user segment from a journey query. Static segments contain a fixed list of users computed from the query at creation time. + * @param param The request object + */ + public createRumStaticSegment( + param: RUMUserSegmentsApiCreateRumStaticSegmentRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.createRumStaticSegment( + param.body, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.createRumStaticSegment(responseContext); + }); + }); + } + + /** + * Delete a user segment by its identifier. + * @param param The request object + */ + public deleteRumSegment( + param: RUMUserSegmentsApiDeleteRumSegmentRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.deleteRumSegment( + param.segmentId, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.deleteRumSegment(responseContext); + }); + }); + } + + /** + * Get a specific user segment by its identifier. + * @param param The request object + */ + public getRumSegment( + param: RUMUserSegmentsApiGetRumSegmentRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.getRumSegment( + param.segmentId, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getRumSegment(responseContext); + }); + }); + } + + /** + * Initialize default segments for the current organization. This creates a set of predefined segments if they do not already exist. + * @param param The request object + */ + public initializeRumSegments(options?: Configuration): Promise { + const requestContextPromise = + this.requestFactory.initializeRumSegments(options); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.initializeRumSegments(responseContext); + }); + }); + } + + /** + * List all user segments for the current organization. Supports sorting and pagination. + * @param param The request object + */ + public listRumSegments( + param: RUMUserSegmentsApiListRumSegmentsRequest = {}, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.listRumSegments( + param.sort, + param.limit, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listRumSegments(responseContext); + }); + }); + } + + /** + * List all available segment templates. Templates provide predefined segment configurations that can be customized with parameters. + * @param param The request object + */ + public listRumSegmentTemplates( + options?: Configuration, + ): Promise { + const requestContextPromise = + this.requestFactory.listRumSegmentTemplates(options); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listRumSegmentTemplates( + responseContext, + ); + }); + }); + } + + /** + * Update an existing user segment. All fields in the request body are optional. + * @param param The request object + */ + public updateRumSegment( + param: RUMUserSegmentsApiUpdateRumSegmentRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.updateRumSegment( + param.segmentId, + param.body, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.updateRumSegment(responseContext); + }); + }); + } +} diff --git a/services/rum_user_segments/src/v2/index.ts b/services/rum_user_segments/src/v2/index.ts new file mode 100644 index 000000000000..112504244875 --- /dev/null +++ b/services/rum_user_segments/src/v2/index.ts @@ -0,0 +1,53 @@ +export { + RUMUserSegmentsApiCreateRumSegmentRequest, + RUMUserSegmentsApiCreateRumStaticSegmentRequest, + RUMUserSegmentsApiDeleteRumSegmentRequest, + RUMUserSegmentsApiGetRumSegmentRequest, + RUMUserSegmentsApiListRumSegmentsRequest, + RUMUserSegmentsApiUpdateRumSegmentRequest, + RUMUserSegmentsApi, +} from "./RUMUserSegmentsApi"; + +export { APIErrorResponse } from "./models/APIErrorResponse"; +export { JSONAPIErrorItem } from "./models/JSONAPIErrorItem"; +export { JSONAPIErrorItemSource } from "./models/JSONAPIErrorItemSource"; +export { JSONAPIErrorResponse } from "./models/JSONAPIErrorResponse"; +export { RumSegmentCreateAttributes } from "./models/RumSegmentCreateAttributes"; +export { RumSegmentCreateData } from "./models/RumSegmentCreateData"; +export { RumSegmentCreateRequest } from "./models/RumSegmentCreateRequest"; +export { RumSegmentDataQuery } from "./models/RumSegmentDataQuery"; +export { RumSegmentDeleteAttributes } from "./models/RumSegmentDeleteAttributes"; +export { RumSegmentDeleteData } from "./models/RumSegmentDeleteData"; +export { RumSegmentDeleteResponse } from "./models/RumSegmentDeleteResponse"; +export { RumSegmentDeleteType } from "./models/RumSegmentDeleteType"; +export { RumSegmentEventPlatform } from "./models/RumSegmentEventPlatform"; +export { RumSegmentJourney } from "./models/RumSegmentJourney"; +export { RumSegmentListResponse } from "./models/RumSegmentListResponse"; +export { RumSegmentReferenceTable } from "./models/RumSegmentReferenceTable"; +export { RumSegmentReferenceTableColumn } from "./models/RumSegmentReferenceTableColumn"; +export { RumSegmentReferenceTableJoinCondition } from "./models/RumSegmentReferenceTableJoinCondition"; +export { RumSegmentResourceType } from "./models/RumSegmentResourceType"; +export { RumSegmentResponse } from "./models/RumSegmentResponse"; +export { RumSegmentResponseAttributes } from "./models/RumSegmentResponseAttributes"; +export { RumSegmentResponseData } from "./models/RumSegmentResponseData"; +export { RumSegmentSegmentType } from "./models/RumSegmentSegmentType"; +export { RumSegmentSource } from "./models/RumSegmentSource"; +export { RumSegmentStaticEntry } from "./models/RumSegmentStaticEntry"; +export { RumSegmentTemplateInstance } from "./models/RumSegmentTemplateInstance"; +export { RumSegmentTemplateListResponse } from "./models/RumSegmentTemplateListResponse"; +export { RumSegmentTemplateParameterDef } from "./models/RumSegmentTemplateParameterDef"; +export { RumSegmentTemplateResourceType } from "./models/RumSegmentTemplateResourceType"; +export { RumSegmentTemplateResponseAttributes } from "./models/RumSegmentTemplateResponseAttributes"; +export { RumSegmentTemplateResponseData } from "./models/RumSegmentTemplateResponseData"; +export { RumSegmentTemplateStatus } from "./models/RumSegmentTemplateStatus"; +export { RumSegmentUpdateAttributes } from "./models/RumSegmentUpdateAttributes"; +export { RumSegmentUpdateData } from "./models/RumSegmentUpdateData"; +export { RumSegmentUpdateRequest } from "./models/RumSegmentUpdateRequest"; +export { RumSegmentUser } from "./models/RumSegmentUser"; +export { RumStaticSegmentCreateAttributes } from "./models/RumStaticSegmentCreateAttributes"; +export { RumStaticSegmentCreateData } from "./models/RumStaticSegmentCreateData"; +export { RumStaticSegmentCreateRequest } from "./models/RumStaticSegmentCreateRequest"; +export { RumStaticSegmentJourneyFilter } from "./models/RumStaticSegmentJourneyFilter"; +export { RumStaticSegmentJourneyNode } from "./models/RumStaticSegmentJourneyNode"; +export { RumStaticSegmentJourneyQueryObject } from "./models/RumStaticSegmentJourneyQueryObject"; +export { RumStaticSegmentRequestType } from "./models/RumStaticSegmentRequestType"; diff --git a/services/rum_user_segments/src/v2/models/APIErrorResponse.ts b/services/rum_user_segments/src/v2/models/APIErrorResponse.ts new file mode 100644 index 000000000000..58d6c35b80f0 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/APIErrorResponse.ts @@ -0,0 +1,45 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * API error response. + */ +export class APIErrorResponse { + /** + * A list of errors. + */ + "errors": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + errors: { + baseName: "errors", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return APIErrorResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/JSONAPIErrorItem.ts b/services/rum_user_segments/src/v2/models/JSONAPIErrorItem.ts new file mode 100644 index 000000000000..a1ca45cd463c --- /dev/null +++ b/services/rum_user_segments/src/v2/models/JSONAPIErrorItem.ts @@ -0,0 +1,78 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { JSONAPIErrorItemSource } from "./JSONAPIErrorItemSource"; + +/** + * API error response body + */ +export class JSONAPIErrorItem { + /** + * A human-readable explanation specific to this occurrence of the error. + */ + "detail"?: string; + /** + * Non-standard meta-information about the error + */ + "meta"?: { [key: string]: any }; + /** + * References to the source of the error. + */ + "source"?: JSONAPIErrorItemSource; + /** + * Status code of the response. + */ + "status"?: string; + /** + * Short human-readable summary of the error. + */ + "title"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + detail: { + baseName: "detail", + type: "string", + }, + meta: { + baseName: "meta", + type: "{ [key: string]: any; }", + }, + source: { + baseName: "source", + type: "JSONAPIErrorItemSource", + }, + status: { + baseName: "status", + type: "string", + }, + title: { + baseName: "title", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return JSONAPIErrorItem.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/JSONAPIErrorItemSource.ts b/services/rum_user_segments/src/v2/models/JSONAPIErrorItemSource.ts new file mode 100644 index 000000000000..5889114315fa --- /dev/null +++ b/services/rum_user_segments/src/v2/models/JSONAPIErrorItemSource.ts @@ -0,0 +1,60 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * References to the source of the error. + */ +export class JSONAPIErrorItemSource { + /** + * A string indicating the name of a single request header which caused the error. + */ + "header"?: string; + /** + * A string indicating which URI query parameter caused the error. + */ + "parameter"?: string; + /** + * A JSON pointer to the value in the request document that caused the error. + */ + "pointer"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + header: { + baseName: "header", + type: "string", + }, + parameter: { + baseName: "parameter", + type: "string", + }, + pointer: { + baseName: "pointer", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return JSONAPIErrorItemSource.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/JSONAPIErrorResponse.ts b/services/rum_user_segments/src/v2/models/JSONAPIErrorResponse.ts new file mode 100644 index 000000000000..68aa04ffc27b --- /dev/null +++ b/services/rum_user_segments/src/v2/models/JSONAPIErrorResponse.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { JSONAPIErrorItem } from "./JSONAPIErrorItem"; + +/** + * API error response. + */ +export class JSONAPIErrorResponse { + /** + * A list of errors. + */ + "errors": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + errors: { + baseName: "errors", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return JSONAPIErrorResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentCreateAttributes.ts b/services/rum_user_segments/src/v2/models/RumSegmentCreateAttributes.ts new file mode 100644 index 000000000000..29dccfc8365f --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentCreateAttributes.ts @@ -0,0 +1,72 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentDataQuery } from "./RumSegmentDataQuery"; + +/** + * Attributes for creating a new segment. + */ +export class RumSegmentCreateAttributes { + /** + * Query definition for the segment. Contains one or more query blocks and an optional combination formula. + */ + "dataQuery": RumSegmentDataQuery; + /** + * A description of the segment. + */ + "description"?: string; + /** + * The name of the segment. + */ + "name": string; + /** + * A list of tags for the segment. + */ + "tags"?: Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + dataQuery: { + baseName: "data_query", + type: "RumSegmentDataQuery", + required: true, + }, + description: { + baseName: "description", + type: "string", + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + tags: { + baseName: "tags", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentCreateAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentCreateData.ts b/services/rum_user_segments/src/v2/models/RumSegmentCreateData.ts new file mode 100644 index 000000000000..32fdd4fb9607 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentCreateData.ts @@ -0,0 +1,57 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentCreateAttributes } from "./RumSegmentCreateAttributes"; +import { RumSegmentResourceType } from "./RumSegmentResourceType"; + +/** + * Data object for a segment creation request. + */ +export class RumSegmentCreateData { + /** + * Attributes for creating a new segment. + */ + "attributes": RumSegmentCreateAttributes; + /** + * Type of the segment resource. + */ + "type": RumSegmentResourceType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "RumSegmentCreateAttributes", + required: true, + }, + type: { + baseName: "type", + type: "RumSegmentResourceType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentCreateData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentCreateRequest.ts b/services/rum_user_segments/src/v2/models/RumSegmentCreateRequest.ts new file mode 100644 index 000000000000..de86e7eeb151 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentCreateRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentCreateData } from "./RumSegmentCreateData"; + +/** + * Request body for creating a new segment. + */ +export class RumSegmentCreateRequest { + /** + * Data object for a segment creation request. + */ + "data": RumSegmentCreateData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "RumSegmentCreateData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentCreateRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentDataQuery.ts b/services/rum_user_segments/src/v2/models/RumSegmentDataQuery.ts new file mode 100644 index 000000000000..372539c78523 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentDataQuery.ts @@ -0,0 +1,90 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentEventPlatform } from "./RumSegmentEventPlatform"; +import { RumSegmentJourney } from "./RumSegmentJourney"; +import { RumSegmentReferenceTable } from "./RumSegmentReferenceTable"; +import { RumSegmentStaticEntry } from "./RumSegmentStaticEntry"; +import { RumSegmentTemplateInstance } from "./RumSegmentTemplateInstance"; + +/** + * Query definition for the segment. Contains one or more query blocks and an optional combination formula. + */ +export class RumSegmentDataQuery { + /** + * Boolean expression combining multiple query blocks. + */ + "combination"?: string; + /** + * List of event platform query blocks. + */ + "eventPlatforms"?: Array; + /** + * List of journey-based query blocks. + */ + "journeys"?: Array; + /** + * List of reference table query blocks. + */ + "referenceTables"?: Array; + /** + * List of static user list blocks. + */ + "_static"?: Array; + /** + * List of template-based query blocks. + */ + "templates"?: Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + combination: { + baseName: "combination", + type: "string", + }, + eventPlatforms: { + baseName: "event_platforms", + type: "Array", + }, + journeys: { + baseName: "journeys", + type: "Array", + }, + referenceTables: { + baseName: "reference_tables", + type: "Array", + }, + _static: { + baseName: "static", + type: "Array", + }, + templates: { + baseName: "templates", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentDataQuery.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentDeleteAttributes.ts b/services/rum_user_segments/src/v2/models/RumSegmentDeleteAttributes.ts new file mode 100644 index 000000000000..c24cf817a8ee --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentDeleteAttributes.ts @@ -0,0 +1,75 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentUser } from "./RumSegmentUser"; + +/** + * Attributes of a deleted segment response. + */ +export class RumSegmentDeleteAttributes { + /** + * The timestamp when the segment was disabled in RFC 3339 format. + */ + "disabledAt": Date; + /** + * A user who performed an action on a segment. + */ + "disabledBy": RumSegmentUser; + /** + * The name of the deleted segment. + */ + "name": string; + /** + * The unique identifier of the deleted segment. + */ + "uuid": string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + disabledAt: { + baseName: "disabled_at", + type: "Date", + required: true, + format: "date-time", + }, + disabledBy: { + baseName: "disabled_by", + type: "RumSegmentUser", + required: true, + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + uuid: { + baseName: "uuid", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentDeleteAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentDeleteData.ts b/services/rum_user_segments/src/v2/models/RumSegmentDeleteData.ts new file mode 100644 index 000000000000..c80b99aee0a9 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentDeleteData.ts @@ -0,0 +1,66 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentDeleteAttributes } from "./RumSegmentDeleteAttributes"; +import { RumSegmentDeleteType } from "./RumSegmentDeleteType"; + +/** + * Data object for a deleted segment response. + */ +export class RumSegmentDeleteData { + /** + * Attributes of a deleted segment response. + */ + "attributes": RumSegmentDeleteAttributes; + /** + * Unique identifier for the deleted segment. + */ + "id": string; + /** + * Type of the deleted segment resource. + */ + "type": RumSegmentDeleteType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "RumSegmentDeleteAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "RumSegmentDeleteType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentDeleteData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentDeleteResponse.ts b/services/rum_user_segments/src/v2/models/RumSegmentDeleteResponse.ts new file mode 100644 index 000000000000..17653a6ca521 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentDeleteResponse.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentDeleteData } from "./RumSegmentDeleteData"; + +/** + * Response for a segment deletion. + */ +export class RumSegmentDeleteResponse { + /** + * Data object for a deleted segment response. + */ + "data": RumSegmentDeleteData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "RumSegmentDeleteData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentDeleteResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentDeleteType.ts b/services/rum_user_segments/src/v2/models/RumSegmentDeleteType.ts new file mode 100644 index 000000000000..b57b0d938f25 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentDeleteType.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * Type of the deleted segment resource. + */ +export type RumSegmentDeleteType = typeof DELETED_SEGMENT | UnparsedObject; +export const DELETED_SEGMENT = "deleted_segment"; diff --git a/services/rum_user_segments/src/v2/models/RumSegmentEventPlatform.ts b/services/rum_user_segments/src/v2/models/RumSegmentEventPlatform.ts new file mode 100644 index 000000000000..bb456d19fe68 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentEventPlatform.ts @@ -0,0 +1,81 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * An event platform query block within a segment data query. + */ +export class RumSegmentEventPlatform { + /** + * The facet to extract user identifiers from. + */ + "facet": string; + /** + * The start of the time range in milliseconds since epoch. + */ + "from"?: number; + /** + * The name of this query block. + */ + "name": string; + /** + * The search query for filtering events. + */ + "query": string; + /** + * The end of the time range in milliseconds since epoch. + */ + "to"?: number; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + facet: { + baseName: "facet", + type: "string", + required: true, + }, + from: { + baseName: "from", + type: "number", + format: "int64", + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + query: { + baseName: "query", + type: "string", + required: true, + }, + to: { + baseName: "to", + type: "number", + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentEventPlatform.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentJourney.ts b/services/rum_user_segments/src/v2/models/RumSegmentJourney.ts new file mode 100644 index 000000000000..c096dc0297e2 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentJourney.ts @@ -0,0 +1,68 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * A journey-based query block within a segment data query. + */ +export class RumSegmentJourney { + /** + * The type of conversion to track. + */ + "conversionType"?: string; + /** + * The facet to group journey results by. + */ + "groupBy"?: string; + /** + * The name of this journey query block. + */ + "name"?: string; + /** + * The search query for filtering events. + */ + "search"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + conversionType: { + baseName: "conversion_type", + type: "string", + }, + groupBy: { + baseName: "group_by", + type: "string", + }, + name: { + baseName: "name", + type: "string", + }, + search: { + baseName: "search", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentJourney.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentListResponse.ts b/services/rum_user_segments/src/v2/models/RumSegmentListResponse.ts new file mode 100644 index 000000000000..f666436b8398 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentListResponse.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentResponseData } from "./RumSegmentResponseData"; + +/** + * Response for listing segments. + */ +export class RumSegmentListResponse { + /** + * The list of segments. + */ + "data": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentListResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentReferenceTable.ts b/services/rum_user_segments/src/v2/models/RumSegmentReferenceTable.ts new file mode 100644 index 000000000000..9fd5ac61e1c0 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentReferenceTable.ts @@ -0,0 +1,83 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentReferenceTableColumn } from "./RumSegmentReferenceTableColumn"; +import { RumSegmentReferenceTableJoinCondition } from "./RumSegmentReferenceTableJoinCondition"; + +/** + * A reference table query block within a segment data query. + */ +export class RumSegmentReferenceTable { + /** + * The columns to include from the reference table. + */ + "columns": Array; + /** + * An optional filter query for the reference table data. + */ + "filterQuery"?: string; + /** + * The join condition for a reference table query block. + */ + "joinCondition": RumSegmentReferenceTableJoinCondition; + /** + * The name of this query block. + */ + "name": string; + /** + * The name of the reference table. + */ + "tableName": string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + columns: { + baseName: "columns", + type: "Array", + required: true, + }, + filterQuery: { + baseName: "filter_query", + type: "string", + }, + joinCondition: { + baseName: "join_condition", + type: "RumSegmentReferenceTableJoinCondition", + required: true, + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + tableName: { + baseName: "table_name", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentReferenceTable.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentReferenceTableColumn.ts b/services/rum_user_segments/src/v2/models/RumSegmentReferenceTableColumn.ts new file mode 100644 index 000000000000..816098a605c8 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentReferenceTableColumn.ts @@ -0,0 +1,45 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * A column definition in a reference table query block. + */ +export class RumSegmentReferenceTableColumn { + /** + * The name of the column. + */ + "name": string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + name: { + baseName: "name", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentReferenceTableColumn.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentReferenceTableJoinCondition.ts b/services/rum_user_segments/src/v2/models/RumSegmentReferenceTableJoinCondition.ts new file mode 100644 index 000000000000..6d5e227b1fc0 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentReferenceTableJoinCondition.ts @@ -0,0 +1,54 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * The join condition for a reference table query block. + */ +export class RumSegmentReferenceTableJoinCondition { + /** + * The reference table column to join on. + */ + "columnName": string; + /** + * The RUM facet to join on. + */ + "facet": string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + columnName: { + baseName: "column_name", + type: "string", + required: true, + }, + facet: { + baseName: "facet", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentReferenceTableJoinCondition.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentResourceType.ts b/services/rum_user_segments/src/v2/models/RumSegmentResourceType.ts new file mode 100644 index 000000000000..53f77292df04 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentResourceType.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * Type of the segment resource. + */ +export type RumSegmentResourceType = typeof SEGMENT | UnparsedObject; +export const SEGMENT = "segment"; diff --git a/services/rum_user_segments/src/v2/models/RumSegmentResponse.ts b/services/rum_user_segments/src/v2/models/RumSegmentResponse.ts new file mode 100644 index 000000000000..db508509bde3 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentResponse.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentResponseData } from "./RumSegmentResponseData"; + +/** + * Response containing a single segment. + */ +export class RumSegmentResponse { + /** + * Data object for a segment in a response. + */ + "data": RumSegmentResponseData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "RumSegmentResponseData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentResponseAttributes.ts b/services/rum_user_segments/src/v2/models/RumSegmentResponseAttributes.ts new file mode 100644 index 000000000000..429113acefda --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentResponseAttributes.ts @@ -0,0 +1,172 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentDataQuery } from "./RumSegmentDataQuery"; +import { RumSegmentSegmentType } from "./RumSegmentSegmentType"; +import { RumSegmentSource } from "./RumSegmentSource"; +import { RumSegmentUser } from "./RumSegmentUser"; + +/** + * Attributes of a segment in a response. + */ +export class RumSegmentResponseAttributes { + /** + * The creation timestamp in RFC 3339 format. + */ + "createdAt": Date; + /** + * A user who performed an action on a segment. + */ + "createdBy": RumSegmentUser; + /** + * Query definition for the segment. Contains one or more query blocks and an optional combination formula. + */ + "dataQuery": RumSegmentDataQuery; + /** + * A description of the segment. + */ + "description": string; + /** + * The last modification timestamp in RFC 3339 format. + */ + "modifiedAt": Date; + /** + * A user who performed an action on a segment. + */ + "modifiedBy": RumSegmentUser; + /** + * The name of the segment. + */ + "name": string; + /** + * The organization identifier. + */ + "orgId": number; + /** + * The number of users in the segment. + */ + "rowCount": number; + /** + * The source of a segment. + */ + "source": RumSegmentSource; + /** + * A list of tags for the segment. + */ + "tags": Array; + /** + * The type of a segment based on its data query configuration. + */ + "type": RumSegmentSegmentType; + /** + * The unique identifier of the segment. + */ + "uuid": string; + /** + * The version number of the segment. + */ + "version": number; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + createdAt: { + baseName: "created_at", + type: "Date", + required: true, + format: "date-time", + }, + createdBy: { + baseName: "created_by", + type: "RumSegmentUser", + required: true, + }, + dataQuery: { + baseName: "data_query", + type: "RumSegmentDataQuery", + required: true, + }, + description: { + baseName: "description", + type: "string", + required: true, + }, + modifiedAt: { + baseName: "modified_at", + type: "Date", + required: true, + format: "date-time", + }, + modifiedBy: { + baseName: "modified_by", + type: "RumSegmentUser", + required: true, + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + orgId: { + baseName: "org_id", + type: "number", + required: true, + format: "int64", + }, + rowCount: { + baseName: "row_count", + type: "number", + required: true, + format: "int64", + }, + source: { + baseName: "source", + type: "RumSegmentSource", + required: true, + }, + tags: { + baseName: "tags", + type: "Array", + required: true, + }, + type: { + baseName: "type", + type: "RumSegmentSegmentType", + required: true, + }, + uuid: { + baseName: "uuid", + type: "string", + required: true, + }, + version: { + baseName: "version", + type: "number", + required: true, + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentResponseAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentResponseData.ts b/services/rum_user_segments/src/v2/models/RumSegmentResponseData.ts new file mode 100644 index 000000000000..51b360c66343 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentResponseData.ts @@ -0,0 +1,66 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentResourceType } from "./RumSegmentResourceType"; +import { RumSegmentResponseAttributes } from "./RumSegmentResponseAttributes"; + +/** + * Data object for a segment in a response. + */ +export class RumSegmentResponseData { + /** + * Attributes of a segment in a response. + */ + "attributes": RumSegmentResponseAttributes; + /** + * The unique identifier of the segment. + */ + "id": string; + /** + * Type of the segment resource. + */ + "type": RumSegmentResourceType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "RumSegmentResponseAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "RumSegmentResourceType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentResponseData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentSegmentType.ts b/services/rum_user_segments/src/v2/models/RumSegmentSegmentType.ts new file mode 100644 index 000000000000..820831e68658 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentSegmentType.ts @@ -0,0 +1,19 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The type of a segment based on its data query configuration. + */ +export type RumSegmentSegmentType = + | typeof STATIC + | typeof EVENT_PLATFORM + | typeof COMBINATION + | typeof JOURNEYS + | typeof REFERENCE_TABLE + | typeof TEMPLATES + | UnparsedObject; +export const STATIC = "static"; +export const EVENT_PLATFORM = "event_platform"; +export const COMBINATION = "combination"; +export const JOURNEYS = "journeys"; +export const REFERENCE_TABLE = "reference_table"; +export const TEMPLATES = "templates"; diff --git a/services/rum_user_segments/src/v2/models/RumSegmentSource.ts b/services/rum_user_segments/src/v2/models/RumSegmentSource.ts new file mode 100644 index 000000000000..18575b6c01f3 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentSource.ts @@ -0,0 +1,11 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The source of a segment. + */ +export type RumSegmentSource = + | typeof USER_CREATED + | typeof INITIAL + | UnparsedObject; +export const USER_CREATED = "user_created"; +export const INITIAL = "initial"; diff --git a/services/rum_user_segments/src/v2/models/RumSegmentStaticEntry.ts b/services/rum_user_segments/src/v2/models/RumSegmentStaticEntry.ts new file mode 100644 index 000000000000..c823807e213d --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentStaticEntry.ts @@ -0,0 +1,64 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * A static user list entry within a segment data query. + */ +export class RumSegmentStaticEntry { + /** + * The identifier of the static list. + */ + "id": string; + /** + * The name of the static list. + */ + "name": string; + /** + * The number of users in the static list. + */ + "userCount": number; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + id: { + baseName: "id", + type: "string", + required: true, + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + userCount: { + baseName: "user_count", + type: "number", + required: true, + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentStaticEntry.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentTemplateInstance.ts b/services/rum_user_segments/src/v2/models/RumSegmentTemplateInstance.ts new file mode 100644 index 000000000000..0e81932328f8 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentTemplateInstance.ts @@ -0,0 +1,71 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * A template-based query block within a segment data query. + */ +export class RumSegmentTemplateInstance { + /** + * The start of the time range in milliseconds since epoch. + */ + "from"?: number; + /** + * The template parameters as key-value pairs. + */ + "parameters"?: { [key: string]: string }; + /** + * The identifier of the template. + */ + "templateId": string; + /** + * The end of the time range in milliseconds since epoch. + */ + "to"?: number; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + from: { + baseName: "from", + type: "number", + format: "int64", + }, + parameters: { + baseName: "parameters", + type: "{ [key: string]: string; }", + }, + templateId: { + baseName: "template_id", + type: "string", + required: true, + }, + to: { + baseName: "to", + type: "number", + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentTemplateInstance.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentTemplateListResponse.ts b/services/rum_user_segments/src/v2/models/RumSegmentTemplateListResponse.ts new file mode 100644 index 000000000000..acfedfe209d5 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentTemplateListResponse.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentTemplateResponseData } from "./RumSegmentTemplateResponseData"; + +/** + * Response for listing segment templates. + */ +export class RumSegmentTemplateListResponse { + /** + * The list of segment templates. + */ + "data": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentTemplateListResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentTemplateParameterDef.ts b/services/rum_user_segments/src/v2/models/RumSegmentTemplateParameterDef.ts new file mode 100644 index 000000000000..99a45fb4af30 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentTemplateParameterDef.ts @@ -0,0 +1,63 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * A parameter definition for a segment template. + */ +export class RumSegmentTemplateParameterDef { + /** + * The default value for the parameter. + */ + "_default": string; + /** + * A description of the parameter. + */ + "description": string; + /** + * Validation rules for the parameter. + */ + "validate": string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + _default: { + baseName: "default", + type: "string", + required: true, + }, + description: { + baseName: "description", + type: "string", + required: true, + }, + validate: { + baseName: "validate", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentTemplateParameterDef.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentTemplateResourceType.ts b/services/rum_user_segments/src/v2/models/RumSegmentTemplateResourceType.ts new file mode 100644 index 000000000000..cfbb03ecbf71 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentTemplateResourceType.ts @@ -0,0 +1,9 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * Type of the segment template resource. + */ +export type RumSegmentTemplateResourceType = + | typeof TEMPLATE_METADATA + | UnparsedObject; +export const TEMPLATE_METADATA = "template_metadata"; diff --git a/services/rum_user_segments/src/v2/models/RumSegmentTemplateResponseAttributes.ts b/services/rum_user_segments/src/v2/models/RumSegmentTemplateResponseAttributes.ts new file mode 100644 index 000000000000..7117e3aa1de2 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentTemplateResponseAttributes.ts @@ -0,0 +1,114 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentTemplateParameterDef } from "./RumSegmentTemplateParameterDef"; +import { RumSegmentTemplateStatus } from "./RumSegmentTemplateStatus"; + +/** + * Attributes of a segment template in a response. + */ +export class RumSegmentTemplateResponseAttributes { + /** + * The category of the template. + */ + "category": string; + /** + * The creation timestamp in RFC 3339 format. + */ + "createdAt": Date; + /** + * A description of the template. + */ + "description": string; + /** + * The last modification timestamp in RFC 3339 format. + */ + "modifiedAt": Date; + /** + * The name of the template. + */ + "name": string; + /** + * The template parameter definitions. + */ + "parameters": { [key: string]: RumSegmentTemplateParameterDef }; + /** + * The status of a segment template. + */ + "status": RumSegmentTemplateStatus; + /** + * The version number of the template. + */ + "version": number; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + category: { + baseName: "category", + type: "string", + required: true, + }, + createdAt: { + baseName: "created_at", + type: "Date", + required: true, + format: "date-time", + }, + description: { + baseName: "description", + type: "string", + required: true, + }, + modifiedAt: { + baseName: "modified_at", + type: "Date", + required: true, + format: "date-time", + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + parameters: { + baseName: "parameters", + type: "{ [key: string]: RumSegmentTemplateParameterDef; }", + required: true, + }, + status: { + baseName: "status", + type: "RumSegmentTemplateStatus", + required: true, + }, + version: { + baseName: "version", + type: "number", + required: true, + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentTemplateResponseAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentTemplateResponseData.ts b/services/rum_user_segments/src/v2/models/RumSegmentTemplateResponseData.ts new file mode 100644 index 000000000000..5a8499c90977 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentTemplateResponseData.ts @@ -0,0 +1,66 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentTemplateResourceType } from "./RumSegmentTemplateResourceType"; +import { RumSegmentTemplateResponseAttributes } from "./RumSegmentTemplateResponseAttributes"; + +/** + * Data object for a segment template in a response. + */ +export class RumSegmentTemplateResponseData { + /** + * Attributes of a segment template in a response. + */ + "attributes": RumSegmentTemplateResponseAttributes; + /** + * The unique identifier of the template. + */ + "id": string; + /** + * Type of the segment template resource. + */ + "type": RumSegmentTemplateResourceType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "RumSegmentTemplateResponseAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "RumSegmentTemplateResourceType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentTemplateResponseData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentTemplateStatus.ts b/services/rum_user_segments/src/v2/models/RumSegmentTemplateStatus.ts new file mode 100644 index 000000000000..2ec8908e6d57 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentTemplateStatus.ts @@ -0,0 +1,13 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The status of a segment template. + */ +export type RumSegmentTemplateStatus = + | typeof ACTIVE + | typeof DEPRECATED + | typeof ARCHIVED + | UnparsedObject; +export const ACTIVE = "active"; +export const DEPRECATED = "deprecated"; +export const ARCHIVED = "archived"; diff --git a/services/rum_user_segments/src/v2/models/RumSegmentUpdateAttributes.ts b/services/rum_user_segments/src/v2/models/RumSegmentUpdateAttributes.ts new file mode 100644 index 000000000000..d577b9e92d6f --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentUpdateAttributes.ts @@ -0,0 +1,70 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentDataQuery } from "./RumSegmentDataQuery"; + +/** + * Attributes for updating a segment. All fields are optional. + */ +export class RumSegmentUpdateAttributes { + /** + * Query definition for the segment. Contains one or more query blocks and an optional combination formula. + */ + "dataQuery"?: RumSegmentDataQuery; + /** + * The updated description of the segment. + */ + "description"?: string; + /** + * The updated name of the segment. + */ + "name"?: string; + /** + * The updated list of tags for the segment. + */ + "tags"?: Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + dataQuery: { + baseName: "data_query", + type: "RumSegmentDataQuery", + }, + description: { + baseName: "description", + type: "string", + }, + name: { + baseName: "name", + type: "string", + }, + tags: { + baseName: "tags", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentUpdateAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentUpdateData.ts b/services/rum_user_segments/src/v2/models/RumSegmentUpdateData.ts new file mode 100644 index 000000000000..0a66b65f4039 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentUpdateData.ts @@ -0,0 +1,66 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentResourceType } from "./RumSegmentResourceType"; +import { RumSegmentUpdateAttributes } from "./RumSegmentUpdateAttributes"; + +/** + * Data object for a segment update request. + */ +export class RumSegmentUpdateData { + /** + * Attributes for updating a segment. All fields are optional. + */ + "attributes": RumSegmentUpdateAttributes; + /** + * The identifier of the segment to update. + */ + "id": string; + /** + * Type of the segment resource. + */ + "type": RumSegmentResourceType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "RumSegmentUpdateAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "RumSegmentResourceType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentUpdateData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentUpdateRequest.ts b/services/rum_user_segments/src/v2/models/RumSegmentUpdateRequest.ts new file mode 100644 index 000000000000..5cb4425e365e --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentUpdateRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumSegmentUpdateData } from "./RumSegmentUpdateData"; + +/** + * Request body for updating a segment. + */ +export class RumSegmentUpdateRequest { + /** + * Data object for a segment update request. + */ + "data": RumSegmentUpdateData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "RumSegmentUpdateData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentUpdateRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumSegmentUser.ts b/services/rum_user_segments/src/v2/models/RumSegmentUser.ts new file mode 100644 index 000000000000..d4d42e036817 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumSegmentUser.ts @@ -0,0 +1,81 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * A user who performed an action on a segment. + */ +export class RumSegmentUser { + /** + * The email handle of the user. + */ + "handle": string; + /** + * The URL of the user icon. + */ + "icon": string; + /** + * The numeric identifier of the user. + */ + "id": string; + /** + * The display name of the user. + */ + "name": string; + /** + * The unique identifier of the user. + */ + "uuid": string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + handle: { + baseName: "handle", + type: "string", + required: true, + }, + icon: { + baseName: "icon", + type: "string", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + uuid: { + baseName: "uuid", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumSegmentUser.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumStaticSegmentCreateAttributes.ts b/services/rum_user_segments/src/v2/models/RumStaticSegmentCreateAttributes.ts new file mode 100644 index 000000000000..3215a09ae240 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumStaticSegmentCreateAttributes.ts @@ -0,0 +1,73 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumStaticSegmentJourneyQueryObject } from "./RumStaticSegmentJourneyQueryObject"; + +/** + * Attributes for creating a new static segment. + */ +export class RumStaticSegmentCreateAttributes { + /** + * A description of the static segment. + */ + "description": string; + /** + * The journey query object used to compute the static segment user list. + */ + "journeyQueryObject": RumStaticSegmentJourneyQueryObject; + /** + * The name of the static segment. + */ + "name": string; + /** + * A list of tags for the static segment. + */ + "tags"?: Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + description: { + baseName: "description", + type: "string", + required: true, + }, + journeyQueryObject: { + baseName: "journey_query_object", + type: "RumStaticSegmentJourneyQueryObject", + required: true, + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + tags: { + baseName: "tags", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumStaticSegmentCreateAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumStaticSegmentCreateData.ts b/services/rum_user_segments/src/v2/models/RumStaticSegmentCreateData.ts new file mode 100644 index 000000000000..5057b2698722 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumStaticSegmentCreateData.ts @@ -0,0 +1,57 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumStaticSegmentCreateAttributes } from "./RumStaticSegmentCreateAttributes"; +import { RumStaticSegmentRequestType } from "./RumStaticSegmentRequestType"; + +/** + * Data object for a static segment creation request. + */ +export class RumStaticSegmentCreateData { + /** + * Attributes for creating a new static segment. + */ + "attributes": RumStaticSegmentCreateAttributes; + /** + * Type of the static segment creation request resource. + */ + "type": RumStaticSegmentRequestType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "RumStaticSegmentCreateAttributes", + required: true, + }, + type: { + baseName: "type", + type: "RumStaticSegmentRequestType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumStaticSegmentCreateData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumStaticSegmentCreateRequest.ts b/services/rum_user_segments/src/v2/models/RumStaticSegmentCreateRequest.ts new file mode 100644 index 000000000000..7f5c4d9e7ccc --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumStaticSegmentCreateRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumStaticSegmentCreateData } from "./RumStaticSegmentCreateData"; + +/** + * Request body for creating a new static segment. + */ +export class RumStaticSegmentCreateRequest { + /** + * Data object for a static segment creation request. + */ + "data": RumStaticSegmentCreateData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "RumStaticSegmentCreateData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumStaticSegmentCreateRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumStaticSegmentJourneyFilter.ts b/services/rum_user_segments/src/v2/models/RumStaticSegmentJourneyFilter.ts new file mode 100644 index 000000000000..cf3d783212e6 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumStaticSegmentJourneyFilter.ts @@ -0,0 +1,54 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * A filter within a journey query node. + */ +export class RumStaticSegmentJourneyFilter { + /** + * The attribute to filter on. + */ + "attribute": string; + /** + * The value to match. + */ + "value": string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attribute: { + baseName: "attribute", + type: "string", + required: true, + }, + value: { + baseName: "value", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumStaticSegmentJourneyFilter.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumStaticSegmentJourneyNode.ts b/services/rum_user_segments/src/v2/models/RumStaticSegmentJourneyNode.ts new file mode 100644 index 000000000000..647a8eae1c92 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumStaticSegmentJourneyNode.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumStaticSegmentJourneyFilter } from "./RumStaticSegmentJourneyFilter"; + +/** + * A node in a journey query object. + */ +export class RumStaticSegmentJourneyNode { + /** + * The list of filters for this node. + */ + "filters": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + filters: { + baseName: "filters", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumStaticSegmentJourneyNode.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumStaticSegmentJourneyQueryObject.ts b/services/rum_user_segments/src/v2/models/RumStaticSegmentJourneyQueryObject.ts new file mode 100644 index 000000000000..910d7126546b --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumStaticSegmentJourneyQueryObject.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RumStaticSegmentJourneyNode } from "./RumStaticSegmentJourneyNode"; + +/** + * The journey query object used to compute the static segment user list. + */ +export class RumStaticSegmentJourneyQueryObject { + /** + * The list of journey nodes defining the query. + */ + "nodes": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + nodes: { + baseName: "nodes", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RumStaticSegmentJourneyQueryObject.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/rum_user_segments/src/v2/models/RumStaticSegmentRequestType.ts b/services/rum_user_segments/src/v2/models/RumStaticSegmentRequestType.ts new file mode 100644 index 000000000000..9bbca0262e38 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/RumStaticSegmentRequestType.ts @@ -0,0 +1,9 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * Type of the static segment creation request resource. + */ +export type RumStaticSegmentRequestType = + | typeof CREATE_STATIC_SEGMENT_REQUEST + | UnparsedObject; +export const CREATE_STATIC_SEGMENT_REQUEST = "create_static_segment_request"; diff --git a/services/rum_user_segments/src/v2/models/TypingInfo.ts b/services/rum_user_segments/src/v2/models/TypingInfo.ts new file mode 100644 index 000000000000..4b5c649c7c83 --- /dev/null +++ b/services/rum_user_segments/src/v2/models/TypingInfo.ts @@ -0,0 +1,97 @@ +import { ModelTypingInfo } from "@datadog/datadog-api-client"; + +import { APIErrorResponse } from "./APIErrorResponse"; +import { JSONAPIErrorItem } from "./JSONAPIErrorItem"; +import { JSONAPIErrorItemSource } from "./JSONAPIErrorItemSource"; +import { JSONAPIErrorResponse } from "./JSONAPIErrorResponse"; +import { RumSegmentCreateAttributes } from "./RumSegmentCreateAttributes"; +import { RumSegmentCreateData } from "./RumSegmentCreateData"; +import { RumSegmentCreateRequest } from "./RumSegmentCreateRequest"; +import { RumSegmentDataQuery } from "./RumSegmentDataQuery"; +import { RumSegmentDeleteAttributes } from "./RumSegmentDeleteAttributes"; +import { RumSegmentDeleteData } from "./RumSegmentDeleteData"; +import { RumSegmentDeleteResponse } from "./RumSegmentDeleteResponse"; +import { RumSegmentEventPlatform } from "./RumSegmentEventPlatform"; +import { RumSegmentJourney } from "./RumSegmentJourney"; +import { RumSegmentListResponse } from "./RumSegmentListResponse"; +import { RumSegmentReferenceTable } from "./RumSegmentReferenceTable"; +import { RumSegmentReferenceTableColumn } from "./RumSegmentReferenceTableColumn"; +import { RumSegmentReferenceTableJoinCondition } from "./RumSegmentReferenceTableJoinCondition"; +import { RumSegmentResponse } from "./RumSegmentResponse"; +import { RumSegmentResponseAttributes } from "./RumSegmentResponseAttributes"; +import { RumSegmentResponseData } from "./RumSegmentResponseData"; +import { RumSegmentStaticEntry } from "./RumSegmentStaticEntry"; +import { RumSegmentTemplateInstance } from "./RumSegmentTemplateInstance"; +import { RumSegmentTemplateListResponse } from "./RumSegmentTemplateListResponse"; +import { RumSegmentTemplateParameterDef } from "./RumSegmentTemplateParameterDef"; +import { RumSegmentTemplateResponseAttributes } from "./RumSegmentTemplateResponseAttributes"; +import { RumSegmentTemplateResponseData } from "./RumSegmentTemplateResponseData"; +import { RumSegmentUpdateAttributes } from "./RumSegmentUpdateAttributes"; +import { RumSegmentUpdateData } from "./RumSegmentUpdateData"; +import { RumSegmentUpdateRequest } from "./RumSegmentUpdateRequest"; +import { RumSegmentUser } from "./RumSegmentUser"; +import { RumStaticSegmentCreateAttributes } from "./RumStaticSegmentCreateAttributes"; +import { RumStaticSegmentCreateData } from "./RumStaticSegmentCreateData"; +import { RumStaticSegmentCreateRequest } from "./RumStaticSegmentCreateRequest"; +import { RumStaticSegmentJourneyFilter } from "./RumStaticSegmentJourneyFilter"; +import { RumStaticSegmentJourneyNode } from "./RumStaticSegmentJourneyNode"; +import { RumStaticSegmentJourneyQueryObject } from "./RumStaticSegmentJourneyQueryObject"; + +export const TypingInfo: ModelTypingInfo = { + enumsMap: { + RumSegmentDeleteType: ["deleted_segment"], + RumSegmentResourceType: ["segment"], + RumSegmentSegmentType: [ + "static", + "event_platform", + "combination", + "journeys", + "reference_table", + "templates", + ], + RumSegmentSource: ["user_created", "initial"], + RumSegmentTemplateResourceType: ["template_metadata"], + RumSegmentTemplateStatus: ["active", "deprecated", "archived"], + RumStaticSegmentRequestType: ["create_static_segment_request"], + }, + oneOfMap: {}, + typeMap: { + APIErrorResponse: APIErrorResponse, + JSONAPIErrorItem: JSONAPIErrorItem, + JSONAPIErrorItemSource: JSONAPIErrorItemSource, + JSONAPIErrorResponse: JSONAPIErrorResponse, + RumSegmentCreateAttributes: RumSegmentCreateAttributes, + RumSegmentCreateData: RumSegmentCreateData, + RumSegmentCreateRequest: RumSegmentCreateRequest, + RumSegmentDataQuery: RumSegmentDataQuery, + RumSegmentDeleteAttributes: RumSegmentDeleteAttributes, + RumSegmentDeleteData: RumSegmentDeleteData, + RumSegmentDeleteResponse: RumSegmentDeleteResponse, + RumSegmentEventPlatform: RumSegmentEventPlatform, + RumSegmentJourney: RumSegmentJourney, + RumSegmentListResponse: RumSegmentListResponse, + RumSegmentReferenceTable: RumSegmentReferenceTable, + RumSegmentReferenceTableColumn: RumSegmentReferenceTableColumn, + RumSegmentReferenceTableJoinCondition: + RumSegmentReferenceTableJoinCondition, + RumSegmentResponse: RumSegmentResponse, + RumSegmentResponseAttributes: RumSegmentResponseAttributes, + RumSegmentResponseData: RumSegmentResponseData, + RumSegmentStaticEntry: RumSegmentStaticEntry, + RumSegmentTemplateInstance: RumSegmentTemplateInstance, + RumSegmentTemplateListResponse: RumSegmentTemplateListResponse, + RumSegmentTemplateParameterDef: RumSegmentTemplateParameterDef, + RumSegmentTemplateResponseAttributes: RumSegmentTemplateResponseAttributes, + RumSegmentTemplateResponseData: RumSegmentTemplateResponseData, + RumSegmentUpdateAttributes: RumSegmentUpdateAttributes, + RumSegmentUpdateData: RumSegmentUpdateData, + RumSegmentUpdateRequest: RumSegmentUpdateRequest, + RumSegmentUser: RumSegmentUser, + RumStaticSegmentCreateAttributes: RumStaticSegmentCreateAttributes, + RumStaticSegmentCreateData: RumStaticSegmentCreateData, + RumStaticSegmentCreateRequest: RumStaticSegmentCreateRequest, + RumStaticSegmentJourneyFilter: RumStaticSegmentJourneyFilter, + RumStaticSegmentJourneyNode: RumStaticSegmentJourneyNode, + RumStaticSegmentJourneyQueryObject: RumStaticSegmentJourneyQueryObject, + }, +}; diff --git a/services/rum_user_segments/tsconfig.json b/services/rum_user_segments/tsconfig.json new file mode 100644 index 000000000000..d6c32bfb893c --- /dev/null +++ b/services/rum_user_segments/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "strict": true, + /* Basic Options */ + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "declaration": true, + + "esModuleInterop": true, + "resolveJsonModule": true, + + "noImplicitAny": true, + "noImplicitThis": true, + + /* Additional Checks */ + "noUnusedLocals": false /* Report errors on unused locals. */, // TODO: reenable (unused imports!) + "noUnusedParameters": false /* Report errors on unused parameters. */, // TODO: set to true again + "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, + "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, + + "sourceMap": true, + "outDir": "./dist", + "lib": ["es6", "es7"] + }, + "exclude": ["dist", "node_modules", "tests"], + "include": ["src"] +} diff --git a/yarn.lock b/yarn.lock index 87fef10ea2ba..317573218590 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1036,6 +1036,15 @@ __metadata: languageName: unknown linkType: soft +"@datadog/datadog-api-client-rum-user-segments@workspace:services/rum_user_segments": + version: 0.0.0-use.local + resolution: "@datadog/datadog-api-client-rum-user-segments@workspace:services/rum_user_segments" + dependencies: + "@datadog/datadog-api-client": "npm:^2.0.0-beta.2" + typescript: "npm:5.8.3" + languageName: unknown + linkType: soft + "@datadog/datadog-api-client-rum@workspace:services/rum": version: 0.0.0-use.local resolution: "@datadog/datadog-api-client-rum@workspace:services/rum"