diff --git a/examples/TemplateUpdateExample.cs b/examples/TemplateUpdateExample.cs new file mode 100644 index 000000000..23f5496fe --- /dev/null +++ b/examples/TemplateUpdateExample.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.Json; + +using Dropbox.Sign.Api; +using Dropbox.Sign.Client; +using Dropbox.Sign.Model; + +namespace Dropbox.SignSandbox; + +public class TemplateUpdateExample +{ + public static void Run() + { + var config = new Configuration(); + config.Username = "YOUR_API_KEY"; + // config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var templateUpdateRequest = new TemplateUpdateRequest( + allowFormView: false, + title: "Test Title", + subject: "Test Subject", + message: "Test Message", + ccRoles: [ + "CC Role 1", + "CC Role 2", + ] + ); + + try + { + var response = new TemplateApi(config).TemplateUpdate( + templateId: "f57db65d3f933b5316d398057a36176831451a35", + templateUpdateRequest: templateUpdateRequest + ); + + Console.WriteLine(response); + } + catch (ApiException e) + { + Console.WriteLine("Exception when calling TemplateApi#TemplateUpdate: " + e.Message); + Console.WriteLine("Status Code: " + e.ErrorCode); + Console.WriteLine(e.StackTrace); + } + } +} diff --git a/examples/TemplateUpdateExample.java b/examples/TemplateUpdateExample.java new file mode 100644 index 000000000..1b69f2ace --- /dev/null +++ b/examples/TemplateUpdateExample.java @@ -0,0 +1,52 @@ +package com.dropbox.sign_sandbox; + +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.JSON; +import com.dropbox.sign.model.*; + +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class TemplateUpdateExample +{ + public static void main(String[] args) + { + var config = Configuration.getDefaultApiClient(); + ((HttpBasicAuth) config.getAuthentication("api_key")).setUsername("YOUR_API_KEY"); + // ((HttpBearerAuth) config.getAuthentication("oauth2")).setBearerToken("YOUR_ACCESS_TOKEN"); + + var templateUpdateRequest = new TemplateUpdateRequest(); + templateUpdateRequest.allowFormView(false); + templateUpdateRequest.title("Test Title"); + templateUpdateRequest.subject("Test Subject"); + templateUpdateRequest.message("Test Message"); + templateUpdateRequest.ccRoles(List.of ( + "CC Role 1", + "CC Role 2" + )); + + try + { + var response = new TemplateApi(config).templateUpdate( + "f57db65d3f933b5316d398057a36176831451a35", // templateId + templateUpdateRequest + ); + + System.out.println(response); + } catch (ApiException e) { + System.err.println("Exception when calling TemplateApi#templateUpdate"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/TemplateUpdateExample.php b/examples/TemplateUpdateExample.php new file mode 100644 index 000000000..6dadda6c5 --- /dev/null +++ b/examples/TemplateUpdateExample.php @@ -0,0 +1,33 @@ +setUsername("YOUR_API_KEY"); +// $config->setAccessToken("YOUR_ACCESS_TOKEN"); + +$template_update_request = (new Dropbox\Sign\Model\TemplateUpdateRequest()) + ->setAllowFormView(false) + ->setTitle("Test Title") + ->setSubject("Test Subject") + ->setMessage("Test Message") + ->setCcRoles([ + "CC Role 1", + "CC Role 2", + ]); + +try { + $response = (new Dropbox\Sign\Api\TemplateApi(config: $config))->templateUpdate( + template_id: "f57db65d3f933b5316d398057a36176831451a35", + template_update_request: $template_update_request, + ); + + print_r($response); +} catch (Dropbox\Sign\ApiException $e) { + echo "Exception when calling TemplateApi#templateUpdate: {$e->getMessage()}"; +} diff --git a/examples/TemplateUpdateExample.py b/examples/TemplateUpdateExample.py new file mode 100644 index 000000000..b8c85862a --- /dev/null +++ b/examples/TemplateUpdateExample.py @@ -0,0 +1,32 @@ +import json +from datetime import date, datetime +from pprint import pprint + +from dropbox_sign import ApiClient, ApiException, Configuration, api, models + +configuration = Configuration( + username="YOUR_API_KEY", + # access_token="YOUR_ACCESS_TOKEN", +) + +with ApiClient(configuration) as api_client: + template_update_request = models.TemplateUpdateRequest( + allow_form_view=False, + title="Test Title", + subject="Test Subject", + message="Test Message", + cc_roles=[ + "CC Role 1", + "CC Role 2", + ], + ) + + try: + response = api.TemplateApi(api_client).template_update( + template_id="f57db65d3f933b5316d398057a36176831451a35", + template_update_request=template_update_request, + ) + + pprint(response) + except ApiException as e: + print("Exception when calling TemplateApi#template_update: %s\n" % e) diff --git a/examples/TemplateUpdateExample.rb b/examples/TemplateUpdateExample.rb new file mode 100644 index 000000000..393bd3653 --- /dev/null +++ b/examples/TemplateUpdateExample.rb @@ -0,0 +1,28 @@ +require "json" +require "dropbox-sign" + +Dropbox::Sign.configure do |config| + config.username = "YOUR_API_KEY" + # config.access_token = "YOUR_ACCESS_TOKEN" +end + +template_update_request = Dropbox::Sign::TemplateUpdateRequest.new +template_update_request.allow_form_view = false +template_update_request.title = "Test Title" +template_update_request.subject = "Test Subject" +template_update_request.message = "Test Message" +template_update_request.cc_roles = [ + "CC Role 1", + "CC Role 2", +] + +begin + response = Dropbox::Sign::TemplateApi.new.template_update( + "f57db65d3f933b5316d398057a36176831451a35", # template_id + template_update_request, + ) + + p response +rescue Dropbox::Sign::ApiError => e + puts "Exception when calling TemplateApi#template_update: #{e}" +end diff --git a/examples/TemplateUpdateExample.ts b/examples/TemplateUpdateExample.ts new file mode 100644 index 000000000..62ca78172 --- /dev/null +++ b/examples/TemplateUpdateExample.ts @@ -0,0 +1,28 @@ +import * as fs from 'fs'; +import api from "@dropbox/sign" +import models from "@dropbox/sign" + +const apiCaller = new api.TemplateApi(); +apiCaller.username = "YOUR_API_KEY"; +// apiCaller.accessToken = "YOUR_ACCESS_TOKEN"; + +const templateUpdateRequest: models.TemplateUpdateRequest = { + allowFormView: false, + title: "Test Title", + subject: "Test Subject", + message: "Test Message", + ccRoles: [ + "CC Role 1", + "CC Role 2", + ], +}; + +apiCaller.templateUpdate( + "f57db65d3f933b5316d398057a36176831451a35", // templateId + templateUpdateRequest, +).then(response => { + console.log(response.body); +}).catch(error => { + console.log("Exception when calling TemplateApi#templateUpdate:"); + console.log(error.body); +}); diff --git a/examples/json/TemplateUpdateRequest.json b/examples/json/TemplateUpdateRequest.json new file mode 100644 index 000000000..070aba6d2 --- /dev/null +++ b/examples/json/TemplateUpdateRequest.json @@ -0,0 +1,7 @@ +{ + "allow_form_view": false, + "title": "Test Title", + "subject": "Test Subject", + "message": "Test Message", + "cc_roles": ["CC Role 1", "CC Role 2"] +} diff --git a/openapi-raw.yaml b/openapi-raw.yaml index 9f264f89f..b3dabf5bb 100644 --- a/openapi-raw.yaml +++ b/openapi-raw.yaml @@ -7172,6 +7172,121 @@ paths: seo: title: '_t__TemplateRemoveUser::SEO::TITLE' description: '_t__TemplateRemoveUser::SEO::DESCRIPTION' + '/template/update/{template_id}': + post: + tags: + - Template + summary: '_t__TemplateUpdate::SUMMARY' + description: '_t__TemplateUpdate::DESCRIPTION' + operationId: templateUpdate + parameters: + - + name: template_id + in: path + description: '_t__TemplateUpdate::TEMPLATE_ID' + required: true + schema: + type: string + example: f57db65d3f933b5316d398057a36176831451a35 + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TemplateUpdateRequest' + examples: + example: + $ref: '#/components/examples/TemplateUpdateRequest' + multipart/form-data: + schema: + $ref: '#/components/schemas/TemplateUpdateRequest' + responses: + '200': + description: 'successful operation' + headers: + X-RateLimit-Limit: + $ref: '#/components/headers/X-RateLimit-Limit' + X-RateLimit-Remaining: + $ref: '#/components/headers/X-RateLimit-Remaining' + X-Ratelimit-Reset: + $ref: '#/components/headers/X-Ratelimit-Reset' + content: + application/json: + schema: + $ref: '#/components/schemas/TemplateGetResponse' + examples: + example: + $ref: '#/components/examples/TemplateGetResponse' + 4XX: + description: failed_operation + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + examples: + 400_example: + $ref: '#/components/examples/Error400Response' + 401_example: + $ref: '#/components/examples/Error401Response' + 402_example: + $ref: '#/components/examples/Error402Response' + 403_example: + $ref: '#/components/examples/Error403Response' + 429_example: + $ref: '#/components/examples/Error429Response' + 404_example: + $ref: '#/components/examples/Error404Response' + 409_example: + $ref: '#/components/examples/Error409Response' + 4XX_example: + $ref: '#/components/examples/Error4XXResponse' + security: + - + api_key: [] + - + oauth2: + - template_access + x-codeSamples: + - + lang: PHP + label: PHP + source: + $ref: examples/TemplateUpdateExample.php + - + lang: 'C#' + label: 'C#' + source: + $ref: examples/TemplateUpdateExample.cs + - + lang: TypeScript + label: TypeScript + source: + $ref: examples/TemplateUpdateExample.ts + - + lang: Java + label: Java + source: + $ref: examples/TemplateUpdateExample.java + - + lang: Ruby + label: Ruby + source: + $ref: examples/TemplateUpdateExample.rb + - + lang: Python + label: Python + source: + $ref: examples/TemplateUpdateExample.py + - + lang: cURL + label: cURL + source: + $ref: examples/TemplateUpdateExample.sh + x-meta: + seo: + title: '_t__TemplateUpdate::SEO::TITLE' + description: '_t__TemplateUpdate::SEO::DESCRIPTION' + x-hideOn: doc '/template/update_files/{template_id}': post: tags: @@ -10189,6 +10304,28 @@ components: type: string format: email type: object + TemplateUpdateRequest: + properties: + cc_roles: + description: '_t__TemplateUpdate::CC_ROLES' + type: array + items: + type: string + allow_form_view: + description: '_t__TemplateUpdate::ALLOW_FORM_VIEW' + type: boolean + title: + description: '_t__TemplateUpdate::TITLE' + type: string + subject: + description: '_t__TemplateUpdate::SUBJECT' + type: string + maxLength: 200 + message: + description: '_t__TemplateUpdate::MESSAGE' + type: string + maxLength: 5000 + type: object TemplateUpdateFilesRequest: properties: client_id: @@ -12767,14 +12904,6 @@ components: $ref: '#/components/schemas/WarningResponse' type: object x-internal-class: true - TemplateEditResponse: - required: - - template_id - properties: - template_id: - description: '_t__TemplateResponse::TEMPLATE_ID' - type: string - type: object TemplateGetResponse: required: - template @@ -13102,6 +13231,10 @@ components: summary: 'Default Example' value: $ref: examples/json/TemplateRemoveUserRequest.json + TemplateUpdateRequest: + summary: 'Default Example' + value: + $ref: examples/json/TemplateUpdateRequest.json TemplateUpdateFilesRequest: summary: 'Default Example' value: diff --git a/openapi-sdk.yaml b/openapi-sdk.yaml index 707ba5ab3..2bb178817 100644 --- a/openapi-sdk.yaml +++ b/openapi-sdk.yaml @@ -7245,6 +7245,121 @@ paths: seo: title: 'Remove User from Template | REST API | Dropbox Sign for Developers' description: 'The Dropbox Sign API easily allows you to build custom integrations. To find out how to remove a specified Account''s access to a Template, click here.' + '/template/update/{template_id}': + post: + tags: + - Template + summary: 'Edit Template' + description: 'Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged.' + operationId: templateUpdate + parameters: + - + name: template_id + in: path + description: 'The ID of the template to update.' + required: true + schema: + type: string + example: f57db65d3f933b5316d398057a36176831451a35 + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TemplateUpdateRequest' + examples: + example: + $ref: '#/components/examples/TemplateUpdateRequest' + multipart/form-data: + schema: + $ref: '#/components/schemas/TemplateUpdateRequest' + responses: + '200': + description: 'successful operation' + headers: + X-RateLimit-Limit: + $ref: '#/components/headers/X-RateLimit-Limit' + X-RateLimit-Remaining: + $ref: '#/components/headers/X-RateLimit-Remaining' + X-Ratelimit-Reset: + $ref: '#/components/headers/X-Ratelimit-Reset' + content: + application/json: + schema: + $ref: '#/components/schemas/TemplateGetResponse' + examples: + example: + $ref: '#/components/examples/TemplateGetResponse' + '4XX': + description: failed_operation + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + examples: + 400_example: + $ref: '#/components/examples/Error400Response' + 401_example: + $ref: '#/components/examples/Error401Response' + 402_example: + $ref: '#/components/examples/Error402Response' + 403_example: + $ref: '#/components/examples/Error403Response' + 429_example: + $ref: '#/components/examples/Error429Response' + 404_example: + $ref: '#/components/examples/Error404Response' + 409_example: + $ref: '#/components/examples/Error409Response' + 4XX_example: + $ref: '#/components/examples/Error4XXResponse' + security: + - + api_key: [] + - + oauth2: + - template_access + x-codeSamples: + - + lang: PHP + label: PHP + source: + $ref: examples/TemplateUpdateExample.php + - + lang: 'C#' + label: 'C#' + source: + $ref: examples/TemplateUpdateExample.cs + - + lang: TypeScript + label: TypeScript + source: + $ref: examples/TemplateUpdateExample.ts + - + lang: Java + label: Java + source: + $ref: examples/TemplateUpdateExample.java + - + lang: Ruby + label: Ruby + source: + $ref: examples/TemplateUpdateExample.rb + - + lang: Python + label: Python + source: + $ref: examples/TemplateUpdateExample.py + - + lang: cURL + label: cURL + source: + $ref: examples/TemplateUpdateExample.sh + x-meta: + seo: + title: 'Update Template | REST API | Dropbox Sign for Developers' + description: 'The Dropbox Sign API easily allows you to build custom integrations. To find out how to update properties of an existing template, click here.' + x-hideOn: doc '/template/update_files/{template_id}': post: tags: @@ -10826,6 +10941,28 @@ components: type: string format: email type: object + TemplateUpdateRequest: + properties: + cc_roles: + description: 'The CC roles that must be assigned when using the template to send a signature request.' + type: array + items: + type: string + allow_form_view: + description: 'The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names.' + type: boolean + title: + description: 'The title you want to assign to the SignatureRequest.' + type: string + subject: + description: 'The new default template email subject.' + type: string + maxLength: 200 + message: + description: 'The new default template email message.' + type: string + maxLength: 5000 + type: object TemplateUpdateFilesRequest: properties: client_id: @@ -13691,14 +13828,6 @@ components: $ref: '#/components/schemas/WarningResponse' type: object x-internal-class: true - TemplateEditResponse: - required: - - template_id - properties: - template_id: - description: 'The id of the Template.' - type: string - type: object TemplateGetResponse: required: - template @@ -14026,6 +14155,10 @@ components: summary: 'Default Example' value: $ref: examples/json/TemplateRemoveUserRequest.json + TemplateUpdateRequest: + summary: 'Default Example' + value: + $ref: examples/json/TemplateUpdateRequest.json TemplateUpdateFilesRequest: summary: 'Default Example' value: diff --git a/openapi.yaml b/openapi.yaml index 998bc4ebd..99098f471 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -10804,6 +10804,28 @@ components: type: string format: email type: object + TemplateUpdateRequest: + properties: + cc_roles: + description: 'The CC roles that must be assigned when using the template to send a signature request.' + type: array + items: + type: string + allow_form_view: + description: 'The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names.' + type: boolean + title: + description: 'The title you want to assign to the SignatureRequest.' + type: string + subject: + description: 'The new default template email subject.' + type: string + maxLength: 200 + message: + description: 'The new default template email message.' + type: string + maxLength: 5000 + type: object TemplateUpdateFilesRequest: properties: client_id: @@ -13669,14 +13691,6 @@ components: $ref: '#/components/schemas/WarningResponse' type: object x-internal-class: true - TemplateEditResponse: - required: - - template_id - properties: - template_id: - description: 'The id of the Template.' - type: string - type: object TemplateGetResponse: required: - template @@ -14004,6 +14018,10 @@ components: summary: 'Default Example' value: $ref: examples/json/TemplateRemoveUserRequest.json + TemplateUpdateRequest: + summary: 'Default Example' + value: + $ref: examples/json/TemplateUpdateRequest.json TemplateUpdateFilesRequest: summary: 'Default Example' value: diff --git a/sandbox/dotnet/src/Dropbox.SignSandbox/TemplateUpdateExample.cs b/sandbox/dotnet/src/Dropbox.SignSandbox/TemplateUpdateExample.cs new file mode 100644 index 000000000..23f5496fe --- /dev/null +++ b/sandbox/dotnet/src/Dropbox.SignSandbox/TemplateUpdateExample.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.Json; + +using Dropbox.Sign.Api; +using Dropbox.Sign.Client; +using Dropbox.Sign.Model; + +namespace Dropbox.SignSandbox; + +public class TemplateUpdateExample +{ + public static void Run() + { + var config = new Configuration(); + config.Username = "YOUR_API_KEY"; + // config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var templateUpdateRequest = new TemplateUpdateRequest( + allowFormView: false, + title: "Test Title", + subject: "Test Subject", + message: "Test Message", + ccRoles: [ + "CC Role 1", + "CC Role 2", + ] + ); + + try + { + var response = new TemplateApi(config).TemplateUpdate( + templateId: "f57db65d3f933b5316d398057a36176831451a35", + templateUpdateRequest: templateUpdateRequest + ); + + Console.WriteLine(response); + } + catch (ApiException e) + { + Console.WriteLine("Exception when calling TemplateApi#TemplateUpdate: " + e.Message); + Console.WriteLine("Status Code: " + e.ErrorCode); + Console.WriteLine(e.StackTrace); + } + } +} diff --git a/sandbox/java/src/main/java/com/dropbox/sign_sandbox/TemplateUpdateExample.java b/sandbox/java/src/main/java/com/dropbox/sign_sandbox/TemplateUpdateExample.java new file mode 100644 index 000000000..1b69f2ace --- /dev/null +++ b/sandbox/java/src/main/java/com/dropbox/sign_sandbox/TemplateUpdateExample.java @@ -0,0 +1,52 @@ +package com.dropbox.sign_sandbox; + +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.JSON; +import com.dropbox.sign.model.*; + +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class TemplateUpdateExample +{ + public static void main(String[] args) + { + var config = Configuration.getDefaultApiClient(); + ((HttpBasicAuth) config.getAuthentication("api_key")).setUsername("YOUR_API_KEY"); + // ((HttpBearerAuth) config.getAuthentication("oauth2")).setBearerToken("YOUR_ACCESS_TOKEN"); + + var templateUpdateRequest = new TemplateUpdateRequest(); + templateUpdateRequest.allowFormView(false); + templateUpdateRequest.title("Test Title"); + templateUpdateRequest.subject("Test Subject"); + templateUpdateRequest.message("Test Message"); + templateUpdateRequest.ccRoles(List.of ( + "CC Role 1", + "CC Role 2" + )); + + try + { + var response = new TemplateApi(config).templateUpdate( + "f57db65d3f933b5316d398057a36176831451a35", // templateId + templateUpdateRequest + ); + + System.out.println(response); + } catch (ApiException e) { + System.err.println("Exception when calling TemplateApi#templateUpdate"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/sandbox/node/src/TemplateUpdateExample.ts b/sandbox/node/src/TemplateUpdateExample.ts new file mode 100644 index 000000000..62ca78172 --- /dev/null +++ b/sandbox/node/src/TemplateUpdateExample.ts @@ -0,0 +1,28 @@ +import * as fs from 'fs'; +import api from "@dropbox/sign" +import models from "@dropbox/sign" + +const apiCaller = new api.TemplateApi(); +apiCaller.username = "YOUR_API_KEY"; +// apiCaller.accessToken = "YOUR_ACCESS_TOKEN"; + +const templateUpdateRequest: models.TemplateUpdateRequest = { + allowFormView: false, + title: "Test Title", + subject: "Test Subject", + message: "Test Message", + ccRoles: [ + "CC Role 1", + "CC Role 2", + ], +}; + +apiCaller.templateUpdate( + "f57db65d3f933b5316d398057a36176831451a35", // templateId + templateUpdateRequest, +).then(response => { + console.log(response.body); +}).catch(error => { + console.log("Exception when calling TemplateApi#templateUpdate:"); + console.log(error.body); +}); diff --git a/sandbox/php/src/TemplateUpdateExample.php b/sandbox/php/src/TemplateUpdateExample.php new file mode 100644 index 000000000..6dadda6c5 --- /dev/null +++ b/sandbox/php/src/TemplateUpdateExample.php @@ -0,0 +1,33 @@ +setUsername("YOUR_API_KEY"); +// $config->setAccessToken("YOUR_ACCESS_TOKEN"); + +$template_update_request = (new Dropbox\Sign\Model\TemplateUpdateRequest()) + ->setAllowFormView(false) + ->setTitle("Test Title") + ->setSubject("Test Subject") + ->setMessage("Test Message") + ->setCcRoles([ + "CC Role 1", + "CC Role 2", + ]); + +try { + $response = (new Dropbox\Sign\Api\TemplateApi(config: $config))->templateUpdate( + template_id: "f57db65d3f933b5316d398057a36176831451a35", + template_update_request: $template_update_request, + ); + + print_r($response); +} catch (Dropbox\Sign\ApiException $e) { + echo "Exception when calling TemplateApi#templateUpdate: {$e->getMessage()}"; +} diff --git a/sandbox/python/src/TemplateUpdateExample.py b/sandbox/python/src/TemplateUpdateExample.py new file mode 100644 index 000000000..b8c85862a --- /dev/null +++ b/sandbox/python/src/TemplateUpdateExample.py @@ -0,0 +1,32 @@ +import json +from datetime import date, datetime +from pprint import pprint + +from dropbox_sign import ApiClient, ApiException, Configuration, api, models + +configuration = Configuration( + username="YOUR_API_KEY", + # access_token="YOUR_ACCESS_TOKEN", +) + +with ApiClient(configuration) as api_client: + template_update_request = models.TemplateUpdateRequest( + allow_form_view=False, + title="Test Title", + subject="Test Subject", + message="Test Message", + cc_roles=[ + "CC Role 1", + "CC Role 2", + ], + ) + + try: + response = api.TemplateApi(api_client).template_update( + template_id="f57db65d3f933b5316d398057a36176831451a35", + template_update_request=template_update_request, + ) + + pprint(response) + except ApiException as e: + print("Exception when calling TemplateApi#template_update: %s\n" % e) diff --git a/sandbox/ruby/src/TemplateUpdateExample.rb b/sandbox/ruby/src/TemplateUpdateExample.rb new file mode 100644 index 000000000..393bd3653 --- /dev/null +++ b/sandbox/ruby/src/TemplateUpdateExample.rb @@ -0,0 +1,28 @@ +require "json" +require "dropbox-sign" + +Dropbox::Sign.configure do |config| + config.username = "YOUR_API_KEY" + # config.access_token = "YOUR_ACCESS_TOKEN" +end + +template_update_request = Dropbox::Sign::TemplateUpdateRequest.new +template_update_request.allow_form_view = false +template_update_request.title = "Test Title" +template_update_request.subject = "Test Subject" +template_update_request.message = "Test Message" +template_update_request.cc_roles = [ + "CC Role 1", + "CC Role 2", +] + +begin + response = Dropbox::Sign::TemplateApi.new.template_update( + "f57db65d3f933b5316d398057a36176831451a35", # template_id + template_update_request, + ) + + p response +rescue Dropbox::Sign::ApiError => e + puts "Exception when calling TemplateApi#template_update: #{e}" +end diff --git a/sdks/dotnet/README.md b/sdks/dotnet/README.md index c8323efa3..644657b4c 100644 --- a/sdks/dotnet/README.md +++ b/sdks/dotnet/README.md @@ -199,6 +199,7 @@ Class | Method | HTTP request | Description *TemplateApi* | [**TemplateGet**](docs/TemplateApi.md#templateget) | **GET** /template/{template_id} | Get Template *TemplateApi* | [**TemplateList**](docs/TemplateApi.md#templatelist) | **GET** /template/list | List Templates *TemplateApi* | [**TemplateRemoveUser**](docs/TemplateApi.md#templateremoveuser) | **POST** /template/remove_user/{template_id} | Remove User from Template +*TemplateApi* | [**TemplateUpdate**](docs/TemplateApi.md#templateupdate) | **POST** /template/update/{template_id} | Edit Template *TemplateApi* | [**TemplateUpdateFiles**](docs/TemplateApi.md#templateupdatefiles) | **POST** /template/update_files/{template_id} | Update Template Files *UnclaimedDraftApi* | [**UnclaimedDraftCreate**](docs/UnclaimedDraftApi.md#unclaimeddraftcreate) | **POST** /unclaimed_draft/create | Create Unclaimed Draft *UnclaimedDraftApi* | [**UnclaimedDraftCreateEmbedded**](docs/UnclaimedDraftApi.md#unclaimeddraftcreateembedded) | **POST** /unclaimed_draft/create_embedded | Create Embedded Unclaimed Draft @@ -357,7 +358,6 @@ Class | Method | HTTP request | Description - [Model.TemplateCreateRequest](docs/TemplateCreateRequest.md) - [Model.TemplateCreateResponse](docs/TemplateCreateResponse.md) - [Model.TemplateCreateResponseTemplate](docs/TemplateCreateResponseTemplate.md) - - [Model.TemplateEditResponse](docs/TemplateEditResponse.md) - [Model.TemplateGetResponse](docs/TemplateGetResponse.md) - [Model.TemplateListResponse](docs/TemplateListResponse.md) - [Model.TemplateRemoveUserRequest](docs/TemplateRemoveUserRequest.md) @@ -394,6 +394,7 @@ Class | Method | HTTP request | Description - [Model.TemplateUpdateFilesRequest](docs/TemplateUpdateFilesRequest.md) - [Model.TemplateUpdateFilesResponse](docs/TemplateUpdateFilesResponse.md) - [Model.TemplateUpdateFilesResponseTemplate](docs/TemplateUpdateFilesResponseTemplate.md) + - [Model.TemplateUpdateRequest](docs/TemplateUpdateRequest.md) - [Model.UnclaimedDraftCreateEmbeddedRequest](docs/UnclaimedDraftCreateEmbeddedRequest.md) - [Model.UnclaimedDraftCreateEmbeddedWithTemplateRequest](docs/UnclaimedDraftCreateEmbeddedWithTemplateRequest.md) - [Model.UnclaimedDraftCreateRequest](docs/UnclaimedDraftCreateRequest.md) diff --git a/sdks/dotnet/docs/TemplateApi.md b/sdks/dotnet/docs/TemplateApi.md index f9c66e11c..fffb3cfa9 100644 --- a/sdks/dotnet/docs/TemplateApi.md +++ b/sdks/dotnet/docs/TemplateApi.md @@ -14,6 +14,7 @@ All URIs are relative to *https://api.hellosign.com/v3* | [**TemplateGet**](TemplateApi.md#templateget) | **GET** /template/{template_id} | Get Template | | [**TemplateList**](TemplateApi.md#templatelist) | **GET** /template/list | List Templates | | [**TemplateRemoveUser**](TemplateApi.md#templateremoveuser) | **POST** /template/remove_user/{template_id} | Remove User from Template | +| [**TemplateUpdate**](TemplateApi.md#templateupdate) | **POST** /template/update/{template_id} | Edit Template | | [**TemplateUpdateFiles**](TemplateApi.md#templateupdatefiles) | **POST** /template/update_files/{template_id} | Update Template Files | @@ -1135,6 +1136,115 @@ catch (ApiException e) - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
| +| **4XX** | failed_operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **TemplateUpdate** +> TemplateGetResponse TemplateUpdate (string templateId, TemplateUpdateRequest templateUpdateRequest) + +Edit Template + +Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + +### Example +```csharp +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.Json; + +using Dropbox.Sign.Api; +using Dropbox.Sign.Client; +using Dropbox.Sign.Model; + +namespace Dropbox.SignSandbox; + +public class TemplateUpdateExample +{ + public static void Run() + { + var config = new Configuration(); + config.Username = "YOUR_API_KEY"; + // config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var templateUpdateRequest = new TemplateUpdateRequest( + allowFormView: false, + title: "Test Title", + subject: "Test Subject", + message: "Test Message", + ccRoles: [ + "CC Role 1", + "CC Role 2", + ] + ); + + try + { + var response = new TemplateApi(config).TemplateUpdate( + templateId: "f57db65d3f933b5316d398057a36176831451a35", + templateUpdateRequest: templateUpdateRequest + ); + + Console.WriteLine(response); + } + catch (ApiException e) + { + Console.WriteLine("Exception when calling TemplateApi#TemplateUpdate: " + e.Message); + Console.WriteLine("Status Code: " + e.ErrorCode); + Console.WriteLine(e.StackTrace); + } + } +} + +``` + +#### Using the TemplateUpdateWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Edit Template + ApiResponse response = apiInstance.TemplateUpdateWithHttpInfo(templateId, templateUpdateRequest); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling TemplateApi.TemplateUpdateWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **templateId** | **string** | The ID of the template to update. | | +| **templateUpdateRequest** | [**TemplateUpdateRequest**](TemplateUpdateRequest.md) | | | + +### Return type + +[**TemplateGetResponse**](TemplateGetResponse.md) + +### Authorization + +[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json, multipart/form-data + - **Accept**: application/json + + ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| diff --git a/sdks/dotnet/docs/TemplateEditResponse.md b/sdks/dotnet/docs/TemplateEditResponse.md deleted file mode 100644 index 830c7a9ed..000000000 --- a/sdks/dotnet/docs/TemplateEditResponse.md +++ /dev/null @@ -1,10 +0,0 @@ -# Dropbox.Sign.Model.TemplateEditResponse - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**TemplateId** | **string** | The id of the Template. | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/sdks/dotnet/docs/TemplateUpdateRequest.md b/sdks/dotnet/docs/TemplateUpdateRequest.md new file mode 100644 index 000000000..76565ccfa --- /dev/null +++ b/sdks/dotnet/docs/TemplateUpdateRequest.md @@ -0,0 +1,10 @@ +# Dropbox.Sign.Model.TemplateUpdateRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**CcRoles** | **List<string>** | The CC roles that must be assigned when using the template to send a signature request. | [optional] **AllowFormView** | **bool** | The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names. | [optional] **Title** | **string** | The title you want to assign to the SignatureRequest. | [optional] **Subject** | **string** | The new default template email subject. | [optional] **Message** | **string** | The new default template email message. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/sdks/dotnet/src/Dropbox.Sign/Api/TemplateApi.cs b/sdks/dotnet/src/Dropbox.Sign/Api/TemplateApi.cs index f98f0671c..ec79ef59c 100644 --- a/sdks/dotnet/src/Dropbox.Sign/Api/TemplateApi.cs +++ b/sdks/dotnet/src/Dropbox.Sign/Api/TemplateApi.cs @@ -272,6 +272,31 @@ public interface ITemplateApiSync : IApiAccessor /// ApiResponse of TemplateGetResponse ApiResponse TemplateRemoveUserWithHttpInfo(string templateId, TemplateRemoveUserRequest templateRemoveUserRequest, int operationIndex = 0); /// + /// Edit Template + /// + /// + /// Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + /// + /// Thrown when fails to make API call + /// The ID of the template to update. + /// + /// Index associated with the operation. + /// TemplateGetResponse + TemplateGetResponse TemplateUpdate(string templateId, TemplateUpdateRequest templateUpdateRequest, int operationIndex = 0); + + /// + /// Edit Template + /// + /// + /// Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + /// + /// Thrown when fails to make API call + /// The ID of the template to update. + /// + /// Index associated with the operation. + /// ApiResponse of TemplateGetResponse + ApiResponse TemplateUpdateWithHttpInfo(string templateId, TemplateUpdateRequest templateUpdateRequest, int operationIndex = 0); + /// /// Update Template Files /// /// @@ -570,6 +595,33 @@ public interface ITemplateApiAsync : IApiAccessor /// Task of ApiResponse (TemplateGetResponse) System.Threading.Tasks.Task> TemplateRemoveUserWithHttpInfoAsync(string templateId, TemplateRemoveUserRequest templateRemoveUserRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); /// + /// Edit Template + /// + /// + /// Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + /// + /// Thrown when fails to make API call + /// The ID of the template to update. + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of TemplateGetResponse + System.Threading.Tasks.Task TemplateUpdateAsync(string templateId, TemplateUpdateRequest templateUpdateRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Edit Template + /// + /// + /// Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + /// + /// Thrown when fails to make API call + /// The ID of the template to update. + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (TemplateGetResponse) + System.Threading.Tasks.Task> TemplateUpdateWithHttpInfoAsync(string templateId, TemplateUpdateRequest templateUpdateRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// /// Update Template Files /// /// @@ -2552,6 +2604,208 @@ public Dropbox.Sign.Client.ApiResponse TemplateRemoveUserWi return localVarResponse; } + /// + /// Edit Template Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + /// + /// Thrown when fails to make API call + /// The ID of the template to update. + /// + /// Index associated with the operation. + /// TemplateGetResponse + public TemplateGetResponse TemplateUpdate(string templateId, TemplateUpdateRequest templateUpdateRequest, int operationIndex = 0) + { + Dropbox.Sign.Client.ApiResponse localVarResponse = TemplateUpdateWithHttpInfo(templateId, templateUpdateRequest); + return localVarResponse.Data; + } + + /// + /// Edit Template Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + /// + /// Thrown when fails to make API call + /// The ID of the template to update. + /// + /// Index associated with the operation. + /// ApiResponse of TemplateGetResponse + public Dropbox.Sign.Client.ApiResponse TemplateUpdateWithHttpInfo(string templateId, TemplateUpdateRequest templateUpdateRequest, int operationIndex = 0) + { + // verify the required parameter 'templateId' is set + if (templateId == null) + { + throw new Dropbox.Sign.Client.ApiException(400, "Missing required parameter 'templateId' when calling TemplateApi->TemplateUpdate"); + } + + // verify the required parameter 'templateUpdateRequest' is set + if (templateUpdateRequest == null) + { + throw new Dropbox.Sign.Client.ApiException(400, "Missing required parameter 'templateUpdateRequest' when calling TemplateApi->TemplateUpdate"); + } + + Dropbox.Sign.Client.RequestOptions localVarRequestOptions = new Dropbox.Sign.Client.RequestOptions(); + + var localVarContentType = ""; + var openApiTypes = templateUpdateRequest.GetOpenApiTypes(); + if (ClientUtils.HasFileType(openApiTypes)) + { + ClientUtils.SetFormData(localVarRequestOptions, openApiTypes); + localVarContentType = "multipart/form-data"; + } + else + { + localVarContentType = "application/json"; + localVarRequestOptions.Data = templateUpdateRequest; + } + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Dropbox.Sign.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("template_id", Dropbox.Sign.Client.ClientUtils.ParameterToString(templateId)); // path parameter + + localVarRequestOptions.Operation = "TemplateApi.TemplateUpdate"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (api_key) required + // http basic authentication required + if (!string.IsNullOrEmpty(this.Configuration.Username) || !string.IsNullOrEmpty(this.Configuration.Password) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + Dropbox.Sign.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password)); + } + // authentication (oauth2) required + // bearer authentication required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/template/update/{template_id}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TemplateUpdate", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Edit Template Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + /// + /// Thrown when fails to make API call + /// The ID of the template to update. + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of TemplateGetResponse + public async System.Threading.Tasks.Task TemplateUpdateAsync(string templateId, TemplateUpdateRequest templateUpdateRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Dropbox.Sign.Client.ApiResponse localVarResponse = await TemplateUpdateWithHttpInfoAsync(templateId, templateUpdateRequest, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Edit Template Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + /// + /// Thrown when fails to make API call + /// The ID of the template to update. + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (TemplateGetResponse) + public async System.Threading.Tasks.Task> TemplateUpdateWithHttpInfoAsync(string templateId, TemplateUpdateRequest templateUpdateRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'templateId' is set + if (templateId == null) + { + throw new Dropbox.Sign.Client.ApiException(400, "Missing required parameter 'templateId' when calling TemplateApi->TemplateUpdate"); + } + + // verify the required parameter 'templateUpdateRequest' is set + if (templateUpdateRequest == null) + { + throw new Dropbox.Sign.Client.ApiException(400, "Missing required parameter 'templateUpdateRequest' when calling TemplateApi->TemplateUpdate"); + } + + + Dropbox.Sign.Client.RequestOptions localVarRequestOptions = new Dropbox.Sign.Client.RequestOptions(); + + var localVarContentType = ""; + var openApiTypes = templateUpdateRequest.GetOpenApiTypes(); + if (ClientUtils.HasFileType(openApiTypes)) + { + ClientUtils.SetFormData(localVarRequestOptions, openApiTypes); + localVarContentType = "multipart/form-data"; + } + else + { + localVarContentType = "application/json"; + localVarRequestOptions.Data = templateUpdateRequest; + } + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Dropbox.Sign.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("template_id", Dropbox.Sign.Client.ClientUtils.ParameterToString(templateId)); // path parameter + + localVarRequestOptions.Operation = "TemplateApi.TemplateUpdate"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (api_key) required + // http basic authentication required + if (!string.IsNullOrEmpty(this.Configuration.Username) || !string.IsNullOrEmpty(this.Configuration.Password) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + Dropbox.Sign.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password)); + } + // authentication (oauth2) required + // bearer authentication required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/template/update/{template_id}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TemplateUpdate", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + /// /// Update Template Files Overlays a new file with the overlay of an existing template. The new file(s) must: 1. have the same or higher page count 2. the same orientation as the file(s) being replaced. This will not overwrite or in any way affect the existing template. Both the existing template and new template will be available for use after executing this endpoint. Also note that this will decrement your template quota. Overlaying new files is asynchronous and a successful call to this endpoint will return 200 OK response if the request passes initial validation checks. It is recommended that a callback be implemented to listen for the callback event. A `template_created` event will be sent when the files are updated or a `template_error` event will be sent if there was a problem while updating the files. If a callback handler has been configured and the event has not been received within 60 minutes of making the call, check the status of the request in the API dashboard and retry the request if necessary. If the page orientation or page count is different from the original template document, we will notify you with a `template_error` [callback event](https://app.hellosign.com/api/eventsAndCallbacksWalkthrough). /// diff --git a/sdks/dotnet/src/Dropbox.Sign/Model/TemplateEditResponse.cs b/sdks/dotnet/src/Dropbox.Sign/Model/TemplateEditResponse.cs deleted file mode 100644 index f76b5eb4f..000000000 --- a/sdks/dotnet/src/Dropbox.Sign/Model/TemplateEditResponse.cs +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Dropbox Sign API - * - * Dropbox Sign v3 API - * - * The version of the OpenAPI document: 3.0.0 - * Contact: apisupport@hellosign.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Dropbox.Sign.Client.OpenAPIDateConverter; - -namespace Dropbox.Sign.Model -{ - /// - /// TemplateEditResponse - /// - [DataContract(Name = "TemplateEditResponse")] - [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] - public partial class TemplateEditResponse : IEquatable, IValidatableObject - { - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected TemplateEditResponse() { } - /// - /// Initializes a new instance of the class. - /// - /// The id of the Template. (required). - public TemplateEditResponse(string templateId = default(string)) - { - - // to ensure "templateId" is required (not null) - if (templateId == null) - { - throw new ArgumentNullException("templateId is a required property for TemplateEditResponse and cannot be null"); - } - this.TemplateId = templateId; - } - - /// - /// Attempt to instantiate and hydrate a new instance of this class - /// - /// String of JSON data representing target object - public static TemplateEditResponse Init(string jsonData) - { - var obj = JsonConvert.DeserializeObject(jsonData); - - if (obj == null) - { - throw new Exception("Unable to deserialize JSON to instance of TemplateEditResponse"); - } - - return obj; - } - - /// - /// The id of the Template. - /// - /// The id of the Template. - [DataMember(Name = "template_id", IsRequired = true, EmitDefaultValue = true)] - public string TemplateId { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class TemplateEditResponse {\n"); - sb.Append(" TemplateId: ").Append(TemplateId).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object input) - { - return this.Equals(input as TemplateEditResponse); - } - - /// - /// Returns true if TemplateEditResponse instances are equal - /// - /// Instance of TemplateEditResponse to be compared - /// Boolean - public bool Equals(TemplateEditResponse input) - { - if (input == null) - { - return false; - } - return - ( - this.TemplateId == input.TemplateId || - (this.TemplateId != null && - this.TemplateId.Equals(input.TemplateId)) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (this.TemplateId != null) - { - hashCode = (hashCode * 59) + this.TemplateId.GetHashCode(); - } - return hashCode; - } - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - public List GetOpenApiTypes() - { - var types = new List(); - types.Add(new OpenApiType() - { - Name = "template_id", - Property = "TemplateId", - Type = "string", - Value = TemplateId, - }); - - return types; - } - } - -} diff --git a/sdks/dotnet/src/Dropbox.Sign/Model/TemplateUpdateRequest.cs b/sdks/dotnet/src/Dropbox.Sign/Model/TemplateUpdateRequest.cs new file mode 100644 index 000000000..6d034d9de --- /dev/null +++ b/sdks/dotnet/src/Dropbox.Sign/Model/TemplateUpdateRequest.cs @@ -0,0 +1,279 @@ +/* + * Dropbox Sign API + * + * Dropbox Sign v3 API + * + * The version of the OpenAPI document: 3.0.0 + * Contact: apisupport@hellosign.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Dropbox.Sign.Client.OpenAPIDateConverter; + +namespace Dropbox.Sign.Model +{ + /// + /// TemplateUpdateRequest + /// + [DataContract(Name = "TemplateUpdateRequest")] + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public partial class TemplateUpdateRequest : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TemplateUpdateRequest() { } + /// + /// Initializes a new instance of the class. + /// + /// The CC roles that must be assigned when using the template to send a signature request.. + /// The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names.. + /// The title you want to assign to the SignatureRequest.. + /// The new default template email subject.. + /// The new default template email message.. + public TemplateUpdateRequest(List ccRoles = default(List), bool allowFormView = default(bool), string title = default(string), string subject = default(string), string message = default(string)) + { + + this.CcRoles = ccRoles; + this.AllowFormView = allowFormView; + this.Title = title; + this.Subject = subject; + this.Message = message; + } + + /// + /// Attempt to instantiate and hydrate a new instance of this class + /// + /// String of JSON data representing target object + public static TemplateUpdateRequest Init(string jsonData) + { + var obj = JsonConvert.DeserializeObject(jsonData); + + if (obj == null) + { + throw new Exception("Unable to deserialize JSON to instance of TemplateUpdateRequest"); + } + + return obj; + } + + /// + /// The CC roles that must be assigned when using the template to send a signature request. + /// + /// The CC roles that must be assigned when using the template to send a signature request. + [DataMember(Name = "cc_roles", EmitDefaultValue = true)] + public List CcRoles { get; set; } + + /// + /// The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names. + /// + /// The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names. + [DataMember(Name = "allow_form_view", EmitDefaultValue = true)] + public bool AllowFormView { get; set; } + + /// + /// The title you want to assign to the SignatureRequest. + /// + /// The title you want to assign to the SignatureRequest. + [DataMember(Name = "title", EmitDefaultValue = true)] + public string Title { get; set; } + + /// + /// The new default template email subject. + /// + /// The new default template email subject. + [DataMember(Name = "subject", EmitDefaultValue = true)] + public string Subject { get; set; } + + /// + /// The new default template email message. + /// + /// The new default template email message. + [DataMember(Name = "message", EmitDefaultValue = true)] + public string Message { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TemplateUpdateRequest {\n"); + sb.Append(" CcRoles: ").Append(CcRoles).Append("\n"); + sb.Append(" AllowFormView: ").Append(AllowFormView).Append("\n"); + sb.Append(" Title: ").Append(Title).Append("\n"); + sb.Append(" Subject: ").Append(Subject).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TemplateUpdateRequest); + } + + /// + /// Returns true if TemplateUpdateRequest instances are equal + /// + /// Instance of TemplateUpdateRequest to be compared + /// Boolean + public bool Equals(TemplateUpdateRequest input) + { + if (input == null) + { + return false; + } + return + ( + this.CcRoles == input.CcRoles || + this.CcRoles != null && + input.CcRoles != null && + this.CcRoles.SequenceEqual(input.CcRoles) + ) && + ( + this.AllowFormView == input.AllowFormView || + this.AllowFormView.Equals(input.AllowFormView) + ) && + ( + this.Title == input.Title || + (this.Title != null && + this.Title.Equals(input.Title)) + ) && + ( + this.Subject == input.Subject || + (this.Subject != null && + this.Subject.Equals(input.Subject)) + ) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.CcRoles != null) + { + hashCode = (hashCode * 59) + this.CcRoles.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AllowFormView.GetHashCode(); + if (this.Title != null) + { + hashCode = (hashCode * 59) + this.Title.GetHashCode(); + } + if (this.Subject != null) + { + hashCode = (hashCode * 59) + this.Subject.GetHashCode(); + } + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Subject (string) maxLength + if (this.Subject != null && this.Subject.Length > 200) + { + yield return new ValidationResult("Invalid value for Subject, length must be less than 200.", new[] { "Subject" }); + } + + // Message (string) maxLength + if (this.Message != null && this.Message.Length > 5000) + { + yield return new ValidationResult("Invalid value for Message, length must be less than 5000.", new[] { "Message" }); + } + + yield break; + } + public List GetOpenApiTypes() + { + var types = new List(); + types.Add(new OpenApiType() + { + Name = "cc_roles", + Property = "CcRoles", + Type = "List", + Value = CcRoles, + }); + types.Add(new OpenApiType() + { + Name = "allow_form_view", + Property = "AllowFormView", + Type = "bool", + Value = AllowFormView, + }); + types.Add(new OpenApiType() + { + Name = "title", + Property = "Title", + Type = "string", + Value = Title, + }); + types.Add(new OpenApiType() + { + Name = "subject", + Property = "Subject", + Type = "string", + Value = Subject, + }); + types.Add(new OpenApiType() + { + Name = "message", + Property = "Message", + Type = "string", + Value = Message, + }); + + return types; + } + } + +} diff --git a/sdks/java-v1/README.md b/sdks/java-v1/README.md index 50dab15bb..5be9bb99d 100644 --- a/sdks/java-v1/README.md +++ b/sdks/java-v1/README.md @@ -242,6 +242,7 @@ Class | Method | HTTP request | Description *TemplateApi* | [**templateGet**](docs/TemplateApi.md#templateGet) | **GET** /template/{template_id} | Get Template *TemplateApi* | [**templateList**](docs/TemplateApi.md#templateList) | **GET** /template/list | List Templates *TemplateApi* | [**templateRemoveUser**](docs/TemplateApi.md#templateRemoveUser) | **POST** /template/remove_user/{template_id} | Remove User from Template +*TemplateApi* | [**templateUpdate**](docs/TemplateApi.md#templateUpdate) | **POST** /template/update/{template_id} | Edit Template *TemplateApi* | [**templateUpdateFiles**](docs/TemplateApi.md#templateUpdateFiles) | **POST** /template/update_files/{template_id} | Update Template Files *UnclaimedDraftApi* | [**unclaimedDraftCreate**](docs/UnclaimedDraftApi.md#unclaimedDraftCreate) | **POST** /unclaimed_draft/create | Create Unclaimed Draft *UnclaimedDraftApi* | [**unclaimedDraftCreateEmbedded**](docs/UnclaimedDraftApi.md#unclaimedDraftCreateEmbedded) | **POST** /unclaimed_draft/create_embedded | Create Embedded Unclaimed Draft @@ -399,7 +400,6 @@ Class | Method | HTTP request | Description - [TemplateCreateRequest](docs/TemplateCreateRequest.md) - [TemplateCreateResponse](docs/TemplateCreateResponse.md) - [TemplateCreateResponseTemplate](docs/TemplateCreateResponseTemplate.md) - - [TemplateEditResponse](docs/TemplateEditResponse.md) - [TemplateGetResponse](docs/TemplateGetResponse.md) - [TemplateListResponse](docs/TemplateListResponse.md) - [TemplateRemoveUserRequest](docs/TemplateRemoveUserRequest.md) @@ -436,6 +436,7 @@ Class | Method | HTTP request | Description - [TemplateUpdateFilesRequest](docs/TemplateUpdateFilesRequest.md) - [TemplateUpdateFilesResponse](docs/TemplateUpdateFilesResponse.md) - [TemplateUpdateFilesResponseTemplate](docs/TemplateUpdateFilesResponseTemplate.md) + - [TemplateUpdateRequest](docs/TemplateUpdateRequest.md) - [UnclaimedDraftCreateEmbeddedRequest](docs/UnclaimedDraftCreateEmbeddedRequest.md) - [UnclaimedDraftCreateEmbeddedWithTemplateRequest](docs/UnclaimedDraftCreateEmbeddedWithTemplateRequest.md) - [UnclaimedDraftCreateRequest](docs/UnclaimedDraftCreateRequest.md) diff --git a/sdks/java-v1/docs/TemplateApi.md b/sdks/java-v1/docs/TemplateApi.md index dd470487b..123e25a4d 100644 --- a/sdks/java-v1/docs/TemplateApi.md +++ b/sdks/java-v1/docs/TemplateApi.md @@ -14,6 +14,7 @@ All URIs are relative to *https://api.hellosign.com/v3* [**templateGet**](TemplateApi.md#templateGet) | **GET** /template/{template_id} | Get Template [**templateList**](TemplateApi.md#templateList) | **GET** /template/list | List Templates [**templateRemoveUser**](TemplateApi.md#templateRemoveUser) | **POST** /template/remove_user/{template_id} | Remove User from Template +[**templateUpdate**](TemplateApi.md#templateUpdate) | **POST** /template/update/{template_id} | Edit Template [**templateUpdateFiles**](TemplateApi.md#templateUpdateFiles) | **POST** /template/update_files/{template_id} | Update Template Files @@ -987,6 +988,100 @@ public class TemplateRemoveUserExample | **4XX** | failed_operation | - | +## templateUpdate + +> TemplateGetResponse templateUpdate(templateId, templateUpdateRequest) + +Edit Template + +Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + +### Example + +```java +package com.dropbox.sign_sandbox; + +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.JSON; +import com.dropbox.sign.model.*; + +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class TemplateUpdateExample +{ + public static void main(String[] args) + { + var config = Configuration.getDefaultApiClient(); + ((HttpBasicAuth) config.getAuthentication("api_key")).setUsername("YOUR_API_KEY"); + // ((HttpBearerAuth) config.getAuthentication("oauth2")).setBearerToken("YOUR_ACCESS_TOKEN"); + + var templateUpdateRequest = new TemplateUpdateRequest(); + templateUpdateRequest.allowFormView(false); + templateUpdateRequest.title("Test Title"); + templateUpdateRequest.subject("Test Subject"); + templateUpdateRequest.message("Test Message"); + templateUpdateRequest.ccRoles(List.of ( + "CC Role 1", + "CC Role 2" + )); + + try + { + var response = new TemplateApi(config).templateUpdate( + "f57db65d3f933b5316d398057a36176831451a35", // templateId + templateUpdateRequest + ); + + System.out.println(response); + } catch (ApiException e) { + System.err.println("Exception when calling TemplateApi#templateUpdate"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| + **templateId** | **String**| The ID of the template to update. | + **templateUpdateRequest** | [**TemplateUpdateRequest**](TemplateUpdateRequest.md)| | + +### Return type + +[**TemplateGetResponse**](TemplateGetResponse.md) + +### Authorization + +[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) + +### HTTP request headers + +- **Content-Type**: application/json, multipart/form-data +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
| +| **4XX** | failed_operation | - | + + ## templateUpdateFiles > TemplateUpdateFilesResponse templateUpdateFiles(templateId, templateUpdateFilesRequest) diff --git a/sdks/java-v1/docs/TemplateEditResponse.md b/sdks/java-v1/docs/TemplateEditResponse.md deleted file mode 100644 index 88d225e68..000000000 --- a/sdks/java-v1/docs/TemplateEditResponse.md +++ /dev/null @@ -1,14 +0,0 @@ - - -# TemplateEditResponse - - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -| `templateId`*_required_ | ```String``` | The id of the Template. | | - - - diff --git a/sdks/java-v1/docs/TemplateUpdateRequest.md b/sdks/java-v1/docs/TemplateUpdateRequest.md new file mode 100644 index 000000000..cfe85c5e7 --- /dev/null +++ b/sdks/java-v1/docs/TemplateUpdateRequest.md @@ -0,0 +1,18 @@ + + +# TemplateUpdateRequest + + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `ccRoles` | ```List``` | The CC roles that must be assigned when using the template to send a signature request. | | +| `allowFormView` | ```Boolean``` | The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names. | | +| `title` | ```String``` | The title you want to assign to the SignatureRequest. | | +| `subject` | ```String``` | The new default template email subject. | | +| `message` | ```String``` | The new default template email message. | | + + + diff --git a/sdks/java-v1/src/main/java/com/dropbox/sign/api/TemplateApi.java b/sdks/java-v1/src/main/java/com/dropbox/sign/api/TemplateApi.java index 14eeae070..5342e0b30 100644 --- a/sdks/java-v1/src/main/java/com/dropbox/sign/api/TemplateApi.java +++ b/sdks/java-v1/src/main/java/com/dropbox/sign/api/TemplateApi.java @@ -17,6 +17,7 @@ import com.dropbox.sign.model.TemplateRemoveUserRequest; import com.dropbox.sign.model.TemplateUpdateFilesRequest; import com.dropbox.sign.model.TemplateUpdateFilesResponse; +import com.dropbox.sign.model.TemplateUpdateRequest; import java.io.File; import java.util.ArrayList; import java.util.HashMap; @@ -997,6 +998,92 @@ public ApiResponse templateRemoveUserWithHttpInfo( false); } + /** + * Edit Template Edit template fields. Every field is optional and the endpoint will only change + * whatever is provided. The fields not included in the request payload will remain unchanged. + * + * @param templateId The ID of the template to update. (required) + * @param templateUpdateRequest (required) + * @return TemplateGetResponse + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public TemplateGetResponse templateUpdate( + String templateId, TemplateUpdateRequest templateUpdateRequest) throws ApiException { + return templateUpdateWithHttpInfo(templateId, templateUpdateRequest).getData(); + } + + /** + * Edit Template Edit template fields. Every field is optional and the endpoint will only change + * whatever is provided. The fields not included in the request payload will remain unchanged. + * + * @param templateId The ID of the template to update. (required) + * @param templateUpdateRequest (required) + * @return ApiResponse<TemplateGetResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public ApiResponse templateUpdateWithHttpInfo( + String templateId, TemplateUpdateRequest templateUpdateRequest) throws ApiException { + + // Check required parameters + if (templateId == null) { + throw new ApiException( + 400, "Missing the required parameter 'templateId' when calling templateUpdate"); + } + if (templateUpdateRequest == null) { + throw new ApiException( + 400, + "Missing the required parameter 'templateUpdateRequest' when calling" + + " templateUpdate"); + } + + // Path parameters + String localVarPath = + "/template/update/{template_id}" + .replaceAll( + "\\{template_id}", apiClient.escapeString(templateId.toString())); + + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); + localVarFormParams = templateUpdateRequest.createFormData(); + boolean isFileTypeFound = !localVarFormParams.isEmpty(); + String localVarContentType = + isFileTypeFound + ? "multipart/form-data" + : apiClient.selectHeaderContentType( + "application/json", "multipart/form-data"); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; + GenericType localVarReturnType = + new GenericType() {}; + return apiClient.invokeAPI( + "TemplateApi.templateUpdate", + localVarPath, + "POST", + new ArrayList<>(), + isFileTypeFound ? null : templateUpdateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false); + } + /** * Update Template Files Overlays a new file with the overlay of an existing template. The new * file(s) must: 1. have the same or higher page count 2. the same orientation as the file(s) diff --git a/sdks/java-v1/src/main/java/com/dropbox/sign/model/TemplateEditResponse.java b/sdks/java-v1/src/main/java/com/dropbox/sign/model/TemplateEditResponse.java deleted file mode 100644 index 095b796a1..000000000 --- a/sdks/java-v1/src/main/java/com/dropbox/sign/model/TemplateEditResponse.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Dropbox Sign API - * Dropbox Sign v3 API - * - * The version of the OpenAPI document: 3.0.0 - * Contact: apisupport@hellosign.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.dropbox.sign.model; - -import com.dropbox.sign.ApiException; -import com.dropbox.sign.JSON; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** TemplateEditResponse */ -@JsonPropertyOrder({TemplateEditResponse.JSON_PROPERTY_TEMPLATE_ID}) -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.12.0") -@JsonIgnoreProperties(ignoreUnknown = true) -public class TemplateEditResponse { - public static final String JSON_PROPERTY_TEMPLATE_ID = "template_id"; - @javax.annotation.Nonnull private String templateId; - - public TemplateEditResponse() {} - - /** - * Attempt to instantiate and hydrate a new instance of this class - * - * @param jsonData String of JSON data representing target object - */ - public static TemplateEditResponse init(String jsonData) throws Exception { - return new ObjectMapper().readValue(jsonData, TemplateEditResponse.class); - } - - public static TemplateEditResponse init(HashMap data) throws Exception { - return new ObjectMapper() - .readValue(new ObjectMapper().writeValueAsString(data), TemplateEditResponse.class); - } - - public TemplateEditResponse templateId(@javax.annotation.Nonnull String templateId) { - this.templateId = templateId; - return this; - } - - /** - * The id of the Template. - * - * @return templateId - */ - @javax.annotation.Nonnull - @JsonProperty(JSON_PROPERTY_TEMPLATE_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getTemplateId() { - return templateId; - } - - @JsonProperty(JSON_PROPERTY_TEMPLATE_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setTemplateId(@javax.annotation.Nonnull String templateId) { - this.templateId = templateId; - } - - /** Return true if this TemplateEditResponse object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TemplateEditResponse templateEditResponse = (TemplateEditResponse) o; - return Objects.equals(this.templateId, templateEditResponse.templateId); - } - - @Override - public int hashCode() { - return Objects.hash(templateId); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TemplateEditResponse {\n"); - sb.append(" templateId: ").append(toIndentedString(templateId)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - public Map createFormData() throws ApiException { - Map map = new HashMap<>(); - boolean fileTypeFound = false; - try { - if (templateId != null) { - if (isFileTypeOrListOfFiles(templateId)) { - fileTypeFound = true; - } - - if (templateId.getClass().equals(java.io.File.class) - || templateId.getClass().equals(Integer.class) - || templateId.getClass().equals(String.class) - || templateId.getClass().isEnum()) { - map.put("template_id", templateId); - } else if (isListOfFile(templateId)) { - for (int i = 0; i < getListSize(templateId); i++) { - map.put("template_id[" + i + "]", getFromList(templateId, i)); - } - } else { - map.put( - "template_id", - JSON.getDefault().getMapper().writeValueAsString(templateId)); - } - } - } catch (Exception e) { - throw new ApiException(e); - } - - return fileTypeFound ? map : new HashMap<>(); - } - - private boolean isFileTypeOrListOfFiles(Object obj) throws Exception { - return obj.getClass().equals(java.io.File.class) || isListOfFile(obj); - } - - private boolean isListOfFile(Object obj) throws Exception { - return obj instanceof java.util.List - && !isListEmpty(obj) - && getFromList(obj, 0) instanceof java.io.File; - } - - private boolean isListEmpty(Object obj) throws Exception { - return (boolean) - Class.forName(java.util.List.class.getName()).getMethod("isEmpty").invoke(obj); - } - - private Object getFromList(Object obj, int index) throws Exception { - return Class.forName(java.util.List.class.getName()) - .getMethod("get", int.class) - .invoke(obj, index); - } - - private int getListSize(Object obj) throws Exception { - return (int) Class.forName(java.util.List.class.getName()).getMethod("size").invoke(obj); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/sdks/java-v1/src/main/java/com/dropbox/sign/model/TemplateUpdateRequest.java b/sdks/java-v1/src/main/java/com/dropbox/sign/model/TemplateUpdateRequest.java new file mode 100644 index 000000000..66b9d4ee1 --- /dev/null +++ b/sdks/java-v1/src/main/java/com/dropbox/sign/model/TemplateUpdateRequest.java @@ -0,0 +1,365 @@ +/* + * Dropbox Sign API + * Dropbox Sign v3 API + * + * The version of the OpenAPI document: 3.0.0 + * Contact: apisupport@hellosign.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.dropbox.sign.model; + +import com.dropbox.sign.ApiException; +import com.dropbox.sign.JSON; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** TemplateUpdateRequest */ +@JsonPropertyOrder({ + TemplateUpdateRequest.JSON_PROPERTY_CC_ROLES, + TemplateUpdateRequest.JSON_PROPERTY_ALLOW_FORM_VIEW, + TemplateUpdateRequest.JSON_PROPERTY_TITLE, + TemplateUpdateRequest.JSON_PROPERTY_SUBJECT, + TemplateUpdateRequest.JSON_PROPERTY_MESSAGE +}) +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.12.0") +@JsonIgnoreProperties(ignoreUnknown = true) +public class TemplateUpdateRequest { + public static final String JSON_PROPERTY_CC_ROLES = "cc_roles"; + @javax.annotation.Nullable private List ccRoles = null; + + public static final String JSON_PROPERTY_ALLOW_FORM_VIEW = "allow_form_view"; + @javax.annotation.Nullable private Boolean allowFormView; + + public static final String JSON_PROPERTY_TITLE = "title"; + @javax.annotation.Nullable private String title; + + public static final String JSON_PROPERTY_SUBJECT = "subject"; + @javax.annotation.Nullable private String subject; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + @javax.annotation.Nullable private String message; + + public TemplateUpdateRequest() {} + + /** + * Attempt to instantiate and hydrate a new instance of this class + * + * @param jsonData String of JSON data representing target object + */ + public static TemplateUpdateRequest init(String jsonData) throws Exception { + return new ObjectMapper().readValue(jsonData, TemplateUpdateRequest.class); + } + + public static TemplateUpdateRequest init(HashMap data) throws Exception { + return new ObjectMapper() + .readValue( + new ObjectMapper().writeValueAsString(data), TemplateUpdateRequest.class); + } + + public TemplateUpdateRequest ccRoles(@javax.annotation.Nullable List ccRoles) { + this.ccRoles = ccRoles; + return this; + } + + public TemplateUpdateRequest addCcRolesItem(String ccRolesItem) { + if (this.ccRoles == null) { + this.ccRoles = new ArrayList<>(); + } + this.ccRoles.add(ccRolesItem); + return this; + } + + /** + * The CC roles that must be assigned when using the template to send a signature request. + * + * @return ccRoles + */ + @javax.annotation.Nullable @JsonProperty(JSON_PROPERTY_CC_ROLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getCcRoles() { + return ccRoles; + } + + @JsonProperty(JSON_PROPERTY_CC_ROLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCcRoles(@javax.annotation.Nullable List ccRoles) { + this.ccRoles = ccRoles; + } + + public TemplateUpdateRequest allowFormView(@javax.annotation.Nullable Boolean allowFormView) { + this.allowFormView = allowFormView; + return this; + } + + /** + * The CC roles that must be assigned when using the template to send a signature request. If + * set to `true` all the form fields on template document must have non-empty names. + * + * @return allowFormView + */ + @javax.annotation.Nullable @JsonProperty(JSON_PROPERTY_ALLOW_FORM_VIEW) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getAllowFormView() { + return allowFormView; + } + + @JsonProperty(JSON_PROPERTY_ALLOW_FORM_VIEW) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAllowFormView(@javax.annotation.Nullable Boolean allowFormView) { + this.allowFormView = allowFormView; + } + + public TemplateUpdateRequest title(@javax.annotation.Nullable String title) { + this.title = title; + return this; + } + + /** + * The title you want to assign to the SignatureRequest. + * + * @return title + */ + @javax.annotation.Nullable @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTitle() { + return title; + } + + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTitle(@javax.annotation.Nullable String title) { + this.title = title; + } + + public TemplateUpdateRequest subject(@javax.annotation.Nullable String subject) { + this.subject = subject; + return this; + } + + /** + * The new default template email subject. + * + * @return subject + */ + @javax.annotation.Nullable @JsonProperty(JSON_PROPERTY_SUBJECT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSubject() { + return subject; + } + + @JsonProperty(JSON_PROPERTY_SUBJECT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSubject(@javax.annotation.Nullable String subject) { + this.subject = subject; + } + + public TemplateUpdateRequest message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * The new default template email message. + * + * @return message + */ + @javax.annotation.Nullable @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMessage() { + return message; + } + + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + /** Return true if this TemplateUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TemplateUpdateRequest templateUpdateRequest = (TemplateUpdateRequest) o; + return Objects.equals(this.ccRoles, templateUpdateRequest.ccRoles) + && Objects.equals(this.allowFormView, templateUpdateRequest.allowFormView) + && Objects.equals(this.title, templateUpdateRequest.title) + && Objects.equals(this.subject, templateUpdateRequest.subject) + && Objects.equals(this.message, templateUpdateRequest.message); + } + + @Override + public int hashCode() { + return Objects.hash(ccRoles, allowFormView, title, subject, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TemplateUpdateRequest {\n"); + sb.append(" ccRoles: ").append(toIndentedString(ccRoles)).append("\n"); + sb.append(" allowFormView: ").append(toIndentedString(allowFormView)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" subject: ").append(toIndentedString(subject)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public Map createFormData() throws ApiException { + Map map = new HashMap<>(); + boolean fileTypeFound = false; + try { + if (ccRoles != null) { + if (isFileTypeOrListOfFiles(ccRoles)) { + fileTypeFound = true; + } + + if (ccRoles.getClass().equals(java.io.File.class) + || ccRoles.getClass().equals(Integer.class) + || ccRoles.getClass().equals(String.class) + || ccRoles.getClass().isEnum()) { + map.put("cc_roles", ccRoles); + } else if (isListOfFile(ccRoles)) { + for (int i = 0; i < getListSize(ccRoles); i++) { + map.put("cc_roles[" + i + "]", getFromList(ccRoles, i)); + } + } else { + map.put("cc_roles", JSON.getDefault().getMapper().writeValueAsString(ccRoles)); + } + } + if (allowFormView != null) { + if (isFileTypeOrListOfFiles(allowFormView)) { + fileTypeFound = true; + } + + if (allowFormView.getClass().equals(java.io.File.class) + || allowFormView.getClass().equals(Integer.class) + || allowFormView.getClass().equals(String.class) + || allowFormView.getClass().isEnum()) { + map.put("allow_form_view", allowFormView); + } else if (isListOfFile(allowFormView)) { + for (int i = 0; i < getListSize(allowFormView); i++) { + map.put("allow_form_view[" + i + "]", getFromList(allowFormView, i)); + } + } else { + map.put( + "allow_form_view", + JSON.getDefault().getMapper().writeValueAsString(allowFormView)); + } + } + if (title != null) { + if (isFileTypeOrListOfFiles(title)) { + fileTypeFound = true; + } + + if (title.getClass().equals(java.io.File.class) + || title.getClass().equals(Integer.class) + || title.getClass().equals(String.class) + || title.getClass().isEnum()) { + map.put("title", title); + } else if (isListOfFile(title)) { + for (int i = 0; i < getListSize(title); i++) { + map.put("title[" + i + "]", getFromList(title, i)); + } + } else { + map.put("title", JSON.getDefault().getMapper().writeValueAsString(title)); + } + } + if (subject != null) { + if (isFileTypeOrListOfFiles(subject)) { + fileTypeFound = true; + } + + if (subject.getClass().equals(java.io.File.class) + || subject.getClass().equals(Integer.class) + || subject.getClass().equals(String.class) + || subject.getClass().isEnum()) { + map.put("subject", subject); + } else if (isListOfFile(subject)) { + for (int i = 0; i < getListSize(subject); i++) { + map.put("subject[" + i + "]", getFromList(subject, i)); + } + } else { + map.put("subject", JSON.getDefault().getMapper().writeValueAsString(subject)); + } + } + if (message != null) { + if (isFileTypeOrListOfFiles(message)) { + fileTypeFound = true; + } + + if (message.getClass().equals(java.io.File.class) + || message.getClass().equals(Integer.class) + || message.getClass().equals(String.class) + || message.getClass().isEnum()) { + map.put("message", message); + } else if (isListOfFile(message)) { + for (int i = 0; i < getListSize(message); i++) { + map.put("message[" + i + "]", getFromList(message, i)); + } + } else { + map.put("message", JSON.getDefault().getMapper().writeValueAsString(message)); + } + } + } catch (Exception e) { + throw new ApiException(e); + } + + return fileTypeFound ? map : new HashMap<>(); + } + + private boolean isFileTypeOrListOfFiles(Object obj) throws Exception { + return obj.getClass().equals(java.io.File.class) || isListOfFile(obj); + } + + private boolean isListOfFile(Object obj) throws Exception { + return obj instanceof java.util.List + && !isListEmpty(obj) + && getFromList(obj, 0) instanceof java.io.File; + } + + private boolean isListEmpty(Object obj) throws Exception { + return (boolean) + Class.forName(java.util.List.class.getName()).getMethod("isEmpty").invoke(obj); + } + + private Object getFromList(Object obj, int index) throws Exception { + return Class.forName(java.util.List.class.getName()) + .getMethod("get", int.class) + .invoke(obj, index); + } + + private int getListSize(Object obj) throws Exception { + return (int) Class.forName(java.util.List.class.getName()).getMethod("size").invoke(obj); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/sdks/java-v2/README.md b/sdks/java-v2/README.md index bf70604a9..4e2114f82 100644 --- a/sdks/java-v2/README.md +++ b/sdks/java-v2/README.md @@ -218,6 +218,7 @@ Class | Method | HTTP request | Description *TemplateApi* | [**templateGet**](docs/TemplateApi.md#templateGet) | **GET** /template/{template_id} | Get Template *TemplateApi* | [**templateList**](docs/TemplateApi.md#templateList) | **GET** /template/list | List Templates *TemplateApi* | [**templateRemoveUser**](docs/TemplateApi.md#templateRemoveUser) | **POST** /template/remove_user/{template_id} | Remove User from Template +*TemplateApi* | [**templateUpdate**](docs/TemplateApi.md#templateUpdate) | **POST** /template/update/{template_id} | Edit Template *TemplateApi* | [**templateUpdateFiles**](docs/TemplateApi.md#templateUpdateFiles) | **POST** /template/update_files/{template_id} | Update Template Files *UnclaimedDraftApi* | [**unclaimedDraftCreate**](docs/UnclaimedDraftApi.md#unclaimedDraftCreate) | **POST** /unclaimed_draft/create | Create Unclaimed Draft *UnclaimedDraftApi* | [**unclaimedDraftCreateEmbedded**](docs/UnclaimedDraftApi.md#unclaimedDraftCreateEmbedded) | **POST** /unclaimed_draft/create_embedded | Create Embedded Unclaimed Draft @@ -375,7 +376,6 @@ Class | Method | HTTP request | Description - [TemplateCreateRequest](docs/TemplateCreateRequest.md) - [TemplateCreateResponse](docs/TemplateCreateResponse.md) - [TemplateCreateResponseTemplate](docs/TemplateCreateResponseTemplate.md) - - [TemplateEditResponse](docs/TemplateEditResponse.md) - [TemplateGetResponse](docs/TemplateGetResponse.md) - [TemplateListResponse](docs/TemplateListResponse.md) - [TemplateRemoveUserRequest](docs/TemplateRemoveUserRequest.md) @@ -412,6 +412,7 @@ Class | Method | HTTP request | Description - [TemplateUpdateFilesRequest](docs/TemplateUpdateFilesRequest.md) - [TemplateUpdateFilesResponse](docs/TemplateUpdateFilesResponse.md) - [TemplateUpdateFilesResponseTemplate](docs/TemplateUpdateFilesResponseTemplate.md) + - [TemplateUpdateRequest](docs/TemplateUpdateRequest.md) - [UnclaimedDraftCreateEmbeddedRequest](docs/UnclaimedDraftCreateEmbeddedRequest.md) - [UnclaimedDraftCreateEmbeddedWithTemplateRequest](docs/UnclaimedDraftCreateEmbeddedWithTemplateRequest.md) - [UnclaimedDraftCreateRequest](docs/UnclaimedDraftCreateRequest.md) diff --git a/sdks/java-v2/docs/TemplateApi.md b/sdks/java-v2/docs/TemplateApi.md index dd470487b..123e25a4d 100644 --- a/sdks/java-v2/docs/TemplateApi.md +++ b/sdks/java-v2/docs/TemplateApi.md @@ -14,6 +14,7 @@ All URIs are relative to *https://api.hellosign.com/v3* [**templateGet**](TemplateApi.md#templateGet) | **GET** /template/{template_id} | Get Template [**templateList**](TemplateApi.md#templateList) | **GET** /template/list | List Templates [**templateRemoveUser**](TemplateApi.md#templateRemoveUser) | **POST** /template/remove_user/{template_id} | Remove User from Template +[**templateUpdate**](TemplateApi.md#templateUpdate) | **POST** /template/update/{template_id} | Edit Template [**templateUpdateFiles**](TemplateApi.md#templateUpdateFiles) | **POST** /template/update_files/{template_id} | Update Template Files @@ -987,6 +988,100 @@ public class TemplateRemoveUserExample | **4XX** | failed_operation | - | +## templateUpdate + +> TemplateGetResponse templateUpdate(templateId, templateUpdateRequest) + +Edit Template + +Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + +### Example + +```java +package com.dropbox.sign_sandbox; + +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.JSON; +import com.dropbox.sign.model.*; + +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class TemplateUpdateExample +{ + public static void main(String[] args) + { + var config = Configuration.getDefaultApiClient(); + ((HttpBasicAuth) config.getAuthentication("api_key")).setUsername("YOUR_API_KEY"); + // ((HttpBearerAuth) config.getAuthentication("oauth2")).setBearerToken("YOUR_ACCESS_TOKEN"); + + var templateUpdateRequest = new TemplateUpdateRequest(); + templateUpdateRequest.allowFormView(false); + templateUpdateRequest.title("Test Title"); + templateUpdateRequest.subject("Test Subject"); + templateUpdateRequest.message("Test Message"); + templateUpdateRequest.ccRoles(List.of ( + "CC Role 1", + "CC Role 2" + )); + + try + { + var response = new TemplateApi(config).templateUpdate( + "f57db65d3f933b5316d398057a36176831451a35", // templateId + templateUpdateRequest + ); + + System.out.println(response); + } catch (ApiException e) { + System.err.println("Exception when calling TemplateApi#templateUpdate"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| + **templateId** | **String**| The ID of the template to update. | + **templateUpdateRequest** | [**TemplateUpdateRequest**](TemplateUpdateRequest.md)| | + +### Return type + +[**TemplateGetResponse**](TemplateGetResponse.md) + +### Authorization + +[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) + +### HTTP request headers + +- **Content-Type**: application/json, multipart/form-data +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
| +| **4XX** | failed_operation | - | + + ## templateUpdateFiles > TemplateUpdateFilesResponse templateUpdateFiles(templateId, templateUpdateFilesRequest) diff --git a/sdks/java-v2/docs/TemplateEditResponse.md b/sdks/java-v2/docs/TemplateEditResponse.md deleted file mode 100644 index 88d225e68..000000000 --- a/sdks/java-v2/docs/TemplateEditResponse.md +++ /dev/null @@ -1,14 +0,0 @@ - - -# TemplateEditResponse - - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -| `templateId`*_required_ | ```String``` | The id of the Template. | | - - - diff --git a/sdks/java-v2/docs/TemplateUpdateRequest.md b/sdks/java-v2/docs/TemplateUpdateRequest.md new file mode 100644 index 000000000..cfe85c5e7 --- /dev/null +++ b/sdks/java-v2/docs/TemplateUpdateRequest.md @@ -0,0 +1,18 @@ + + +# TemplateUpdateRequest + + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `ccRoles` | ```List``` | The CC roles that must be assigned when using the template to send a signature request. | | +| `allowFormView` | ```Boolean``` | The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names. | | +| `title` | ```String``` | The title you want to assign to the SignatureRequest. | | +| `subject` | ```String``` | The new default template email subject. | | +| `message` | ```String``` | The new default template email message. | | + + + diff --git a/sdks/java-v2/src/main/java/com/dropbox/sign/api/TemplateApi.java b/sdks/java-v2/src/main/java/com/dropbox/sign/api/TemplateApi.java index 974e61c40..c71fc7f37 100644 --- a/sdks/java-v2/src/main/java/com/dropbox/sign/api/TemplateApi.java +++ b/sdks/java-v2/src/main/java/com/dropbox/sign/api/TemplateApi.java @@ -22,6 +22,7 @@ import com.dropbox.sign.model.TemplateRemoveUserRequest; import com.dropbox.sign.model.TemplateUpdateFilesRequest; import com.dropbox.sign.model.TemplateUpdateFilesResponse; +import com.dropbox.sign.model.TemplateUpdateRequest; import java.util.ArrayList; import java.util.HashMap; @@ -880,6 +881,78 @@ public ApiResponse templateRemoveUserWithHttpInfo(String te false ); } + /** + * Edit Template + * Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + * @param templateId The ID of the template to update. (required) + * @param templateUpdateRequest (required) + * @return TemplateGetResponse + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public TemplateGetResponse templateUpdate(String templateId, TemplateUpdateRequest templateUpdateRequest) throws ApiException { + return templateUpdateWithHttpInfo(templateId, templateUpdateRequest).getData(); + } + + + /** + * Edit Template + * Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + * @param templateId The ID of the template to update. (required) + * @param templateUpdateRequest (required) + * @return ApiResponse<TemplateGetResponse> + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public ApiResponse templateUpdateWithHttpInfo(String templateId, TemplateUpdateRequest templateUpdateRequest) throws ApiException { + + // Check required parameters + if (templateId == null) { + throw new ApiException(400, "Missing the required parameter 'templateId' when calling templateUpdate"); + } + if (templateUpdateRequest == null) { + throw new ApiException(400, "Missing the required parameter 'templateUpdateRequest' when calling templateUpdate"); + } + + // Path parameters + String localVarPath = "/template/update/{template_id}" + .replaceAll("\\{template_id}", apiClient.escapeString(templateId.toString())); + + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); + localVarFormParams = templateUpdateRequest.createFormData(); + boolean isFileTypeFound = !localVarFormParams.isEmpty(); + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json", "multipart/form-data"); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "TemplateApi.templateUpdate", + localVarPath, + "POST", + new ArrayList<>(), + isFileTypeFound ? null : templateUpdateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); + } /** * Update Template Files * Overlays a new file with the overlay of an existing template. The new file(s) must: 1. have the same or higher page count 2. the same orientation as the file(s) being replaced. This will not overwrite or in any way affect the existing template. Both the existing template and new template will be available for use after executing this endpoint. Also note that this will decrement your template quota. Overlaying new files is asynchronous and a successful call to this endpoint will return 200 OK response if the request passes initial validation checks. It is recommended that a callback be implemented to listen for the callback event. A `template_created` event will be sent when the files are updated or a `template_error` event will be sent if there was a problem while updating the files. If a callback handler has been configured and the event has not been received within 60 minutes of making the call, check the status of the request in the API dashboard and retry the request if necessary. If the page orientation or page count is different from the original template document, we will notify you with a `template_error` [callback event](https://app.hellosign.com/api/eventsAndCallbacksWalkthrough). diff --git a/sdks/java-v2/src/main/java/com/dropbox/sign/model/TemplateEditResponse.java b/sdks/java-v2/src/main/java/com/dropbox/sign/model/TemplateEditResponse.java deleted file mode 100644 index 866a87fa3..000000000 --- a/sdks/java-v2/src/main/java/com/dropbox/sign/model/TemplateEditResponse.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Dropbox Sign API - * Dropbox Sign v3 API - * - * The version of the OpenAPI document: 3.0.0 - * Contact: apisupport@hellosign.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.dropbox.sign.model; - -import java.util.Objects; -import java.util.Map; -import java.util.HashMap; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.dropbox.sign.JSON; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.databind.ObjectMapper; - - -import com.dropbox.sign.ApiException; -/** - * TemplateEditResponse - */ -@JsonPropertyOrder({ - TemplateEditResponse.JSON_PROPERTY_TEMPLATE_ID -}) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0") -@JsonIgnoreProperties(ignoreUnknown=true) -public class TemplateEditResponse { - public static final String JSON_PROPERTY_TEMPLATE_ID = "template_id"; - @jakarta.annotation.Nonnull - private String templateId; - - public TemplateEditResponse() { - } - - /** - * Attempt to instantiate and hydrate a new instance of this class - * @param jsonData String of JSON data representing target object - */ - static public TemplateEditResponse init(String jsonData) throws Exception { - return new ObjectMapper().readValue(jsonData, TemplateEditResponse.class); - } - - static public TemplateEditResponse init(HashMap data) throws Exception { - return new ObjectMapper().readValue( - new ObjectMapper().writeValueAsString(data), - TemplateEditResponse.class - ); - } - - public TemplateEditResponse templateId(@jakarta.annotation.Nonnull String templateId) { - this.templateId = templateId; - return this; - } - - /** - * The id of the Template. - * @return templateId - */ - @jakarta.annotation.Nonnull - @JsonProperty(JSON_PROPERTY_TEMPLATE_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public String getTemplateId() { - return templateId; - } - - - @JsonProperty(JSON_PROPERTY_TEMPLATE_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setTemplateId(@jakarta.annotation.Nonnull String templateId) { - this.templateId = templateId; - } - - - /** - * Return true if this TemplateEditResponse object is equal to o. - */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TemplateEditResponse templateEditResponse = (TemplateEditResponse) o; - return Objects.equals(this.templateId, templateEditResponse.templateId); - } - - @Override - public int hashCode() { - return Objects.hash(templateId); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TemplateEditResponse {\n"); - sb.append(" templateId: ").append(toIndentedString(templateId)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - public Map createFormData() throws ApiException { - Map map = new HashMap<>(); - boolean fileTypeFound = false; - try { - if (templateId != null) { - if (isFileTypeOrListOfFiles(templateId)) { - fileTypeFound = true; - } - - if (templateId.getClass().equals(java.io.File.class) || - templateId.getClass().equals(Integer.class) || - templateId.getClass().equals(String.class) || - templateId.getClass().isEnum()) { - map.put("template_id", templateId); - } else if (isListOfFile(templateId)) { - for(int i = 0; i< getListSize(templateId); i++) { - map.put("template_id[" + i + "]", getFromList(templateId, i)); - } - } - else { - map.put("template_id", JSON.getDefault().getMapper().writeValueAsString(templateId)); - } - } - } catch (Exception e) { - throw new ApiException(e); - } - - return fileTypeFound ? map : new HashMap<>(); - } - - private boolean isFileTypeOrListOfFiles(Object obj) throws Exception { - return obj.getClass().equals(java.io.File.class) || isListOfFile(obj); - } - - private boolean isListOfFile(Object obj) throws Exception { - return obj instanceof java.util.List && !isListEmpty(obj) && getFromList(obj, 0) instanceof java.io.File; - } - - private boolean isListEmpty(Object obj) throws Exception { - return (boolean) Class.forName(java.util.List.class.getName()).getMethod("isEmpty").invoke(obj); - } - - private Object getFromList(Object obj, int index) throws Exception { - return Class.forName(java.util.List.class.getName()).getMethod("get", int.class).invoke(obj, index); - } - - private int getListSize(Object obj) throws Exception { - return (int) Class.forName(java.util.List.class.getName()).getMethod("size").invoke(obj); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/sdks/java-v2/src/main/java/com/dropbox/sign/model/TemplateUpdateRequest.java b/sdks/java-v2/src/main/java/com/dropbox/sign/model/TemplateUpdateRequest.java new file mode 100644 index 000000000..9b8b7e7f1 --- /dev/null +++ b/sdks/java-v2/src/main/java/com/dropbox/sign/model/TemplateUpdateRequest.java @@ -0,0 +1,393 @@ +/* + * Dropbox Sign API + * Dropbox Sign v3 API + * + * The version of the OpenAPI document: 3.0.0 + * Contact: apisupport@hellosign.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.dropbox.sign.model; + +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.dropbox.sign.JSON; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.ObjectMapper; + + +import com.dropbox.sign.ApiException; +/** + * TemplateUpdateRequest + */ +@JsonPropertyOrder({ + TemplateUpdateRequest.JSON_PROPERTY_CC_ROLES, + TemplateUpdateRequest.JSON_PROPERTY_ALLOW_FORM_VIEW, + TemplateUpdateRequest.JSON_PROPERTY_TITLE, + TemplateUpdateRequest.JSON_PROPERTY_SUBJECT, + TemplateUpdateRequest.JSON_PROPERTY_MESSAGE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0") +@JsonIgnoreProperties(ignoreUnknown=true) +public class TemplateUpdateRequest { + public static final String JSON_PROPERTY_CC_ROLES = "cc_roles"; + @jakarta.annotation.Nullable + private List ccRoles = null; + + public static final String JSON_PROPERTY_ALLOW_FORM_VIEW = "allow_form_view"; + @jakarta.annotation.Nullable + private Boolean allowFormView; + + public static final String JSON_PROPERTY_TITLE = "title"; + @jakarta.annotation.Nullable + private String title; + + public static final String JSON_PROPERTY_SUBJECT = "subject"; + @jakarta.annotation.Nullable + private String subject; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + @jakarta.annotation.Nullable + private String message; + + public TemplateUpdateRequest() { + } + + /** + * Attempt to instantiate and hydrate a new instance of this class + * @param jsonData String of JSON data representing target object + */ + static public TemplateUpdateRequest init(String jsonData) throws Exception { + return new ObjectMapper().readValue(jsonData, TemplateUpdateRequest.class); + } + + static public TemplateUpdateRequest init(HashMap data) throws Exception { + return new ObjectMapper().readValue( + new ObjectMapper().writeValueAsString(data), + TemplateUpdateRequest.class + ); + } + + public TemplateUpdateRequest ccRoles(@jakarta.annotation.Nullable List ccRoles) { + this.ccRoles = ccRoles; + return this; + } + + public TemplateUpdateRequest addCcRolesItem(String ccRolesItem) { + if (this.ccRoles == null) { + this.ccRoles = new ArrayList<>(); + } + this.ccRoles.add(ccRolesItem); + return this; + } + + /** + * The CC roles that must be assigned when using the template to send a signature request. + * @return ccRoles + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CC_ROLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getCcRoles() { + return ccRoles; + } + + + @JsonProperty(JSON_PROPERTY_CC_ROLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCcRoles(@jakarta.annotation.Nullable List ccRoles) { + this.ccRoles = ccRoles; + } + + + public TemplateUpdateRequest allowFormView(@jakarta.annotation.Nullable Boolean allowFormView) { + this.allowFormView = allowFormView; + return this; + } + + /** + * The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names. + * @return allowFormView + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ALLOW_FORM_VIEW) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getAllowFormView() { + return allowFormView; + } + + + @JsonProperty(JSON_PROPERTY_ALLOW_FORM_VIEW) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAllowFormView(@jakarta.annotation.Nullable Boolean allowFormView) { + this.allowFormView = allowFormView; + } + + + public TemplateUpdateRequest title(@jakarta.annotation.Nullable String title) { + this.title = title; + return this; + } + + /** + * The title you want to assign to the SignatureRequest. + * @return title + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getTitle() { + return title; + } + + + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTitle(@jakarta.annotation.Nullable String title) { + this.title = title; + } + + + public TemplateUpdateRequest subject(@jakarta.annotation.Nullable String subject) { + this.subject = subject; + return this; + } + + /** + * The new default template email subject. + * @return subject + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SUBJECT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSubject() { + return subject; + } + + + @JsonProperty(JSON_PROPERTY_SUBJECT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSubject(@jakarta.annotation.Nullable String subject) { + this.subject = subject; + } + + + public TemplateUpdateRequest message(@jakarta.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * The new default template email message. + * @return message + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMessage() { + return message; + } + + + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(@jakarta.annotation.Nullable String message) { + this.message = message; + } + + + /** + * Return true if this TemplateUpdateRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TemplateUpdateRequest templateUpdateRequest = (TemplateUpdateRequest) o; + return Objects.equals(this.ccRoles, templateUpdateRequest.ccRoles) && + Objects.equals(this.allowFormView, templateUpdateRequest.allowFormView) && + Objects.equals(this.title, templateUpdateRequest.title) && + Objects.equals(this.subject, templateUpdateRequest.subject) && + Objects.equals(this.message, templateUpdateRequest.message); + } + + @Override + public int hashCode() { + return Objects.hash(ccRoles, allowFormView, title, subject, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TemplateUpdateRequest {\n"); + sb.append(" ccRoles: ").append(toIndentedString(ccRoles)).append("\n"); + sb.append(" allowFormView: ").append(toIndentedString(allowFormView)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" subject: ").append(toIndentedString(subject)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public Map createFormData() throws ApiException { + Map map = new HashMap<>(); + boolean fileTypeFound = false; + try { + if (ccRoles != null) { + if (isFileTypeOrListOfFiles(ccRoles)) { + fileTypeFound = true; + } + + if (ccRoles.getClass().equals(java.io.File.class) || + ccRoles.getClass().equals(Integer.class) || + ccRoles.getClass().equals(String.class) || + ccRoles.getClass().isEnum()) { + map.put("cc_roles", ccRoles); + } else if (isListOfFile(ccRoles)) { + for(int i = 0; i< getListSize(ccRoles); i++) { + map.put("cc_roles[" + i + "]", getFromList(ccRoles, i)); + } + } + else { + map.put("cc_roles", JSON.getDefault().getMapper().writeValueAsString(ccRoles)); + } + } + if (allowFormView != null) { + if (isFileTypeOrListOfFiles(allowFormView)) { + fileTypeFound = true; + } + + if (allowFormView.getClass().equals(java.io.File.class) || + allowFormView.getClass().equals(Integer.class) || + allowFormView.getClass().equals(String.class) || + allowFormView.getClass().isEnum()) { + map.put("allow_form_view", allowFormView); + } else if (isListOfFile(allowFormView)) { + for(int i = 0; i< getListSize(allowFormView); i++) { + map.put("allow_form_view[" + i + "]", getFromList(allowFormView, i)); + } + } + else { + map.put("allow_form_view", JSON.getDefault().getMapper().writeValueAsString(allowFormView)); + } + } + if (title != null) { + if (isFileTypeOrListOfFiles(title)) { + fileTypeFound = true; + } + + if (title.getClass().equals(java.io.File.class) || + title.getClass().equals(Integer.class) || + title.getClass().equals(String.class) || + title.getClass().isEnum()) { + map.put("title", title); + } else if (isListOfFile(title)) { + for(int i = 0; i< getListSize(title); i++) { + map.put("title[" + i + "]", getFromList(title, i)); + } + } + else { + map.put("title", JSON.getDefault().getMapper().writeValueAsString(title)); + } + } + if (subject != null) { + if (isFileTypeOrListOfFiles(subject)) { + fileTypeFound = true; + } + + if (subject.getClass().equals(java.io.File.class) || + subject.getClass().equals(Integer.class) || + subject.getClass().equals(String.class) || + subject.getClass().isEnum()) { + map.put("subject", subject); + } else if (isListOfFile(subject)) { + for(int i = 0; i< getListSize(subject); i++) { + map.put("subject[" + i + "]", getFromList(subject, i)); + } + } + else { + map.put("subject", JSON.getDefault().getMapper().writeValueAsString(subject)); + } + } + if (message != null) { + if (isFileTypeOrListOfFiles(message)) { + fileTypeFound = true; + } + + if (message.getClass().equals(java.io.File.class) || + message.getClass().equals(Integer.class) || + message.getClass().equals(String.class) || + message.getClass().isEnum()) { + map.put("message", message); + } else if (isListOfFile(message)) { + for(int i = 0; i< getListSize(message); i++) { + map.put("message[" + i + "]", getFromList(message, i)); + } + } + else { + map.put("message", JSON.getDefault().getMapper().writeValueAsString(message)); + } + } + } catch (Exception e) { + throw new ApiException(e); + } + + return fileTypeFound ? map : new HashMap<>(); + } + + private boolean isFileTypeOrListOfFiles(Object obj) throws Exception { + return obj.getClass().equals(java.io.File.class) || isListOfFile(obj); + } + + private boolean isListOfFile(Object obj) throws Exception { + return obj instanceof java.util.List && !isListEmpty(obj) && getFromList(obj, 0) instanceof java.io.File; + } + + private boolean isListEmpty(Object obj) throws Exception { + return (boolean) Class.forName(java.util.List.class.getName()).getMethod("isEmpty").invoke(obj); + } + + private Object getFromList(Object obj, int index) throws Exception { + return Class.forName(java.util.List.class.getName()).getMethod("get", int.class).invoke(obj, index); + } + + private int getListSize(Object obj) throws Exception { + return (int) Class.forName(java.util.List.class.getName()).getMethod("size").invoke(obj); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/sdks/node/README.md b/sdks/node/README.md index 93d2bfdfd..ad01065c0 100644 --- a/sdks/node/README.md +++ b/sdks/node/README.md @@ -147,6 +147,7 @@ All URIs are relative to *https://api.hellosign.com/v3* | *TemplateApi* | [**templateGet**](./docs/api/TemplateApi.md#templateget) | **GET** /template/{template_id} | Get Template | | *TemplateApi* | [**templateList**](./docs/api/TemplateApi.md#templatelist) | **GET** /template/list | List Templates | | *TemplateApi* | [**templateRemoveUser**](./docs/api/TemplateApi.md#templateremoveuser) | **POST** /template/remove_user/{template_id} | Remove User from Template | +| *TemplateApi* | [**templateUpdate**](./docs/api/TemplateApi.md#templateupdate) | **POST** /template/update/{template_id} | Edit Template | | *TemplateApi* | [**templateUpdateFiles**](./docs/api/TemplateApi.md#templateupdatefiles) | **POST** /template/update_files/{template_id} | Update Template Files | | *UnclaimedDraftApi* | [**unclaimedDraftCreate**](./docs/api/UnclaimedDraftApi.md#unclaimeddraftcreate) | **POST** /unclaimed_draft/create | Create Unclaimed Draft | | *UnclaimedDraftApi* | [**unclaimedDraftCreateEmbedded**](./docs/api/UnclaimedDraftApi.md#unclaimeddraftcreateembedded) | **POST** /unclaimed_draft/create_embedded | Create Embedded Unclaimed Draft | @@ -303,7 +304,6 @@ All URIs are relative to *https://api.hellosign.com/v3* - [TemplateCreateRequest](./docs/model/TemplateCreateRequest.md) - [TemplateCreateResponse](./docs/model/TemplateCreateResponse.md) - [TemplateCreateResponseTemplate](./docs/model/TemplateCreateResponseTemplate.md) -- [TemplateEditResponse](./docs/model/TemplateEditResponse.md) - [TemplateGetResponse](./docs/model/TemplateGetResponse.md) - [TemplateListResponse](./docs/model/TemplateListResponse.md) - [TemplateRemoveUserRequest](./docs/model/TemplateRemoveUserRequest.md) @@ -340,6 +340,7 @@ All URIs are relative to *https://api.hellosign.com/v3* - [TemplateUpdateFilesRequest](./docs/model/TemplateUpdateFilesRequest.md) - [TemplateUpdateFilesResponse](./docs/model/TemplateUpdateFilesResponse.md) - [TemplateUpdateFilesResponseTemplate](./docs/model/TemplateUpdateFilesResponseTemplate.md) +- [TemplateUpdateRequest](./docs/model/TemplateUpdateRequest.md) - [UnclaimedDraftCreateEmbeddedRequest](./docs/model/UnclaimedDraftCreateEmbeddedRequest.md) - [UnclaimedDraftCreateEmbeddedWithTemplateRequest](./docs/model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.md) - [UnclaimedDraftCreateRequest](./docs/model/UnclaimedDraftCreateRequest.md) diff --git a/sdks/node/api/templateApi.ts b/sdks/node/api/templateApi.ts index 35ac24648..6cc43a036 100644 --- a/sdks/node/api/templateApi.ts +++ b/sdks/node/api/templateApi.ts @@ -42,6 +42,7 @@ import { TemplateRemoveUserRequest, TemplateUpdateFilesRequest, TemplateUpdateFilesResponse, + TemplateUpdateRequest, VoidAuth, } from "../model"; @@ -1506,6 +1507,165 @@ export class TemplateApi { ); }); } + /** + * Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + * @summary Edit Template + * @param templateId The ID of the template to update. + * @param templateUpdateRequest + * @param options + */ + public async templateUpdate( + templateId: string, + templateUpdateRequest: TemplateUpdateRequest, + options: optionsI = { headers: {} } + ): Promise> { + templateUpdateRequest = deserializeIfNeeded( + templateUpdateRequest, + "TemplateUpdateRequest" + ); + const localVarPath = + this.basePath + + "/template/update/{template_id}".replace( + "{" + "template_id" + "}", + encodeURIComponent(String(templateId)) + ); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign( + {}, + this._defaultHeaders + ); + const produces = ["application/json"]; + // give precedence to 'application/json' + if (produces.indexOf("application/json") >= 0) { + localVarHeaderParams["content-type"] = "application/json"; + } else { + localVarHeaderParams["content-type"] = produces.join(","); + } + let localVarFormParams: any = {}; + let localVarBodyParams: any = undefined; + + // verify required parameter 'templateId' is not null or undefined + if (templateId === null || templateId === undefined) { + throw new Error( + "Required parameter templateId was null or undefined when calling templateUpdate." + ); + } + + // verify required parameter 'templateUpdateRequest' is not null or undefined + if (templateUpdateRequest === null || templateUpdateRequest === undefined) { + throw new Error( + "Required parameter templateUpdateRequest was null or undefined when calling templateUpdate." + ); + } + + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + const result = generateFormData( + templateUpdateRequest, + TemplateUpdateRequest.attributeTypeMap + ); + localVarUseFormData = result.localVarUseFormData; + + let data = {}; + if (localVarUseFormData) { + const formData = toFormData(result.data); + data = formData; + localVarHeaderParams = { + ...localVarHeaderParams, + ...formData.getHeaders(), + }; + } else { + data = ObjectSerializer.serialize( + templateUpdateRequest, + "TemplateUpdateRequest" + ); + } + + let localVarRequestOptions: AxiosRequestConfig = { + method: "POST", + params: localVarQueryParameters, + headers: localVarHeaderParams, + url: localVarPath, + paramsSerializer: this._useQuerystring + ? queryParamsSerializer + : undefined, + maxContentLength: Infinity, + maxBodyLength: Infinity, + responseType: "json", + data, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.api_key.username) { + authenticationPromise = authenticationPromise.then(() => + this.authentications.api_key.applyToRequest(localVarRequestOptions) + ); + } + if (this.authentications.oauth2.accessToken) { + authenticationPromise = authenticationPromise.then(() => + this.authentications.oauth2.applyToRequest(localVarRequestOptions) + ); + } + authenticationPromise = authenticationPromise.then(() => + this.authentications.default.applyToRequest(localVarRequestOptions) + ); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => + interceptor(localVarRequestOptions) + ); + } + + return interceptorPromise.then(() => { + return new Promise>( + (resolve, reject) => { + axios.request(localVarRequestOptions).then( + (response) => { + handleSuccessfulResponse( + resolve, + reject, + response, + "TemplateGetResponse" + ); + }, + (error: AxiosError) => { + if (error.response == null) { + reject(error); + return; + } + + if ( + handleErrorCodeResponse( + reject, + error.response, + 200, + "TemplateGetResponse" + ) + ) { + return; + } + + if ( + handleErrorRangeResponse( + reject, + error.response, + "4XX", + "ErrorResponse" + ) + ) { + return; + } + + reject(error); + } + ); + } + ); + }); + } /** * Overlays a new file with the overlay of an existing template. The new file(s) must: 1. have the same or higher page count 2. the same orientation as the file(s) being replaced. This will not overwrite or in any way affect the existing template. Both the existing template and new template will be available for use after executing this endpoint. Also note that this will decrement your template quota. Overlaying new files is asynchronous and a successful call to this endpoint will return 200 OK response if the request passes initial validation checks. It is recommended that a callback be implemented to listen for the callback event. A `template_created` event will be sent when the files are updated or a `template_error` event will be sent if there was a problem while updating the files. If a callback handler has been configured and the event has not been received within 60 minutes of making the call, check the status of the request in the API dashboard and retry the request if necessary. If the page orientation or page count is different from the original template document, we will notify you with a `template_error` [callback event](https://app.hellosign.com/api/eventsAndCallbacksWalkthrough). * @summary Update Template Files diff --git a/sdks/node/dist/api.js b/sdks/node/dist/api.js index f8478972a..98b4dd3b5 100644 --- a/sdks/node/dist/api.js +++ b/sdks/node/dist/api.js @@ -13310,7 +13310,6 @@ __export(api_exports, { TemplateCreateRequest: () => TemplateCreateRequest, TemplateCreateResponse: () => TemplateCreateResponse, TemplateCreateResponseTemplate: () => TemplateCreateResponseTemplate, - TemplateEditResponse: () => TemplateEditResponse, TemplateGetResponse: () => TemplateGetResponse, TemplateListResponse: () => TemplateListResponse, TemplateRemoveUserRequest: () => TemplateRemoveUserRequest, @@ -13347,6 +13346,7 @@ __export(api_exports, { TemplateUpdateFilesRequest: () => TemplateUpdateFilesRequest, TemplateUpdateFilesResponse: () => TemplateUpdateFilesResponse, TemplateUpdateFilesResponseTemplate: () => TemplateUpdateFilesResponseTemplate, + TemplateUpdateRequest: () => TemplateUpdateRequest, USER_AGENT: () => USER_AGENT, UnclaimedDraftApi: () => UnclaimedDraftApi, UnclaimedDraftCreateEmbeddedRequest: () => UnclaimedDraftCreateEmbeddedRequest, @@ -24399,29 +24399,6 @@ var TemplateCreateResponseTemplate = class _TemplateCreateResponseTemplate { } }; -// model/templateEditResponse.ts -var TemplateEditResponse = class _TemplateEditResponse { - static { - this.discriminator = void 0; - } - static { - this.attributeTypeMap = [ - { - name: "templateId", - baseName: "template_id", - type: "string" - } - ]; - } - static getAttributeTypeMap() { - return _TemplateEditResponse.attributeTypeMap; - } - /** Attempt to instantiate and hydrate a new instance of this class */ - static init(data) { - return ObjectSerializer.deserialize(data, "TemplateEditResponse"); - } -}; - // model/templateGetResponse.ts var TemplateGetResponse = class _TemplateGetResponse { static { @@ -25989,6 +25966,49 @@ var TemplateUpdateFilesResponseTemplate = class _TemplateUpdateFilesResponseTemp } }; +// model/templateUpdateRequest.ts +var TemplateUpdateRequest = class _TemplateUpdateRequest { + static { + this.discriminator = void 0; + } + static { + this.attributeTypeMap = [ + { + name: "ccRoles", + baseName: "cc_roles", + type: "Array" + }, + { + name: "allowFormView", + baseName: "allow_form_view", + type: "boolean" + }, + { + name: "title", + baseName: "title", + type: "string" + }, + { + name: "subject", + baseName: "subject", + type: "string" + }, + { + name: "message", + baseName: "message", + type: "string" + } + ]; + } + static getAttributeTypeMap() { + return _TemplateUpdateRequest.attributeTypeMap; + } + /** Attempt to instantiate and hydrate a new instance of this class */ + static init(data) { + return ObjectSerializer.deserialize(data, "TemplateUpdateRequest"); + } +}; + // model/unclaimedDraftCreateEmbeddedRequest.ts var UnclaimedDraftCreateEmbeddedRequest = class _UnclaimedDraftCreateEmbeddedRequest { constructor() { @@ -27025,7 +27045,6 @@ var typeMap = { TemplateCreateRequest, TemplateCreateResponse, TemplateCreateResponseTemplate, - TemplateEditResponse, TemplateGetResponse, TemplateListResponse, TemplateRemoveUserRequest, @@ -27062,6 +27081,7 @@ var typeMap = { TemplateUpdateFilesRequest, TemplateUpdateFilesResponse, TemplateUpdateFilesResponseTemplate, + TemplateUpdateRequest, UnclaimedDraftCreateEmbeddedRequest, UnclaimedDraftCreateEmbeddedWithTemplateRequest, UnclaimedDraftCreateRequest, @@ -35554,6 +35574,137 @@ var TemplateApi = class { ); }); } + /** + * Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + * @summary Edit Template + * @param templateId The ID of the template to update. + * @param templateUpdateRequest + * @param options + */ + async templateUpdate(templateId, templateUpdateRequest, options = { headers: {} }) { + templateUpdateRequest = deserializeIfNeeded10( + templateUpdateRequest, + "TemplateUpdateRequest" + ); + const localVarPath = this.basePath + "/template/update/{template_id}".replace( + "{template_id}", + encodeURIComponent(String(templateId)) + ); + let localVarQueryParameters = {}; + let localVarHeaderParams = Object.assign( + {}, + this._defaultHeaders + ); + const produces = ["application/json"]; + if (produces.indexOf("application/json") >= 0) { + localVarHeaderParams["content-type"] = "application/json"; + } else { + localVarHeaderParams["content-type"] = produces.join(","); + } + let localVarFormParams = {}; + let localVarBodyParams = void 0; + if (templateId === null || templateId === void 0) { + throw new Error( + "Required parameter templateId was null or undefined when calling templateUpdate." + ); + } + if (templateUpdateRequest === null || templateUpdateRequest === void 0) { + throw new Error( + "Required parameter templateUpdateRequest was null or undefined when calling templateUpdate." + ); + } + Object.assign(localVarHeaderParams, options.headers); + let localVarUseFormData = false; + const result = generateFormData( + templateUpdateRequest, + TemplateUpdateRequest.attributeTypeMap + ); + localVarUseFormData = result.localVarUseFormData; + let data = {}; + if (localVarUseFormData) { + const formData2 = toFormData3(result.data); + data = formData2; + localVarHeaderParams = { + ...localVarHeaderParams, + ...formData2.getHeaders() + }; + } else { + data = ObjectSerializer.serialize( + templateUpdateRequest, + "TemplateUpdateRequest" + ); + } + let localVarRequestOptions = { + method: "POST", + params: localVarQueryParameters, + headers: localVarHeaderParams, + url: localVarPath, + paramsSerializer: this._useQuerystring ? queryParamsSerializer : void 0, + maxContentLength: Infinity, + maxBodyLength: Infinity, + responseType: "json", + data + }; + let authenticationPromise = Promise.resolve(); + if (this.authentications.api_key.username) { + authenticationPromise = authenticationPromise.then( + () => this.authentications.api_key.applyToRequest(localVarRequestOptions) + ); + } + if (this.authentications.oauth2.accessToken) { + authenticationPromise = authenticationPromise.then( + () => this.authentications.oauth2.applyToRequest(localVarRequestOptions) + ); + } + authenticationPromise = authenticationPromise.then( + () => this.authentications.default.applyToRequest(localVarRequestOptions) + ); + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then( + () => interceptor(localVarRequestOptions) + ); + } + return interceptorPromise.then(() => { + return new Promise( + (resolve, reject) => { + axios_default.request(localVarRequestOptions).then( + (response) => { + handleSuccessfulResponse11( + resolve, + reject, + response, + "TemplateGetResponse" + ); + }, + (error) => { + if (error.response == null) { + reject(error); + return; + } + if (handleErrorCodeResponse11( + reject, + error.response, + 200, + "TemplateGetResponse" + )) { + return; + } + if (handleErrorRangeResponse11( + reject, + error.response, + "4XX", + "ErrorResponse" + )) { + return; + } + reject(error); + } + ); + } + ); + }); + } /** * Overlays a new file with the overlay of an existing template. The new file(s) must: 1. have the same or higher page count 2. the same orientation as the file(s) being replaced. This will not overwrite or in any way affect the existing template. Both the existing template and new template will be available for use after executing this endpoint. Also note that this will decrement your template quota. Overlaying new files is asynchronous and a successful call to this endpoint will return 200 OK response if the request passes initial validation checks. It is recommended that a callback be implemented to listen for the callback event. A `template_created` event will be sent when the files are updated or a `template_error` event will be sent if there was a problem while updating the files. If a callback handler has been configured and the event has not been received within 60 minutes of making the call, check the status of the request in the API dashboard and retry the request if necessary. If the page orientation or page count is different from the original template document, we will notify you with a `template_error` [callback event](https://app.hellosign.com/api/eventsAndCallbacksWalkthrough). * @summary Update Template Files @@ -36562,7 +36713,6 @@ var APIS = [ TemplateCreateRequest, TemplateCreateResponse, TemplateCreateResponseTemplate, - TemplateEditResponse, TemplateGetResponse, TemplateListResponse, TemplateRemoveUserRequest, @@ -36599,6 +36749,7 @@ var APIS = [ TemplateUpdateFilesRequest, TemplateUpdateFilesResponse, TemplateUpdateFilesResponseTemplate, + TemplateUpdateRequest, USER_AGENT, UnclaimedDraftApi, UnclaimedDraftCreateEmbeddedRequest, diff --git a/sdks/node/docs/api/TemplateApi.md b/sdks/node/docs/api/TemplateApi.md index d86551c72..2afccaf4c 100644 --- a/sdks/node/docs/api/TemplateApi.md +++ b/sdks/node/docs/api/TemplateApi.md @@ -14,6 +14,7 @@ All URIs are relative to https://api.hellosign.com/v3. | [**templateGet()**](TemplateApi.md#templateGet) | **GET** /template/{template_id} | Get Template | | [**templateList()**](TemplateApi.md#templateList) | **GET** /template/list | List Templates | | [**templateRemoveUser()**](TemplateApi.md#templateRemoveUser) | **POST** /template/remove_user/{template_id} | Remove User from Template | +| [**templateUpdate()**](TemplateApi.md#templateUpdate) | **POST** /template/update/{template_id} | Edit Template | | [**templateUpdateFiles()**](TemplateApi.md#templateUpdateFiles) | **POST** /template/update_files/{template_id} | Update Template Files | @@ -725,6 +726,74 @@ apiCaller.templateRemoveUser( [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) +## `templateUpdate()` + +```typescript +templateUpdate(templateId: string, templateUpdateRequest: TemplateUpdateRequest): TemplateGetResponse +``` + +Edit Template + +Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + +### TypeScript Example + +```typescript +import * as fs from 'fs'; +import api from "@dropbox/sign" +import models from "@dropbox/sign" + +const apiCaller = new api.TemplateApi(); +apiCaller.username = "YOUR_API_KEY"; +// apiCaller.accessToken = "YOUR_ACCESS_TOKEN"; + +const templateUpdateRequest: models.TemplateUpdateRequest = { + allowFormView: false, + title: "Test Title", + subject: "Test Subject", + message: "Test Message", + ccRoles: [ + "CC Role 1", + "CC Role 2", + ], +}; + +apiCaller.templateUpdate( + "f57db65d3f933b5316d398057a36176831451a35", // templateId + templateUpdateRequest, +).then(response => { + console.log(response.body); +}).catch(error => { + console.log("Exception when calling TemplateApi#templateUpdate:"); + console.log(error.body); +}); + +``` + +### Parameters + +|Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **templateId** | **string**| The ID of the template to update. | | +| **templateUpdateRequest** | [**TemplateUpdateRequest**](../model/TemplateUpdateRequest.md)| | | + +### Return type + +[**TemplateGetResponse**](../model/TemplateGetResponse.md) + +### Authorization + +[api_key](../../README.md#api_key), [oauth2](../../README.md#oauth2) + +### HTTP request headers + +- **Content-Type**: `application/json`, `multipart/form-data` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + ## `templateUpdateFiles()` ```typescript diff --git a/sdks/node/docs/model/TemplateEditResponse.md b/sdks/node/docs/model/TemplateEditResponse.md deleted file mode 100644 index 2f40ccbad..000000000 --- a/sdks/node/docs/model/TemplateEditResponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# # TemplateEditResponse - - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `templateId`*_required_ | ```string``` | The id of the Template. | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/sdks/node/docs/model/TemplateUpdateRequest.md b/sdks/node/docs/model/TemplateUpdateRequest.md new file mode 100644 index 000000000..1e38af681 --- /dev/null +++ b/sdks/node/docs/model/TemplateUpdateRequest.md @@ -0,0 +1,15 @@ +# # TemplateUpdateRequest + + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +| `ccRoles` | ```Array``` | The CC roles that must be assigned when using the template to send a signature request. | | +| `allowFormView` | ```boolean``` | The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names. | | +| `title` | ```string``` | The title you want to assign to the SignatureRequest. | | +| `subject` | ```string``` | The new default template email subject. | | +| `message` | ```string``` | The new default template email message. | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/sdks/node/model/index.ts b/sdks/node/model/index.ts index 1f2ea9c97..8215317b9 100644 --- a/sdks/node/model/index.ts +++ b/sdks/node/model/index.ts @@ -160,7 +160,6 @@ import { TemplateCreateEmbeddedDraftResponseTemplate } from "./templateCreateEmb import { TemplateCreateRequest } from "./templateCreateRequest"; import { TemplateCreateResponse } from "./templateCreateResponse"; import { TemplateCreateResponseTemplate } from "./templateCreateResponseTemplate"; -import { TemplateEditResponse } from "./templateEditResponse"; import { TemplateGetResponse } from "./templateGetResponse"; import { TemplateListResponse } from "./templateListResponse"; import { TemplateRemoveUserRequest } from "./templateRemoveUserRequest"; @@ -197,6 +196,7 @@ import { TemplateResponseSignerRole } from "./templateResponseSignerRole"; import { TemplateUpdateFilesRequest } from "./templateUpdateFilesRequest"; import { TemplateUpdateFilesResponse } from "./templateUpdateFilesResponse"; import { TemplateUpdateFilesResponseTemplate } from "./templateUpdateFilesResponseTemplate"; +import { TemplateUpdateRequest } from "./templateUpdateRequest"; import { UnclaimedDraftCreateEmbeddedRequest } from "./unclaimedDraftCreateEmbeddedRequest"; import { UnclaimedDraftCreateEmbeddedWithTemplateRequest } from "./unclaimedDraftCreateEmbeddedWithTemplateRequest"; import { UnclaimedDraftCreateRequest } from "./unclaimedDraftCreateRequest"; @@ -415,7 +415,6 @@ export let typeMap: { [index: string]: any } = { TemplateCreateRequest: TemplateCreateRequest, TemplateCreateResponse: TemplateCreateResponse, TemplateCreateResponseTemplate: TemplateCreateResponseTemplate, - TemplateEditResponse: TemplateEditResponse, TemplateGetResponse: TemplateGetResponse, TemplateListResponse: TemplateListResponse, TemplateRemoveUserRequest: TemplateRemoveUserRequest, @@ -472,6 +471,7 @@ export let typeMap: { [index: string]: any } = { TemplateUpdateFilesRequest: TemplateUpdateFilesRequest, TemplateUpdateFilesResponse: TemplateUpdateFilesResponse, TemplateUpdateFilesResponseTemplate: TemplateUpdateFilesResponseTemplate, + TemplateUpdateRequest: TemplateUpdateRequest, UnclaimedDraftCreateEmbeddedRequest: UnclaimedDraftCreateEmbeddedRequest, UnclaimedDraftCreateEmbeddedWithTemplateRequest: UnclaimedDraftCreateEmbeddedWithTemplateRequest, @@ -642,7 +642,6 @@ export { TemplateCreateRequest, TemplateCreateResponse, TemplateCreateResponseTemplate, - TemplateEditResponse, TemplateGetResponse, TemplateListResponse, TemplateRemoveUserRequest, @@ -679,6 +678,7 @@ export { TemplateUpdateFilesRequest, TemplateUpdateFilesResponse, TemplateUpdateFilesResponseTemplate, + TemplateUpdateRequest, UnclaimedDraftCreateEmbeddedRequest, UnclaimedDraftCreateEmbeddedWithTemplateRequest, UnclaimedDraftCreateRequest, diff --git a/sdks/node/model/templateEditResponse.ts b/sdks/node/model/templateUpdateRequest.ts similarity index 55% rename from sdks/node/model/templateEditResponse.ts rename to sdks/node/model/templateUpdateRequest.ts index aa51f43d0..990a6a339 100644 --- a/sdks/node/model/templateEditResponse.ts +++ b/sdks/node/model/templateUpdateRequest.ts @@ -24,28 +24,64 @@ import { AttributeTypeMap, ObjectSerializer } from "./"; -export class TemplateEditResponse { +export class TemplateUpdateRequest { /** - * The id of the Template. + * The CC roles that must be assigned when using the template to send a signature request. */ - "templateId": string; + "ccRoles"?: Array; + /** + * The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names. + */ + "allowFormView"?: boolean; + /** + * The title you want to assign to the SignatureRequest. + */ + "title"?: string; + /** + * The new default template email subject. + */ + "subject"?: string; + /** + * The new default template email message. + */ + "message"?: string; static discriminator: string | undefined = undefined; static attributeTypeMap: AttributeTypeMap = [ { - name: "templateId", - baseName: "template_id", + name: "ccRoles", + baseName: "cc_roles", + type: "Array", + }, + { + name: "allowFormView", + baseName: "allow_form_view", + type: "boolean", + }, + { + name: "title", + baseName: "title", + type: "string", + }, + { + name: "subject", + baseName: "subject", + type: "string", + }, + { + name: "message", + baseName: "message", type: "string", }, ]; static getAttributeTypeMap(): AttributeTypeMap { - return TemplateEditResponse.attributeTypeMap; + return TemplateUpdateRequest.attributeTypeMap; } /** Attempt to instantiate and hydrate a new instance of this class */ - static init(data: any): TemplateEditResponse { - return ObjectSerializer.deserialize(data, "TemplateEditResponse"); + static init(data: any): TemplateUpdateRequest { + return ObjectSerializer.deserialize(data, "TemplateUpdateRequest"); } } diff --git a/sdks/node/types/api/templateApi.d.ts b/sdks/node/types/api/templateApi.d.ts index aeaa69a46..98a126994 100644 --- a/sdks/node/types/api/templateApi.d.ts +++ b/sdks/node/types/api/templateApi.d.ts @@ -1,4 +1,4 @@ -import { Authentication, FileResponse, FileResponseDataUri, HttpBasicAuth, HttpBearerAuth, Interceptor, TemplateAddUserRequest, TemplateCreateEmbeddedDraftRequest, TemplateCreateEmbeddedDraftResponse, TemplateCreateRequest, TemplateCreateResponse, TemplateGetResponse, TemplateListResponse, TemplateRemoveUserRequest, TemplateUpdateFilesRequest, TemplateUpdateFilesResponse } from "../model"; +import { Authentication, FileResponse, FileResponseDataUri, HttpBasicAuth, HttpBearerAuth, Interceptor, TemplateAddUserRequest, TemplateCreateEmbeddedDraftRequest, TemplateCreateEmbeddedDraftResponse, TemplateCreateRequest, TemplateCreateResponse, TemplateGetResponse, TemplateListResponse, TemplateRemoveUserRequest, TemplateUpdateFilesRequest, TemplateUpdateFilesResponse, TemplateUpdateRequest } from "../model"; import { optionsI, returnTypeI, returnTypeT } from "./"; export declare enum TemplateApiApiKeys { } @@ -34,5 +34,6 @@ export declare class TemplateApi { templateGet(templateId: string, options?: optionsI): Promise>; templateList(accountId?: string, page?: number, pageSize?: number, query?: string, options?: optionsI): Promise>; templateRemoveUser(templateId: string, templateRemoveUserRequest: TemplateRemoveUserRequest, options?: optionsI): Promise>; + templateUpdate(templateId: string, templateUpdateRequest: TemplateUpdateRequest, options?: optionsI): Promise>; templateUpdateFiles(templateId: string, templateUpdateFilesRequest: TemplateUpdateFilesRequest, options?: optionsI): Promise>; } diff --git a/sdks/node/types/model/index.d.ts b/sdks/node/types/model/index.d.ts index 99010c62f..5b00b530c 100644 --- a/sdks/node/types/model/index.d.ts +++ b/sdks/node/types/model/index.d.ts @@ -148,7 +148,6 @@ import { TemplateCreateEmbeddedDraftResponseTemplate } from "./templateCreateEmb import { TemplateCreateRequest } from "./templateCreateRequest"; import { TemplateCreateResponse } from "./templateCreateResponse"; import { TemplateCreateResponseTemplate } from "./templateCreateResponseTemplate"; -import { TemplateEditResponse } from "./templateEditResponse"; import { TemplateGetResponse } from "./templateGetResponse"; import { TemplateListResponse } from "./templateListResponse"; import { TemplateRemoveUserRequest } from "./templateRemoveUserRequest"; @@ -185,6 +184,7 @@ import { TemplateResponseSignerRole } from "./templateResponseSignerRole"; import { TemplateUpdateFilesRequest } from "./templateUpdateFilesRequest"; import { TemplateUpdateFilesResponse } from "./templateUpdateFilesResponse"; import { TemplateUpdateFilesResponseTemplate } from "./templateUpdateFilesResponseTemplate"; +import { TemplateUpdateRequest } from "./templateUpdateRequest"; import { UnclaimedDraftCreateEmbeddedRequest } from "./unclaimedDraftCreateEmbeddedRequest"; import { UnclaimedDraftCreateEmbeddedWithTemplateRequest } from "./unclaimedDraftCreateEmbeddedWithTemplateRequest"; import { UnclaimedDraftCreateRequest } from "./unclaimedDraftCreateRequest"; @@ -198,4 +198,4 @@ export declare let enumsMap: { export declare let typeMap: { [index: string]: any; }; -export { AccountCreateRequest, AccountCreateResponse, AccountGetResponse, AccountResponse, AccountResponseQuotas, AccountResponseUsage, AccountUpdateRequest, AccountVerifyRequest, AccountVerifyResponse, AccountVerifyResponseAccount, ApiAppCreateRequest, ApiAppGetResponse, ApiAppListResponse, ApiAppResponse, ApiAppResponseOAuth, ApiAppResponseOptions, ApiAppResponseOwnerAccount, ApiAppResponseWhiteLabelingOptions, ApiAppUpdateRequest, ApiKeyAuth, AttributeTypeMap, Authentication, BulkSendJobGetResponse, BulkSendJobGetResponseSignatureRequests, BulkSendJobListResponse, BulkSendJobResponse, BulkSendJobSendResponse, EmbeddedEditUrlRequest, EmbeddedEditUrlResponse, EmbeddedEditUrlResponseEmbedded, EmbeddedSignUrlResponse, EmbeddedSignUrlResponseEmbedded, ErrorResponse, ErrorResponseError, EventCallbackHelper, EventCallbackRequest, EventCallbackRequestEvent, EventCallbackRequestEventMetadata, FaxGetResponse, FaxLineAddUserRequest, FaxLineAreaCodeGetCountryEnum, FaxLineAreaCodeGetProvinceEnum, FaxLineAreaCodeGetResponse, FaxLineAreaCodeGetStateEnum, FaxLineCreateRequest, FaxLineDeleteRequest, FaxLineListResponse, FaxLineRemoveUserRequest, FaxLineResponse, FaxLineResponseFaxLine, FaxListResponse, FaxResponse, FaxResponseTransmission, FaxSendRequest, FileResponse, FileResponseDataUri, HttpBasicAuth, HttpBearerAuth, Interceptor, ListInfoResponse, OAuth, OAuthTokenGenerateRequest, OAuthTokenRefreshRequest, OAuthTokenResponse, ObjectSerializer, ReportCreateRequest, ReportCreateResponse, ReportResponse, RequestDetailedFile, RequestFile, SignatureRequestBulkCreateEmbeddedWithTemplateRequest, SignatureRequestBulkSendWithTemplateRequest, SignatureRequestCreateEmbeddedRequest, SignatureRequestCreateEmbeddedWithTemplateRequest, SignatureRequestEditEmbeddedRequest, SignatureRequestEditEmbeddedWithTemplateRequest, SignatureRequestEditRequest, SignatureRequestEditWithTemplateRequest, SignatureRequestGetResponse, SignatureRequestListResponse, SignatureRequestRemindRequest, SignatureRequestResponse, SignatureRequestResponseAttachment, SignatureRequestResponseCustomFieldBase, SignatureRequestResponseCustomFieldCheckbox, SignatureRequestResponseCustomFieldText, SignatureRequestResponseCustomFieldTypeEnum, SignatureRequestResponseDataBase, SignatureRequestResponseDataTypeEnum, SignatureRequestResponseDataValueCheckbox, SignatureRequestResponseDataValueCheckboxMerge, SignatureRequestResponseDataValueDateSigned, SignatureRequestResponseDataValueDropdown, SignatureRequestResponseDataValueInitials, SignatureRequestResponseDataValueRadio, SignatureRequestResponseDataValueSignature, SignatureRequestResponseDataValueText, SignatureRequestResponseDataValueTextMerge, SignatureRequestResponseSignatures, SignatureRequestSendRequest, SignatureRequestSendWithTemplateRequest, SignatureRequestUpdateRequest, SubAttachment, SubBulkSignerList, SubBulkSignerListCustomField, SubCC, SubCustomField, SubEditorOptions, SubFieldOptions, SubFormFieldGroup, SubFormFieldRule, SubFormFieldRuleAction, SubFormFieldRuleTrigger, SubFormFieldsPerDocumentBase, SubFormFieldsPerDocumentCheckbox, SubFormFieldsPerDocumentCheckboxMerge, SubFormFieldsPerDocumentDateSigned, SubFormFieldsPerDocumentDropdown, SubFormFieldsPerDocumentFontEnum, SubFormFieldsPerDocumentHyperlink, SubFormFieldsPerDocumentInitials, SubFormFieldsPerDocumentRadio, SubFormFieldsPerDocumentSignature, SubFormFieldsPerDocumentText, SubFormFieldsPerDocumentTextMerge, SubFormFieldsPerDocumentTypeEnum, SubMergeField, SubOAuth, SubOptions, SubSignatureRequestGroupedSigners, SubSignatureRequestSigner, SubSignatureRequestTemplateSigner, SubSigningOptions, SubTeamResponse, SubTemplateRole, SubUnclaimedDraftSigner, SubUnclaimedDraftTemplateSigner, SubWhiteLabelingOptions, TeamAddMemberRequest, TeamCreateRequest, TeamGetInfoResponse, TeamGetResponse, TeamInfoResponse, TeamInviteResponse, TeamInvitesResponse, TeamMemberResponse, TeamMembersResponse, TeamParentResponse, TeamRemoveMemberRequest, TeamResponse, TeamSubTeamsResponse, TeamUpdateRequest, TemplateAddUserRequest, TemplateCreateEmbeddedDraftRequest, TemplateCreateEmbeddedDraftResponse, TemplateCreateEmbeddedDraftResponseTemplate, TemplateCreateRequest, TemplateCreateResponse, TemplateCreateResponseTemplate, TemplateEditResponse, TemplateGetResponse, TemplateListResponse, TemplateRemoveUserRequest, TemplateResponse, TemplateResponseAccount, TemplateResponseAccountQuota, TemplateResponseCCRole, TemplateResponseDocument, TemplateResponseDocumentCustomFieldBase, TemplateResponseDocumentCustomFieldCheckbox, TemplateResponseDocumentCustomFieldText, TemplateResponseDocumentFieldGroup, TemplateResponseDocumentFieldGroupRule, TemplateResponseDocumentFormFieldBase, TemplateResponseDocumentFormFieldCheckbox, TemplateResponseDocumentFormFieldDateSigned, TemplateResponseDocumentFormFieldDropdown, TemplateResponseDocumentFormFieldHyperlink, TemplateResponseDocumentFormFieldInitials, TemplateResponseDocumentFormFieldRadio, TemplateResponseDocumentFormFieldSignature, TemplateResponseDocumentFormFieldText, TemplateResponseDocumentStaticFieldBase, TemplateResponseDocumentStaticFieldCheckbox, TemplateResponseDocumentStaticFieldDateSigned, TemplateResponseDocumentStaticFieldDropdown, TemplateResponseDocumentStaticFieldHyperlink, TemplateResponseDocumentStaticFieldInitials, TemplateResponseDocumentStaticFieldRadio, TemplateResponseDocumentStaticFieldSignature, TemplateResponseDocumentStaticFieldText, TemplateResponseFieldAvgTextLength, TemplateResponseSignerRole, TemplateUpdateFilesRequest, TemplateUpdateFilesResponse, TemplateUpdateFilesResponseTemplate, UnclaimedDraftCreateEmbeddedRequest, UnclaimedDraftCreateEmbeddedWithTemplateRequest, UnclaimedDraftCreateRequest, UnclaimedDraftCreateResponse, UnclaimedDraftEditAndResendRequest, UnclaimedDraftResponse, VoidAuth, WarningResponse, }; +export { AccountCreateRequest, AccountCreateResponse, AccountGetResponse, AccountResponse, AccountResponseQuotas, AccountResponseUsage, AccountUpdateRequest, AccountVerifyRequest, AccountVerifyResponse, AccountVerifyResponseAccount, ApiAppCreateRequest, ApiAppGetResponse, ApiAppListResponse, ApiAppResponse, ApiAppResponseOAuth, ApiAppResponseOptions, ApiAppResponseOwnerAccount, ApiAppResponseWhiteLabelingOptions, ApiAppUpdateRequest, ApiKeyAuth, AttributeTypeMap, Authentication, BulkSendJobGetResponse, BulkSendJobGetResponseSignatureRequests, BulkSendJobListResponse, BulkSendJobResponse, BulkSendJobSendResponse, EmbeddedEditUrlRequest, EmbeddedEditUrlResponse, EmbeddedEditUrlResponseEmbedded, EmbeddedSignUrlResponse, EmbeddedSignUrlResponseEmbedded, ErrorResponse, ErrorResponseError, EventCallbackHelper, EventCallbackRequest, EventCallbackRequestEvent, EventCallbackRequestEventMetadata, FaxGetResponse, FaxLineAddUserRequest, FaxLineAreaCodeGetCountryEnum, FaxLineAreaCodeGetProvinceEnum, FaxLineAreaCodeGetResponse, FaxLineAreaCodeGetStateEnum, FaxLineCreateRequest, FaxLineDeleteRequest, FaxLineListResponse, FaxLineRemoveUserRequest, FaxLineResponse, FaxLineResponseFaxLine, FaxListResponse, FaxResponse, FaxResponseTransmission, FaxSendRequest, FileResponse, FileResponseDataUri, HttpBasicAuth, HttpBearerAuth, Interceptor, ListInfoResponse, OAuth, OAuthTokenGenerateRequest, OAuthTokenRefreshRequest, OAuthTokenResponse, ObjectSerializer, ReportCreateRequest, ReportCreateResponse, ReportResponse, RequestDetailedFile, RequestFile, SignatureRequestBulkCreateEmbeddedWithTemplateRequest, SignatureRequestBulkSendWithTemplateRequest, SignatureRequestCreateEmbeddedRequest, SignatureRequestCreateEmbeddedWithTemplateRequest, SignatureRequestEditEmbeddedRequest, SignatureRequestEditEmbeddedWithTemplateRequest, SignatureRequestEditRequest, SignatureRequestEditWithTemplateRequest, SignatureRequestGetResponse, SignatureRequestListResponse, SignatureRequestRemindRequest, SignatureRequestResponse, SignatureRequestResponseAttachment, SignatureRequestResponseCustomFieldBase, SignatureRequestResponseCustomFieldCheckbox, SignatureRequestResponseCustomFieldText, SignatureRequestResponseCustomFieldTypeEnum, SignatureRequestResponseDataBase, SignatureRequestResponseDataTypeEnum, SignatureRequestResponseDataValueCheckbox, SignatureRequestResponseDataValueCheckboxMerge, SignatureRequestResponseDataValueDateSigned, SignatureRequestResponseDataValueDropdown, SignatureRequestResponseDataValueInitials, SignatureRequestResponseDataValueRadio, SignatureRequestResponseDataValueSignature, SignatureRequestResponseDataValueText, SignatureRequestResponseDataValueTextMerge, SignatureRequestResponseSignatures, SignatureRequestSendRequest, SignatureRequestSendWithTemplateRequest, SignatureRequestUpdateRequest, SubAttachment, SubBulkSignerList, SubBulkSignerListCustomField, SubCC, SubCustomField, SubEditorOptions, SubFieldOptions, SubFormFieldGroup, SubFormFieldRule, SubFormFieldRuleAction, SubFormFieldRuleTrigger, SubFormFieldsPerDocumentBase, SubFormFieldsPerDocumentCheckbox, SubFormFieldsPerDocumentCheckboxMerge, SubFormFieldsPerDocumentDateSigned, SubFormFieldsPerDocumentDropdown, SubFormFieldsPerDocumentFontEnum, SubFormFieldsPerDocumentHyperlink, SubFormFieldsPerDocumentInitials, SubFormFieldsPerDocumentRadio, SubFormFieldsPerDocumentSignature, SubFormFieldsPerDocumentText, SubFormFieldsPerDocumentTextMerge, SubFormFieldsPerDocumentTypeEnum, SubMergeField, SubOAuth, SubOptions, SubSignatureRequestGroupedSigners, SubSignatureRequestSigner, SubSignatureRequestTemplateSigner, SubSigningOptions, SubTeamResponse, SubTemplateRole, SubUnclaimedDraftSigner, SubUnclaimedDraftTemplateSigner, SubWhiteLabelingOptions, TeamAddMemberRequest, TeamCreateRequest, TeamGetInfoResponse, TeamGetResponse, TeamInfoResponse, TeamInviteResponse, TeamInvitesResponse, TeamMemberResponse, TeamMembersResponse, TeamParentResponse, TeamRemoveMemberRequest, TeamResponse, TeamSubTeamsResponse, TeamUpdateRequest, TemplateAddUserRequest, TemplateCreateEmbeddedDraftRequest, TemplateCreateEmbeddedDraftResponse, TemplateCreateEmbeddedDraftResponseTemplate, TemplateCreateRequest, TemplateCreateResponse, TemplateCreateResponseTemplate, TemplateGetResponse, TemplateListResponse, TemplateRemoveUserRequest, TemplateResponse, TemplateResponseAccount, TemplateResponseAccountQuota, TemplateResponseCCRole, TemplateResponseDocument, TemplateResponseDocumentCustomFieldBase, TemplateResponseDocumentCustomFieldCheckbox, TemplateResponseDocumentCustomFieldText, TemplateResponseDocumentFieldGroup, TemplateResponseDocumentFieldGroupRule, TemplateResponseDocumentFormFieldBase, TemplateResponseDocumentFormFieldCheckbox, TemplateResponseDocumentFormFieldDateSigned, TemplateResponseDocumentFormFieldDropdown, TemplateResponseDocumentFormFieldHyperlink, TemplateResponseDocumentFormFieldInitials, TemplateResponseDocumentFormFieldRadio, TemplateResponseDocumentFormFieldSignature, TemplateResponseDocumentFormFieldText, TemplateResponseDocumentStaticFieldBase, TemplateResponseDocumentStaticFieldCheckbox, TemplateResponseDocumentStaticFieldDateSigned, TemplateResponseDocumentStaticFieldDropdown, TemplateResponseDocumentStaticFieldHyperlink, TemplateResponseDocumentStaticFieldInitials, TemplateResponseDocumentStaticFieldRadio, TemplateResponseDocumentStaticFieldSignature, TemplateResponseDocumentStaticFieldText, TemplateResponseFieldAvgTextLength, TemplateResponseSignerRole, TemplateUpdateFilesRequest, TemplateUpdateFilesResponse, TemplateUpdateFilesResponseTemplate, TemplateUpdateRequest, UnclaimedDraftCreateEmbeddedRequest, UnclaimedDraftCreateEmbeddedWithTemplateRequest, UnclaimedDraftCreateRequest, UnclaimedDraftCreateResponse, UnclaimedDraftEditAndResendRequest, UnclaimedDraftResponse, VoidAuth, WarningResponse, }; diff --git a/sdks/node/types/model/templateEditResponse.d.ts b/sdks/node/types/model/templateEditResponse.d.ts deleted file mode 100644 index dba3ddce6..000000000 --- a/sdks/node/types/model/templateEditResponse.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { AttributeTypeMap } from "./"; -export declare class TemplateEditResponse { - "templateId": string; - static discriminator: string | undefined; - static attributeTypeMap: AttributeTypeMap; - static getAttributeTypeMap(): AttributeTypeMap; - static init(data: any): TemplateEditResponse; -} diff --git a/sdks/node/types/model/templateUpdateRequest.d.ts b/sdks/node/types/model/templateUpdateRequest.d.ts new file mode 100644 index 000000000..1ecd5055a --- /dev/null +++ b/sdks/node/types/model/templateUpdateRequest.d.ts @@ -0,0 +1,12 @@ +import { AttributeTypeMap } from "./"; +export declare class TemplateUpdateRequest { + "ccRoles"?: Array; + "allowFormView"?: boolean; + "title"?: string; + "subject"?: string; + "message"?: string; + static discriminator: string | undefined; + static attributeTypeMap: AttributeTypeMap; + static getAttributeTypeMap(): AttributeTypeMap; + static init(data: any): TemplateUpdateRequest; +} diff --git a/sdks/php/README.md b/sdks/php/README.md index ddc1ded08..c94b62a8c 100644 --- a/sdks/php/README.md +++ b/sdks/php/README.md @@ -215,6 +215,7 @@ All URIs are relative to *https://api.hellosign.com/v3* | *TemplateApi* | [**templateGet**](docs/Api/TemplateApi.md#templateget) | **GET** /template/{template_id} | Get Template | | *TemplateApi* | [**templateList**](docs/Api/TemplateApi.md#templatelist) | **GET** /template/list | List Templates | | *TemplateApi* | [**templateRemoveUser**](docs/Api/TemplateApi.md#templateremoveuser) | **POST** /template/remove_user/{template_id} | Remove User from Template | +| *TemplateApi* | [**templateUpdate**](docs/Api/TemplateApi.md#templateupdate) | **POST** /template/update/{template_id} | Edit Template | | *TemplateApi* | [**templateUpdateFiles**](docs/Api/TemplateApi.md#templateupdatefiles) | **POST** /template/update_files/{template_id} | Update Template Files | | *UnclaimedDraftApi* | [**unclaimedDraftCreate**](docs/Api/UnclaimedDraftApi.md#unclaimeddraftcreate) | **POST** /unclaimed_draft/create | Create Unclaimed Draft | | *UnclaimedDraftApi* | [**unclaimedDraftCreateEmbedded**](docs/Api/UnclaimedDraftApi.md#unclaimeddraftcreateembedded) | **POST** /unclaimed_draft/create_embedded | Create Embedded Unclaimed Draft | @@ -372,7 +373,6 @@ All URIs are relative to *https://api.hellosign.com/v3* - [TemplateCreateRequest](docs/Model/TemplateCreateRequest.md) - [TemplateCreateResponse](docs/Model/TemplateCreateResponse.md) - [TemplateCreateResponseTemplate](docs/Model/TemplateCreateResponseTemplate.md) -- [TemplateEditResponse](docs/Model/TemplateEditResponse.md) - [TemplateGetResponse](docs/Model/TemplateGetResponse.md) - [TemplateListResponse](docs/Model/TemplateListResponse.md) - [TemplateRemoveUserRequest](docs/Model/TemplateRemoveUserRequest.md) @@ -409,6 +409,7 @@ All URIs are relative to *https://api.hellosign.com/v3* - [TemplateUpdateFilesRequest](docs/Model/TemplateUpdateFilesRequest.md) - [TemplateUpdateFilesResponse](docs/Model/TemplateUpdateFilesResponse.md) - [TemplateUpdateFilesResponseTemplate](docs/Model/TemplateUpdateFilesResponseTemplate.md) +- [TemplateUpdateRequest](docs/Model/TemplateUpdateRequest.md) - [UnclaimedDraftCreateEmbeddedRequest](docs/Model/UnclaimedDraftCreateEmbeddedRequest.md) - [UnclaimedDraftCreateEmbeddedWithTemplateRequest](docs/Model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.md) - [UnclaimedDraftCreateRequest](docs/Model/UnclaimedDraftCreateRequest.md) diff --git a/sdks/php/docs/Api/TemplateApi.md b/sdks/php/docs/Api/TemplateApi.md index 23d1d5a98..3288d0a45 100644 --- a/sdks/php/docs/Api/TemplateApi.md +++ b/sdks/php/docs/Api/TemplateApi.md @@ -14,6 +14,7 @@ All URIs are relative to https://api.hellosign.com/v3. | [**templateGet()**](TemplateApi.md#templateGet) | **GET** /template/{template_id} | Get Template | | [**templateList()**](TemplateApi.md#templateList) | **GET** /template/list | List Templates | | [**templateRemoveUser()**](TemplateApi.md#templateRemoveUser) | **POST** /template/remove_user/{template_id} | Remove User from Template | +| [**templateUpdate()**](TemplateApi.md#templateUpdate) | **POST** /template/update/{template_id} | Edit Template | | [**templateUpdateFiles()**](TemplateApi.md#templateUpdateFiles) | **POST** /template/update_files/{template_id} | Update Template Files | @@ -754,6 +755,78 @@ try { [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) +## `templateUpdate()` + +```php +templateUpdate($template_id, $template_update_request): \Dropbox\Sign\Model\TemplateGetResponse +``` +Edit Template + +Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + +### Example + +```php +setUsername("YOUR_API_KEY"); +// $config->setAccessToken("YOUR_ACCESS_TOKEN"); + +$template_update_request = (new Dropbox\Sign\Model\TemplateUpdateRequest()) + ->setAllowFormView(false) + ->setTitle("Test Title") + ->setSubject("Test Subject") + ->setMessage("Test Message") + ->setCcRoles([ + "CC Role 1", + "CC Role 2", + ]); + +try { + $response = (new Dropbox\Sign\Api\TemplateApi(config: $config))->templateUpdate( + template_id: "f57db65d3f933b5316d398057a36176831451a35", + template_update_request: $template_update_request, + ); + + print_r($response); +} catch (Dropbox\Sign\ApiException $e) { + echo "Exception when calling TemplateApi#templateUpdate: {$e->getMessage()}"; +} + +``` + +### Parameters + +|Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **template_id** | **string**| The ID of the template to update. | | +| **template_update_request** | [**\Dropbox\Sign\Model\TemplateUpdateRequest**](../Model/TemplateUpdateRequest.md)| | | + +### Return type + +[**\Dropbox\Sign\Model\TemplateGetResponse**](../Model/TemplateGetResponse.md) + +### Authorization + +[api_key](../../README.md#api_key), [oauth2](../../README.md#oauth2) + +### HTTP request headers + +- **Content-Type**: `application/json`, `multipart/form-data` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + ## `templateUpdateFiles()` ```php diff --git a/sdks/php/docs/Model/TemplateEditResponse.md b/sdks/php/docs/Model/TemplateEditResponse.md deleted file mode 100644 index b343db573..000000000 --- a/sdks/php/docs/Model/TemplateEditResponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# # TemplateEditResponse - - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `template_id`*_required_ | ```string``` | The id of the Template. | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/sdks/php/docs/Model/TemplateUpdateRequest.md b/sdks/php/docs/Model/TemplateUpdateRequest.md new file mode 100644 index 000000000..e6dcc2c30 --- /dev/null +++ b/sdks/php/docs/Model/TemplateUpdateRequest.md @@ -0,0 +1,15 @@ +# # TemplateUpdateRequest + + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +| `cc_roles` | ```string[]``` | The CC roles that must be assigned when using the template to send a signature request. | | +| `allow_form_view` | ```bool``` | The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names. | | +| `title` | ```string``` | The title you want to assign to the SignatureRequest. | | +| `subject` | ```string``` | The new default template email subject. | | +| `message` | ```string``` | The new default template email message. | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/sdks/php/src/Api/TemplateApi.php b/sdks/php/src/Api/TemplateApi.php index 2d39bc886..a0b7a8388 100644 --- a/sdks/php/src/Api/TemplateApi.php +++ b/sdks/php/src/Api/TemplateApi.php @@ -100,6 +100,10 @@ class TemplateApi 'templateRemoveUser' => [ 'application/json', ], + 'templateUpdate' => [ + 'application/json', + 'multipart/form-data', + ], 'templateUpdateFiles' => [ 'application/json', 'multipart/form-data', @@ -3524,6 +3528,366 @@ public function templateRemoveUserRequest(string $template_id, Model\TemplateRem ); } + /** + * Operation templateUpdate + * + * Edit Template + * + * @param string $template_id The ID of the template to update. (required) + * @param Model\TemplateUpdateRequest $template_update_request template_update_request (required) + * + * @return Model\TemplateGetResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + */ + public function templateUpdate(string $template_id, Model\TemplateUpdateRequest $template_update_request) + { + list($response) = $this->templateUpdateWithHttpInfo($template_id, $template_update_request); + return $response; + } + + /** + * Operation templateUpdateWithHttpInfo + * + * Edit Template + * + * @param string $template_id The ID of the template to update. (required) + * @param Model\TemplateUpdateRequest $template_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateUpdate'] to see the possible values for this operation + * + * @return array of Model\TemplateGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateUpdate. This method will eventually become unavailable + */ + public function templateUpdateWithHttpInfo(string $template_id, Model\TemplateUpdateRequest $template_update_request, string $contentType = self::contentTypes['templateUpdate'][0]) + { + $request = $this->templateUpdateRequest($template_id, $template_update_request, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + $this->response = $response; + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int)$e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string)$e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int)$e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; + } + + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\TemplateGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\TemplateGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TemplateGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string)$request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string)$response->getBody() + ); + } + + $returnType = '\Dropbox\Sign\Model\TemplateGetResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders(), + ]; + } catch (ApiException $e) { + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\TemplateGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation templateUpdateAsync + * + * Edit Template + * + * @param string $template_id The ID of the template to update. (required) + * @param Model\TemplateUpdateRequest $template_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateUpdate'] to see the possible values for this operation + * + * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateUpdate. This method will eventually become unavailable + */ + public function templateUpdateAsync(string $template_id, Model\TemplateUpdateRequest $template_update_request, string $contentType = self::contentTypes['templateUpdate'][0]) + { + return $this->templateUpdateAsyncWithHttpInfo($template_id, $template_update_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation templateUpdateAsyncWithHttpInfo + * + * Edit Template + * + * @param string $template_id The ID of the template to update. (required) + * @param Model\TemplateUpdateRequest $template_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateUpdate'] to see the possible values for this operation + * + * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateUpdate. This method will eventually become unavailable + */ + public function templateUpdateAsyncWithHttpInfo(string $template_id, Model\TemplateUpdateRequest $template_update_request, string $contentType = self::contentTypes['templateUpdate'][0]) + { + $returnType = '\Dropbox\Sign\Model\TemplateGetResponse'; + $request = $this->templateUpdateRequest($template_id, $template_update_request, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders(), + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string)$response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'templateUpdate' + * + * @param string $template_id The ID of the template to update. (required) + * @param Model\TemplateUpdateRequest $template_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateUpdate'] to see the possible values for this operation + * + * @return Request + * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateUpdate. This method will eventually become unavailable + */ + public function templateUpdateRequest(string $template_id, Model\TemplateUpdateRequest $template_update_request, string $contentType = self::contentTypes['templateUpdate'][0]) + { + // verify the required parameter 'template_id' is set + if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $template_id when calling templateUpdate' + ); + } + + // verify the required parameter 'template_update_request' is set + if ($template_update_request === null || (is_array($template_update_request) && count($template_update_request) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $template_update_request when calling templateUpdate' + ); + } + + $resourcePath = '/template/update/{template_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + $formParams = ObjectSerializer::getFormParams( + $template_update_request + ); + + $multipart = !empty($formParams); + + // path params + if ($template_id !== null) { + $resourcePath = str_replace( + '{template_id}', + ObjectSerializer::toPathValue($template_id), + $resourcePath + ); + } + + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['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_request)); + } else { + $httpBody = $template_update_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem, + ]; + } + } + // 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_request); + } + $httpBody = new MultipartStream($multipartContents); + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername())) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ':'); + } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation templateUpdateFiles * diff --git a/sdks/php/src/Model/TemplateEditResponse.php b/sdks/php/src/Model/TemplateUpdateRequest.php similarity index 60% rename from sdks/php/src/Model/TemplateEditResponse.php rename to sdks/php/src/Model/TemplateUpdateRequest.php index 625024594..49f28c0ec 100644 --- a/sdks/php/src/Model/TemplateEditResponse.php +++ b/sdks/php/src/Model/TemplateUpdateRequest.php @@ -1,6 +1,6 @@ */ -class TemplateEditResponse implements ModelInterface, ArrayAccess, JsonSerializable +class TemplateUpdateRequest implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class TemplateEditResponse implements ModelInterface, ArrayAccess, JsonSerializa * * @var string */ - protected static $openAPIModelName = 'TemplateEditResponse'; + protected static $openAPIModelName = 'TemplateUpdateRequest'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,11 @@ class TemplateEditResponse implements ModelInterface, ArrayAccess, JsonSerializa * @var string[] */ protected static $openAPITypes = [ - 'template_id' => 'string', + 'cc_roles' => 'string[]', + 'allow_form_view' => 'bool', + 'title' => 'string', + 'subject' => 'string', + 'message' => 'string', ]; /** @@ -68,7 +72,11 @@ class TemplateEditResponse implements ModelInterface, ArrayAccess, JsonSerializa * @psalm-var array */ protected static $openAPIFormats = [ - 'template_id' => null, + 'cc_roles' => null, + 'allow_form_view' => null, + 'title' => null, + 'subject' => null, + 'message' => null, ]; /** @@ -77,7 +85,11 @@ class TemplateEditResponse implements ModelInterface, ArrayAccess, JsonSerializa * @var bool[] */ protected static array $openAPINullables = [ - 'template_id' => false, + 'cc_roles' => false, + 'allow_form_view' => false, + 'title' => false, + 'subject' => false, + 'message' => false, ]; /** @@ -158,7 +170,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'template_id' => 'template_id', + 'cc_roles' => 'cc_roles', + 'allow_form_view' => 'allow_form_view', + 'title' => 'title', + 'subject' => 'subject', + 'message' => 'message', ]; /** @@ -167,7 +183,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'template_id' => 'setTemplateId', + 'cc_roles' => 'setCcRoles', + 'allow_form_view' => 'setAllowFormView', + 'title' => 'setTitle', + 'subject' => 'setSubject', + 'message' => 'setMessage', ]; /** @@ -176,7 +196,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'template_id' => 'getTemplateId', + 'cc_roles' => 'getCcRoles', + 'allow_form_view' => 'getAllowFormView', + 'title' => 'getTitle', + 'subject' => 'getSubject', + 'message' => 'getMessage', ]; /** @@ -235,13 +259,17 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('template_id', $data ?? [], null); + $this->setIfExists('cc_roles', $data ?? [], null); + $this->setIfExists('allow_form_view', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); } /** * @deprecated use ::init() */ - public static function fromArray(array $data): TemplateEditResponse + public static function fromArray(array $data): TemplateUpdateRequest { return self::init($data); } @@ -249,12 +277,12 @@ public static function fromArray(array $data): TemplateEditResponse /** * Attempt to instantiate and hydrate a new instance of this class */ - public static function init(array $data): TemplateEditResponse + public static function init(array $data): TemplateUpdateRequest { - /** @var TemplateEditResponse */ + /** @var TemplateUpdateRequest */ return ObjectSerializer::deserialize( $data, - TemplateEditResponse::class, + TemplateUpdateRequest::class, ); } @@ -283,9 +311,14 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['template_id'] === null) { - $invalidProperties[] = "'template_id' can't be null"; + if (!is_null($this->container['subject']) && (mb_strlen($this->container['subject']) > 200)) { + $invalidProperties[] = "invalid value for 'subject', the character length must be smaller than or equal to 200."; } + + if (!is_null($this->container['message']) && (mb_strlen($this->container['message']) > 5000)) { + $invalidProperties[] = "invalid value for 'message', the character length must be smaller than or equal to 5000."; + } + return $invalidProperties; } @@ -301,28 +334,144 @@ public function valid() } /** - * Gets template_id + * Gets cc_roles * - * @return string + * @return string[]|null + */ + public function getCcRoles() + { + return $this->container['cc_roles']; + } + + /** + * Sets cc_roles + * + * @param string[]|null $cc_roles the CC roles that must be assigned when using the template to send a signature request + * + * @return self + */ + public function setCcRoles(?array $cc_roles) + { + if (is_null($cc_roles)) { + throw new InvalidArgumentException('non-nullable cc_roles cannot be null'); + } + $this->container['cc_roles'] = $cc_roles; + + return $this; + } + + /** + * Gets allow_form_view + * + * @return bool|null + */ + public function getAllowFormView() + { + return $this->container['allow_form_view']; + } + + /** + * Sets allow_form_view + * + * @param bool|null $allow_form_view The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names. + * + * @return self + */ + public function setAllowFormView(?bool $allow_form_view) + { + if (is_null($allow_form_view)) { + throw new InvalidArgumentException('non-nullable allow_form_view cannot be null'); + } + $this->container['allow_form_view'] = $allow_form_view; + + return $this; + } + + /** + * Gets title + * + * @return string|null */ - public function getTemplateId() + public function getTitle() { - return $this->container['template_id']; + return $this->container['title']; } /** - * Sets template_id + * Sets title * - * @param string $template_id the id of the Template + * @param string|null $title the title you want to assign to the SignatureRequest * * @return self */ - public function setTemplateId(string $template_id) + public function setTitle(?string $title) { - if (is_null($template_id)) { - throw new InvalidArgumentException('non-nullable template_id cannot be null'); + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); } - $this->container['template_id'] = $template_id; + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject the new default template email subject + * + * @return self + */ + public function setSubject(?string $subject) + { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + if (mb_strlen($subject) > 200) { + throw new InvalidArgumentException('invalid length for $subject when calling TemplateUpdateRequest., must be smaller than or equal to 200.'); + } + + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message the new default template email message + * + * @return self + */ + public function setMessage(?string $message) + { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + if (mb_strlen($message) > 5000) { + throw new InvalidArgumentException('invalid length for $message when calling TemplateUpdateRequest., must be smaller than or equal to 5000.'); + } + + $this->container['message'] = $message; return $this; } diff --git a/sdks/python/README.md b/sdks/python/README.md index 5c2d67154..16360a95f 100644 --- a/sdks/python/README.md +++ b/sdks/python/README.md @@ -171,6 +171,7 @@ Class | Method | HTTP request | Description ```TemplateApi``` | [```template_get```](docs/TemplateApi.md#template_get) | ```GET /template/{template_id}``` | Get Template| ```TemplateApi``` | [```template_list```](docs/TemplateApi.md#template_list) | ```GET /template/list``` | List Templates| ```TemplateApi``` | [```template_remove_user```](docs/TemplateApi.md#template_remove_user) | ```POST /template/remove_user/{template_id}``` | Remove User from Template| +```TemplateApi``` | [```template_update```](docs/TemplateApi.md#template_update) | ```POST /template/update/{template_id}``` | Edit Template| ```TemplateApi``` | [```template_update_files```](docs/TemplateApi.md#template_update_files) | ```POST /template/update_files/{template_id}``` | Update Template Files| |```UnclaimedDraftApi``` | [```unclaimed_draft_create```](docs/UnclaimedDraftApi.md#unclaimed_draft_create) | ```POST /unclaimed_draft/create``` | Create Unclaimed Draft| ```UnclaimedDraftApi``` | [```unclaimed_draft_create_embedded```](docs/UnclaimedDraftApi.md#unclaimed_draft_create_embedded) | ```POST /unclaimed_draft/create_embedded``` | Create Embedded Unclaimed Draft| @@ -328,7 +329,6 @@ Class | Method | HTTP request | Description - [TemplateCreateRequest](docs/TemplateCreateRequest.md) - [TemplateCreateResponse](docs/TemplateCreateResponse.md) - [TemplateCreateResponseTemplate](docs/TemplateCreateResponseTemplate.md) - - [TemplateEditResponse](docs/TemplateEditResponse.md) - [TemplateGetResponse](docs/TemplateGetResponse.md) - [TemplateListResponse](docs/TemplateListResponse.md) - [TemplateRemoveUserRequest](docs/TemplateRemoveUserRequest.md) @@ -365,6 +365,7 @@ Class | Method | HTTP request | Description - [TemplateUpdateFilesRequest](docs/TemplateUpdateFilesRequest.md) - [TemplateUpdateFilesResponse](docs/TemplateUpdateFilesResponse.md) - [TemplateUpdateFilesResponseTemplate](docs/TemplateUpdateFilesResponseTemplate.md) + - [TemplateUpdateRequest](docs/TemplateUpdateRequest.md) - [UnclaimedDraftCreateEmbeddedRequest](docs/UnclaimedDraftCreateEmbeddedRequest.md) - [UnclaimedDraftCreateEmbeddedWithTemplateRequest](docs/UnclaimedDraftCreateEmbeddedWithTemplateRequest.md) - [UnclaimedDraftCreateRequest](docs/UnclaimedDraftCreateRequest.md) diff --git a/sdks/python/docs/TemplateApi.md b/sdks/python/docs/TemplateApi.md index 5ff5a44c8..fb39b718e 100644 --- a/sdks/python/docs/TemplateApi.md +++ b/sdks/python/docs/TemplateApi.md @@ -14,6 +14,7 @@ Method | HTTP request | Description |[```template_get```](TemplateApi.md#template_get) | ```GET /template/{template_id}``` | Get Template| |[```template_list```](TemplateApi.md#template_list) | ```GET /template/list``` | List Templates| |[```template_remove_user```](TemplateApi.md#template_remove_user) | ```POST /template/remove_user/{template_id}``` | Remove User from Template| +|[```template_update```](TemplateApi.md#template_update) | ```POST /template/update/{template_id}``` | Edit Template| |[```template_update_files```](TemplateApi.md#template_update_files) | ```POST /template/update_files/{template_id}``` | Update Template Files| @@ -823,6 +824,83 @@ with ApiClient(configuration) as api_client: [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# ```template_update``` +> ```TemplateGetResponse template_update(template_id, template_update_request)``` + +Edit Template + +Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + +### Example + +* Basic Authentication (api_key): +* Bearer (JWT) Authentication (oauth2): + +```python +import json +from datetime import date, datetime +from pprint import pprint + +from dropbox_sign import ApiClient, ApiException, Configuration, api, models + +configuration = Configuration( + username="YOUR_API_KEY", + # access_token="YOUR_ACCESS_TOKEN", +) + +with ApiClient(configuration) as api_client: + template_update_request = models.TemplateUpdateRequest( + allow_form_view=False, + title="Test Title", + subject="Test Subject", + message="Test Message", + cc_roles=[ + "CC Role 1", + "CC Role 2", + ], + ) + + try: + response = api.TemplateApi(api_client).template_update( + template_id="f57db65d3f933b5316d398057a36176831451a35", + template_update_request=template_update_request, + ) + + pprint(response) + except ApiException as e: + print("Exception when calling TemplateApi#template_update: %s\n" % e) + +``` +``` + +### Parameters +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| `template_id` | **str** | The ID of the template to update. | | +| `template_update_request` | [**TemplateUpdateRequest**](TemplateUpdateRequest.md) | | | + +### Return type + +[**TemplateGetResponse**](TemplateGetResponse.md) + +### Authorization + +[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json, multipart/form-data + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
| +**4XX** | failed_operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # ```template_update_files``` > ```TemplateUpdateFilesResponse template_update_files(template_id, template_update_files_request)``` diff --git a/sdks/python/docs/TemplateEditResponse.md b/sdks/python/docs/TemplateEditResponse.md deleted file mode 100644 index 2384cb094..000000000 --- a/sdks/python/docs/TemplateEditResponse.md +++ /dev/null @@ -1,12 +0,0 @@ -# TemplateEditResponse - - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `template_id`*_required_ | ```str``` | The id of the Template. | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/sdks/python/docs/TemplateUpdateRequest.md b/sdks/python/docs/TemplateUpdateRequest.md new file mode 100644 index 000000000..e12fa3274 --- /dev/null +++ b/sdks/python/docs/TemplateUpdateRequest.md @@ -0,0 +1,16 @@ +# TemplateUpdateRequest + + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +| `cc_roles` | ```List[str]``` | The CC roles that must be assigned when using the template to send a signature request. | | +| `allow_form_view` | ```bool``` | The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names. | | +| `title` | ```str``` | The title you want to assign to the SignatureRequest. | | +| `subject` | ```str``` | The new default template email subject. | | +| `message` | ```str``` | The new default template email message. | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/sdks/python/dropbox_sign/__init__.py b/sdks/python/dropbox_sign/__init__.py index 82a36a10d..68fc1be94 100644 --- a/sdks/python/dropbox_sign/__init__.py +++ b/sdks/python/dropbox_sign/__init__.py @@ -306,7 +306,6 @@ from dropbox_sign.models.template_create_response_template import ( TemplateCreateResponseTemplate, ) -from dropbox_sign.models.template_edit_response import TemplateEditResponse from dropbox_sign.models.template_get_response import TemplateGetResponse from dropbox_sign.models.template_list_response import TemplateListResponse from dropbox_sign.models.template_remove_user_request import TemplateRemoveUserRequest @@ -397,6 +396,7 @@ from dropbox_sign.models.template_update_files_response_template import ( TemplateUpdateFilesResponseTemplate, ) +from dropbox_sign.models.template_update_request import TemplateUpdateRequest from dropbox_sign.models.unclaimed_draft_create_embedded_request import ( UnclaimedDraftCreateEmbeddedRequest, ) diff --git a/sdks/python/dropbox_sign/api/template_api.py b/sdks/python/dropbox_sign/api/template_api.py index 3205675ea..8a43a9da1 100644 --- a/sdks/python/dropbox_sign/api/template_api.py +++ b/sdks/python/dropbox_sign/api/template_api.py @@ -38,6 +38,7 @@ from dropbox_sign.models.template_update_files_response import ( TemplateUpdateFilesResponse, ) +from dropbox_sign.models.template_update_request import TemplateUpdateRequest from dropbox_sign.api_client import ApiClient, RequestSerialized from dropbox_sign.api_response import ApiResponse @@ -2896,6 +2897,304 @@ def _template_remove_user_serialize( _request_auth=_request_auth, ) + @validate_call + def template_update( + self, + template_id: Annotated[ + StrictStr, Field(description="The ID of the template to update.") + ], + template_update_request: TemplateUpdateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> TemplateGetResponse: + """Edit Template + + Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + + :param template_id: The ID of the template to update. (required) + :type template_id: str + :param template_update_request: (required) + :type template_update_request: TemplateUpdateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._template_update_serialize( + template_id=template_id, + template_update_request=template_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "TemplateGetResponse", + "4XX": "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def template_update_with_http_info( + self, + template_id: Annotated[ + StrictStr, Field(description="The ID of the template to update.") + ], + template_update_request: TemplateUpdateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[TemplateGetResponse]: + """Edit Template + + Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + + :param template_id: The ID of the template to update. (required) + :type template_id: str + :param template_update_request: (required) + :type template_update_request: TemplateUpdateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._template_update_serialize( + template_id=template_id, + template_update_request=template_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "TemplateGetResponse", + "4XX": "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def template_update_without_preload_content( + self, + template_id: Annotated[ + StrictStr, Field(description="The ID of the template to update.") + ], + template_update_request: TemplateUpdateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Edit Template + + Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + + :param template_id: The ID of the template to update. (required) + :type template_id: str + :param template_update_request: (required) + :type template_update_request: TemplateUpdateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._template_update_serialize( + template_id=template_id, + template_update_request=template_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "TemplateGetResponse", + "4XX": "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _template_update_serialize( + self, + template_id, + template_update_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + has_files = False + body_param = template_update_request + excluded_json_fields = set([]) + for param_name, param_type in body_param.openapi_types().items(): + param_value = getattr(body_param, param_name) + if param_value is None: + continue + + if "io.IOBase" in param_type: + has_files = True + _content_type = "multipart/form-data" + excluded_json_fields.add(param_name) + + if isinstance(param_value, list): + for index, item in enumerate(param_value): + _files[f"{param_name}[{index}]"] = item + else: + _files[param_name] = param_value + + if has_files is True: + _form_params = body_param.to_json_form_params(excluded_json_fields) + + # process the path parameters + if template_id is not None: + _path_params["template_id"] = template_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if template_update_request is not None and has_files is False: + _body_params = template_update_request + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json", "multipart/form-data"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = ["api_key", "oauth2"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/template/update/{template_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + @validate_call def template_update_files( self, diff --git a/sdks/python/dropbox_sign/models/__init__.py b/sdks/python/dropbox_sign/models/__init__.py index fd5331ae1..b4e421f19 100644 --- a/sdks/python/dropbox_sign/models/__init__.py +++ b/sdks/python/dropbox_sign/models/__init__.py @@ -289,7 +289,6 @@ from dropbox_sign.models.template_create_response_template import ( TemplateCreateResponseTemplate, ) -from dropbox_sign.models.template_edit_response import TemplateEditResponse from dropbox_sign.models.template_get_response import TemplateGetResponse from dropbox_sign.models.template_list_response import TemplateListResponse from dropbox_sign.models.template_remove_user_request import TemplateRemoveUserRequest @@ -380,6 +379,7 @@ from dropbox_sign.models.template_update_files_response_template import ( TemplateUpdateFilesResponseTemplate, ) +from dropbox_sign.models.template_update_request import TemplateUpdateRequest from dropbox_sign.models.unclaimed_draft_create_embedded_request import ( UnclaimedDraftCreateEmbeddedRequest, ) diff --git a/sdks/python/dropbox_sign/models/template_edit_response.py b/sdks/python/dropbox_sign/models/template_update_request.py similarity index 58% rename from sdks/python/dropbox_sign/models/template_edit_response.py rename to sdks/python/dropbox_sign/models/template_update_request.py index 198813848..3941b9fe0 100644 --- a/sdks/python/dropbox_sign/models/template_edit_response.py +++ b/sdks/python/dropbox_sign/models/template_update_request.py @@ -18,8 +18,9 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing import Any, ClassVar, Dict, List +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self from typing import Tuple, Union @@ -27,13 +28,36 @@ from pydantic import StrictBool -class TemplateEditResponse(BaseModel): +class TemplateUpdateRequest(BaseModel): """ - TemplateEditResponse + TemplateUpdateRequest """ # noqa: E501 - template_id: StrictStr = Field(description="The id of the Template.") - __properties: ClassVar[List[str]] = ["template_id"] + cc_roles: Optional[List[StrictStr]] = Field( + default=None, + description="The CC roles that must be assigned when using the template to send a signature request.", + ) + allow_form_view: Optional[StrictBool] = Field( + default=None, + description="The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names.", + ) + title: Optional[StrictStr] = Field( + default=None, + description="The title you want to assign to the SignatureRequest.", + ) + subject: Optional[Annotated[str, Field(strict=True, max_length=200)]] = Field( + default=None, description="The new default template email subject." + ) + message: Optional[Annotated[str, Field(strict=True, max_length=5000)]] = Field( + default=None, description="The new default template email message." + ) + __properties: ClassVar[List[str]] = [ + "cc_roles", + "allow_form_view", + "title", + "subject", + "message", + ] model_config = ConfigDict( populate_by_name=True, @@ -66,7 +90,7 @@ def to_json_form_params( @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of TemplateEditResponse from a JSON string""" + """Create an instance of TemplateUpdateRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self, excluded_fields: Set[str] = None) -> Dict[str, Any]: @@ -89,14 +113,22 @@ def to_dict(self, excluded_fields: Set[str] = None) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of TemplateEditResponse from a dict""" + """Create an instance of TemplateUpdateRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate({"template_id": obj.get("template_id")}) + _obj = cls.model_validate( + { + "cc_roles": obj.get("cc_roles"), + "allow_form_view": obj.get("allow_form_view"), + "title": obj.get("title"), + "subject": obj.get("subject"), + "message": obj.get("message"), + } + ) return _obj @classmethod @@ -112,9 +144,15 @@ def init(cls, data: Any) -> Self: @classmethod def openapi_types(cls) -> Dict[str, str]: return { - "template_id": "(str,)", + "cc_roles": "(List[str],)", + "allow_form_view": "(bool,)", + "title": "(str,)", + "subject": "(str,)", + "message": "(str,)", } @classmethod def openapi_type_is_array(cls, property_name: str) -> bool: - return property_name in [] + return property_name in [ + "cc_roles", + ] diff --git a/sdks/ruby/README.md b/sdks/ruby/README.md index 2e973be17..62186f8fa 100644 --- a/sdks/ruby/README.md +++ b/sdks/ruby/README.md @@ -175,6 +175,7 @@ All URIs are relative to *https://api.hellosign.com/v3* |*Dropbox::Sign::TemplateApi* | [**template_get**](docs/TemplateApi.md#template_get) | **GET** /template/{template_id} | Get Template | |*Dropbox::Sign::TemplateApi* | [**template_list**](docs/TemplateApi.md#template_list) | **GET** /template/list | List Templates | |*Dropbox::Sign::TemplateApi* | [**template_remove_user**](docs/TemplateApi.md#template_remove_user) | **POST** /template/remove_user/{template_id} | Remove User from Template | +|*Dropbox::Sign::TemplateApi* | [**template_update**](docs/TemplateApi.md#template_update) | **POST** /template/update/{template_id} | Edit Template | |*Dropbox::Sign::TemplateApi* | [**template_update_files**](docs/TemplateApi.md#template_update_files) | **POST** /template/update_files/{template_id} | Update Template Files | |*Dropbox::Sign::UnclaimedDraftApi* | [**unclaimed_draft_create**](docs/UnclaimedDraftApi.md#unclaimed_draft_create) | **POST** /unclaimed_draft/create | Create Unclaimed Draft | |*Dropbox::Sign::UnclaimedDraftApi* | [**unclaimed_draft_create_embedded**](docs/UnclaimedDraftApi.md#unclaimed_draft_create_embedded) | **POST** /unclaimed_draft/create_embedded | Create Embedded Unclaimed Draft | @@ -332,7 +333,6 @@ All URIs are relative to *https://api.hellosign.com/v3* - [Dropbox::Sign::TemplateCreateRequest](docs/TemplateCreateRequest.md) - [Dropbox::Sign::TemplateCreateResponse](docs/TemplateCreateResponse.md) - [Dropbox::Sign::TemplateCreateResponseTemplate](docs/TemplateCreateResponseTemplate.md) - - [Dropbox::Sign::TemplateEditResponse](docs/TemplateEditResponse.md) - [Dropbox::Sign::TemplateGetResponse](docs/TemplateGetResponse.md) - [Dropbox::Sign::TemplateListResponse](docs/TemplateListResponse.md) - [Dropbox::Sign::TemplateRemoveUserRequest](docs/TemplateRemoveUserRequest.md) @@ -369,6 +369,7 @@ All URIs are relative to *https://api.hellosign.com/v3* - [Dropbox::Sign::TemplateUpdateFilesRequest](docs/TemplateUpdateFilesRequest.md) - [Dropbox::Sign::TemplateUpdateFilesResponse](docs/TemplateUpdateFilesResponse.md) - [Dropbox::Sign::TemplateUpdateFilesResponseTemplate](docs/TemplateUpdateFilesResponseTemplate.md) + - [Dropbox::Sign::TemplateUpdateRequest](docs/TemplateUpdateRequest.md) - [Dropbox::Sign::UnclaimedDraftCreateEmbeddedRequest](docs/UnclaimedDraftCreateEmbeddedRequest.md) - [Dropbox::Sign::UnclaimedDraftCreateEmbeddedWithTemplateRequest](docs/UnclaimedDraftCreateEmbeddedWithTemplateRequest.md) - [Dropbox::Sign::UnclaimedDraftCreateRequest](docs/UnclaimedDraftCreateRequest.md) diff --git a/sdks/ruby/docs/TemplateApi.md b/sdks/ruby/docs/TemplateApi.md index 315ced97c..e59532feb 100644 --- a/sdks/ruby/docs/TemplateApi.md +++ b/sdks/ruby/docs/TemplateApi.md @@ -14,6 +14,7 @@ All URIs are relative to *https://api.hellosign.com/v3* | [`template_get`](TemplateApi.md#template_get) | **GET** `/template/{template_id}` | Get Template | | [`template_list`](TemplateApi.md#template_list) | **GET** `/template/list` | List Templates | | [`template_remove_user`](TemplateApi.md#template_remove_user) | **POST** `/template/remove_user/{template_id}` | Remove User from Template | +| [`template_update`](TemplateApi.md#template_update) | **POST** `/template/update/{template_id}` | Edit Template | | [`template_update_files`](TemplateApi.md#template_update_files) | **POST** `/template/update_files/{template_id}` | Update Template Files | @@ -852,6 +853,87 @@ end - **Accept**: application/json +## `template_update` + +> ` template_update(template_id, template_update_request)` + +Edit Template + +Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + +### Examples + +```ruby +require "json" +require "dropbox-sign" + +Dropbox::Sign.configure do |config| + config.username = "YOUR_API_KEY" + # config.access_token = "YOUR_ACCESS_TOKEN" +end + +template_update_request = Dropbox::Sign::TemplateUpdateRequest.new +template_update_request.allow_form_view = false +template_update_request.title = "Test Title" +template_update_request.subject = "Test Subject" +template_update_request.message = "Test Message" +template_update_request.cc_roles = [ + "CC Role 1", + "CC Role 2", +] + +begin + response = Dropbox::Sign::TemplateApi.new.template_update( + "f57db65d3f933b5316d398057a36176831451a35", # template_id + template_update_request, + ) + + p response +rescue Dropbox::Sign::ApiError => e + puts "Exception when calling TemplateApi#template_update: #{e}" +end + +``` + +#### Using the `template_update_with_http_info` variant + +This returns an Array which contains the response data, status code and headers. + +> `, Integer, Hash)> template_update_with_http_info(template_id, template_update_request)` + +```ruby +begin + # Edit Template + data, status_code, headers = api_instance.template_update_with_http_info(template_id, template_update_request) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Dropbox::Sign::ApiError => e + puts "Error when calling TemplateApi->template_update_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| `template_id` | **String** | The ID of the template to update. | | +| `template_update_request` | [**TemplateUpdateRequest**](TemplateUpdateRequest.md) | | | + +### Return type + +[**TemplateGetResponse**](TemplateGetResponse.md) + +### Authorization + +[api_key](../README.md#api_key), [oauth2](../README.md#oauth2) + +### HTTP request headers + +- **Content-Type**: application/json, multipart/form-data +- **Accept**: application/json + + ## `template_update_files` > ` template_update_files(template_id, template_update_files_request)` diff --git a/sdks/ruby/docs/TemplateEditResponse.md b/sdks/ruby/docs/TemplateEditResponse.md deleted file mode 100644 index 5b46080d2..000000000 --- a/sdks/ruby/docs/TemplateEditResponse.md +++ /dev/null @@ -1,10 +0,0 @@ -# Dropbox::Sign::TemplateEditResponse - - - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| `template_id`*_required_ | ```String``` | The id of the Template. | | - diff --git a/sdks/ruby/docs/TemplateUpdateRequest.md b/sdks/ruby/docs/TemplateUpdateRequest.md new file mode 100644 index 000000000..b17d48fc6 --- /dev/null +++ b/sdks/ruby/docs/TemplateUpdateRequest.md @@ -0,0 +1,14 @@ +# Dropbox::Sign::TemplateUpdateRequest + + + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| `cc_roles` | ```Array``` | The CC roles that must be assigned when using the template to send a signature request. | | +| `allow_form_view` | ```Boolean``` | The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names. | | +| `title` | ```String``` | The title you want to assign to the SignatureRequest. | | +| `subject` | ```String``` | The new default template email subject. | | +| `message` | ```String``` | The new default template email message. | | + diff --git a/sdks/ruby/lib/dropbox-sign.rb b/sdks/ruby/lib/dropbox-sign.rb index 413c293c8..06035409a 100644 --- a/sdks/ruby/lib/dropbox-sign.rb +++ b/sdks/ruby/lib/dropbox-sign.rb @@ -144,7 +144,6 @@ require 'dropbox-sign/models/template_create_request' require 'dropbox-sign/models/template_create_response' require 'dropbox-sign/models/template_create_response_template' -require 'dropbox-sign/models/template_edit_response' require 'dropbox-sign/models/template_get_response' require 'dropbox-sign/models/template_list_response' require 'dropbox-sign/models/template_remove_user_request' @@ -163,6 +162,7 @@ require 'dropbox-sign/models/template_update_files_request' require 'dropbox-sign/models/template_update_files_response' require 'dropbox-sign/models/template_update_files_response_template' +require 'dropbox-sign/models/template_update_request' require 'dropbox-sign/models/unclaimed_draft_create_embedded_request' require 'dropbox-sign/models/unclaimed_draft_create_embedded_with_template_request' require 'dropbox-sign/models/unclaimed_draft_create_request' diff --git a/sdks/ruby/lib/dropbox-sign/api/template_api.rb b/sdks/ruby/lib/dropbox-sign/api/template_api.rb index 4620ab332..56957782a 100644 --- a/sdks/ruby/lib/dropbox-sign/api/template_api.rb +++ b/sdks/ruby/lib/dropbox-sign/api/template_api.rb @@ -1031,6 +1031,121 @@ def template_remove_user_with_http_info(template_id, template_remove_user_reques return data, status_code, headers end + # Edit Template + # Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + # @param template_id [String] The ID of the template to update. + # @param template_update_request [TemplateUpdateRequest] + # @param [Hash] opts the optional parameters + # @return [TemplateGetResponse] + def template_update(template_id, template_update_request, opts = {}) + data, _status_code, _headers = template_update_with_http_info(template_id, template_update_request, opts) + data + end + + # Edit Template + # Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. + # @param template_id [String] The ID of the template to update. + # @param template_update_request [TemplateUpdateRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(TemplateGetResponse, Integer, Hash)>] TemplateGetResponse data, response status code and response headers + def template_update_with_http_info(template_id, template_update_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TemplateApi.template_update ...' + end + # verify the required parameter 'template_id' is set + if @api_client.config.client_side_validation && template_id.nil? + fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplateApi.template_update" + end + # verify the required parameter 'template_update_request' is set + if @api_client.config.client_side_validation && template_update_request.nil? + fail ArgumentError, "Missing the required parameter 'template_update_request' when calling TemplateApi.template_update" + end + # resource path + local_var_path = '/template/update/{template_id}'.sub('{' + 'template_id' + '}', CGI.escape(template_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json', 'multipart/form-data']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + post_body = {} + form_params = opts[:form_params] || {} + result = @api_client.generate_form_data( + template_update_request, + Dropbox::Sign::TemplateUpdateRequest.openapi_types + ) + + # form parameters + if result[:has_file] + form_params = opts[:form_params] || result[:params] + header_params['Content-Type'] = 'multipart/form-data' + else + # http body (model) + post_body = opts[:debug_body] || result[:params] + end + + # return_type + return_type = opts[:debug_return_type] || 'TemplateGetResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['api_key', 'oauth2'] + + new_options = opts.merge( + :operation => :"TemplateApi.template_update", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + begin + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + rescue Dropbox::Sign::ApiError => e + if e.code === 200 + body = @api_client.convert_to_type( + JSON.parse("[#{e.response_body}]", :symbolize_names => true)[0], + "Dropbox::Sign::TemplateGetResponse" + ) + + fail ApiError.new(:code => e.code, + :response_headers => e.response_headers, + :response_body => body), + e.message + end + + range_code = "4XX".split('').first + range_code_left = "#{range_code}00".to_i + range_code_right = "#{range_code}99".to_i + if e.code >= range_code_left && e.code <= range_code_right + body = @api_client.convert_to_type( + JSON.parse("[#{e.response_body}]", :symbolize_names => true)[0], + "Dropbox::Sign::ErrorResponse" + ) + + fail ApiError.new(:code => e.code, + :response_headers => e.response_headers, + :response_body => body), + e.message + end + + end + + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TemplateApi#template_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update Template Files # Overlays a new file with the overlay of an existing template. The new file(s) must: 1. have the same or higher page count 2. the same orientation as the file(s) being replaced. This will not overwrite or in any way affect the existing template. Both the existing template and new template will be available for use after executing this endpoint. Also note that this will decrement your template quota. Overlaying new files is asynchronous and a successful call to this endpoint will return 200 OK response if the request passes initial validation checks. It is recommended that a callback be implemented to listen for the callback event. A `template_created` event will be sent when the files are updated or a `template_error` event will be sent if there was a problem while updating the files. If a callback handler has been configured and the event has not been received within 60 minutes of making the call, check the status of the request in the API dashboard and retry the request if necessary. If the page orientation or page count is different from the original template document, we will notify you with a `template_error` [callback event](https://app.hellosign.com/api/eventsAndCallbacksWalkthrough). # @param template_id [String] The ID of the template whose files to update. diff --git a/sdks/ruby/lib/dropbox-sign/models/template_edit_response.rb b/sdks/ruby/lib/dropbox-sign/models/template_update_request.rb similarity index 67% rename from sdks/ruby/lib/dropbox-sign/models/template_edit_response.rb rename to sdks/ruby/lib/dropbox-sign/models/template_update_request.rb index 9a4996745..66f9b8408 100644 --- a/sdks/ruby/lib/dropbox-sign/models/template_edit_response.rb +++ b/sdks/ruby/lib/dropbox-sign/models/template_update_request.rb @@ -17,15 +17,35 @@ module Dropbox end module Dropbox::Sign - class TemplateEditResponse - # The id of the Template. + class TemplateUpdateRequest + # The CC roles that must be assigned when using the template to send a signature request. + # @return [Array] + attr_accessor :cc_roles + + # The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names. + # @return [Boolean] + attr_accessor :allow_form_view + + # The title you want to assign to the SignatureRequest. + # @return [String] + attr_accessor :title + + # The new default template email subject. + # @return [String] + attr_accessor :subject + + # The new default template email message. # @return [String] - attr_accessor :template_id + attr_accessor :message # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'template_id' => :'template_id' + :'cc_roles' => :'cc_roles', + :'allow_form_view' => :'allow_form_view', + :'title' => :'title', + :'subject' => :'subject', + :'message' => :'message' } end @@ -42,7 +62,11 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'template_id' => :'String' + :'cc_roles' => :'Array', + :'allow_form_view' => :'Boolean', + :'title' => :'String', + :'subject' => :'String', + :'message' => :'String' } end @@ -69,32 +93,50 @@ def self.merged_nullable # Attempt to instantiate and hydrate a new instance of this class # @param [Object] data Data to be converted - # @return [TemplateEditResponse] + # @return [TemplateUpdateRequest] def self.init(data) ApiClient.default.convert_to_type( data, - "TemplateEditResponse" - ) || TemplateEditResponse.new + "TemplateUpdateRequest" + ) || TemplateUpdateRequest.new end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `Dropbox::Sign::TemplateEditResponse` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `Dropbox::Sign::TemplateUpdateRequest` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.merged_attributes.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Dropbox::Sign::TemplateEditResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `Dropbox::Sign::TemplateUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } - if attributes.key?(:'template_id') - self.template_id = attributes[:'template_id'] + if attributes.key?(:'cc_roles') + if (value = attributes[:'cc_roles']).is_a?(Array) + self.cc_roles = value + end + end + + if attributes.key?(:'allow_form_view') + self.allow_form_view = attributes[:'allow_form_view'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'subject') + self.subject = attributes[:'subject'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] end end @@ -102,8 +144,12 @@ def initialize(attributes = {}) # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new - if @template_id.nil? - invalid_properties.push('invalid value for "template_id", template_id cannot be nil.') + if !@subject.nil? && @subject.to_s.length > 200 + invalid_properties.push('invalid value for "subject", the character length must be smaller than or equal to 200.') + end + + if !@message.nil? && @message.to_s.length > 5000 + invalid_properties.push('invalid value for "message", the character length must be smaller than or equal to 5000.') end invalid_properties @@ -112,18 +158,29 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - return false if @template_id.nil? + return false if !@subject.nil? && @subject.to_s.length > 200 + return false if !@message.nil? && @message.to_s.length > 5000 true end # Custom attribute writer method with validation - # @param [Object] template_id Value to be assigned - def template_id=(template_id) - if template_id.nil? - fail ArgumentError, 'template_id cannot be nil' + # @param [Object] subject Value to be assigned + def subject=(subject) + if subject.to_s.length > 200 + fail ArgumentError, 'invalid value for "subject", the character length must be smaller than or equal to 200.' + end + + @subject = subject + end + + # Custom attribute writer method with validation + # @param [Object] message Value to be assigned + def message=(message) + if message.to_s.length > 5000 + fail ArgumentError, 'invalid value for "message", the character length must be smaller than or equal to 5000.' end - @template_id = template_id + @message = message end # Checks equality by comparing each attribute. @@ -131,7 +188,11 @@ def template_id=(template_id) def ==(o) return true if self.equal?(o) self.class == o.class && - template_id == o.template_id + cc_roles == o.cc_roles && + allow_form_view == o.allow_form_view && + title == o.title && + subject == o.subject && + message == o.message end # @see the `==` method @@ -143,7 +204,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [template_id].hash + [cc_roles, allow_form_view, title, subject, message].hash end # Builds the object from hash diff --git a/test_fixtures/TemplateUpdateRequest.json b/test_fixtures/TemplateUpdateRequest.json new file mode 100644 index 000000000..fb4d2017d --- /dev/null +++ b/test_fixtures/TemplateUpdateRequest.json @@ -0,0 +1,9 @@ +{ + "default": { + "allow_form_view": false, + "title": "Test Title", + "subject": "Test Subject", + "message": "Test Message", + "cc_roles": ["one", "two"] + } +} \ No newline at end of file diff --git a/translations/en.yaml b/translations/en.yaml index 4099e33e9..42f635bef 100644 --- a/translations/en.yaml +++ b/translations/en.yaml @@ -777,6 +777,15 @@ "TemplateRemoveUser::EMAIL_ADDRESS": The id or email address of the Account to remove access to the Template. The account id prevails if both are provided. "TemplateRemoveUser::TEMPLATE_ID": The id of the Template to remove the Account's access to. +"TemplateUpdate::SUMMARY": Edit Template +"TemplateUpdate::DESCRIPTION": Edit template fields. Every field is optional and the endpoint will only change whatever is provided. The fields not included in the request payload will remain unchanged. +"TemplateUpdate::TEMPLATE_ID": The ID of the template to update. +"TemplateUpdate::CC_ROLES": The CC roles that must be assigned when using the template to send a signature request. +"TemplateUpdate::ALLOW_FORM_VIEW": "The CC roles that must be assigned when using the template to send a signature request. If set to `true` all the form fields on template document must have non-empty names." +"TemplateUpdate::TITLE": The title you want to assign to the SignatureRequest. +"TemplateUpdate::SUBJECT": The new default template email subject. +"TemplateUpdate::MESSAGE": The new default template email message. + "TemplateUpdateFiles::SUMMARY": Update Template Files "TemplateUpdateFiles::DESCRIPTION": |- Overlays a new file with the overlay of an existing template. The new file(s) must: @@ -1829,6 +1838,8 @@ "TemplateList::SEO::DESCRIPTION": "The Dropbox Sign API easily allows you to build custom integrations. To find out how to return a list of the Templates that can be accessed by you, click here." "TemplateRemoveUser::SEO::TITLE": "Remove User from Template | REST API | Dropbox Sign for Developers" "TemplateRemoveUser::SEO::DESCRIPTION": "The Dropbox Sign API easily allows you to build custom integrations. To find out how to remove a specified Account's access to a Template, click here." +"TemplateUpdate::SEO::TITLE": "Update Template | REST API | Dropbox Sign for Developers" +"TemplateUpdate::SEO::DESCRIPTION": "The Dropbox Sign API easily allows you to build custom integrations. To find out how to update properties of an existing template, click here." "TemplateUpdateFiles::SEO::TITLE": "Update Template Files | REST API | Dropbox Sign for Developers" "TemplateUpdateFiles::SEO::DESCRIPTION": "Overlays a new file with the overlay of an existing template" "UnclaimedDraftCreate::SEO::TITLE": "Create Unclaimed Draft | REST API | Dropbox Sign for Developers"