Skip to content
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

feat: API spec for spender bulk edit expenses API #591

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
156 changes: 156 additions & 0 deletions reference/spender.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2458,6 +2458,109 @@ components:
- ROUND_TRIP
- NO_DEDUCTION
- null
spender_expenses_bulk_in:
type: array
additionalProperties: false
description: |
Array of expenses to be updated in bulk by the spender.
items:
type: object
required:
- id
- category_id
properties:
id:
allOf:
- $ref: '#/components/schemas/id_string'
description: |
Expense id of the expense to be updated.
example: txwownwrng
merchant:
$ref: '#/components/schemas/merchant'
nullable: true
description: |
String denoting the name of the merchant to which the expense was made.
example: Uber
purpose:
type: string
nullable: true
description: |
Purpose of this expense.
example: Team lunch
cost_center_id:
allOf:
- $ref: '#/components/schemas/fk_integer'
nullable: true
description: |
This represents the cost_center's id given by Fyle during creation of cost center
for which this expense is created.
example: 1049
category_id:
allOf:
- $ref: '#/components/schemas/fk_integer'
nullable: false
description: |
This represents the category's id given by Fyle during creation of category
for which this expense is created.
example: 49058
project_id:
allOf:
- $ref: '#/components/schemas/fk_integer'
nullable: true
description: |
This represents the project's id given by Fyle during creation of project
for which this expense is created.
example: 92895
is_billable:
$ref: '#/components/schemas/is_billable'
nullable: true
description: This fields marks whether a given expense is billable or not.
example: true
custom_fields:
$ref: '#/components/schemas/custom_fields'
nullable: false
started_at:
$ref: '#/components/schemas/timestamptz_pst'
nullable: true
description: |
Start date for travel or per diem related expenses.
ended_at:
$ref: '#/components/schemas/timestamptz_pst'
nullable: true
description: |
End date for travel or per diem related expenses.
travel_classes:
$ref: '#/components/schemas/travel_classes'
nullable: false
description: |
This field is applicable only for `Flight`, `Train`, `Bus`, `Taxi` category.
index 0 holds onward journey class, index 1 holds return journey travel class.
example:
- ECONOMY
- BUSINESS
locations:
$ref: '#/components/schemas/locations'
nullable: false
description: |
This field will be present for travel related categories.
For travel between Place A to Place B, this array will contain two items, From location at array index 0 and To location at array index 1.
distance:
$ref: '#/components/schemas/distance'
nullable: true
description: Actual distance travelled by employee in travel related expenses.
distance_unit:
enum:
- KM
- MILES
- null
nullable: true
description: Unit of distance travelled.
example: MILES
hotel_is_breakfast_provided:
type: boolean
nullable: true
description: |
This field is applicable for only `Hotel` category.
expense_add_comment_action_in:
type: object
required:
Expand Down Expand Up @@ -9569,6 +9672,59 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/403'
/spender/expenses/bulk:
post:
tags:
- Expenses
summary: Update expenses in bulk
description: |
Update expenses in bulk.
operationId: expenses_post_bulk
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/spender_expenses_bulk_in'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/expense_out'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/400'
'401':
description: Unauthorized request
content:
application/json:
schema:
$ref: '#/components/schemas/401'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/403'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/404'
/spender/expenses/add_comment:
post:
tags:
Expand Down
2 changes: 2 additions & 0 deletions src/spender/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ paths:
$ref: 'paths/[email protected]'
/spender/expenses:
$ref: 'paths/[email protected]'
/spender/expenses/bulk:
$ref: 'paths/spender@[email protected]'
/spender/expenses/add_comment:
$ref: 'paths/spender@expenses@add_comment.yaml'
/spender/expenses/attach_receipt:
Expand Down
52 changes: 52 additions & 0 deletions src/spender/paths/spender@[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
post:
tags:
- Expenses
summary: Update expenses in bulk
description: |
Update expenses in bulk.
operationId: expenses_post_bulk
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data:
$ref: '../../components/schemas/expense.yaml#/spender_expenses_bulk_in'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '../../components/schemas/expense.yaml#/expense_out'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '../../components/schemas/400.yaml'
'401':
description: Unauthorized request
content:
application/json:
schema:
$ref: '../../components/schemas/401.yaml'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '../../components/schemas/403.yaml'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '../../components/schemas/404.yaml'