From c2ed4bb921ee988a34fb6c9c8b03c0bdeae0bcbb Mon Sep 17 00:00:00 2001 From: Madan Gopal <159766771+madangopal122@users.noreply.github.com> Date: Thu, 7 Nov 2024 20:11:27 +0530 Subject: [PATCH] feat: Add corporate card transactions exports api docs (#575) * cct exports api doc * Auto generate API docs --------- Co-authored-by: Siva --- reference/admin.yaml | 232 ++++++++++++++++++ src/admin/openapi.yaml | 2 + ...n@corporate_card_transactions@exports.yaml | 46 ++++ .../corporate_card_transactions_exports.yaml | 167 +++++++++++++ src/components/schemas/fields.yaml | 24 ++ 5 files changed, 471 insertions(+) create mode 100644 src/admin/paths/admin@corporate_card_transactions@exports.yaml create mode 100644 src/components/schemas/corporate_card_transactions_exports.yaml diff --git a/reference/admin.yaml b/reference/admin.yaml index 2adb41b6b..30fd02b47 100644 --- a/reference/admin.yaml +++ b/reference/admin.yaml @@ -9656,6 +9656,191 @@ components: - matched_expenses - last_user_matched_at - metadata + corporate_card_transactions_export_config_column_formula: + type: object + properties: + function: + type: string + example: parse-format-time + parameters: + type: array + items: + anyOf: + - type: object + - type: string + - type: number + - type: integer + - type: boolean + example: + - function: field + parameters: + - spent_at + - yyyy-MM-dd'T'HH:mm:ss + - dd-MM-yyyy + - error in date formatting + description: | + Export column formula is a expression that is used to transform the data. Refer https://help.fylehq.com/en/articles/4422306-advanced-export-formulas for more details. + corporate_card_transactions_export_config: + type: object + additionalProperties: true + properties: + type: + type: string + enum: + - xlsx + - csv + description: | + Type of the export file. + example: csv + is_header_visible: + type: boolean + description: | + Whether to show the header in the export file. Only required for CSV and XLSX exports. + example: true + separate_line_items_entry: + type: object + properties: + enabled: + type: boolean + description: | + Whether to show the double rows for each line item in the export file. + example: false + debit_entries_only: + type: array + items: + type: string + description: | + Configure which columns to show for debit entries. + example: + - debit_amount + credit_entries_only: + type: array + items: + type: string + description: | + Configure which columns to show for credit entries. + example: + - credit_amount + description: | + Configure how to show the double rows for each line item in the export file, if enabled. Only required for CSV and XLSX exports. + columns: + type: array + items: + type: object + properties: + name: + type: string + description: | + Name of the column. + example: Spent Date + formula: + allOf: + - $ref: '#/components/schemas/corporate_card_transactions_export_config_column_formula' + description: | + Formula to transform the data in the column. + description: | + Configure the columns to show in the export file. Only required for CSV and XLSX exports. + corporate_card_transactions_exports_in: + type: object + additionalProperties: false + required: + - query_params + - notify_emails + - config + properties: + query_params: + allOf: + - $ref: '#/components/schemas/query_params' + nullable: false + notify_emails: + type: array + nullable: false + items: + $ref: '#/components/schemas/email' + description: | + List of emails to notify when the export is ready. + config: + allOf: + - $ref: '#/components/schemas/corporate_card_transactions_export_config' + nullable: false + description: | + Configuration for the export. + processed_at: + type: string + format: date-time + nullable: true + description: | + Signifies when this was processed in [ISO8601 format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14). + example: '2020-06-11T13:14:55.201598+00:00' + completed_at: + type: string + format: date-time + nullable: true + description: | + Signifies when this was completed in [ISO8601 format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14). + example: '2020-06-11T13:14:55.201598+00:00' + failed_at: + type: string + format: date-time + nullable: true + description: | + Signifies when this was failed in [ISO8601 format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14). + example: '2020-06-11T13:14:55.201598+00:00' + corporate_card_transactions_exports_out: + type: object + additionalProperties: false + properties: + created_at: + $ref: '#/components/schemas/created_at' + updated_at: + $ref: '#/components/schemas/updated_at' + id: + allOf: + - $ref: '#/components/schemas/id_string' + example: refilumWHrlPf7K + org_id: + $ref: '#/components/schemas/org_id' + user_id: + $ref: '#/components/schemas/user_id' + query_params: + allOf: + - $ref: '#/components/schemas/query_params' + nullable: false + notify_emails: + type: array + nullable: false + items: + $ref: '#/components/schemas/email' + config: + allOf: + - $ref: '#/components/schemas/corporate_card_transactions_export_config' + nullable: false + file_id: + anyOf: + - $ref: '#/components/schemas/null_field' + - $ref: '#/components/schemas/id_string' + nullable: true + example: filumVIrlPf7K + state: + type: string + nullable: false + enum: + - PENDING + - PROCESSING + - COMPLETED + - FAILED + description: | + Status of the export. + example: PENDING + processed_at: + $ref: '#/components/schemas/processed_at' + nullable: true + completed_at: + $ref: '#/components/schemas/completed_at' + nullable: true + failed_at: + $ref: '#/components/schemas/failed_at' + nullable: true virtual_card_out: type: object properties: @@ -21206,6 +21391,53 @@ paths: application/json: schema: $ref: '#/components/schemas/404' + /admin/corporate_card_transactions/exports: + post: + tags: + - Corporate Card Transactions + summary: Create Corproate Card Transactions Export + description: | + Create Corporate Card Transactions Export Request. + operationId: corporate_card_transactions_exports_post + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + data: + $ref: '#/components/schemas/corporate_card_transactions_exports_in' + required: + - data + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + data: + $ref: '#/components/schemas/corporate_card_transactions_exports_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' /admin/virtual_cards: get: tags: diff --git a/src/admin/openapi.yaml b/src/admin/openapi.yaml index dbe49b5f2..d0723232d 100644 --- a/src/admin/openapi.yaml +++ b/src/admin/openapi.yaml @@ -353,6 +353,8 @@ paths: $ref: paths/admin@corporate_card_transactions@match.yaml /admin/corporate_card_transactions/unmatch: $ref: paths/admin@corporate_card_transactions@unmatch.yaml + /admin/corporate_card_transactions/exports: + $ref: paths/admin@corporate_card_transactions@exports.yaml /admin/virtual_cards: $ref: paths/admin@virtual_cards.yaml diff --git a/src/admin/paths/admin@corporate_card_transactions@exports.yaml b/src/admin/paths/admin@corporate_card_transactions@exports.yaml new file mode 100644 index 000000000..a0600ae9b --- /dev/null +++ b/src/admin/paths/admin@corporate_card_transactions@exports.yaml @@ -0,0 +1,46 @@ +post: + tags: + - Corporate Card Transactions + summary: Create Corproate Card Transactions Export + description: | + Create Corporate Card Transactions Export Request. + operationId: corporate_card_transactions_exports_post + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + data: + $ref: '../../components/schemas/corporate_card_transactions_exports.yaml#/corporate_card_transactions_exports_in' + required: + - data + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + data: + $ref: '../../components/schemas/corporate_card_transactions_exports.yaml#/corporate_card_transactions_exports_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' \ No newline at end of file diff --git a/src/components/schemas/corporate_card_transactions_exports.yaml b/src/components/schemas/corporate_card_transactions_exports.yaml new file mode 100644 index 000000000..c7583d2b3 --- /dev/null +++ b/src/components/schemas/corporate_card_transactions_exports.yaml @@ -0,0 +1,167 @@ +corporate_card_transactions_export_config_column_formula: + type: object + properties: + function: + type: string + example: parse-format-time + parameters: + type: array + items: + anyOf: + - type: object + - type: string + - type: number + - type: integer + - type: boolean + example: + - function: field + parameters: ['spent_at'] + - yyyy-MM-dd'T'HH:mm:ss + - dd-MM-yyyy + - error in date formatting + description: | + Export column formula is a expression that is used to transform the data. Refer https://help.fylehq.com/en/articles/4422306-advanced-export-formulas for more details. + + +corporate_card_transactions_export_config: + type: object + additionalProperties: true + properties: + type: + type: string + enum: + - xlsx + - csv + description: | + Type of the export file. + example: csv + is_header_visible: + type: boolean + description: | + Whether to show the header in the export file. Only required for CSV and XLSX exports. + example: true + separate_line_items_entry: + type: object + properties: + enabled: + type: boolean + description: | + Whether to show the double rows for each line item in the export file. + example: false + debit_entries_only: + type: array + items: + type: string + description: | + Configure which columns to show for debit entries. + example: ['debit_amount'] + credit_entries_only: + type: array + items: + type: string + description: | + Configure which columns to show for credit entries. + example: ['credit_amount'] + description: | + Configure how to show the double rows for each line item in the export file, if enabled. Only required for CSV and XLSX exports. + columns: + type: array + items: + type: object + properties: + name: + type: string + description: | + Name of the column. + example: Spent Date + formula: + allOf: + - $ref: '#/corporate_card_transactions_export_config_column_formula' + description: | + Formula to transform the data in the column. + description: | + Configure the columns to show in the export file. Only required for CSV and XLSX exports. + + +corporate_card_transactions_exports_in: + type: object + additionalProperties: false + required: + - query_params + - notify_emails + - config + properties: + query_params: + allOf: + - $ref: './fields.yaml#/query_params' + nullable: false + notify_emails: + type: array + nullable: false + items: + $ref: './fields.yaml#/email' + description: | + List of emails to notify when the export is ready. + config: + allOf: + - $ref: '#/corporate_card_transactions_export_config' + nullable: false + description: | + Configuration for the export. + + +corporate_card_transactions_exports_out: + type: object + additionalProperties: false + properties: + created_at: + $ref: './fields.yaml#/created_at' + updated_at: + $ref: './fields.yaml#/updated_at' + id: + allOf: + - $ref: './fields.yaml#/id_string' + example: refilumWHrlPf7K + org_id: + $ref: './fields.yaml#/org_id' + user_id: + $ref: './fields.yaml#/user_id' + query_params: + allOf: + - $ref: './fields.yaml#/query_params' + nullable: false + notify_emails: + type: array + nullable: false + items: + $ref: './fields.yaml#/email' + config: + allOf: + - $ref: '#/corporate_card_transactions_export_config' + nullable: false + file_id: + anyOf: + - $ref: './fields.yaml#/null_field' + - $ref: './fields.yaml#/id_string' + nullable: true + example: filumVIrlPf7K + state: + type: string + nullable: false + enum: + - PENDING + - PROCESSING + - COMPLETED + - FAILED + description: | + Status of the export. + example: PENDING + processed_at: + $ref: './fields.yaml#/processed_at' + nullable: true + completed_at: + $ref: './fields.yaml#/completed_at' + nullable: true + failed_at: + $ref: './fields.yaml#/failed_at' + nullable: true \ No newline at end of file diff --git a/src/components/schemas/fields.yaml b/src/components/schemas/fields.yaml index 9c57a2e05..d67b612e2 100644 --- a/src/components/schemas/fields.yaml +++ b/src/components/schemas/fields.yaml @@ -99,6 +99,30 @@ updated_at: 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' +processed_at: + type: string + format: date-time + nullable: true + description: | + Signifies when this was processed in [ISO8601 format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14). + example: '2020-06-11T13:14:55.201598+00:00' + +completed_at: + type: string + format: date-time + nullable: true + description: | + Signifies when this was completed in [ISO8601 format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14). + example: '2020-06-11T13:14:55.201598+00:00' + +failed_at: + type: string + format: date-time + nullable: true + description: | + Signifies when this was failed 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: |