Skip to content

Commit

Permalink
Updated dropzone and pickup apis
Browse files Browse the repository at this point in the history
  • Loading branch information
skynexus committed Jul 2, 2024
1 parent e4c36e8 commit 8617d56
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 52 deletions.
73 changes: 38 additions & 35 deletions api-dropzone-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ info:
email: [email protected]
url: http://parsly.com
servers:
- url: https://parsly.com/api/dropzone/v1
- url: /api/dropzone/v1
- url: https://apix.parsly.com/dropzone/v1
paths:
/healthcheck:
description: |
Expand All @@ -24,16 +23,23 @@ paths:
content:
application/json:
schema:
type: boolean
/attachments:
$ref: "#/components/schemas/Status"
/files:
description: |
Invoice files.
Invoice invoice .
post:
description: |
Upload invoice attachments.
operationId: postAttachments
Upload invoice files.
operationId: postFiles
parameters:
- name: uploadId
in: query
description: Optional upload ID (automatically assigned if omitted)
required: false
schema:
$ref: "#/components/schemas/ResourceId"
requestBody:
description: Array of invoice attachments.
description: Array of invoice files.
required: true
content:
multipart/form-data:
Expand All @@ -45,56 +51,53 @@ paths:
items:
type: string
format: binary
encoding:
file:
contentType: multipart/form-data
headers:
X-File-Id:
description: Optional file ID (automatically assigned if omitted)
schema:
$ref: "#/components/schemas/ResourceId"
responses:
'201':
description: List of uploaded invoice attachments.
description: List of uploaded invoice files.
content:
application/json:
schema:
$ref: '#/components/schemas/AttachmentList'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
$ref: '#/components/schemas/FileList'
components:
schemas:
AttachmentList:
Status:
type: boolean
ResourceId:
type: string
minLength: 8
maxLength: 256
pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\-]*[a-zA-Z0-9]+$'
FileList:
type: object
required:
- id
- attachments
- files
properties:
id:
type: string
format: uuid
x-go-type: uuid.UUID
x-go-type-import:
path: github.com/google/uuid
attachments:
$ref: "#/components/schemas/ResourceId"
files:
type: array
items:
$ref: "#/components/schemas/Attachment"
Attachment:
$ref: "#/components/schemas/File"
File:
type: object
required:
- id
- external_id
- file_name
- content_type
- checksum
- size
properties:
id:
type: string
format: uuid
x-go-type: uuid.UUID
x-go-type-import:
path: github.com/google/uuid
external_id:
type: string
maxLength: 200
$ref: "#/components/schemas/ResourceId"
file_name:
type: string
maxLength: 1024
Expand Down
104 changes: 87 additions & 17 deletions api-pickup-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,41 +25,60 @@ paths:
application/json:
schema:
type: boolean
/results/{list_id}/{attachment_id}:
/results/{uploadId}:
description: |
Available result status of uploaded file group.
get:
description: |
Download available result status of uploaded file group.
operationId: getFileGroupResult
parameters:
- name: uploadId
in: path
description: Id of uploaded file group
required: true
schema:
$ref: "#/components/schemas/ResourceId"
responses:
'200':
description: file group result status
content:
application/json:
schema:
$ref: "#/components/schemas/ResultList"
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/results/{uploadId}/{fileId}:
description: |
Invoice parser results.
get:
description: |
Download invoice parser result.
operationId: getResult
operationId: getFileResult
parameters:
- name: list_id
- name: uploadId
in: path
description: Id of uploaded attachment list
description: Id of uploaded file group
required: true
schema:
type: string
format: uuid
x-go-type: uuid.UUID
x-go-type-import:
path: github.com/google/uuid
- name: attachment_id
$ref: "#/components/schemas/ResourceId"
- name: fileId
in: path
description: Id of uploaded attachment
description: Id of uploaded file
required: true
schema:
type: string
format: uuid
x-go-type: uuid.UUID
x-go-type-import:
path: github.com/google/uuid
$ref: "#/components/schemas/ResourceId"
responses:
'200':
description: invoice parser result
content:
application/json:
schema:
type: object
$ref: "#/components/schemas/Result"
default:
description: unexpected error
content:
Expand All @@ -68,6 +87,57 @@ paths:
$ref: '#/components/schemas/Error'
components:
schemas:
ResourceId:
type: string
minLength: 8
maxLength: 256
pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\-]*[a-zA-Z0-9]+$'
FileList:
type: object
required:
- id
- files
properties:
id:
$ref: "#/components/schemas/ResourceId"
files:
type: array
items:
$ref: "#/components/schemas/Result"
ResultList:
type: object
required:
- id
- results
properties:
id:
$ref: "#/components/schemas/ResourceId"
results:
type: array
items:
$ref: "#/components/schemas/ResultHead"
Result:
allOf:
- $ref: '#/components/schemas/ResultHead'
- type: object
required:
- content
properties:
content:
type: object
ResultHead:
type: object
required:
- id
- status
properties:
id:
$ref: "#/components/schemas/ResourceId"
status:
$ref: "#/components/schemas/ResultStatus"
ResultStatus:
type: string
enum: [unknown, processed, failed]
Error:
type: object
required:
Expand Down

0 comments on commit 8617d56

Please sign in to comment.