Skip to content

Commit

Permalink
Add snooze and unsnooze case API endpoints.
Browse files Browse the repository at this point in the history
  • Loading branch information
apognu committed Mar 7, 2025
1 parent 3410108 commit fe22079
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 2 deletions.
75 changes: 75 additions & 0 deletions packages/marble-api/openapis/marblecore-api/cases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
- $ref: 'components.yml#/parameters/offset_id'
- $ref: 'components.yml#/parameters/limit'
- $ref: 'components.yml#/parameters/order'
- name: include_snoozed
description: Include cases that are currently snoozed
in: query
required: false
schema:
type: boolean
default: false
responses:
'200':
description: List of corresponding cases
Expand Down Expand Up @@ -212,6 +219,71 @@
$ref: 'components.yml#/responses/403'
'404':
$ref: 'components.yml#/responses/404'
/cases/{caseId}/snooze:
post:
tags:
- Cases
summary: Snooze a case
operationId: snoozeCase
security:
- bearerAuth: []
parameters:
- name: caseId
description: ID of the case that needs to be snoozed
in: path
required: true
schema:
type: string
format: uuid
requestBody:
description: 'Decision ids to add to case'
content:
application/json:
schema:
type: object
required:
- until
properties:
until:
type: date-time
required: true
responses:
'204':
description: The case was snoozed
'400':
$ref: 'components.yml#/responses/400'
'401':
$ref: 'components.yml#/responses/401'
'403':
$ref: 'components.yml#/responses/403'
'404':
$ref: 'components.yml#/responses/404'
delete:
tags:
- Cases
summary: Snooze a case
operationId: unsnoozeCase
security:
- bearerAuth: []
parameters:
- name: caseId
description: ID of the case that needs to be unsnoozed
in: path
required: true
schema:
type: string
format: uuid
responses:
'204':
description: The case was unsnoozed
'400':
$ref: 'components.yml#/responses/400'
'401':
$ref: 'components.yml#/responses/401'
'403':
$ref: 'components.yml#/responses/403'
'404':
$ref: 'components.yml#/responses/404'
/cases/{caseId}/comments:
post:
tags:
Expand Down Expand Up @@ -430,6 +502,9 @@ components:
type: array
items:
$ref: '#/components/schemas/CaseTagDto'
snoozed_until:
type: string
format: date-time
CaseDetailDto:
allOf:
- $ref: '#/components/schemas/CaseDto'
Expand Down
7 changes: 5 additions & 2 deletions packages/marble-api/src/generated/marblecore-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export type CaseDto = {
inbox_id: string;
contributors: CaseContributorDto[];
tags: CaseTagDto[];
snoozed_until?: string;
};
export type Error = {
code: number;
Expand Down Expand Up @@ -945,7 +946,7 @@ export function createDecision(createDecisionBody: CreateDecisionBody, opts?: Oa
/**
* List cases
*/
export function listCases({ status, inboxId, startDate, endDate, sorting, name, offsetId, limit, order }: {
export function listCases({ status, inboxId, startDate, endDate, sorting, name, offsetId, limit, order, includeSnoozed }: {
status?: CaseStatusDto[];
inboxId?: string[];
startDate?: string;
Expand All @@ -955,6 +956,7 @@ export function listCases({ status, inboxId, startDate, endDate, sorting, name,
offsetId?: string;
limit?: number;
order?: "ASC" | "DESC";
includeSnoozed?: boolean;
} = {}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
status: 200;
Expand All @@ -976,7 +978,8 @@ export function listCases({ status, inboxId, startDate, endDate, sorting, name,
name,
offset_id: offsetId,
limit,
order
order,
include_snoozed: includeSnoozed
}))}`, {
...opts
}));
Expand Down

0 comments on commit fe22079

Please sign in to comment.