seahaven-ap/packages/api/openapi/paths/invoices-id-lines.yaml

123 lines
3.3 KiB
YAML

parameters:
- name: id
in: path
required: true
description: Invoice primary key.
schema:
type: string
format: uuid
example: 88888888-8888-4888-8888-888888888888
post:
tags: [Invoices]
summary: Add an invoice line
description: Appends one coding line. Sum is checked on replace, not on this add.
operationId: post-api-invoices-id-lines
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [description, amount]
properties:
description:
type: string
example: Extra coding
amount:
type: string
example: "25.00"
glAccountId:
type: string
format: uuid
example: 66666666-6666-4666-8666-666666666666
departmentId:
type: string
format: uuid
example: 77777777-7777-4777-8777-777777777777
responses:
"201":
description: Created line.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/InvoiceLine
"400":
description: Validation failed.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
"403":
description: Caller lacks write:invoices.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
"404":
description: Invoice not found.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
put:
tags: [Invoices]
summary: Replace invoice lines
description: Replaces every coding line. The amounts must sum to the invoice amount.
operationId: put-api-invoices-id-lines
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [items]
properties:
items:
type: array
items:
type: object
required: [description, amount]
properties:
description:
type: string
example: Labor
amount:
type: string
example: "1250.00"
glAccountId:
type: string
format: uuid
departmentId:
type: string
format: uuid
responses:
"200":
description: Replaced lines.
content:
application/json:
schema:
type: object
required: [items]
properties:
items:
type: array
items:
$ref: ../components/schemas.yaml#/InvoiceLine
"400":
description: Validation failed.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
"403":
description: Caller lacks write:invoices.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
"404":
description: Invoice not found.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error