From 1c345aba3d0f3817e89504f17fd57e6178f12895 Mon Sep 17 00:00:00 2001 From: Roshan Mhatre Date: Thu, 10 Oct 2024 15:22:27 +0530 Subject: [PATCH 1/4] feat: Docs for GET admin/corporate_card_transactions/exports --- src/admin/openapi.yaml | 3 + ...n@corporate_card_transactions@exports.yaml | 34 +++++ .../corporate_card_transactions_exports.yaml | 131 ++++++++++++++++++ 3 files changed, 168 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/src/admin/openapi.yaml b/src/admin/openapi.yaml index 93743a78b..7d5dbdca3 100644 --- a/src/admin/openapi.yaml +++ b/src/admin/openapi.yaml @@ -353,6 +353,9 @@ 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..dcd10bb44 --- /dev/null +++ b/src/admin/paths/admin@corporate_card_transactions@exports.yaml @@ -0,0 +1,34 @@ +get: + tags: + - Corporate Card Transactions + summary: Get export requests for corporate card transactions + description: | + Get corporate card transactions export request details. 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) + operationId: corporate_card_transactions_exports_get + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + count: + $ref: '../../components/schemas/count.yaml' + offset: + $ref: '../../components/schemas/offset.yaml' + data: + type: array + items: + $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' 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..dbc030884 --- /dev/null +++ b/src/components/schemas/corporate_card_transactions_exports.yaml @@ -0,0 +1,131 @@ +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. + 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. + 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_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: cctefilumWHrlPf7K + 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: filumWHrlPf7K + state: + type: string + nullable: false + enum: + - PENDING + - PROCESSING + - SUCCESS + - ERROR + description: | + Status of the export. + example: PENDING From afc6c8bb0fbc95ff0100b2830daba5b769073985 Mon Sep 17 00:00:00 2001 From: Roshan Mhatre Date: Thu, 10 Oct 2024 15:25:25 +0530 Subject: [PATCH 2/4] feat: Add better example --- src/components/schemas/corporate_card_transactions_exports.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/schemas/corporate_card_transactions_exports.yaml b/src/components/schemas/corporate_card_transactions_exports.yaml index dbc030884..3b31948a6 100644 --- a/src/components/schemas/corporate_card_transactions_exports.yaml +++ b/src/components/schemas/corporate_card_transactions_exports.yaml @@ -103,6 +103,7 @@ corporate_card_transactions_exports_out: allOf: - $ref: './fields.yaml#/query_params' nullable: false + example: id=eq.btxnRsjf2WmGd2 notify_emails: type: array nullable: false From 7161ab650eaae0b372e887173fb4807ad2183855 Mon Sep 17 00:00:00 2001 From: Roshan Mhatre Date: Thu, 10 Oct 2024 23:47:49 +0530 Subject: [PATCH 3/4] feat: Minor content changes --- src/admin/paths/admin@corporate_card_transactions@exports.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/admin/paths/admin@corporate_card_transactions@exports.yaml b/src/admin/paths/admin@corporate_card_transactions@exports.yaml index dcd10bb44..fd17c4dad 100644 --- a/src/admin/paths/admin@corporate_card_transactions@exports.yaml +++ b/src/admin/paths/admin@corporate_card_transactions@exports.yaml @@ -3,7 +3,7 @@ get: - Corporate Card Transactions summary: Get export requests for corporate card transactions description: | - Get corporate card transactions export request details. 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) + Get corporate card transactions export requests. 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) operationId: corporate_card_transactions_exports_get responses: '200': From bb56469729afc6b08f9b68e0730649001a29b170 Mon Sep 17 00:00:00 2001 From: Siva Date: Thu, 10 Oct 2024 18:22:39 +0000 Subject: [PATCH 4/4] Auto generate API docs --- reference/admin.yaml | 166 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) diff --git a/reference/admin.yaml b/reference/admin.yaml index 1700aab71..a5a64513d 100644 --- a/reference/admin.yaml +++ b/reference/admin.yaml @@ -9620,6 +9620,137 @@ 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. + 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. + 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_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: cctefilumWHrlPf7K + org_id: + $ref: '#/components/schemas/org_id' + user_id: + $ref: '#/components/schemas/user_id' + query_params: + allOf: + - $ref: '#/components/schemas/query_params' + nullable: false + example: id=eq.btxnRsjf2WmGd2 + 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: filumWHrlPf7K + state: + type: string + nullable: false + enum: + - PENDING + - PROCESSING + - SUCCESS + - ERROR + description: | + Status of the export. + example: PENDING virtual_card_out: type: object properties: @@ -21115,6 +21246,41 @@ paths: application/json: schema: $ref: '#/components/schemas/404' + /admin/corporate_card_transactions/exports: + get: + tags: + - Corporate Card Transactions + summary: Get export requests for corporate card transactions + description: | + Get corporate card transactions export requests. 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) + operationId: corporate_card_transactions_exports_get + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + count: + $ref: '#/components/schemas/count' + offset: + $ref: '#/components/schemas/offset' + data: + type: array + items: + $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' /admin/virtual_cards: get: tags: