Skip to content

Document case management attributes endpoints #2719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .generated-info
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"spec_repo_commit": "dcf594e",
"generated": "2025-07-31 09:55:56.724"
"spec_repo_commit": "b75095c",
"generated": "2025-07-31 10:46:07.850"
}
76 changes: 75 additions & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6891,14 +6891,16 @@ components:
- data
type: object
CaseAttributes:
description: Case attributes
description: Case resource attributes
properties:
archived_at:
description: Timestamp of when the case was archived
format: date-time
nullable: true
readOnly: true
type: string
attributes:
$ref: '#/components/schemas/CaseObjectAttributes'
closed_at:
description: Timestamp of when the case was closed
format: date-time
Expand Down Expand Up @@ -7003,6 +7005,13 @@ components:
required:
- data
type: object
CaseObjectAttributes:
additionalProperties:
items:
type: string
type: array
description: The definition of `CaseObjectAttributes` object.
type: object
CasePriority:
default: NOT_DEFINED
description: Case priority
Expand Down Expand Up @@ -7098,6 +7107,33 @@ components:
type: string
x-enum-varnames:
- STANDARD
CaseUpdateAttributes:
description: Case update attributes
properties:
attributes:
$ref: '#/components/schemas/CaseUpdateAttributesAttributes'
type:
$ref: '#/components/schemas/CaseResourceType'
required:
- attributes
- type
type: object
CaseUpdateAttributesAttributes:
description: Case update attributes attributes
properties:
attributes:
$ref: '#/components/schemas/CaseObjectAttributes'
required:
- attributes
type: object
CaseUpdateAttributesRequest:
description: Case update attributes request
properties:
data:
$ref: '#/components/schemas/CaseUpdateAttributes'
required:
- data
type: object
CaseUpdatePriority:
description: Case priority status
properties:
Expand Down Expand Up @@ -45579,6 +45615,44 @@ paths:
summary: Assign case
tags:
- Case Management
/api/v2/cases/{case_id}/attributes:
post:
description: Update case attributes
operationId: UpdateAttributes
parameters:
- $ref: '#/components/parameters/CaseIDPathParameter'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CaseUpdateAttributesRequest'
description: Case attributes update payload
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/CaseResponse'
description: OK
'400':
$ref: '#/components/responses/BadRequestResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- cases_write
summary: Update case attributes
tags:
- Case Management
/api/v2/cases/{case_id}/priority:
post:
description: Update case priority
Expand Down
28 changes: 28 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2118,6 +2118,13 @@ datadog\_api\_client.v2.model.case\_empty\_request module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.case\_object\_attributes module
-------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.case_object_attributes
:members:
:show-inheritance:

datadog\_api\_client.v2.model.case\_priority module
---------------------------------------------------

Expand Down Expand Up @@ -2181,6 +2188,27 @@ datadog\_api\_client.v2.model.case\_type module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.case\_update\_attributes module
-------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.case_update_attributes
:members:
:show-inheritance:

datadog\_api\_client.v2.model.case\_update\_attributes\_attributes module
-------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.case_update_attributes_attributes
:members:
:show-inheritance:

datadog\_api\_client.v2.model.case\_update\_attributes\_request module
----------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.case_update_attributes_request
:members:
:show-inheritance:

datadog\_api\_client.v2.model.case\_update\_priority module
-----------------------------------------------------------

Expand Down
42 changes: 42 additions & 0 deletions examples/v2/case-management/UpdateAttributes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""
Update case attributes returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.case_management_api import CaseManagementApi
from datadog_api_client.v2.model.case_object_attributes import CaseObjectAttributes
from datadog_api_client.v2.model.case_resource_type import CaseResourceType
from datadog_api_client.v2.model.case_update_attributes import CaseUpdateAttributes
from datadog_api_client.v2.model.case_update_attributes_attributes import CaseUpdateAttributesAttributes
from datadog_api_client.v2.model.case_update_attributes_request import CaseUpdateAttributesRequest

# there is a valid "case" in the system
CASE_ID = environ["CASE_ID"]

