Skip to content

Commit

Permalink
update openapi spec
Browse files Browse the repository at this point in the history
fix api

fix
  • Loading branch information
Pascal-Delange committed Dec 19, 2023
1 parent bca5b2a commit cadb40c
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
58 changes: 58 additions & 0 deletions packages/marble-api/scripts/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,40 @@ paths:
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
/cases/files/${caseFileId}/download_link:
get:
tags:
- Cases
summary: Download a case file
operationId: downloadCaseFile
security:
- bearerAuth: []
parameters:
- name: caseFileId
description: ID of the case file that needs to be downloaded
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Signed url to download the case file's content
content:
application/json:
schema:
type: object
required:
- url
properties:
url:
type: string
format: uri
description: Signed url to download the case file's content
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
/tags:
get:
tags:
Expand Down Expand Up @@ -3012,6 +3046,7 @@ components:
required:
- decisions
- events
- files
properties:
decisions:
type: array
Expand All @@ -3021,6 +3056,10 @@ components:
type: array
items:
$ref: '#/components/schemas/CaseEventDto'
files:
type: array
items:
$ref: '#/components/schemas/CaseFile'
CaseEventDto:
type: object
discriminator:
Expand Down Expand Up @@ -3054,6 +3093,25 @@ components:
format: date-time
event_type:
type: string
CaseFile:
type: object
required:
- id
- case_id
- created_at
- file_name
properties:
id:
type: string
format: uuid
case_id:
type: string
format: uuid
created_at:
type: string
format: date-time
file_name:
type: string
CaseTag:
type: object
required:
Expand Down
26 changes: 26 additions & 0 deletions packages/marble-api/src/generated/marble-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,16 @@ export type FileAddedEvent = {
additional_note: string;
};
export type CaseEventDto = CaseCreatedEvent | CaseStatusUpdatedEvent | DecisionAddedEvent | CommentAddedEvent | NameUpdatedEvent | CaseTagsUpdatedEventDto | FileAddedEvent;
export type CaseFile = {
id: string;
case_id: string;
created_at: string;
file_name: string;
};
export type CaseDetailDto = Case & {
decisions: Decision[];
events: CaseEventDto[];
files: CaseFile[];
};
export type UpdateCaseBody = {
name?: string;
Expand Down Expand Up @@ -752,6 +759,25 @@ export function updateTagsForCase(caseId: string, body: {
body
})));
}
/**
* Download a case file
*/
export function downloadCaseFile(caseFileId: string, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
status: 200;
data: {
url: string;
};
} | {
status: 401;
data: string;
} | {
status: 403;
data: string;
}>(`/cases/files/$${encodeURIComponent(caseFileId)}/download_link`, {
...opts
}));
}
/**
* List tags
*/
Expand Down

0 comments on commit cadb40c

Please sign in to comment.