diff --git a/reference/admin.yaml b/reference/admin.yaml index 5f7924127..4bd6552df 100644 --- a/reference/admin.yaml +++ b/reference/admin.yaml @@ -1781,6 +1781,61 @@ paths: application/json: schema: $ref: '#/components/schemas/401' + /admin/employees/stats: + post: + tags: + - Employees + summary: Employees Stats + description: | + Employees Stats + operationId: employees_stats + requestBody: + required: true + content: + application/json: + schema: + type: object + additionalProperties: false + required: + - data + properties: + data: + $ref: '#/components/schemas/employees_stats_in' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/employees_stats_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' /admin/employees/potential_duplicate_expenses: get: tags: @@ -4217,6 +4272,94 @@ paths: application/json: schema: $ref: '#/components/schemas/404' + /admin/expenses/permissions/bulk: + post: + tags: + - Expenses + - Expense permissions + - Permissions + summary: Bulk Expense Permissions + description: | + Returns the permissions that the principal user can perform on the given expenses, calculated based on the admin role. + + **Note:** Maximum 200 expenses per API call. + operationId: bulk_expense_permissions + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + $ref: '#/components/schemas/expense_permissions_bulk_in' + example: + data: + - id: txAcczJOQHGR + - id: txCG82pa4yQQ + - id: txuiMc5kJbK4 + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/expense_permissions_bulk_out' + example: + data: + - id: txAcczJOQHGR + can_delete: false + can_edit: true + can_verify: false + can_remove_from_report: true + can_add_to_report: false + can_assign: false + - id: txCG82pa4yQQ + can_delete: true + can_edit: true + can_verify: false + can_remove_from_report: false + can_add_to_report: true + can_assign: true + - id: txuiMc5kJbK4 + can_delete: false + can_edit: false + can_verify: true + can_remove_from_report: false + can_add_to_report: false + can_assign: false + '400': + description: Bad request + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/bulk_error' + - $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' /admin/expenses/merge: post: tags: @@ -5243,6 +5386,61 @@ paths: application/json: schema: $ref: '#/components/schemas/404' + /admin/reminders/stats: + post: + tags: + - Reminders + summary: Reminders Stats + description: | + Reminders Stats + operationId: reminders_stats + requestBody: + required: true + content: + application/json: + schema: + type: object + additionalProperties: false + required: + - data + properties: + data: + $ref: '#/components/schemas/reminders_stats_in' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/reminders_stats_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' /admin/reports: get: tags: @@ -15200,6 +15398,29 @@ components: $ref: '#/components/schemas/category_out_embed' description: | List of categories that this employee is allowed to access. + employees_stats_in: + type: object + required: + - query_params + properties: + query_params: + type: string + description: | + Query param string similar to employees GET call. + example: id=in.('emp123','emp1234') + employees_stats_out: + type: array + additionalProperties: false + items: + type: object + additionalProperties: false + properties: + role: + $ref: '#/components/schemas/role' + count: + type: integer + description: Count of employees with the given role + example: 10 expense_duplicate_sets_out: type: object additionalProperties: false @@ -18719,6 +18940,40 @@ components: description: | Indicates whether the user has permission to add this expense to a report. example: true + expense_permissions_bulk_in: + type: array + maxItems: 200 + description: | + Array of expense IDs to check permissions for (maximum 200 expenses per request). + items: + type: object + required: + - id + additionalProperties: false + properties: + id: + allOf: + - $ref: '#/components/schemas/id_string' + description: | + Expense ID of the expense to check permissions for. + example: txAcczJOQHGR + expense_permissions_bulk_out: + type: array + description: | + Array of permission objects for each expense. Each object corresponds to an expense from the request. + items: + allOf: + - type: object + required: + - id + properties: + id: + allOf: + - $ref: '#/components/schemas/id_string' + description: | + Expense ID + example: txAcczJOQHGR + - $ref: '#/components/schemas/expense_permissions_out' target_expense_fields: type: object additionalProperties: false @@ -19746,6 +20001,10 @@ components: - CONNECT_MASTERCARD_RTF - PROCESS_REPORTS - VERIFY_REPORTS + - ADD_BANK_ACCOUNT_EMPLOYEES + - COMPLETE_EXPENSES + - RESUBMIT_REPORTS + - SMS_OPT_IN maxLength: 255 description: Represents the type of reminder. example: FYLE_EXPENSES @@ -19908,6 +20167,27 @@ components: description: | ID of the reminder that needs to be deleted. example: remindNZgN7V5pft + reminders_stats_in: + properties: + query_params: + type: string + description: | + Query param string similar to reminders GET call. + nullable: false + example: id=in.('remind123','remind1234') + reminders_stats_out: + type: array + items: + type: object + properties: + last_reminded_at: + type: string + format: date-time + nullable: true + description: Signifies the time when this reminder was sent. In case of scheduled reminders, signifies when the last reminder was sent. Date-time in [ISO8601 format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14). + example: '2021-06-01T13:14:54.804+00:00' + type: + $ref: '#/components/schemas/reminder_type' employee_out_embed_for_report: type: object additionalProperties: false @@ -25663,6 +25943,15 @@ components: description: | Type of budgets example: WEEKLY + budget_visibility: + type: string + enum: + - ONLY_ADMINS + - SPECIFIC_EMPLOYEES + - ALL_CONTRIBUTING_EMPLOYEES + description: | + Visibility of the budget + example: ONLY_ADMINS budget_out: type: object additionalProperties: false @@ -25777,6 +26066,23 @@ components: nullable: true example: 50 description: Utilisation percentage of the budget interval + visibility: + $ref: '#/components/schemas/budget_visibility' + budget_user_ids: + type: array + nullable: true + items: + type: string + nullable: true + maxLength: 15 + description: | + This id is provided by Sage Exp Mgmt to identify an object. + example: uswoirwlwwg + example: + - uswoirwlwwg + - uswlgwkgw42 + description: | + List of IDs of users who are associated with the budget. budget_in: type: object required: @@ -25858,6 +26164,10 @@ components: description: Month number of start of fisical year minimum: 1 maximum: 12 + visibility: + $ref: '#/components/schemas/budget_visibility' + user_ids: + $ref: '#/components/schemas/budget_user_ids' budget_out_embed: type: object additionalProperties: false diff --git a/reference/approver.yaml b/reference/approver.yaml index f4b1cfcf1..6705fe447 100644 --- a/reference/approver.yaml +++ b/reference/approver.yaml @@ -629,6 +629,94 @@ paths: application/json: schema: $ref: '#/components/schemas/404' + /approver/expenses/permissions/bulk: + post: + tags: + - Expenses + - Expense permissions + - Permissions + summary: Bulk Expense Permissions + description: | + Returns the permissions that the principal user can perform on the given expenses, calculated based on the approver role. + + **Note:** Maximum 200 expenses per API call. + operationId: bulk_expense_permissions + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + $ref: '#/components/schemas/expense_permissions_bulk_in' + example: + data: + - id: txAcczJOQHGR + - id: txCG82pa4yQQ + - id: txuiMc5kJbK4 + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/expense_permissions_bulk_out' + example: + data: + - id: txAcczJOQHGR + can_delete: false + can_edit: true + can_verify: false + can_remove_from_report: true + can_add_to_report: false + can_assign: false + - id: txCG82pa4yQQ + can_delete: true + can_edit: true + can_verify: false + can_remove_from_report: false + can_add_to_report: true + can_assign: true + - id: txuiMc5kJbK4 + can_delete: false + can_edit: false + can_verify: true + can_remove_from_report: false + can_add_to_report: false + can_assign: false + '400': + description: Bad request + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/bulk_error' + - $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' /approver/reports/eject_expenses: post: tags: @@ -6676,6 +6764,40 @@ components: description: | Indicates whether the user has permission to add this expense to a report. example: true + expense_permissions_bulk_in: + type: array + maxItems: 200 + description: | + Array of expense IDs to check permissions for (maximum 200 expenses per request). + items: + type: object + required: + - id + additionalProperties: false + properties: + id: + allOf: + - $ref: '#/components/schemas/id_string' + description: | + Expense ID of the expense to check permissions for. + example: txAcczJOQHGR + expense_permissions_bulk_out: + type: array + description: | + Array of permission objects for each expense. Each object corresponds to an expense from the request. + items: + allOf: + - type: object + required: + - id + properties: + id: + allOf: + - $ref: '#/components/schemas/id_string' + description: | + Expense ID + example: txAcczJOQHGR + - $ref: '#/components/schemas/expense_permissions_out' report_action_with_expenses_ids_to_eject: type: object additionalProperties: false diff --git a/reference/spender.yaml b/reference/spender.yaml index 5cd647968..d74ea1223 100644 --- a/reference/spender.yaml +++ b/reference/spender.yaml @@ -20,6 +20,9 @@ tags: - name: Advances description: | This API gives you access to view your Cash Advances data. + - name: Budgets + description: | + This API gives you access to view budgets that are visible to you based on budget visibility settings. - name: Automations description: | This API gives you access to organisation's automations data. @@ -91,6 +94,52 @@ tags: description: | These APIs gives you access to manage Dwolla customer data. paths: + /spender/budgets: + get: + tags: + - Budgets + summary: List budgets + operationId: budgets_list + description: | + This API returns budgets that are visible to the spender based on budget visibility settings. + Budgets are filtered based on the user's presence in the budget_user_visibility table. + + This API supports very rich filtering on all response fields and pagination via query parameters. + To understand how to use these parameters, please see the [Guide to Data APIs](https://docs.fylehq.com/docs/fyle-platform-docs/ZG9jOjI3Mzk2NTM3-guide-to-data-ap-is#filtering) + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + count: + $ref: '#/components/schemas/count' + offset: + $ref: '#/components/schemas/offset' + data: + type: array + items: + $ref: '#/components/schemas/budget_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' /spender/projects: get: tags: @@ -958,6 +1007,94 @@ paths: application/json: schema: $ref: '#/components/schemas/404' + /spender/expenses/permissions/bulk: + post: + tags: + - Expenses + - Expense permissions + - Permissions + summary: Bulk Expense Permissions + description: | + Returns the permissions that the principal user can perform on the given expenses, calculated based on the spender role. + + **Note:** Maximum 200 expenses per API call. + operationId: bulk_expense_permissions + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + $ref: '#/components/schemas/expense_permissions_bulk_in' + example: + data: + - id: txAcczJOQHGR + - id: txCG82pa4yQQ + - id: txuiMc5kJbK4 + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/expense_permissions_bulk_out' + example: + data: + - id: txAcczJOQHGR + can_delete: false + can_edit: true + can_verify: false + can_remove_from_report: true + can_add_to_report: false + can_assign: false + - id: txCG82pa4yQQ + can_delete: true + can_edit: true + can_verify: false + can_remove_from_report: false + can_add_to_report: true + can_assign: true + - id: txuiMc5kJbK4 + can_delete: false + can_edit: false + can_verify: true + can_remove_from_report: false + can_add_to_report: false + can_assign: false + '400': + description: Bad request + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/bulk_error' + - $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/per_diem_rates: get: tags: @@ -7276,11 +7413,12 @@ components: The second request will have offset as 200 and limit as 200 to return next 200 objects.
type: integer example: 10 - id_integer: - type: integer + id_string: + type: string + maxLength: 15 description: | This id is provided by Sage Exp Mgmt to identify an object. - example: 1234 + example: sdfd2391 org_id: type: string description: | @@ -7299,6 +7437,172 @@ components: description: | Signifies when this object was updated in [ISO8601 format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14). example: '2020-06-11T13:14:55.201598+00:00' + is_enabled: + type: boolean + description: | + This indicates if the resource is enabled for use within the organisation. + example: true + name: + type: string + maxLength: 255 + description: | + This represents the name of the resource. This should be unique in an organization + example: foo123 + budget_type: + nullable: false + type: string + enum: + - WEEKLY + - MONTHLY + - QUARTERLY + - HALF_YEARLY + - YEARLY + - ONE_TIME + description: | + Type of budgets + example: WEEKLY + amount: + type: number + description: | + amount of money + example: 47.99 + id_integer: + type: integer + description: | + This id is provided by Sage Exp Mgmt to identify an object. + example: 1234 + email: + type: string + maxLength: 127 + example: john.doe@example.com + description: | + An immutable field that represents the email address of the employee. + Must be compliant with RFC 822. + budget_visibility: + type: string + enum: + - ONLY_ADMINS + - SPECIFIC_EMPLOYEES + - ALL_CONTRIBUTING_EMPLOYEES + description: | + Visibility of the budget + example: ONLY_ADMINS + budget_out: + type: object + additionalProperties: false + properties: + id: + $ref: '#/components/schemas/id_string' + org_id: + $ref: '#/components/schemas/org_id' + created_at: + $ref: '#/components/schemas/created_at' + updated_at: + $ref: '#/components/schemas/updated_at' + is_enabled: + $ref: '#/components/schemas/is_enabled' + name: + allOf: + - $ref: '#/components/schemas/name' + example: Sales + type: + $ref: '#/components/schemas/budget_type' + amount_limit: + $ref: '#/components/schemas/amount' + alert_threshold: + nullable: true + type: number + example: 5000 + department_ids: + type: array + items: + $ref: '#/components/schemas/id_string' + example: + - 2222 + - 1221 + description: | + List of department ids + project_ids: + type: array + items: + $ref: '#/components/schemas/id_integer' + example: + - 2222 + - 1221 + description: | + List of project ids + cost_center_ids: + type: array + items: + $ref: '#/components/schemas/id_integer' + example: + - 2222 + - 1221 + description: | + List of cost center ids + category_ids: + type: array + items: + $ref: '#/components/schemas/id_integer' + example: + - 2222 + - 1221 + description: | + List of category ids + observer_ids: + type: array + items: + $ref: '#/components/schemas/id_string' + example: + - usge49ielgel + fiscal_year_start_month: + type: number + example: 10 + description: Month number of start of fiscal year + minimum: 1 + maximum: 12 + budget_start_date: + type: string + nullable: true + format: date-time + example: '2022-04-01T00:00:00+00:00' + description: Start date of the current budget interval + budget_end_date: + type: string + nullable: true + format: date-time + example: '2022-04-30T00:00:00+00:00' + description: End date of the current budget interval + budget_creator: + type: object + properties: + id: + $ref: '#/components/schemas/id_string' + name: + $ref: '#/components/schemas/name' + email: + $ref: '#/components/schemas/email' + example: + id: usq8rwZj2POy + name: John Brown + email: admin1@company.com + amount_spent: + type: number + nullable: true + example: 5000 + description: Amount spent from the budget interval + amount_remaining: + type: number + nullable: true + example: 5000 + description: Amount remaining in the budget interval + utilisation_percentage: + type: number + nullable: true + example: 50 + description: Utilisation percentage of the budget interval + visibility: + $ref: '#/components/schemas/budget_visibility' code: type: string nullable: true @@ -7313,11 +7617,6 @@ components: description: | This represents the description of the resource. example: Win the trophy - is_enabled: - type: boolean - description: | - This indicates if the resource is enabled for use within the organisation. - example: true project_out: type: object additionalProperties: false @@ -7620,19 +7919,6 @@ components: example: example.com currency: $ref: '#/components/schemas/currency' - id_string: - type: string - maxLength: 15 - description: | - This id is provided by Sage Exp Mgmt to identify an object. - example: sdfd2391 - email: - type: string - maxLength: 127 - example: john.doe@example.com - description: | - An immutable field that represents the email address of the employee. - Must be compliant with RFC 822. user_out_embed: type: object additionalProperties: false @@ -7800,12 +8086,6 @@ components: This id is provided by Sage Exp Mgmt to identify a category. nullable: true example: 49058 - name: - type: string - maxLength: 255 - description: | - This represents the name of the resource. This should be unique in an organization - example: foo123 department_head_user_ids: type: array nullable: false @@ -8140,11 +8420,6 @@ components: example: cf1: string1 custom_field_2: Value 2 - amount: - type: number - description: | - amount of money - example: 47.99 report_approval_out_embed: type: object additionalProperties: false @@ -10034,6 +10309,40 @@ components: description: | Indicates whether the user has permission to add this expense to a report. example: true + expense_permissions_bulk_in: + type: array + maxItems: 200 + description: | + Array of expense IDs to check permissions for (maximum 200 expenses per request). + items: + type: object + required: + - id + additionalProperties: false + properties: + id: + allOf: + - $ref: '#/components/schemas/id_string' + description: | + Expense ID of the expense to check permissions for. + example: txAcczJOQHGR + expense_permissions_bulk_out: + type: array + description: | + Array of permission objects for each expense. Each object corresponds to an expense from the request. + items: + allOf: + - type: object + required: + - id + properties: + id: + allOf: + - $ref: '#/components/schemas/id_string' + description: | + Expense ID + example: txAcczJOQHGR + - $ref: '#/components/schemas/expense_permissions_out' per_diem_rate_out: type: object additionalProperties: false diff --git a/src/admin/openapi.yaml b/src/admin/openapi.yaml index 1d4d40611..4d9279d76 100644 --- a/src/admin/openapi.yaml +++ b/src/admin/openapi.yaml @@ -191,6 +191,8 @@ paths: $ref: paths/admin@levels.yaml /admin/employees: $ref: paths/admin@employees.yaml + /admin/employees/stats: + $ref: paths/admin@employees@stats.yaml /admin/employees/potential_duplicate_expenses: $ref: paths/admin@employees@potential_duplicate_expenses.yaml /admin/employees/business_units: @@ -261,6 +263,8 @@ paths: $ref: paths/admin@expenses@export_configurations@delete@bulk.yaml /admin/expenses/permissions: $ref: paths/admin@expenses@permissions.yaml + /admin/expenses/permissions/bulk: + $ref: paths/admin@expenses@permissions@bulk.yaml /admin/expenses/merge: $ref: paths/admin@expenses@merge.yaml /admin/advance_requests: @@ -291,6 +295,8 @@ paths: $ref: paths/admin@reminders.yaml /admin/reminders/delete: $ref: paths/admin@reminders@delete.yaml + /admin/reminders/stats: + $ref: paths/admin@reminders@stats.yaml /admin/reports: $ref: paths/admin@reports.yaml /admin/reports/eject_expenses: diff --git a/src/admin/paths/admin@employees@stats.yaml b/src/admin/paths/admin@employees@stats.yaml new file mode 100644 index 000000000..bebfd19ae --- /dev/null +++ b/src/admin/paths/admin@employees@stats.yaml @@ -0,0 +1,54 @@ +post: + tags: + - Employees + summary: Employees Stats + description: | + Employees Stats + operationId: employees_stats + requestBody: + required: true + content: + application/json: + schema: + type: object + additionalProperties: False + required: + - data + properties: + data: + $ref: '../../components/schemas/employee.yaml#/employees_stats_in' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + additionalProperties: False + properties: + data: + $ref: '../../components/schemas/employee.yaml#/employees_stats_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' \ No newline at end of file diff --git a/src/admin/paths/admin@expenses@permissions@bulk.yaml b/src/admin/paths/admin@expenses@permissions@bulk.yaml new file mode 100644 index 000000000..0c0719457 --- /dev/null +++ b/src/admin/paths/admin@expenses@permissions@bulk.yaml @@ -0,0 +1,87 @@ +post: + tags: + - Expenses + - Expense permissions + - Permissions + summary: Bulk Expense Permissions + description: | + Returns the permissions that the principal user can perform on the given expenses, calculated based on the admin role. + + **Note:** Maximum 200 expenses per API call. + operationId: bulk_expense_permissions + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + $ref: '../../components/schemas/expense.yaml#/expense_permissions_bulk_in' + example: + data: + - id: txAcczJOQHGR + - id: txCG82pa4yQQ + - id: txuiMc5kJbK4 + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + additionalProperties: False + properties: + data: + $ref: '../../components/schemas/expense.yaml#/expense_permissions_bulk_out' + example: + data: + - id: txAcczJOQHGR + can_delete: false + can_edit: true + can_verify: false + can_remove_from_report: true + can_add_to_report: false + can_assign: false + - id: txCG82pa4yQQ + can_delete: true + can_edit: true + can_verify: false + can_remove_from_report: false + can_add_to_report: true + can_assign: true + - id: txuiMc5kJbK4 + can_delete: false + can_edit: false + can_verify: true + can_remove_from_report: false + can_add_to_report: false + can_assign: false + '400': + description: Bad request + content: + application/json: + schema: + oneOf: + - $ref: '../../components/schemas/bulk_error.yaml' + - $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' diff --git a/src/admin/paths/admin@reminders@stats.yaml b/src/admin/paths/admin@reminders@stats.yaml new file mode 100644 index 000000000..3cca816f3 --- /dev/null +++ b/src/admin/paths/admin@reminders@stats.yaml @@ -0,0 +1,54 @@ +post: + tags: + - Reminders + summary: Reminders Stats + description: | + Reminders Stats + operationId: reminders_stats + requestBody: + required: true + content: + application/json: + schema: + type: object + additionalProperties: False + required: + - data + properties: + data: + $ref: '../../components/schemas/reminder.yaml#/reminders_stats_in' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + additionalProperties: False + properties: + data: + $ref: '../../components/schemas/reminder.yaml#/reminders_stats_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' \ No newline at end of file diff --git a/src/approver/openapi.yaml b/src/approver/openapi.yaml index 93609d907..80075d34f 100644 --- a/src/approver/openapi.yaml +++ b/src/approver/openapi.yaml @@ -83,6 +83,8 @@ paths: $ref: paths/approver@expenses@attach_files@bulk.yaml /approver/expenses/permissions: $ref: paths/approver@expenses@permissions.yaml + /approver/expenses/permissions/bulk: + $ref: paths/approver@expenses@permissions@bulk.yaml /approver/reports/eject_expenses: $ref: 'paths/approver@reports@eject_expenses.yaml' /approver/reports/filters: diff --git a/src/approver/paths/approver@expenses@permissions@bulk.yaml b/src/approver/paths/approver@expenses@permissions@bulk.yaml new file mode 100644 index 000000000..2ffce10c5 --- /dev/null +++ b/src/approver/paths/approver@expenses@permissions@bulk.yaml @@ -0,0 +1,87 @@ +post: + tags: + - Expenses + - Expense permissions + - Permissions + summary: Bulk Expense Permissions + description: | + Returns the permissions that the principal user can perform on the given expenses, calculated based on the approver role. + + **Note:** Maximum 200 expenses per API call. + operationId: bulk_expense_permissions + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + $ref: '../../components/schemas/expense.yaml#/expense_permissions_bulk_in' + example: + data: + - id: txAcczJOQHGR + - id: txCG82pa4yQQ + - id: txuiMc5kJbK4 + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + additionalProperties: False + properties: + data: + $ref: '../../components/schemas/expense.yaml#/expense_permissions_bulk_out' + example: + data: + - id: txAcczJOQHGR + can_delete: false + can_edit: true + can_verify: false + can_remove_from_report: true + can_add_to_report: false + can_assign: false + - id: txCG82pa4yQQ + can_delete: true + can_edit: true + can_verify: false + can_remove_from_report: false + can_add_to_report: true + can_assign: true + - id: txuiMc5kJbK4 + can_delete: false + can_edit: false + can_verify: true + can_remove_from_report: false + can_add_to_report: false + can_assign: false + '400': + description: Bad request + content: + application/json: + schema: + oneOf: + - $ref: '../../components/schemas/bulk_error.yaml' + - $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' diff --git a/src/components/schemas/budget.yaml b/src/components/schemas/budget.yaml index 8ee0c8456..e18db2ff9 100644 --- a/src/components/schemas/budget.yaml +++ b/src/components/schemas/budget.yaml @@ -71,6 +71,10 @@ budget_in: description: Month number of start of fisical year minimum: 1 maximum: 12 + visibility: + $ref: ./fields.yaml#/budget_visibility + user_ids: + $ref: ./fields.yaml#/budget_user_ids budget_out: @@ -179,6 +183,8 @@ budget_out: nullable: true example: 50 description: Utilisation percentage of the budget interval + visibility: + $ref: ./fields.yaml#/budget_visibility budget_out_embed: type: object diff --git a/src/components/schemas/employee.yaml b/src/components/schemas/employee.yaml index a2f62245b..a8f54b335 100644 --- a/src/components/schemas/employee.yaml +++ b/src/components/schemas/employee.yaml @@ -1314,4 +1314,29 @@ employee_change_primary_org_in: - $ref: './fields.yaml#/id_string' example: ouabcdefghij required: - - target_org_id \ No newline at end of file + - target_org_id + +employees_stats_in: + type: object + required: + - query_params + properties: + query_params: + type: string + description: | + Query param string similar to employees GET call. + example: id=in.('emp123','emp1234') + +employees_stats_out: + type: array + additionalProperties: false + items: + type: object + additionalProperties: false + properties: + role: + $ref: ./fields.yaml#/role + count: + type: integer + description: Count of employees with the given role + example: 10 diff --git a/src/components/schemas/expense.yaml b/src/components/schemas/expense.yaml index 2796bd845..15d0b16d8 100644 --- a/src/components/schemas/expense.yaml +++ b/src/components/schemas/expense.yaml @@ -2578,6 +2578,42 @@ expense_permissions_out: Indicates whether the user has permission to add this expense to a report. example: true +expense_permissions_bulk_in: + type: array + maxItems: 200 + description: | + Array of expense IDs to check permissions for (maximum 200 expenses per request). + items: + type: object + required: + - id + additionalProperties: false + properties: + id: + allOf: + - $ref: './fields.yaml#/id_string' + description: | + Expense ID of the expense to check permissions for. + example: 'txAcczJOQHGR' + +expense_permissions_bulk_out: + type: array + description: | + Array of permission objects for each expense. Each object corresponds to an expense from the request. + items: + allOf: + - type: object + required: + - id + properties: + id: + allOf: + - $ref: './fields.yaml#/id_string' + description: | + Expense ID + example: 'txAcczJOQHGR' + - $ref: '#/expense_permissions_out' + expenses_verify_bulk_in: type: object required: diff --git a/src/components/schemas/fields.yaml b/src/components/schemas/fields.yaml index fa57f1f89..aca92edd1 100644 --- a/src/components/schemas/fields.yaml +++ b/src/components/schemas/fields.yaml @@ -1236,6 +1236,29 @@ budget_type: Type of budgets example: WEEKLY +budget_visibility: + type: string + enum: + - ONLY_ADMINS + - SPECIFIC_EMPLOYEES + - ALL_CONTRIBUTING_EMPLOYEES + description: | + Visibility of the budget + example: ONLY_ADMINS + +budget_user_ids: + type: array + nullable: True + items: + type: string + nullable: True + maxLength: 15 + description: | + This id is provided by Sage Exp Mgmt to identify an object. + example: 'uswoirwlwwg' + example: [ 'uswoirwlwwg', 'uswlgwkgw42' ] + description: | + List of IDs of users who are associated with the budget. restricted_spender_user_ids: type: array @@ -1297,6 +1320,10 @@ reminder_type: - CONNECT_MASTERCARD_RTF - PROCESS_REPORTS - VERIFY_REPORTS + - ADD_BANK_ACCOUNT_EMPLOYEES + - COMPLETE_EXPENSES + - RESUBMIT_REPORTS + - SMS_OPT_IN maxLength: 255 description: Represents the type of reminder. example: FYLE_EXPENSES diff --git a/src/components/schemas/reminder.yaml b/src/components/schemas/reminder.yaml index 6255fcf2b..7d1d36f03 100644 --- a/src/components/schemas/reminder.yaml +++ b/src/components/schemas/reminder.yaml @@ -88,4 +88,28 @@ reminder_delete_in: maxLength: 20 description: | ID of the reminder that needs to be deleted. - example: 'remindNZgN7V5pft' \ No newline at end of file + example: 'remindNZgN7V5pft' + +reminders_stats_in: + properties: + query_params: + type: string + description: | + Query param string similar to reminders GET call. + nullable: false + example: id=in.('remind123','remind1234') + +reminders_stats_out: + type: array + items: + type: object + properties: + last_reminded_at: + type: string + format: date-time + nullable: True + description: + Signifies the time when this reminder was sent. In case of scheduled reminders, signifies when the last reminder was sent. Date-time in [ISO8601 format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14). + example: '2021-06-01T13:14:54.804+00:00' + type: + $ref: './fields.yaml#/reminder_type' \ No newline at end of file diff --git a/src/spender/openapi.yaml b/src/spender/openapi.yaml index 8f5ff6952..cd7f18374 100644 --- a/src/spender/openapi.yaml +++ b/src/spender/openapi.yaml @@ -32,6 +32,9 @@ tags: - name: Advances description: | This API gives you access to view your Cash Advances data. + - name: Budgets + description: | + This API gives you access to view budgets that are visible to you based on budget visibility settings. - name: Automations description: | This API gives you access to organisation's automations data. @@ -110,6 +113,8 @@ tags: # Creates a file. paths: + /spender/budgets: + $ref: 'paths/spender@budgets.yaml' /spender/projects: $ref: 'paths/spender@projects.yaml' /spender/cost_centers: @@ -146,6 +151,8 @@ paths: $ref: paths/spender@expenses@attach_files@bulk.yaml /spender/expenses/permissions: $ref: paths/spender@expenses@permissions.yaml + /spender/expenses/permissions/bulk: + $ref: paths/spender@expenses@permissions@bulk.yaml /spender/per_diem_rates: $ref: 'paths/spender@per_diem_rates.yaml' /spender/merchants: diff --git a/src/spender/paths/spender@budgets.yaml b/src/spender/paths/spender@budgets.yaml new file mode 100644 index 000000000..a53a3d723 --- /dev/null +++ b/src/spender/paths/spender@budgets.yaml @@ -0,0 +1,46 @@ +get: + tags: + - Budgets + summary: List budgets + operationId: budgets_list + description: | + This API returns budgets that are visible to the spender based on budget visibility settings. + Budgets are filtered based on the user's presence in the budget_user_visibility table. + + This API supports very rich filtering on all response fields and pagination via query parameters. + To understand how to use these parameters, please see the [Guide to Data APIs](https://docs.fylehq.com/docs/fyle-platform-docs/ZG9jOjI3Mzk2NTM3-guide-to-data-ap-is#filtering) + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + count: + $ref: '../../components/schemas/count.yaml' + offset: + $ref: '../../components/schemas/offset.yaml' + data: + type: array + items: + $ref: '../../components/schemas/budget.yaml#/budget_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' + diff --git a/src/spender/paths/spender@expenses@permissions@bulk.yaml b/src/spender/paths/spender@expenses@permissions@bulk.yaml new file mode 100644 index 000000000..e6c19225c --- /dev/null +++ b/src/spender/paths/spender@expenses@permissions@bulk.yaml @@ -0,0 +1,87 @@ +post: + tags: + - Expenses + - Expense permissions + - Permissions + summary: Bulk Expense Permissions + description: | + Returns the permissions that the principal user can perform on the given expenses, calculated based on the spender role. + + **Note:** Maximum 200 expenses per API call. + operationId: bulk_expense_permissions + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + $ref: '../../components/schemas/expense.yaml#/expense_permissions_bulk_in' + example: + data: + - id: txAcczJOQHGR + - id: txCG82pa4yQQ + - id: txuiMc5kJbK4 + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + additionalProperties: False + properties: + data: + $ref: '../../components/schemas/expense.yaml#/expense_permissions_bulk_out' + example: + data: + - id: txAcczJOQHGR + can_delete: false + can_edit: true + can_verify: false + can_remove_from_report: true + can_add_to_report: false + can_assign: false + - id: txCG82pa4yQQ + can_delete: true + can_edit: true + can_verify: false + can_remove_from_report: false + can_add_to_report: true + can_assign: true + - id: txuiMc5kJbK4 + can_delete: false + can_edit: false + can_verify: true + can_remove_from_report: false + can_add_to_report: false + can_assign: false + '400': + description: Bad request + content: + application/json: + schema: + oneOf: + - $ref: '../../components/schemas/bulk_error.yaml' + - $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'