From d570f64211b27b64c6b24eb7bdbdc5b883e3ad8e Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Fri, 28 Mar 2025 10:16:43 -0500 Subject: [PATCH 1/2] Stopping point --- openapi-raw.yaml | 133 ++++++- openapi-sdk.yaml | 228 ++++++----- openapi.yaml | 105 +++++- sdks/php/docs/Api/ApiAppApi.md | 4 +- sdks/php/docs/Api/FaxApi.md | 2 +- sdks/php/docs/Api/SignatureRequestApi.md | 20 +- sdks/php/docs/Api/TemplateApi.md | 6 +- sdks/php/docs/Api/UnclaimedDraftApi.md | 6 +- sdks/php/src/Api/AccountApi.php | 73 +--- sdks/php/src/Api/ApiAppApi.php | 98 +---- sdks/php/src/Api/BulkSendJobApi.php | 20 +- sdks/php/src/Api/EmbeddedApi.php | 31 +- sdks/php/src/Api/FaxApi.php | 73 +--- sdks/php/src/Api/FaxLineApi.php | 114 +----- sdks/php/src/Api/OAuthApi.php | 42 +-- sdks/php/src/Api/ReportApi.php | 21 +- sdks/php/src/Api/SignatureRequestApi.php | 460 +++++------------------ sdks/php/src/Api/TeamApi.php | 143 +------ sdks/php/src/Api/TemplateApi.php | 203 ++-------- sdks/php/src/Api/UnclaimedDraftApi.php | 120 ++---- sdks/php/templates/api.mustache | 36 -- src/Hello/OpenApi/GenerateSdkOas.php | 32 ++ 22 files changed, 601 insertions(+), 1369 deletions(-) diff --git a/openapi-raw.yaml b/openapi-raw.yaml index f6b22e028..fc7f8d5da 100644 --- a/openapi-raw.yaml +++ b/openapi-raw.yaml @@ -429,7 +429,12 @@ paths: $ref: '#/components/examples/ApiAppCreateRequest' multipart/form-data: schema: - $ref: '#/components/schemas/ApiAppCreateRequest' + required: + - api_app_create_request + properties: + api_app_create_request: + $ref: '#/components/schemas/ApiAppCreateRequest' + type: object responses: '201': description: 'successful operation' @@ -638,7 +643,12 @@ paths: $ref: '#/components/examples/ApiAppUpdateRequest' multipart/form-data: schema: - $ref: '#/components/schemas/ApiAppUpdateRequest' + required: + - api_app_update_request + properties: + api_app_update_request: + $ref: '#/components/schemas/ApiAppUpdateRequest' + type: object responses: '200': description: 'successful operation' @@ -2507,7 +2517,12 @@ paths: $ref: '#/components/examples/FaxSendRequest' multipart/form-data: schema: - $ref: '#/components/schemas/FaxSendRequest' + required: + - fax_send_request + properties: + fax_send_request: + $ref: '#/components/schemas/FaxSendRequest' + type: object responses: '200': description: 'successful operation' @@ -2890,7 +2905,12 @@ paths: $ref: '#/components/examples/SignatureRequestBulkCreateEmbeddedWithTemplateRequest' multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestBulkCreateEmbeddedWithTemplateRequest' + required: + - signature_request_bulk_create_embedded_with_template_request + properties: + signature_request_bulk_create_embedded_with_template_request: + $ref: '#/components/schemas/SignatureRequestBulkCreateEmbeddedWithTemplateRequest' + type: object responses: '200': description: 'successful operation' @@ -2992,7 +3012,12 @@ paths: $ref: '#/components/examples/SignatureRequestBulkSendWithTemplateRequest' multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestBulkSendWithTemplateRequest' + required: + - signature_request_bulk_send_with_template_request + properties: + signature_request_bulk_send_with_template_request: + $ref: '#/components/schemas/SignatureRequestBulkSendWithTemplateRequest' + type: object responses: '200': description: 'successful operation' @@ -3194,7 +3219,12 @@ paths: $ref: '#/components/examples/SignatureRequestCreateEmbeddedRequestGroupedSigners' multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestCreateEmbeddedRequest' + required: + - signature_request_create_embedded_request + properties: + signature_request_create_embedded_request: + $ref: '#/components/schemas/SignatureRequestCreateEmbeddedRequest' + type: object responses: '200': description: 'successful operation' @@ -3297,7 +3327,12 @@ paths: $ref: '#/components/examples/SignatureRequestCreateEmbeddedWithTemplateRequest' multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestCreateEmbeddedWithTemplateRequest' + required: + - signature_request_create_embedded_with_template_request + properties: + signature_request_create_embedded_with_template_request: + $ref: '#/components/schemas/SignatureRequestCreateEmbeddedWithTemplateRequest' + type: object responses: '200': description: 'successful operation' @@ -3411,7 +3446,12 @@ paths: $ref: '#/components/examples/SignatureRequestEditRequestGroupedSigners' multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestEditRequest' + required: + - signature_request_edit_request + properties: + signature_request_edit_request: + $ref: '#/components/schemas/SignatureRequestEditRequest' + type: object responses: '200': description: 'successful operation' @@ -3530,7 +3570,12 @@ paths: $ref: '#/components/examples/SignatureRequestEditEmbeddedRequestGroupedSigners' multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestEditEmbeddedRequest' + required: + - signature_request_edit_embedded_request + properties: + signature_request_edit_embedded_request: + $ref: '#/components/schemas/SignatureRequestEditEmbeddedRequest' + type: object responses: '200': description: 'successful operation' @@ -3646,7 +3691,12 @@ paths: $ref: '#/components/examples/SignatureRequestEditEmbeddedWithTemplateRequest' multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestEditEmbeddedWithTemplateRequest' + required: + - signature_request_edit_embedded_with_template_request + properties: + signature_request_edit_embedded_with_template_request: + $ref: '#/components/schemas/SignatureRequestEditEmbeddedWithTemplateRequest' + type: object responses: '200': description: 'successful operation' @@ -3762,7 +3812,12 @@ paths: $ref: '#/components/examples/SignatureRequestEditWithTemplateRequest' multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestEditWithTemplateRequest' + required: + - signature_request_edit_with_template_request + properties: + signature_request_edit_with_template_request: + $ref: '#/components/schemas/SignatureRequestEditWithTemplateRequest' + type: object responses: '200': description: 'successful operation' @@ -4731,7 +4786,12 @@ paths: $ref: '#/components/examples/SignatureRequestSendRequestGroupedSigners' multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestSendRequest' + required: + - signature_request_send_request + properties: + signature_request_send_request: + $ref: '#/components/schemas/SignatureRequestSendRequest' + type: object responses: '200': description: 'successful operation' @@ -4835,7 +4895,12 @@ paths: $ref: '#/components/examples/SignatureRequestSendWithTemplateRequest' multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestSendWithTemplateRequest' + required: + - signature_request_send_with_template_request + properties: + signature_request_send_with_template_request: + $ref: '#/components/schemas/SignatureRequestSendWithTemplateRequest' + type: object responses: '200': description: 'successful operation' @@ -6154,7 +6219,12 @@ paths: $ref: '#/components/examples/TemplateCreateRequestFormFieldRules' multipart/form-data: schema: - $ref: '#/components/schemas/TemplateCreateRequest' + required: + - template_create_request + properties: + template_create_request: + $ref: '#/components/schemas/TemplateCreateRequest' + type: object responses: '200': description: 'successful operation' @@ -6263,7 +6333,12 @@ paths: $ref: '#/components/examples/TemplateCreateEmbeddedDraftRequestFormFieldRules' multipart/form-data: schema: - $ref: '#/components/schemas/TemplateCreateEmbeddedDraftRequest' + required: + - template_create_embedded_draft_request + properties: + template_create_embedded_draft_request: + $ref: '#/components/schemas/TemplateCreateEmbeddedDraftRequest' + type: object responses: '200': description: 'successful operation' @@ -7127,7 +7202,12 @@ paths: $ref: '#/components/examples/TemplateUpdateFilesRequest' multipart/form-data: schema: - $ref: '#/components/schemas/TemplateUpdateFilesRequest' + required: + - template_update_files_request + properties: + template_update_files_request: + $ref: '#/components/schemas/TemplateUpdateFilesRequest' + type: object responses: '200': description: 'successful operation' @@ -7238,7 +7318,12 @@ paths: $ref: '#/components/examples/UnclaimedDraftCreateRequestFormFieldRules' multipart/form-data: schema: - $ref: '#/components/schemas/UnclaimedDraftCreateRequest' + required: + - unclaimed_draft_create_request + properties: + unclaimed_draft_create_request: + $ref: '#/components/schemas/UnclaimedDraftCreateRequest' + type: object responses: '200': description: 'successful operation' @@ -7343,7 +7428,12 @@ paths: $ref: '#/components/examples/UnclaimedDraftCreateEmbeddedRequestFormFieldRules' multipart/form-data: schema: - $ref: '#/components/schemas/UnclaimedDraftCreateEmbeddedRequest' + required: + - unclaimed_draft_create_embedded_request + properties: + unclaimed_draft_create_embedded_request: + $ref: '#/components/schemas/UnclaimedDraftCreateEmbeddedRequest' + type: object responses: '200': description: 'successful operation' @@ -7447,7 +7537,12 @@ paths: $ref: '#/components/examples/UnclaimedDraftCreateEmbeddedWithTemplateRequest' multipart/form-data: schema: - $ref: '#/components/schemas/UnclaimedDraftCreateEmbeddedWithTemplateRequest' + required: + - unclaimed_draft_create_embedded_with_template_request + properties: + unclaimed_draft_create_embedded_with_template_request: + $ref: '#/components/schemas/UnclaimedDraftCreateEmbeddedWithTemplateRequest' + type: object responses: '200': description: 'successful operation' diff --git a/openapi-sdk.yaml b/openapi-sdk.yaml index 2a95555ab..808cd9f86 100644 --- a/openapi-sdk.yaml +++ b/openapi-sdk.yaml @@ -427,15 +427,17 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/ApiAppCreateRequest' + required: + - api_app_create_request + properties: + api_app_create_request: + $ref: '#/components/schemas/ApiAppCreateRequest' + type: object examples: example: $ref: '#/components/examples/ApiAppCreateRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/ApiAppCreateRequest' responses: '201': description: 'successful operation' @@ -636,15 +638,17 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/ApiAppUpdateRequest' + required: + - api_app_update_request + properties: + api_app_update_request: + $ref: '#/components/schemas/ApiAppUpdateRequest' + type: object examples: example: $ref: '#/components/examples/ApiAppUpdateRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/ApiAppUpdateRequest' responses: '200': description: 'successful operation' @@ -2505,15 +2509,17 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/FaxSendRequest' + required: + - fax_send_request + properties: + fax_send_request: + $ref: '#/components/schemas/FaxSendRequest' + type: object examples: example: $ref: '#/components/examples/FaxSendRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/FaxSendRequest' responses: '200': description: 'successful operation' @@ -2894,15 +2900,17 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestBulkCreateEmbeddedWithTemplateRequest' + required: + - signature_request_bulk_create_embedded_with_template_request + properties: + signature_request_bulk_create_embedded_with_template_request: + $ref: '#/components/schemas/SignatureRequestBulkCreateEmbeddedWithTemplateRequest' + type: object examples: example: $ref: '#/components/examples/SignatureRequestBulkCreateEmbeddedWithTemplateRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/SignatureRequestBulkCreateEmbeddedWithTemplateRequest' responses: '200': description: 'successful operation' @@ -2999,15 +3007,17 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestBulkSendWithTemplateRequest' + required: + - signature_request_bulk_send_with_template_request + properties: + signature_request_bulk_send_with_template_request: + $ref: '#/components/schemas/SignatureRequestBulkSendWithTemplateRequest' + type: object examples: example: $ref: '#/components/examples/SignatureRequestBulkSendWithTemplateRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/SignatureRequestBulkSendWithTemplateRequest' responses: '200': description: 'successful operation' @@ -3208,17 +3218,19 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestCreateEmbeddedRequest' + required: + - signature_request_create_embedded_request + properties: + signature_request_create_embedded_request: + $ref: '#/components/schemas/SignatureRequestCreateEmbeddedRequest' + type: object examples: example: $ref: '#/components/examples/SignatureRequestCreateEmbeddedRequest' grouped_signers_example: $ref: '#/components/examples/SignatureRequestCreateEmbeddedRequestGroupedSigners' - multipart/form-data: - schema: - $ref: '#/components/schemas/SignatureRequestCreateEmbeddedRequest' responses: '200': description: 'successful operation' @@ -3313,15 +3325,17 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestCreateEmbeddedWithTemplateRequest' + required: + - signature_request_create_embedded_with_template_request + properties: + signature_request_create_embedded_with_template_request: + $ref: '#/components/schemas/SignatureRequestCreateEmbeddedWithTemplateRequest' + type: object examples: example: $ref: '#/components/examples/SignatureRequestCreateEmbeddedWithTemplateRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/SignatureRequestCreateEmbeddedWithTemplateRequest' responses: '200': description: 'successful operation' @@ -3428,17 +3442,19 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestEditRequest' + required: + - signature_request_edit_request + properties: + signature_request_edit_request: + $ref: '#/components/schemas/SignatureRequestEditRequest' + type: object examples: example: $ref: '#/components/examples/SignatureRequestEditRequest' grouped_signers_example: $ref: '#/components/examples/SignatureRequestEditRequestGroupedSigners' - multipart/form-data: - schema: - $ref: '#/components/schemas/SignatureRequestEditRequest' responses: '200': description: 'successful operation' @@ -3547,17 +3563,19 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestEditEmbeddedRequest' + required: + - signature_request_edit_embedded_request + properties: + signature_request_edit_embedded_request: + $ref: '#/components/schemas/SignatureRequestEditEmbeddedRequest' + type: object examples: example: $ref: '#/components/examples/SignatureRequestEditEmbeddedRequest' grouped_signers_example: $ref: '#/components/examples/SignatureRequestEditEmbeddedRequestGroupedSigners' - multipart/form-data: - schema: - $ref: '#/components/schemas/SignatureRequestEditEmbeddedRequest' responses: '200': description: 'successful operation' @@ -3665,15 +3683,17 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestEditEmbeddedWithTemplateRequest' + required: + - signature_request_edit_embedded_with_template_request + properties: + signature_request_edit_embedded_with_template_request: + $ref: '#/components/schemas/SignatureRequestEditEmbeddedWithTemplateRequest' + type: object examples: example: $ref: '#/components/examples/SignatureRequestEditEmbeddedWithTemplateRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/SignatureRequestEditEmbeddedWithTemplateRequest' responses: '200': description: 'successful operation' @@ -3784,15 +3804,17 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestEditWithTemplateRequest' + required: + - signature_request_edit_with_template_request + properties: + signature_request_edit_with_template_request: + $ref: '#/components/schemas/SignatureRequestEditWithTemplateRequest' + type: object examples: example: $ref: '#/components/examples/SignatureRequestEditWithTemplateRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/SignatureRequestEditWithTemplateRequest' responses: '200': description: 'successful operation' @@ -4771,17 +4793,19 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestSendRequest' + required: + - signature_request_send_request + properties: + signature_request_send_request: + $ref: '#/components/schemas/SignatureRequestSendRequest' + type: object examples: example: $ref: '#/components/examples/SignatureRequestSendRequest' grouped_signers_example: $ref: '#/components/examples/SignatureRequestSendRequestGroupedSigners' - multipart/form-data: - schema: - $ref: '#/components/schemas/SignatureRequestSendRequest' responses: '200': description: 'successful operation' @@ -4877,15 +4901,17 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestSendWithTemplateRequest' + required: + - signature_request_send_with_template_request + properties: + signature_request_send_with_template_request: + $ref: '#/components/schemas/SignatureRequestSendWithTemplateRequest' + type: object examples: example: $ref: '#/components/examples/SignatureRequestSendWithTemplateRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/SignatureRequestSendWithTemplateRequest' responses: '200': description: 'successful operation' @@ -6195,9 +6221,14 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/TemplateCreateRequest' + required: + - template_create_request + properties: + template_create_request: + $ref: '#/components/schemas/TemplateCreateRequest' + type: object examples: example: $ref: '#/components/examples/TemplateCreateRequest' @@ -6207,9 +6238,6 @@ paths: $ref: '#/components/examples/TemplateCreateRequestFormFieldGroups' form_field_rules_example: $ref: '#/components/examples/TemplateCreateRequestFormFieldRules' - multipart/form-data: - schema: - $ref: '#/components/schemas/TemplateCreateRequest' responses: '200': description: 'successful operation' @@ -6304,9 +6332,14 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/TemplateCreateEmbeddedDraftRequest' + required: + - template_create_embedded_draft_request + properties: + template_create_embedded_draft_request: + $ref: '#/components/schemas/TemplateCreateEmbeddedDraftRequest' + type: object examples: example: $ref: '#/components/examples/TemplateCreateEmbeddedDraftRequest' @@ -6316,9 +6349,6 @@ paths: $ref: '#/components/examples/TemplateCreateEmbeddedDraftRequestFormFieldGroups' form_field_rules_example: $ref: '#/components/examples/TemplateCreateEmbeddedDraftRequestFormFieldRules' - multipart/form-data: - schema: - $ref: '#/components/schemas/TemplateCreateEmbeddedDraftRequest' responses: '200': description: 'successful operation' @@ -7198,15 +7228,17 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/TemplateUpdateFilesRequest' + required: + - template_update_files_request + properties: + template_update_files_request: + $ref: '#/components/schemas/TemplateUpdateFilesRequest' + type: object examples: example: $ref: '#/components/examples/TemplateUpdateFilesRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/TemplateUpdateFilesRequest' responses: '200': description: 'successful operation' @@ -7303,9 +7335,14 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/UnclaimedDraftCreateRequest' + required: + - unclaimed_draft_create_request + properties: + unclaimed_draft_create_request: + $ref: '#/components/schemas/UnclaimedDraftCreateRequest' + type: object examples: example: $ref: '#/components/examples/UnclaimedDraftCreateRequest' @@ -7315,9 +7352,6 @@ paths: $ref: '#/components/examples/UnclaimedDraftCreateRequestFormFieldGroups' form_field_rules_example: $ref: '#/components/examples/UnclaimedDraftCreateRequestFormFieldRules' - multipart/form-data: - schema: - $ref: '#/components/schemas/UnclaimedDraftCreateRequest' responses: '200': description: 'successful operation' @@ -7411,9 +7445,14 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/UnclaimedDraftCreateEmbeddedRequest' + required: + - unclaimed_draft_create_embedded_request + properties: + unclaimed_draft_create_embedded_request: + $ref: '#/components/schemas/UnclaimedDraftCreateEmbeddedRequest' + type: object examples: example: $ref: '#/components/examples/UnclaimedDraftCreateEmbeddedRequest' @@ -7423,9 +7462,6 @@ paths: $ref: '#/components/examples/UnclaimedDraftCreateEmbeddedRequestFormFieldGroups' form_field_rules_example: $ref: '#/components/examples/UnclaimedDraftCreateEmbeddedRequestFormFieldRules' - multipart/form-data: - schema: - $ref: '#/components/schemas/UnclaimedDraftCreateEmbeddedRequest' responses: '200': description: 'successful operation' @@ -7524,15 +7560,17 @@ paths: requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/UnclaimedDraftCreateEmbeddedWithTemplateRequest' + required: + - unclaimed_draft_create_embedded_with_template_request + properties: + unclaimed_draft_create_embedded_with_template_request: + $ref: '#/components/schemas/UnclaimedDraftCreateEmbeddedWithTemplateRequest' + type: object examples: example: $ref: '#/components/examples/UnclaimedDraftCreateEmbeddedWithTemplateRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/UnclaimedDraftCreateEmbeddedWithTemplateRequest' responses: '200': description: 'successful operation' diff --git a/openapi.yaml b/openapi.yaml index f90363d47..8152c64ed 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -435,7 +435,12 @@ paths: $ref: '#/components/examples/ApiAppCreateRequest' multipart/form-data: schema: - $ref: '#/components/schemas/ApiAppCreateRequest' + required: + - api_app_create_request + properties: + api_app_create_request: + $ref: '#/components/schemas/ApiAppCreateRequest' + type: object responses: '201': description: 'successful operation' @@ -644,7 +649,12 @@ paths: $ref: '#/components/examples/ApiAppUpdateRequest' multipart/form-data: schema: - $ref: '#/components/schemas/ApiAppUpdateRequest' + required: + - api_app_update_request + properties: + api_app_update_request: + $ref: '#/components/schemas/ApiAppUpdateRequest' + type: object responses: '200': description: 'successful operation' @@ -2513,7 +2523,12 @@ paths: $ref: '#/components/examples/FaxSendRequest' multipart/form-data: schema: - $ref: '#/components/schemas/FaxSendRequest' + required: + - fax_send_request + properties: + fax_send_request: + $ref: '#/components/schemas/FaxSendRequest' + type: object responses: '200': description: 'successful operation' @@ -2902,7 +2917,12 @@ paths: $ref: '#/components/examples/SignatureRequestBulkCreateEmbeddedWithTemplateRequest' multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestBulkCreateEmbeddedWithTemplateRequest' + required: + - signature_request_bulk_create_embedded_with_template_request + properties: + signature_request_bulk_create_embedded_with_template_request: + $ref: '#/components/schemas/SignatureRequestBulkCreateEmbeddedWithTemplateRequest' + type: object responses: '200': description: 'successful operation' @@ -3007,7 +3027,12 @@ paths: $ref: '#/components/examples/SignatureRequestBulkSendWithTemplateRequest' multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestBulkSendWithTemplateRequest' + required: + - signature_request_bulk_send_with_template_request + properties: + signature_request_bulk_send_with_template_request: + $ref: '#/components/schemas/SignatureRequestBulkSendWithTemplateRequest' + type: object responses: '200': description: 'successful operation' @@ -3218,7 +3243,12 @@ paths: $ref: '#/components/examples/SignatureRequestCreateEmbeddedRequestGroupedSigners' multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestCreateEmbeddedRequest' + required: + - signature_request_create_embedded_request + properties: + signature_request_create_embedded_request: + $ref: '#/components/schemas/SignatureRequestCreateEmbeddedRequest' + type: object responses: '200': description: 'successful operation' @@ -3321,7 +3351,12 @@ paths: $ref: '#/components/examples/SignatureRequestCreateEmbeddedWithTemplateRequest' multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestCreateEmbeddedWithTemplateRequest' + required: + - signature_request_create_embedded_with_template_request + properties: + signature_request_create_embedded_with_template_request: + $ref: '#/components/schemas/SignatureRequestCreateEmbeddedWithTemplateRequest' + type: object responses: '200': description: 'successful operation' @@ -4305,7 +4340,12 @@ paths: $ref: '#/components/examples/SignatureRequestSendRequestGroupedSigners' multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestSendRequest' + required: + - signature_request_send_request + properties: + signature_request_send_request: + $ref: '#/components/schemas/SignatureRequestSendRequest' + type: object responses: '200': description: 'successful operation' @@ -4409,7 +4449,12 @@ paths: $ref: '#/components/examples/SignatureRequestSendWithTemplateRequest' multipart/form-data: schema: - $ref: '#/components/schemas/SignatureRequestSendWithTemplateRequest' + required: + - signature_request_send_with_template_request + properties: + signature_request_send_with_template_request: + $ref: '#/components/schemas/SignatureRequestSendWithTemplateRequest' + type: object responses: '200': description: 'successful operation' @@ -5733,7 +5778,12 @@ paths: $ref: '#/components/examples/TemplateCreateRequestFormFieldRules' multipart/form-data: schema: - $ref: '#/components/schemas/TemplateCreateRequest' + required: + - template_create_request + properties: + template_create_request: + $ref: '#/components/schemas/TemplateCreateRequest' + type: object responses: '200': description: 'successful operation' @@ -5842,7 +5892,12 @@ paths: $ref: '#/components/examples/TemplateCreateEmbeddedDraftRequestFormFieldRules' multipart/form-data: schema: - $ref: '#/components/schemas/TemplateCreateEmbeddedDraftRequest' + required: + - template_create_embedded_draft_request + properties: + template_create_embedded_draft_request: + $ref: '#/components/schemas/TemplateCreateEmbeddedDraftRequest' + type: object responses: '200': description: 'successful operation' @@ -6730,7 +6785,12 @@ paths: $ref: '#/components/examples/TemplateUpdateFilesRequest' multipart/form-data: schema: - $ref: '#/components/schemas/TemplateUpdateFilesRequest' + required: + - template_update_files_request + properties: + template_update_files_request: + $ref: '#/components/schemas/TemplateUpdateFilesRequest' + type: object responses: '200': description: 'successful operation' @@ -6841,7 +6901,12 @@ paths: $ref: '#/components/examples/UnclaimedDraftCreateRequestFormFieldRules' multipart/form-data: schema: - $ref: '#/components/schemas/UnclaimedDraftCreateRequest' + required: + - unclaimed_draft_create_request + properties: + unclaimed_draft_create_request: + $ref: '#/components/schemas/UnclaimedDraftCreateRequest' + type: object responses: '200': description: 'successful operation' @@ -6949,7 +7014,12 @@ paths: $ref: '#/components/examples/UnclaimedDraftCreateEmbeddedRequestFormFieldRules' multipart/form-data: schema: - $ref: '#/components/schemas/UnclaimedDraftCreateEmbeddedRequest' + required: + - unclaimed_draft_create_embedded_request + properties: + unclaimed_draft_create_embedded_request: + $ref: '#/components/schemas/UnclaimedDraftCreateEmbeddedRequest' + type: object responses: '200': description: 'successful operation' @@ -7056,7 +7126,12 @@ paths: $ref: '#/components/examples/UnclaimedDraftCreateEmbeddedWithTemplateRequest' multipart/form-data: schema: - $ref: '#/components/schemas/UnclaimedDraftCreateEmbeddedWithTemplateRequest' + required: + - unclaimed_draft_create_embedded_with_template_request + properties: + unclaimed_draft_create_embedded_with_template_request: + $ref: '#/components/schemas/UnclaimedDraftCreateEmbeddedWithTemplateRequest' + type: object responses: '200': description: 'successful operation' diff --git a/sdks/php/docs/Api/ApiAppApi.md b/sdks/php/docs/Api/ApiAppApi.md index eb5e933ca..1310e214f 100644 --- a/sdks/php/docs/Api/ApiAppApi.md +++ b/sdks/php/docs/Api/ApiAppApi.md @@ -84,7 +84,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) @@ -347,7 +347,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) diff --git a/sdks/php/docs/Api/FaxApi.md b/sdks/php/docs/Api/FaxApi.md index aeb7a3949..fc16343ac 100644 --- a/sdks/php/docs/Api/FaxApi.md +++ b/sdks/php/docs/Api/FaxApi.md @@ -310,7 +310,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) diff --git a/sdks/php/docs/Api/SignatureRequestApi.md b/sdks/php/docs/Api/SignatureRequestApi.md index 72acdccb9..e86f17b97 100644 --- a/sdks/php/docs/Api/SignatureRequestApi.md +++ b/sdks/php/docs/Api/SignatureRequestApi.md @@ -146,7 +146,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) @@ -273,7 +273,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) @@ -428,7 +428,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) @@ -515,7 +515,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) @@ -623,7 +623,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) @@ -722,7 +722,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) @@ -811,7 +811,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) @@ -919,7 +919,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) @@ -1515,7 +1515,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) @@ -1621,7 +1621,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) diff --git a/sdks/php/docs/Api/TemplateApi.md b/sdks/php/docs/Api/TemplateApi.md index 23d1d5a98..b7750f798 100644 --- a/sdks/php/docs/Api/TemplateApi.md +++ b/sdks/php/docs/Api/TemplateApi.md @@ -213,7 +213,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) @@ -317,7 +317,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) @@ -813,7 +813,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) diff --git a/sdks/php/docs/Api/UnclaimedDraftApi.md b/sdks/php/docs/Api/UnclaimedDraftApi.md index caf17af70..d98d11557 100644 --- a/sdks/php/docs/Api/UnclaimedDraftApi.md +++ b/sdks/php/docs/Api/UnclaimedDraftApi.md @@ -79,7 +79,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) @@ -146,7 +146,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) @@ -233,7 +233,7 @@ try { ### HTTP request headers -- **Content-Type**: `application/json`, `multipart/form-data` +- **Content-Type**: `multipart/form-data` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) diff --git a/sdks/php/src/Api/AccountApi.php b/sdks/php/src/Api/AccountApi.php index 700b22166..e3c9d5527 100644 --- a/sdks/php/src/Api/AccountApi.php +++ b/sdks/php/src/Api/AccountApi.php @@ -392,20 +392,14 @@ public function accountCreateRequest(Model\AccountCreateRequest $account_create_ $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $account_create_request - ); - - $multipart = !empty($formParams); - $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($account_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($account_create_request)); @@ -425,17 +419,6 @@ public function accountCreateRequest(Model\AccountCreateRequest $account_create_ } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $account_create_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -749,7 +732,7 @@ public function accountGetRequest(?string $account_id = null, ?string $email_add ) ?? []); $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -768,14 +751,6 @@ public function accountGetRequest(?string $account_id = null, ?string $email_add } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1071,20 +1046,14 @@ public function accountUpdateRequest(Model\AccountUpdateRequest $account_update_ $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $account_update_request - ); - - $multipart = !empty($formParams); - $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($account_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($account_update_request)); @@ -1104,17 +1073,6 @@ public function accountUpdateRequest(Model\AccountUpdateRequest $account_update_ } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $account_update_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1410,20 +1368,14 @@ public function accountVerifyRequest(Model\AccountVerifyRequest $account_verify_ $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $account_verify_request - ); - - $multipart = !empty($formParams); - $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($account_verify_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($account_verify_request)); @@ -1443,17 +1395,6 @@ public function accountVerifyRequest(Model\AccountVerifyRequest $account_verify_ } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $account_verify_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/ApiAppApi.php b/sdks/php/src/Api/ApiAppApi.php index 95b80a91a..fa38c34a0 100644 --- a/sdks/php/src/Api/ApiAppApi.php +++ b/sdks/php/src/Api/ApiAppApi.php @@ -68,7 +68,6 @@ class ApiAppApi */ public const contentTypes = [ 'apiAppCreate' => [ - 'application/json', 'multipart/form-data', ], 'apiAppDelete' => [ @@ -81,7 +80,6 @@ class ApiAppApi 'application/json', ], 'apiAppUpdate' => [ - 'application/json', 'multipart/form-data', ], ]; @@ -397,27 +395,20 @@ public function apiAppCreateRequest(Model\ApiAppCreateRequest $api_app_create_re $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $api_app_create_request - ); - - $multipart = !empty($formParams); + // form params + if ($api_app_create_request !== null) { + $formParams['api_app_create_request'] = ObjectSerializer::toFormValue($api_app_create_request); + } + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($api_app_create_request)); - } else { - $httpBody = $api_app_create_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -430,17 +421,6 @@ public function apiAppCreateRequest(Model\ApiAppCreateRequest $api_app_create_re } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $api_app_create_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -645,7 +625,7 @@ public function apiAppDeleteRequest(string $client_id, string $contentType = sel } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -664,14 +644,6 @@ public function apiAppDeleteRequest(string $client_id, string $contentType = sel } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -977,7 +949,7 @@ public function apiAppGetRequest(string $client_id, string $contentType = self:: } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -996,14 +968,6 @@ public function apiAppGetRequest(string $client_id, string $contentType = self:: } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1317,7 +1281,7 @@ public function apiAppListRequest(?int $page = 1, ?int $page_size = 20, string $ ) ?? []); $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -1336,14 +1300,6 @@ public function apiAppListRequest(?int $page = 1, ?int $page_size = 20, string $ } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1651,12 +1607,6 @@ public function apiAppUpdateRequest(string $client_id, Model\ApiAppUpdateRequest $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $api_app_update_request - ); - - $multipart = !empty($formParams); - // path params if ($client_id !== null) { $resourcePath = str_replace( @@ -1666,21 +1616,20 @@ public function apiAppUpdateRequest(string $client_id, Model\ApiAppUpdateRequest ); } + // form params + if ($api_app_update_request !== null) { + $formParams['api_app_update_request'] = ObjectSerializer::toFormValue($api_app_update_request); + } + + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($api_app_update_request)); - } else { - $httpBody = $api_app_update_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -1693,17 +1642,6 @@ public function apiAppUpdateRequest(string $client_id, Model\ApiAppUpdateRequest } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $api_app_update_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/BulkSendJobApi.php b/sdks/php/src/Api/BulkSendJobApi.php index 3c6bb7e79..ed1f75c04 100644 --- a/sdks/php/src/Api/BulkSendJobApi.php +++ b/sdks/php/src/Api/BulkSendJobApi.php @@ -425,7 +425,7 @@ public function bulkSendJobGetRequest(string $bulk_send_job_id, ?int $page = 1, } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -444,14 +444,6 @@ public function bulkSendJobGetRequest(string $bulk_send_job_id, ?int $page = 1, } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -765,7 +757,7 @@ public function bulkSendJobListRequest(?int $page = 1, ?int $page_size = 20, str ) ?? []); $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -784,14 +776,6 @@ public function bulkSendJobListRequest(?int $page = 1, ?int $page_size = 20, str } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/EmbeddedApi.php b/sdks/php/src/Api/EmbeddedApi.php index 382228786..629ef0fc9 100644 --- a/sdks/php/src/Api/EmbeddedApi.php +++ b/sdks/php/src/Api/EmbeddedApi.php @@ -398,12 +398,6 @@ public function embeddedEditUrlRequest(string $template_id, Model\EmbeddedEditUr $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $embedded_edit_url_request - ); - - $multipart = !empty($formParams); - // path params if ($template_id !== null) { $resourcePath = str_replace( @@ -414,13 +408,13 @@ public function embeddedEditUrlRequest(string $template_id, Model\EmbeddedEditUr } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($embedded_edit_url_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($embedded_edit_url_request)); @@ -440,17 +434,6 @@ public function embeddedEditUrlRequest(string $template_id, Model\EmbeddedEditUr } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $embedded_edit_url_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -756,7 +739,7 @@ public function embeddedSignUrlRequest(string $signature_id, string $contentType } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -775,14 +758,6 @@ public function embeddedSignUrlRequest(string $signature_id, string $contentType } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/FaxApi.php b/sdks/php/src/Api/FaxApi.php index ec43e8a7f..55a11b535 100644 --- a/sdks/php/src/Api/FaxApi.php +++ b/sdks/php/src/Api/FaxApi.php @@ -81,7 +81,6 @@ class FaxApi 'application/json', ], 'faxSend' => [ - 'application/json', 'multipart/form-data', ], ]; @@ -306,7 +305,7 @@ public function faxDeleteRequest(string $fax_id, string $contentType = self::con } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -325,14 +324,6 @@ public function faxDeleteRequest(string $fax_id, string $contentType = self::con } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -634,7 +625,7 @@ public function faxFilesRequest(string $fax_id, string $contentType = self::cont } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/pdf', 'application/json'], + ['application/pdf', 'application/json'], $contentType, $multipart ); @@ -653,14 +644,6 @@ public function faxFilesRequest(string $fax_id, string $contentType = self::cont } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -962,7 +945,7 @@ public function faxGetRequest(string $fax_id, string $contentType = self::conten } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -981,14 +964,6 @@ public function faxGetRequest(string $fax_id, string $contentType = self::conten } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1309,7 +1284,7 @@ public function faxListRequest(?int $page = 1, ?int $page_size = 20, string $con ) ?? []); $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -1328,14 +1303,6 @@ public function faxListRequest(?int $page = 1, ?int $page_size = 20, string $con } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1627,27 +1594,20 @@ public function faxSendRequest(Model\FaxSendRequest $fax_send_request, string $c $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $fax_send_request - ); - - $multipart = !empty($formParams); + // form params + if ($fax_send_request !== null) { + $formParams['fax_send_request'] = ObjectSerializer::toFormValue($fax_send_request); + } + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fax_send_request)); - } else { - $httpBody = $fax_send_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -1660,17 +1620,6 @@ public function faxSendRequest(Model\FaxSendRequest $fax_send_request, string $c } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $fax_send_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/FaxLineApi.php b/sdks/php/src/Api/FaxLineApi.php index 94a5e6e4a..0530a249e 100644 --- a/sdks/php/src/Api/FaxLineApi.php +++ b/sdks/php/src/Api/FaxLineApi.php @@ -401,20 +401,14 @@ public function faxLineAddUserRequest(Model\FaxLineAddUserRequest $fax_line_add_ $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $fax_line_add_user_request - ); - - $multipart = !empty($formParams); - $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($fax_line_add_user_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fax_line_add_user_request)); @@ -434,17 +428,6 @@ public function faxLineAddUserRequest(Model\FaxLineAddUserRequest $fax_line_add_ } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $fax_line_add_user_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -789,7 +772,7 @@ public function faxLineAreaCodeGetRequest(string $country, ?string $state = null ) ?? []); $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -808,14 +791,6 @@ public function faxLineAreaCodeGetRequest(string $country, ?string $state = null } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1107,20 +1082,14 @@ public function faxLineCreateRequest(Model\FaxLineCreateRequest $fax_line_create $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $fax_line_create_request - ); - - $multipart = !empty($formParams); - $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($fax_line_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fax_line_create_request)); @@ -1140,17 +1109,6 @@ public function faxLineCreateRequest(Model\FaxLineCreateRequest $fax_line_create } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $fax_line_create_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1341,20 +1299,14 @@ public function faxLineDeleteRequest(Model\FaxLineDeleteRequest $fax_line_delete $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $fax_line_delete_request - ); - - $multipart = !empty($formParams); - $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($fax_line_delete_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fax_line_delete_request)); @@ -1374,17 +1326,6 @@ public function faxLineDeleteRequest(Model\FaxLineDeleteRequest $fax_line_delete } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $fax_line_delete_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1687,7 +1628,7 @@ public function faxLineGetRequest(string $number, string $contentType = self::co ) ?? []); $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -1706,14 +1647,6 @@ public function faxLineGetRequest(string $number, string $contentType = self::co } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -2051,7 +1984,7 @@ public function faxLineListRequest(?string $account_id = null, ?int $page = 1, ? ) ?? []); $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -2070,14 +2003,6 @@ public function faxLineListRequest(?string $account_id = null, ?int $page = 1, ? } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -2369,20 +2294,14 @@ public function faxLineRemoveUserRequest(Model\FaxLineRemoveUserRequest $fax_lin $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $fax_line_remove_user_request - ); - - $multipart = !empty($formParams); - $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($fax_line_remove_user_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fax_line_remove_user_request)); @@ -2402,17 +2321,6 @@ public function faxLineRemoveUserRequest(Model\FaxLineRemoveUserRequest $fax_lin } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $fax_line_remove_user_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/OAuthApi.php b/sdks/php/src/Api/OAuthApi.php index 19b137a75..787c27e16 100644 --- a/sdks/php/src/Api/OAuthApi.php +++ b/sdks/php/src/Api/OAuthApi.php @@ -414,20 +414,14 @@ public function oauthTokenGenerateRequest(Model\OAuthTokenGenerateRequest $o_aut $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $o_auth_token_generate_request - ); - - $multipart = !empty($formParams); - $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($o_auth_token_generate_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($o_auth_token_generate_request)); @@ -447,17 +441,6 @@ public function oauthTokenGenerateRequest(Model\OAuthTokenGenerateRequest $o_aut } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $o_auth_token_generate_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -797,20 +780,14 @@ public function oauthTokenRefreshRequest(Model\OAuthTokenRefreshRequest $o_auth_ $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $o_auth_token_refresh_request - ); - - $multipart = !empty($formParams); - $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($o_auth_token_refresh_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($o_auth_token_refresh_request)); @@ -830,17 +807,6 @@ public function oauthTokenRefreshRequest(Model\OAuthTokenRefreshRequest $o_auth_ } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $o_auth_token_refresh_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/ReportApi.php b/sdks/php/src/Api/ReportApi.php index cde61fcaf..2a16fcb85 100644 --- a/sdks/php/src/Api/ReportApi.php +++ b/sdks/php/src/Api/ReportApi.php @@ -383,20 +383,14 @@ public function reportCreateRequest(Model\ReportCreateRequest $report_create_req $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $report_create_request - ); - - $multipart = !empty($formParams); - $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($report_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($report_create_request)); @@ -416,17 +410,6 @@ public function reportCreateRequest(Model\ReportCreateRequest $report_create_req } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $report_create_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/SignatureRequestApi.php b/sdks/php/src/Api/SignatureRequestApi.php index 3f6ad70ec..78ad38c95 100644 --- a/sdks/php/src/Api/SignatureRequestApi.php +++ b/sdks/php/src/Api/SignatureRequestApi.php @@ -69,38 +69,30 @@ class SignatureRequestApi */ public const contentTypes = [ 'signatureRequestBulkCreateEmbeddedWithTemplate' => [ - 'application/json', 'multipart/form-data', ], 'signatureRequestBulkSendWithTemplate' => [ - 'application/json', 'multipart/form-data', ], 'signatureRequestCancel' => [ 'application/json', ], 'signatureRequestCreateEmbedded' => [ - 'application/json', 'multipart/form-data', ], 'signatureRequestCreateEmbeddedWithTemplate' => [ - 'application/json', 'multipart/form-data', ], 'signatureRequestEdit' => [ - 'application/json', 'multipart/form-data', ], 'signatureRequestEditEmbedded' => [ - 'application/json', 'multipart/form-data', ], 'signatureRequestEditEmbeddedWithTemplate' => [ - 'application/json', 'multipart/form-data', ], 'signatureRequestEditWithTemplate' => [ - 'application/json', 'multipart/form-data', ], 'signatureRequestFiles' => [ @@ -128,11 +120,9 @@ class SignatureRequestApi 'application/json', ], 'signatureRequestSend' => [ - 'application/json', 'multipart/form-data', ], 'signatureRequestSendWithTemplate' => [ - 'application/json', 'multipart/form-data', ], 'signatureRequestUpdate' => [ @@ -451,27 +441,20 @@ public function signatureRequestBulkCreateEmbeddedWithTemplateRequest(Model\Sign $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $signature_request_bulk_create_embedded_with_template_request - ); - - $multipart = !empty($formParams); + // form params + if ($signature_request_bulk_create_embedded_with_template_request !== null) { + $formParams['signature_request_bulk_create_embedded_with_template_request'] = ObjectSerializer::toFormValue($signature_request_bulk_create_embedded_with_template_request); + } + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_bulk_create_embedded_with_template_request)); - } else { - $httpBody = $signature_request_bulk_create_embedded_with_template_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -484,17 +467,6 @@ public function signatureRequestBulkCreateEmbeddedWithTemplateRequest(Model\Sign } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $signature_request_bulk_create_embedded_with_template_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -786,27 +758,20 @@ public function signatureRequestBulkSendWithTemplateRequest(Model\SignatureReque $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $signature_request_bulk_send_with_template_request - ); - - $multipart = !empty($formParams); + // form params + if ($signature_request_bulk_send_with_template_request !== null) { + $formParams['signature_request_bulk_send_with_template_request'] = ObjectSerializer::toFormValue($signature_request_bulk_send_with_template_request); + } + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_bulk_send_with_template_request)); - } else { - $httpBody = $signature_request_bulk_send_with_template_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -819,17 +784,6 @@ public function signatureRequestBulkSendWithTemplateRequest(Model\SignatureReque } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $signature_request_bulk_send_with_template_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1034,7 +988,7 @@ public function signatureRequestCancelRequest(string $signature_request_id, stri } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -1053,14 +1007,6 @@ public function signatureRequestCancelRequest(string $signature_request_id, stri } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1356,27 +1302,20 @@ public function signatureRequestCreateEmbeddedRequest(Model\SignatureRequestCrea $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $signature_request_create_embedded_request - ); - - $multipart = !empty($formParams); + // form params + if ($signature_request_create_embedded_request !== null) { + $formParams['signature_request_create_embedded_request'] = ObjectSerializer::toFormValue($signature_request_create_embedded_request); + } + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_create_embedded_request)); - } else { - $httpBody = $signature_request_create_embedded_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -1389,17 +1328,6 @@ public function signatureRequestCreateEmbeddedRequest(Model\SignatureRequestCrea } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $signature_request_create_embedded_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1695,27 +1623,20 @@ public function signatureRequestCreateEmbeddedWithTemplateRequest(Model\Signatur $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $signature_request_create_embedded_with_template_request - ); - - $multipart = !empty($formParams); + // form params + if ($signature_request_create_embedded_with_template_request !== null) { + $formParams['signature_request_create_embedded_with_template_request'] = ObjectSerializer::toFormValue($signature_request_create_embedded_with_template_request); + } + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_create_embedded_with_template_request)); - } else { - $httpBody = $signature_request_create_embedded_with_template_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -1728,17 +1649,6 @@ public function signatureRequestCreateEmbeddedWithTemplateRequest(Model\Signatur } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $signature_request_create_embedded_with_template_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -2046,12 +1956,6 @@ public function signatureRequestEditRequest(string $signature_request_id, Model\ $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $signature_request_edit_request - ); - - $multipart = !empty($formParams); - // path params if ($signature_request_id !== null) { $resourcePath = str_replace( @@ -2061,21 +1965,20 @@ public function signatureRequestEditRequest(string $signature_request_id, Model\ ); } + // form params + if ($signature_request_edit_request !== null) { + $formParams['signature_request_edit_request'] = ObjectSerializer::toFormValue($signature_request_edit_request); + } + + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_edit_request)); - } else { - $httpBody = $signature_request_edit_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -2088,17 +1991,6 @@ public function signatureRequestEditRequest(string $signature_request_id, Model\ } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $signature_request_edit_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -2406,12 +2298,6 @@ public function signatureRequestEditEmbeddedRequest(string $signature_request_id $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $signature_request_edit_embedded_request - ); - - $multipart = !empty($formParams); - // path params if ($signature_request_id !== null) { $resourcePath = str_replace( @@ -2421,21 +2307,20 @@ public function signatureRequestEditEmbeddedRequest(string $signature_request_id ); } + // form params + if ($signature_request_edit_embedded_request !== null) { + $formParams['signature_request_edit_embedded_request'] = ObjectSerializer::toFormValue($signature_request_edit_embedded_request); + } + + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_edit_embedded_request)); - } else { - $httpBody = $signature_request_edit_embedded_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -2448,17 +2333,6 @@ public function signatureRequestEditEmbeddedRequest(string $signature_request_id } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $signature_request_edit_embedded_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -2766,12 +2640,6 @@ public function signatureRequestEditEmbeddedWithTemplateRequest(string $signatur $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $signature_request_edit_embedded_with_template_request - ); - - $multipart = !empty($formParams); - // path params if ($signature_request_id !== null) { $resourcePath = str_replace( @@ -2781,21 +2649,20 @@ public function signatureRequestEditEmbeddedWithTemplateRequest(string $signatur ); } + // form params + if ($signature_request_edit_embedded_with_template_request !== null) { + $formParams['signature_request_edit_embedded_with_template_request'] = ObjectSerializer::toFormValue($signature_request_edit_embedded_with_template_request); + } + + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_edit_embedded_with_template_request)); - } else { - $httpBody = $signature_request_edit_embedded_with_template_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -2808,17 +2675,6 @@ public function signatureRequestEditEmbeddedWithTemplateRequest(string $signatur } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $signature_request_edit_embedded_with_template_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -3126,12 +2982,6 @@ public function signatureRequestEditWithTemplateRequest(string $signature_reques $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $signature_request_edit_with_template_request - ); - - $multipart = !empty($formParams); - // path params if ($signature_request_id !== null) { $resourcePath = str_replace( @@ -3141,21 +2991,20 @@ public function signatureRequestEditWithTemplateRequest(string $signature_reques ); } + // form params + if ($signature_request_edit_with_template_request !== null) { + $formParams['signature_request_edit_with_template_request'] = ObjectSerializer::toFormValue($signature_request_edit_with_template_request); + } + + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_edit_with_template_request)); - } else { - $httpBody = $signature_request_edit_with_template_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -3168,17 +3017,6 @@ public function signatureRequestEditWithTemplateRequest(string $signature_reques } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $signature_request_edit_with_template_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -3499,7 +3337,7 @@ public function signatureRequestFilesRequest(string $signature_request_id, ?stri } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/pdf', 'application/zip', 'application/json'], + ['application/pdf', 'application/zip', 'application/json'], $contentType, $multipart ); @@ -3518,14 +3356,6 @@ public function signatureRequestFilesRequest(string $signature_request_id, ?stri } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -3831,7 +3661,7 @@ public function signatureRequestFilesAsDataUriRequest(string $signature_request_ } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -3850,14 +3680,6 @@ public function signatureRequestFilesAsDataUriRequest(string $signature_request_ } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -4178,7 +4000,7 @@ public function signatureRequestFilesAsFileUrlRequest(string $signature_request_ } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -4197,14 +4019,6 @@ public function signatureRequestFilesAsFileUrlRequest(string $signature_request_ } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -4510,7 +4324,7 @@ public function signatureRequestGetRequest(string $signature_request_id, string } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -4529,14 +4343,6 @@ public function signatureRequestGetRequest(string $signature_request_id, string } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -4878,7 +4684,7 @@ public function signatureRequestListRequest(?string $account_id = null, ?int $pa ) ?? []); $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -4897,14 +4703,6 @@ public function signatureRequestListRequest(?string $account_id = null, ?int $pa } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -5210,7 +5008,7 @@ public function signatureRequestReleaseHoldRequest(string $signature_request_id, } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -5229,14 +5027,6 @@ public function signatureRequestReleaseHoldRequest(string $signature_request_id, } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -5544,12 +5334,6 @@ public function signatureRequestRemindRequest(string $signature_request_id, Mode $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $signature_request_remind_request - ); - - $multipart = !empty($formParams); - // path params if ($signature_request_id !== null) { $resourcePath = str_replace( @@ -5560,13 +5344,13 @@ public function signatureRequestRemindRequest(string $signature_request_id, Mode } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($signature_request_remind_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_remind_request)); @@ -5586,17 +5370,6 @@ public function signatureRequestRemindRequest(string $signature_request_id, Mode } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $signature_request_remind_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -5801,7 +5574,7 @@ public function signatureRequestRemoveRequest(string $signature_request_id, stri } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -5820,14 +5593,6 @@ public function signatureRequestRemoveRequest(string $signature_request_id, stri } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -6119,27 +5884,20 @@ public function signatureRequestSendRequest(Model\SignatureRequestSendRequest $s $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $signature_request_send_request - ); - - $multipart = !empty($formParams); + // form params + if ($signature_request_send_request !== null) { + $formParams['signature_request_send_request'] = ObjectSerializer::toFormValue($signature_request_send_request); + } + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_send_request)); - } else { - $httpBody = $signature_request_send_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -6152,17 +5910,6 @@ public function signatureRequestSendRequest(Model\SignatureRequestSendRequest $s } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $signature_request_send_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -6458,27 +6205,20 @@ public function signatureRequestSendWithTemplateRequest(Model\SignatureRequestSe $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $signature_request_send_with_template_request - ); - - $multipart = !empty($formParams); + // form params + if ($signature_request_send_with_template_request !== null) { + $formParams['signature_request_send_with_template_request'] = ObjectSerializer::toFormValue($signature_request_send_with_template_request); + } + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_send_with_template_request)); - } else { - $httpBody = $signature_request_send_with_template_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -6491,17 +6231,6 @@ public function signatureRequestSendWithTemplateRequest(Model\SignatureRequestSe } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $signature_request_send_with_template_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -6809,12 +6538,6 @@ public function signatureRequestUpdateRequest(string $signature_request_id, Mode $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $signature_request_update_request - ); - - $multipart = !empty($formParams); - // path params if ($signature_request_id !== null) { $resourcePath = str_replace( @@ -6825,13 +6548,13 @@ public function signatureRequestUpdateRequest(string $signature_request_id, Mode } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($signature_request_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_update_request)); @@ -6851,17 +6574,6 @@ public function signatureRequestUpdateRequest(string $signature_request_id, Mode } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $signature_request_update_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/TeamApi.php b/sdks/php/src/Api/TeamApi.php index 8b61a5d4b..47b02b42a 100644 --- a/sdks/php/src/Api/TeamApi.php +++ b/sdks/php/src/Api/TeamApi.php @@ -415,11 +415,6 @@ public function teamAddMemberRequest(Model\TeamAddMemberRequest $team_add_member $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $team_add_member_request - ); - - $multipart = !empty($formParams); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( $team_id, @@ -431,13 +426,13 @@ public function teamAddMemberRequest(Model\TeamAddMemberRequest $team_add_member ) ?? []); $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($team_add_member_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($team_add_member_request)); @@ -457,17 +452,6 @@ public function teamAddMemberRequest(Model\TeamAddMemberRequest $team_add_member } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $team_add_member_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -763,20 +747,14 @@ public function teamCreateRequest(Model\TeamCreateRequest $team_create_request, $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $team_create_request - ); - - $multipart = !empty($formParams); - $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($team_create_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($team_create_request)); @@ -796,17 +774,6 @@ public function teamCreateRequest(Model\TeamCreateRequest $team_create_request, } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $team_create_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -989,7 +956,7 @@ public function teamDeleteRequest(string $contentType = self::contentTypes['team $multipart = false; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -1008,14 +975,6 @@ public function teamDeleteRequest(string $contentType = self::contentTypes['team } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1299,7 +1258,7 @@ public function teamGetRequest(string $contentType = self::contentTypes['teamGet $multipart = false; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -1318,14 +1277,6 @@ public function teamGetRequest(string $contentType = self::contentTypes['teamGet } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1625,7 +1576,7 @@ public function teamInfoRequest(?string $team_id = null, string $contentType = s ) ?? []); $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -1644,14 +1595,6 @@ public function teamInfoRequest(?string $team_id = null, string $contentType = s } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1951,7 +1894,7 @@ public function teamInvitesRequest(?string $email_address = null, string $conten ) ?? []); $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -1970,14 +1913,6 @@ public function teamInvitesRequest(?string $email_address = null, string $conten } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -2319,7 +2254,7 @@ public function teamMembersRequest(string $team_id, ?int $page = 1, ?int $page_s } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -2338,14 +2273,6 @@ public function teamMembersRequest(string $team_id, ?int $page = 1, ?int $page_s } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -2641,20 +2568,14 @@ public function teamRemoveMemberRequest(Model\TeamRemoveMemberRequest $team_remo $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $team_remove_member_request - ); - - $multipart = !empty($formParams); - $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($team_remove_member_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($team_remove_member_request)); @@ -2674,17 +2595,6 @@ public function teamRemoveMemberRequest(Model\TeamRemoveMemberRequest $team_remo } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $team_remove_member_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -3026,7 +2936,7 @@ public function teamSubTeamsRequest(string $team_id, ?int $page = 1, ?int $page_ } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -3045,14 +2955,6 @@ public function teamSubTeamsRequest(string $team_id, ?int $page = 1, ?int $page_ } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -3348,20 +3250,14 @@ public function teamUpdateRequest(Model\TeamUpdateRequest $team_update_request, $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $team_update_request - ); - - $multipart = !empty($formParams); - $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($team_update_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($team_update_request)); @@ -3381,17 +3277,6 @@ public function teamUpdateRequest(Model\TeamUpdateRequest $team_update_request, } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $team_update_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/TemplateApi.php b/sdks/php/src/Api/TemplateApi.php index 2d39bc886..ab92e8cbb 100644 --- a/sdks/php/src/Api/TemplateApi.php +++ b/sdks/php/src/Api/TemplateApi.php @@ -72,11 +72,9 @@ class TemplateApi 'application/json', ], 'templateCreate' => [ - 'application/json', 'multipart/form-data', ], 'templateCreateEmbeddedDraft' => [ - 'application/json', 'multipart/form-data', ], 'templateDelete' => [ @@ -101,7 +99,6 @@ class TemplateApi 'application/json', ], 'templateUpdateFiles' => [ - 'application/json', 'multipart/form-data', ], ]; @@ -429,12 +426,6 @@ public function templateAddUserRequest(string $template_id, Model\TemplateAddUse $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $template_add_user_request - ); - - $multipart = !empty($formParams); - // path params if ($template_id !== null) { $resourcePath = str_replace( @@ -445,13 +436,13 @@ public function templateAddUserRequest(string $template_id, Model\TemplateAddUse } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($template_add_user_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($template_add_user_request)); @@ -471,17 +462,6 @@ public function templateAddUserRequest(string $template_id, Model\TemplateAddUse } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $template_add_user_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -777,27 +757,20 @@ public function templateCreateRequest(Model\TemplateCreateRequest $template_crea $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $template_create_request - ); - - $multipart = !empty($formParams); + // form params + if ($template_create_request !== null) { + $formParams['template_create_request'] = ObjectSerializer::toFormValue($template_create_request); + } + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($template_create_request)); - } else { - $httpBody = $template_create_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -810,17 +783,6 @@ public function templateCreateRequest(Model\TemplateCreateRequest $template_crea } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $template_create_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1116,27 +1078,20 @@ public function templateCreateEmbeddedDraftRequest(Model\TemplateCreateEmbeddedD $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $template_create_embedded_draft_request - ); - - $multipart = !empty($formParams); + // form params + if ($template_create_embedded_draft_request !== null) { + $formParams['template_create_embedded_draft_request'] = ObjectSerializer::toFormValue($template_create_embedded_draft_request); + } + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($template_create_embedded_draft_request)); - } else { - $httpBody = $template_create_embedded_draft_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -1149,17 +1104,6 @@ public function templateCreateEmbeddedDraftRequest(Model\TemplateCreateEmbeddedD } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $template_create_embedded_draft_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1364,7 +1308,7 @@ public function templateDeleteRequest(string $template_id, string $contentType = } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -1383,14 +1327,6 @@ public function templateDeleteRequest(string $template_id, string $contentType = } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1711,7 +1647,7 @@ public function templateFilesRequest(string $template_id, ?string $file_type = n } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/pdf', 'application/zip', 'application/json'], + ['application/pdf', 'application/zip', 'application/json'], $contentType, $multipart ); @@ -1730,14 +1666,6 @@ public function templateFilesRequest(string $template_id, ?string $file_type = n } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -2043,7 +1971,7 @@ public function templateFilesAsDataUriRequest(string $template_id, string $conte } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -2062,14 +1990,6 @@ public function templateFilesAsDataUriRequest(string $template_id, string $conte } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -2390,7 +2310,7 @@ public function templateFilesAsFileUrlRequest(string $template_id, ?int $force_d } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -2409,14 +2329,6 @@ public function templateFilesAsFileUrlRequest(string $template_id, ?int $force_d } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -2722,7 +2634,7 @@ public function templateGetRequest(string $template_id, string $contentType = se } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -2741,14 +2653,6 @@ public function templateGetRequest(string $template_id, string $contentType = se } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -3097,7 +3001,7 @@ public function templateListRequest(?string $account_id = null, ?int $page = 1, ) ?? []); $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); @@ -3116,14 +3020,6 @@ public function templateListRequest(?string $account_id = null, ?int $page = 1, } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -3431,12 +3327,6 @@ public function templateRemoveUserRequest(string $template_id, Model\TemplateRem $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $template_remove_user_request - ); - - $multipart = !empty($formParams); - // path params if ($template_id !== null) { $resourcePath = str_replace( @@ -3447,13 +3337,13 @@ public function templateRemoveUserRequest(string $template_id, Model\TemplateRem } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($template_remove_user_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($template_remove_user_request)); @@ -3473,17 +3363,6 @@ public function templateRemoveUserRequest(string $template_id, Model\TemplateRem } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $template_remove_user_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -3791,12 +3670,6 @@ public function templateUpdateFilesRequest(string $template_id, Model\TemplateUp $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $template_update_files_request - ); - - $multipart = !empty($formParams); - // path params if ($template_id !== null) { $resourcePath = str_replace( @@ -3806,21 +3679,20 @@ public function templateUpdateFilesRequest(string $template_id, Model\TemplateUp ); } + // form params + if ($template_update_files_request !== null) { + $formParams['template_update_files_request'] = ObjectSerializer::toFormValue($template_update_files_request); + } + + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($template_update_files_request)); - } else { - $httpBody = $template_update_files_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -3833,17 +3705,6 @@ public function templateUpdateFilesRequest(string $template_id, Model\TemplateUp } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $template_update_files_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/UnclaimedDraftApi.php b/sdks/php/src/Api/UnclaimedDraftApi.php index bb24fb1d9..455350b1d 100644 --- a/sdks/php/src/Api/UnclaimedDraftApi.php +++ b/sdks/php/src/Api/UnclaimedDraftApi.php @@ -68,15 +68,12 @@ class UnclaimedDraftApi */ public const contentTypes = [ 'unclaimedDraftCreate' => [ - 'application/json', 'multipart/form-data', ], 'unclaimedDraftCreateEmbedded' => [ - 'application/json', 'multipart/form-data', ], 'unclaimedDraftCreateEmbeddedWithTemplate' => [ - 'application/json', 'multipart/form-data', ], 'unclaimedDraftEditAndResend' => [ @@ -395,27 +392,20 @@ public function unclaimedDraftCreateRequest(Model\UnclaimedDraftCreateRequest $u $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $unclaimed_draft_create_request - ); - - $multipart = !empty($formParams); + // form params + if ($unclaimed_draft_create_request !== null) { + $formParams['unclaimed_draft_create_request'] = ObjectSerializer::toFormValue($unclaimed_draft_create_request); + } + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($unclaimed_draft_create_request)); - } else { - $httpBody = $unclaimed_draft_create_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -428,17 +418,6 @@ public function unclaimedDraftCreateRequest(Model\UnclaimedDraftCreateRequest $u } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $unclaimed_draft_create_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -734,27 +713,20 @@ public function unclaimedDraftCreateEmbeddedRequest(Model\UnclaimedDraftCreateEm $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $unclaimed_draft_create_embedded_request - ); - - $multipart = !empty($formParams); + // form params + if ($unclaimed_draft_create_embedded_request !== null) { + $formParams['unclaimed_draft_create_embedded_request'] = ObjectSerializer::toFormValue($unclaimed_draft_create_embedded_request); + } + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($unclaimed_draft_create_embedded_request)); - } else { - $httpBody = $unclaimed_draft_create_embedded_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -767,17 +739,6 @@ public function unclaimedDraftCreateEmbeddedRequest(Model\UnclaimedDraftCreateEm } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $unclaimed_draft_create_embedded_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1073,27 +1034,20 @@ public function unclaimedDraftCreateEmbeddedWithTemplateRequest(Model\UnclaimedD $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $unclaimed_draft_create_embedded_with_template_request - ); - - $multipart = !empty($formParams); + // form params + if ($unclaimed_draft_create_embedded_with_template_request !== null) { + $formParams['unclaimed_draft_create_embedded_with_template_request'] = ObjectSerializer::toFormValue($unclaimed_draft_create_embedded_with_template_request); + } + $multipart = true; $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($unclaimed_draft_create_embedded_with_template_request)); - } else { - $httpBody = $unclaimed_draft_create_embedded_with_template_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -1106,17 +1060,6 @@ public function unclaimedDraftCreateEmbeddedWithTemplateRequest(Model\UnclaimedD } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $unclaimed_draft_create_embedded_with_template_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1424,12 +1367,6 @@ public function unclaimedDraftEditAndResendRequest(string $signature_request_id, $httpBody = ''; $multipart = false; - $formParams = ObjectSerializer::getFormParams( - $unclaimed_draft_edit_and_resend_request - ); - - $multipart = !empty($formParams); - // path params if ($signature_request_id !== null) { $resourcePath = str_replace( @@ -1440,13 +1377,13 @@ public function unclaimedDraftEditAndResendRequest(string $signature_request_id, } $headers = $this->headerSelector->selectHeaders( - $multipart ? ['multipart/form-data'] : ['application/json'], + ['application/json'], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) === 0) { + if (isset($unclaimed_draft_edit_and_resend_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($unclaimed_draft_edit_and_resend_request)); @@ -1466,17 +1403,6 @@ public function unclaimedDraftEditAndResendRequest(string $signature_request_id, } } // for HTTP post (form) - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, $unclaimed_draft_edit_and_resend_request); - } $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/templates/api.mustache b/sdks/php/templates/api.mustache index cbcd7efb7..db304e089 100644 --- a/sdks/php/templates/api.mustache +++ b/sdks/php/templates/api.mustache @@ -715,15 +715,6 @@ use Psr\Http\Message\ResponseInterface; $httpBody = ''; $multipart = false; -{{#useCustomTemplateCode}} - {{#bodyParam}} - $formParams = ObjectSerializer::getFormParams( - ${{paramName}} - ); - - $multipart = !empty($formParams); - {{/bodyParam}} -{{/useCustomTemplateCode}} {{#queryParams}} // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( @@ -784,30 +775,18 @@ use Psr\Http\Message\ResponseInterface; } {{/formParams}} - {{^useCustomTemplateCode}} {{#isMultipart}} $multipart = true; {{/isMultipart}} - {{/useCustomTemplateCode}} $headers = $this->headerSelector->selectHeaders( -{{^useCustomTemplateCode}} [{{#produces}}'{{{mediaType}}}', {{/produces}}], -{{/useCustomTemplateCode}} -{{#useCustomTemplateCode}} - $multipart ? ['multipart/form-data'] : [{{#produces}}'{{{mediaType}}}', {{/produces}}], -{{/useCustomTemplateCode}} $contentType, $multipart ); // for model (json/xml) {{#bodyParams}} -{{^useCustomTemplateCode}} if (isset(${{paramName}})) { -{{/useCustomTemplateCode}} -{{#useCustomTemplateCode}} - if (count($formParams) === 0) { -{{/useCustomTemplateCode}} if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization(${{paramName}})); @@ -831,21 +810,6 @@ use Psr\Http\Message\ResponseInterface; } } // for HTTP post (form) -{{#useCustomTemplateCode}} - if (!empty($body)) { - $multipartContents[] = [ - 'name' => 'body', - 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], - ]; - } - - {{#bodyParam}} - if ($payloadHook = $this->config->getPayloadHook()) { - $payloadHook('multipart', $multipartContents, ${{paramName}}); - } - {{/bodyParam}} -{{/useCustomTemplateCode}} $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { diff --git a/src/Hello/OpenApi/GenerateSdkOas.php b/src/Hello/OpenApi/GenerateSdkOas.php index d97f7b1b2..7069280aa 100644 --- a/src/Hello/OpenApi/GenerateSdkOas.php +++ b/src/Hello/OpenApi/GenerateSdkOas.php @@ -21,9 +21,41 @@ public function run(): void ); $data = $raw_file->getData(); + $data['paths'] = $this->removeApplicationJsonFromFormDataOperations( + $data['paths'], + ); unset($data['tags']); $raw_file->setData($data); $raw_file->saveFile(self::ROOT_DIR . '/openapi-sdk.yaml'); } + + private function removeApplicationJsonFromFormDataOperations(array $paths): array + { + foreach ($paths as $path => $methods) { + foreach ($methods as $method => $operation) { + if ( + empty($operation['requestBody']) + || empty($operation['requestBody']['content']) + ) { + continue; + } + + $content = $operation['requestBody']['content']; + + if (empty($content['multipart/form-data'])) { + continue; + } + + $json_examples = $content['application/json']['examples'] ?? []; + unset($content['application/json']); + $content['multipart/form-data']['examples'] = $json_examples; + + $operation['requestBody']['content'] = $content; + $paths[$path][$method]['requestBody']['content'] = $content; + } + } + + return $paths; + } } From e2276f70a397e6b4eefbd2ff04f4201b5d2d01c2 Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Fri, 28 Mar 2025 11:02:39 -0500 Subject: [PATCH 2/2] Cleanup --- src/Hello/OpenApi/GenerateSdkOas.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Hello/OpenApi/GenerateSdkOas.php b/src/Hello/OpenApi/GenerateSdkOas.php index 7069280aa..34628ec0a 100644 --- a/src/Hello/OpenApi/GenerateSdkOas.php +++ b/src/Hello/OpenApi/GenerateSdkOas.php @@ -37,21 +37,24 @@ private function removeApplicationJsonFromFormDataOperations(array $paths): arra if ( empty($operation['requestBody']) || empty($operation['requestBody']['content']) + || empty($operation['requestBody']['content']['multipart/form-data']) ) { continue; } $content = $operation['requestBody']['content']; + $json_examples = []; - if (empty($content['multipart/form-data'])) { - continue; + if (!empty($content['application/json']['examples'])) { + $json_examples = $content['application/json']['examples']; } - $json_examples = $content['application/json']['examples'] ?? []; unset($content['application/json']); - $content['multipart/form-data']['examples'] = $json_examples; - $operation['requestBody']['content'] = $content; + if (empty($content['multipart/form-data']['examples'])) { + $content['multipart/form-data']['examples'] = $json_examples; + } + $paths[$path][$method]['requestBody']['content'] = $content; } }