body = CaseUpdateAttributesRequest(
data=CaseUpdateAttributes(
attributes=CaseUpdateAttributesAttributes(
attributes=CaseObjectAttributes(
env=[
"test",
],
service=[
"web-store",
"web-api",
],
team=[
"engineer",
],
),
),
type=CaseResourceType.CASE,
),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = CaseManagementApi(api_client)
response = api_instance.update_attributes(case_id=CASE_ID, body=body)

print(response)
49 changes: 49 additions & 0 deletions src/datadog_api_client/v2/api/case_management_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from datadog_api_client.v2.model.project_create_request import ProjectCreateRequest
from datadog_api_client.v2.model.case_empty_request import CaseEmptyRequest
from datadog_api_client.v2.model.case_assign_request import CaseAssignRequest
from datadog_api_client.v2.model.case_update_attributes_request import CaseUpdateAttributesRequest
from datadog_api_client.v2.model.case_update_priority_request import CaseUpdatePriorityRequest
from datadog_api_client.v2.model.case_update_status_request import CaseUpdateStatusRequest

Expand Down Expand Up @@ -309,6 +310,32 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._update_attributes_endpoint = _Endpoint(
settings={
"response_type": (CaseResponse,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/cases/{case_id}/attributes",
"operation_id": "update_attributes",
"http_method": "POST",
"version": "v2",
},
params_map={
"case_id": {
"required": True,
"openapi_types": (str,),
"attribute": "case_id",
"location": "path",
},
"body": {
"required": True,
"openapi_types": (CaseUpdateAttributesRequest,),
"location": "body",
},
},
headers_map={"accept": ["application/json"], "content_type": ["application/json"]},
api_client=api_client,
)

self._update_priority_endpoint = _Endpoint(
settings={
"response_type": (CaseResponse,),
Expand Down Expand Up @@ -644,6 +671,28 @@ def unassign_case(

return self._unassign_case_endpoint.call_with_http_info(**kwargs)

def update_attributes(
self,
case_id: str,
body: CaseUpdateAttributesRequest,
) -> CaseResponse:
"""Update case attributes.

Update case attributes

:param case_id: Case's UUID or key
:type case_id: str
:param body: Case attributes update payload
:type body: CaseUpdateAttributesRequest
:rtype: CaseResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["case_id"] = case_id

kwargs["body"] = body

return self._update_attributes_endpoint.call_with_http_info(**kwargs)

def update_priority(
self,
case_id: str,
Expand Down
2 changes: 1 addition & 1 deletion src/datadog_api_client/v2/model/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(
"""
A case

:param attributes: Case attributes
:param attributes: Case resource attributes
:type attributes: CaseAttributes

:param id: Case's identifier
Expand Down
12 changes: 11 additions & 1 deletion src/datadog_api_client/v2/model/case_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@


if TYPE_CHECKING:
from datadog_api_client.v2.model.case_object_attributes import CaseObjectAttributes
from datadog_api_client.v2.model.jira_issue import JiraIssue
from datadog_api_client.v2.model.case_priority import CasePriority
from datadog_api_client.v2.model.service_now_ticket import ServiceNowTicket
Expand All @@ -26,6 +27,7 @@
class CaseAttributes(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.case_object_attributes import CaseObjectAttributes
from datadog_api_client.v2.model.jira_issue import JiraIssue
from datadog_api_client.v2.model.case_priority import CasePriority
from datadog_api_client.v2.model.service_now_ticket import ServiceNowTicket
Expand All @@ -34,6 +36,7 @@ def openapi_types(_):

return {
"archived_at": (datetime, none_type),
"attributes": (CaseObjectAttributes,),
"closed_at": (datetime, none_type),
"created_at": (datetime,),
"description": (str,),
Expand All @@ -49,6 +52,7 @@ def openapi_types(_):

attribute_map = {
"archived_at": "archived_at",
"attributes": "attributes",
"closed_at": "closed_at",
"created_at": "created_at",
"description": "description",
Expand All @@ -73,6 +77,7 @@ def openapi_types(_):
def __init__(
self_,
archived_at: Union[datetime, none_type, UnsetType] = unset,
attributes: Union[CaseObjectAttributes, UnsetType] = unset,
closed_at: Union[datetime, none_type, UnsetType] = unset,
created_at: Union[datetime, UnsetType] = unset,
description: Union[str, UnsetType] = unset,
Expand All @@ -87,11 +92,14 @@ def __init__(
**kwargs,
):
"""
Case attributes
Case resource attributes

:param archived_at: Timestamp of when the case was archived
:type archived_at: datetime, none_type, optional

:param attributes: The definition of ``CaseObjectAttributes`` object.
:type attributes: CaseObjectAttributes, optional

:param closed_at: Timestamp of when the case was closed
:type closed_at: datetime, none_type, optional

Expand Down Expand Up @@ -127,6 +135,8 @@ def __init__(
"""
if archived_at is not unset:
kwargs["archived_at"] = archived_at
if attributes is not unset:
kwargs["attributes"] = attributes
if closed_at is not unset:
kwargs["closed_at"] = closed_at
if created_at is not unset:
Expand Down
22 changes: 22 additions & 0 deletions src/datadog_api_client/v2/model/case_object_attributes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
)


class CaseObjectAttributes(ModelNormal):
@cached_property
def additional_properties_type(_):
return ([str],)

def __init__(self_, **kwargs):
"""
The definition of ``CaseObjectAttributes`` object.
"""
super().__init__(kwargs)
Loading
Loading