diff --git a/.gitignore b/.gitignore index b6717f0..639e150 100644 --- a/.gitignore +++ b/.gitignore @@ -18,12 +18,10 @@ hs_err_pid* **/target target .gradle -build/ +build -.composer -vendor - -# Intellij -.idea/ - -.openapi-generator +/.composer +/vendor +/.idea/ +/.openapi-generator +/.github/workflows/maven.yml diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES deleted file mode 100644 index 9aa2aa6..0000000 --- a/.openapi-generator/FILES +++ /dev/null @@ -1,396 +0,0 @@ -.gitignore -.travis.yml -README.md -VERSION -build.gradle -build.sbt -docs/AccountApi.md -docs/AccountCreateRequest.md -docs/AccountCreateResponse.md -docs/AccountGetResponse.md -docs/AccountResponse.md -docs/AccountResponseQuotas.md -docs/AccountResponseUsage.md -docs/AccountUpdateRequest.md -docs/AccountVerifyRequest.md -docs/AccountVerifyResponse.md -docs/AccountVerifyResponseAccount.md -docs/ApiAppApi.md -docs/ApiAppCreateRequest.md -docs/ApiAppGetResponse.md -docs/ApiAppListResponse.md -docs/ApiAppResponse.md -docs/ApiAppResponseOAuth.md -docs/ApiAppResponseOptions.md -docs/ApiAppResponseOwnerAccount.md -docs/ApiAppResponseWhiteLabelingOptions.md -docs/ApiAppUpdateRequest.md -docs/BulkSendJobApi.md -docs/BulkSendJobGetResponse.md -docs/BulkSendJobGetResponseSignatureRequests.md -docs/BulkSendJobListResponse.md -docs/BulkSendJobResponse.md -docs/BulkSendJobSendResponse.md -docs/EmbeddedApi.md -docs/EmbeddedEditUrlRequest.md -docs/EmbeddedEditUrlResponse.md -docs/EmbeddedEditUrlResponseEmbedded.md -docs/EmbeddedSignUrlResponse.md -docs/EmbeddedSignUrlResponseEmbedded.md -docs/ErrorResponse.md -docs/ErrorResponseError.md -docs/EventCallbackRequest.md -docs/EventCallbackRequestEvent.md -docs/EventCallbackRequestEventMetadata.md -docs/FileResponse.md -docs/FileResponseDataUri.md -docs/ListInfoResponse.md -docs/OAuthApi.md -docs/OAuthTokenGenerateRequest.md -docs/OAuthTokenRefreshRequest.md -docs/OAuthTokenResponse.md -docs/ReportApi.md -docs/ReportCreateRequest.md -docs/ReportCreateResponse.md -docs/ReportResponse.md -docs/SignatureRequestApi.md -docs/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.md -docs/SignatureRequestBulkSendWithTemplateRequest.md -docs/SignatureRequestCreateEmbeddedRequest.md -docs/SignatureRequestCreateEmbeddedWithTemplateRequest.md -docs/SignatureRequestGetResponse.md -docs/SignatureRequestListResponse.md -docs/SignatureRequestRemindRequest.md -docs/SignatureRequestResponse.md -docs/SignatureRequestResponseAttachment.md -docs/SignatureRequestResponseCustomFieldBase.md -docs/SignatureRequestResponseCustomFieldCheckbox.md -docs/SignatureRequestResponseCustomFieldText.md -docs/SignatureRequestResponseCustomFieldTypeEnum.md -docs/SignatureRequestResponseDataBase.md -docs/SignatureRequestResponseDataTypeEnum.md -docs/SignatureRequestResponseDataValueCheckbox.md -docs/SignatureRequestResponseDataValueCheckboxMerge.md -docs/SignatureRequestResponseDataValueDateSigned.md -docs/SignatureRequestResponseDataValueDropdown.md -docs/SignatureRequestResponseDataValueInitials.md -docs/SignatureRequestResponseDataValueRadio.md -docs/SignatureRequestResponseDataValueSignature.md -docs/SignatureRequestResponseDataValueText.md -docs/SignatureRequestResponseDataValueTextMerge.md -docs/SignatureRequestResponseSignatures.md -docs/SignatureRequestSendRequest.md -docs/SignatureRequestSendWithTemplateRequest.md -docs/SignatureRequestUpdateRequest.md -docs/SubAttachment.md -docs/SubBulkSignerList.md -docs/SubBulkSignerListCustomField.md -docs/SubCC.md -docs/SubCustomField.md -docs/SubEditorOptions.md -docs/SubFieldOptions.md -docs/SubFormFieldGroup.md -docs/SubFormFieldRule.md -docs/SubFormFieldRuleAction.md -docs/SubFormFieldRuleTrigger.md -docs/SubFormFieldsPerDocumentBase.md -docs/SubFormFieldsPerDocumentCheckbox.md -docs/SubFormFieldsPerDocumentCheckboxMerge.md -docs/SubFormFieldsPerDocumentDateSigned.md -docs/SubFormFieldsPerDocumentDropdown.md -docs/SubFormFieldsPerDocumentFontEnum.md -docs/SubFormFieldsPerDocumentHyperlink.md -docs/SubFormFieldsPerDocumentInitials.md -docs/SubFormFieldsPerDocumentRadio.md -docs/SubFormFieldsPerDocumentSignature.md -docs/SubFormFieldsPerDocumentText.md -docs/SubFormFieldsPerDocumentTextMerge.md -docs/SubFormFieldsPerDocumentTypeEnum.md -docs/SubMergeField.md -docs/SubOAuth.md -docs/SubOptions.md -docs/SubSignatureRequestGroupedSigners.md -docs/SubSignatureRequestSigner.md -docs/SubSignatureRequestTemplateSigner.md -docs/SubSigningOptions.md -docs/SubTeamResponse.md -docs/SubTemplateRole.md -docs/SubUnclaimedDraftSigner.md -docs/SubUnclaimedDraftTemplateSigner.md -docs/SubWhiteLabelingOptions.md -docs/TeamAddMemberRequest.md -docs/TeamApi.md -docs/TeamCreateRequest.md -docs/TeamGetInfoResponse.md -docs/TeamGetResponse.md -docs/TeamInfoResponse.md -docs/TeamInviteResponse.md -docs/TeamInvitesResponse.md -docs/TeamMemberResponse.md -docs/TeamMembersResponse.md -docs/TeamParentResponse.md -docs/TeamRemoveMemberRequest.md -docs/TeamResponse.md -docs/TeamSubTeamsResponse.md -docs/TeamUpdateRequest.md -docs/TemplateAddUserRequest.md -docs/TemplateApi.md -docs/TemplateCreateEmbeddedDraftRequest.md -docs/TemplateCreateEmbeddedDraftResponse.md -docs/TemplateCreateEmbeddedDraftResponseTemplate.md -docs/TemplateCreateRequest.md -docs/TemplateCreateResponse.md -docs/TemplateCreateResponseTemplate.md -docs/TemplateEditResponse.md -docs/TemplateGetResponse.md -docs/TemplateListResponse.md -docs/TemplateRemoveUserRequest.md -docs/TemplateResponse.md -docs/TemplateResponseAccount.md -docs/TemplateResponseAccountQuota.md -docs/TemplateResponseCCRole.md -docs/TemplateResponseDocument.md -docs/TemplateResponseDocumentCustomFieldBase.md -docs/TemplateResponseDocumentCustomFieldCheckbox.md -docs/TemplateResponseDocumentCustomFieldText.md -docs/TemplateResponseDocumentFieldGroup.md -docs/TemplateResponseDocumentFieldGroupRule.md -docs/TemplateResponseDocumentFormFieldBase.md -docs/TemplateResponseDocumentFormFieldCheckbox.md -docs/TemplateResponseDocumentFormFieldDateSigned.md -docs/TemplateResponseDocumentFormFieldDropdown.md -docs/TemplateResponseDocumentFormFieldHyperlink.md -docs/TemplateResponseDocumentFormFieldInitials.md -docs/TemplateResponseDocumentFormFieldRadio.md -docs/TemplateResponseDocumentFormFieldSignature.md -docs/TemplateResponseDocumentFormFieldText.md -docs/TemplateResponseDocumentStaticFieldBase.md -docs/TemplateResponseDocumentStaticFieldCheckbox.md -docs/TemplateResponseDocumentStaticFieldDateSigned.md -docs/TemplateResponseDocumentStaticFieldDropdown.md -docs/TemplateResponseDocumentStaticFieldHyperlink.md -docs/TemplateResponseDocumentStaticFieldInitials.md -docs/TemplateResponseDocumentStaticFieldRadio.md -docs/TemplateResponseDocumentStaticFieldSignature.md -docs/TemplateResponseDocumentStaticFieldText.md -docs/TemplateResponseFieldAvgTextLength.md -docs/TemplateResponseSignerRole.md -docs/TemplateUpdateFilesRequest.md -docs/TemplateUpdateFilesResponse.md -docs/TemplateUpdateFilesResponseTemplate.md -docs/UnclaimedDraftApi.md -docs/UnclaimedDraftCreateEmbeddedRequest.md -docs/UnclaimedDraftCreateEmbeddedWithTemplateRequest.md -docs/UnclaimedDraftCreateRequest.md -docs/UnclaimedDraftCreateResponse.md -docs/UnclaimedDraftEditAndResendRequest.md -docs/UnclaimedDraftResponse.md -docs/WarningResponse.md -gradle.properties -gradle/wrapper/gradle-wrapper.jar -gradle/wrapper/gradle-wrapper.properties -gradlew -gradlew.bat -pom.xml -settings.gradle -src/main/AndroidManifest.xml -src/main/java/com/dropbox/sign/ApiClient.java -src/main/java/com/dropbox/sign/ApiException.java -src/main/java/com/dropbox/sign/ApiResponse.java -src/main/java/com/dropbox/sign/Configuration.java -src/main/java/com/dropbox/sign/CustomInstantDeserializer.java -src/main/java/com/dropbox/sign/EventCallbackHelper.java -src/main/java/com/dropbox/sign/JSON.java -src/main/java/com/dropbox/sign/JavaTimeFormatter.java -src/main/java/com/dropbox/sign/Pair.java -src/main/java/com/dropbox/sign/RFC3339DateFormat.java -src/main/java/com/dropbox/sign/ServerConfiguration.java -src/main/java/com/dropbox/sign/ServerVariable.java -src/main/java/com/dropbox/sign/StringUtil.java -src/main/java/com/dropbox/sign/api/AccountApi.java -src/main/java/com/dropbox/sign/api/ApiAppApi.java -src/main/java/com/dropbox/sign/api/BulkSendJobApi.java -src/main/java/com/dropbox/sign/api/EmbeddedApi.java -src/main/java/com/dropbox/sign/api/OAuthApi.java -src/main/java/com/dropbox/sign/api/ReportApi.java -src/main/java/com/dropbox/sign/api/SignatureRequestApi.java -src/main/java/com/dropbox/sign/api/TeamApi.java -src/main/java/com/dropbox/sign/api/TemplateApi.java -src/main/java/com/dropbox/sign/api/UnclaimedDraftApi.java -src/main/java/com/dropbox/sign/auth/ApiKeyAuth.java -src/main/java/com/dropbox/sign/auth/Authentication.java -src/main/java/com/dropbox/sign/auth/HttpBasicAuth.java -src/main/java/com/dropbox/sign/auth/HttpBearerAuth.java -src/main/java/com/dropbox/sign/model/AbstractOpenApiSchema.java -src/main/java/com/dropbox/sign/model/AccountCreateRequest.java -src/main/java/com/dropbox/sign/model/AccountCreateResponse.java -src/main/java/com/dropbox/sign/model/AccountGetResponse.java -src/main/java/com/dropbox/sign/model/AccountResponse.java -src/main/java/com/dropbox/sign/model/AccountResponseQuotas.java -src/main/java/com/dropbox/sign/model/AccountResponseUsage.java -src/main/java/com/dropbox/sign/model/AccountUpdateRequest.java -src/main/java/com/dropbox/sign/model/AccountVerifyRequest.java -src/main/java/com/dropbox/sign/model/AccountVerifyResponse.java -src/main/java/com/dropbox/sign/model/AccountVerifyResponseAccount.java -src/main/java/com/dropbox/sign/model/ApiAppCreateRequest.java -src/main/java/com/dropbox/sign/model/ApiAppGetResponse.java -src/main/java/com/dropbox/sign/model/ApiAppListResponse.java -src/main/java/com/dropbox/sign/model/ApiAppResponse.java -src/main/java/com/dropbox/sign/model/ApiAppResponseOAuth.java -src/main/java/com/dropbox/sign/model/ApiAppResponseOptions.java -src/main/java/com/dropbox/sign/model/ApiAppResponseOwnerAccount.java -src/main/java/com/dropbox/sign/model/ApiAppResponseWhiteLabelingOptions.java -src/main/java/com/dropbox/sign/model/ApiAppUpdateRequest.java -src/main/java/com/dropbox/sign/model/BulkSendJobGetResponse.java -src/main/java/com/dropbox/sign/model/BulkSendJobGetResponseSignatureRequests.java -src/main/java/com/dropbox/sign/model/BulkSendJobListResponse.java -src/main/java/com/dropbox/sign/model/BulkSendJobResponse.java -src/main/java/com/dropbox/sign/model/BulkSendJobSendResponse.java -src/main/java/com/dropbox/sign/model/EmbeddedEditUrlRequest.java -src/main/java/com/dropbox/sign/model/EmbeddedEditUrlResponse.java -src/main/java/com/dropbox/sign/model/EmbeddedEditUrlResponseEmbedded.java -src/main/java/com/dropbox/sign/model/EmbeddedSignUrlResponse.java -src/main/java/com/dropbox/sign/model/EmbeddedSignUrlResponseEmbedded.java -src/main/java/com/dropbox/sign/model/ErrorResponse.java -src/main/java/com/dropbox/sign/model/ErrorResponseError.java -src/main/java/com/dropbox/sign/model/EventCallbackRequest.java -src/main/java/com/dropbox/sign/model/EventCallbackRequestEvent.java -src/main/java/com/dropbox/sign/model/EventCallbackRequestEventMetadata.java -src/main/java/com/dropbox/sign/model/FileResponse.java -src/main/java/com/dropbox/sign/model/FileResponseDataUri.java -src/main/java/com/dropbox/sign/model/ListInfoResponse.java -src/main/java/com/dropbox/sign/model/OAuthTokenGenerateRequest.java -src/main/java/com/dropbox/sign/model/OAuthTokenRefreshRequest.java -src/main/java/com/dropbox/sign/model/OAuthTokenResponse.java -src/main/java/com/dropbox/sign/model/ReportCreateRequest.java -src/main/java/com/dropbox/sign/model/ReportCreateResponse.java -src/main/java/com/dropbox/sign/model/ReportResponse.java -src/main/java/com/dropbox/sign/model/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.java -src/main/java/com/dropbox/sign/model/SignatureRequestBulkSendWithTemplateRequest.java -src/main/java/com/dropbox/sign/model/SignatureRequestCreateEmbeddedRequest.java -src/main/java/com/dropbox/sign/model/SignatureRequestCreateEmbeddedWithTemplateRequest.java -src/main/java/com/dropbox/sign/model/SignatureRequestGetResponse.java -src/main/java/com/dropbox/sign/model/SignatureRequestListResponse.java -src/main/java/com/dropbox/sign/model/SignatureRequestRemindRequest.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponse.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponseAttachment.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldBase.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldCheckbox.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldText.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldTypeEnum.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataBase.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataTypeEnum.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueCheckbox.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueCheckboxMerge.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueDateSigned.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueDropdown.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueInitials.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueRadio.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueSignature.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueText.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueTextMerge.java -src/main/java/com/dropbox/sign/model/SignatureRequestResponseSignatures.java -src/main/java/com/dropbox/sign/model/SignatureRequestSendRequest.java -src/main/java/com/dropbox/sign/model/SignatureRequestSendWithTemplateRequest.java -src/main/java/com/dropbox/sign/model/SignatureRequestUpdateRequest.java -src/main/java/com/dropbox/sign/model/SubAttachment.java -src/main/java/com/dropbox/sign/model/SubBulkSignerList.java -src/main/java/com/dropbox/sign/model/SubBulkSignerListCustomField.java -src/main/java/com/dropbox/sign/model/SubCC.java -src/main/java/com/dropbox/sign/model/SubCustomField.java -src/main/java/com/dropbox/sign/model/SubEditorOptions.java -src/main/java/com/dropbox/sign/model/SubFieldOptions.java -src/main/java/com/dropbox/sign/model/SubFormFieldGroup.java -src/main/java/com/dropbox/sign/model/SubFormFieldRule.java -src/main/java/com/dropbox/sign/model/SubFormFieldRuleAction.java -src/main/java/com/dropbox/sign/model/SubFormFieldRuleTrigger.java -src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentBase.java -src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentCheckbox.java -src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentCheckboxMerge.java -src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentDateSigned.java -src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentDropdown.java -src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentFontEnum.java -src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentHyperlink.java -src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentInitials.java -src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentRadio.java -src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentSignature.java -src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentText.java -src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentTextMerge.java -src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentTypeEnum.java -src/main/java/com/dropbox/sign/model/SubMergeField.java -src/main/java/com/dropbox/sign/model/SubOAuth.java -src/main/java/com/dropbox/sign/model/SubOptions.java -src/main/java/com/dropbox/sign/model/SubSignatureRequestGroupedSigners.java -src/main/java/com/dropbox/sign/model/SubSignatureRequestSigner.java -src/main/java/com/dropbox/sign/model/SubSignatureRequestTemplateSigner.java -src/main/java/com/dropbox/sign/model/SubSigningOptions.java -src/main/java/com/dropbox/sign/model/SubTeamResponse.java -src/main/java/com/dropbox/sign/model/SubTemplateRole.java -src/main/java/com/dropbox/sign/model/SubUnclaimedDraftSigner.java -src/main/java/com/dropbox/sign/model/SubUnclaimedDraftTemplateSigner.java -src/main/java/com/dropbox/sign/model/SubWhiteLabelingOptions.java -src/main/java/com/dropbox/sign/model/TeamAddMemberRequest.java -src/main/java/com/dropbox/sign/model/TeamCreateRequest.java -src/main/java/com/dropbox/sign/model/TeamGetInfoResponse.java -src/main/java/com/dropbox/sign/model/TeamGetResponse.java -src/main/java/com/dropbox/sign/model/TeamInfoResponse.java -src/main/java/com/dropbox/sign/model/TeamInviteResponse.java -src/main/java/com/dropbox/sign/model/TeamInvitesResponse.java -src/main/java/com/dropbox/sign/model/TeamMemberResponse.java -src/main/java/com/dropbox/sign/model/TeamMembersResponse.java -src/main/java/com/dropbox/sign/model/TeamParentResponse.java -src/main/java/com/dropbox/sign/model/TeamRemoveMemberRequest.java -src/main/java/com/dropbox/sign/model/TeamResponse.java -src/main/java/com/dropbox/sign/model/TeamSubTeamsResponse.java -src/main/java/com/dropbox/sign/model/TeamUpdateRequest.java -src/main/java/com/dropbox/sign/model/TemplateAddUserRequest.java -src/main/java/com/dropbox/sign/model/TemplateCreateEmbeddedDraftRequest.java -src/main/java/com/dropbox/sign/model/TemplateCreateEmbeddedDraftResponse.java -src/main/java/com/dropbox/sign/model/TemplateCreateEmbeddedDraftResponseTemplate.java -src/main/java/com/dropbox/sign/model/TemplateCreateRequest.java -src/main/java/com/dropbox/sign/model/TemplateCreateResponse.java -src/main/java/com/dropbox/sign/model/TemplateCreateResponseTemplate.java -src/main/java/com/dropbox/sign/model/TemplateEditResponse.java -src/main/java/com/dropbox/sign/model/TemplateGetResponse.java -src/main/java/com/dropbox/sign/model/TemplateListResponse.java -src/main/java/com/dropbox/sign/model/TemplateRemoveUserRequest.java -src/main/java/com/dropbox/sign/model/TemplateResponse.java -src/main/java/com/dropbox/sign/model/TemplateResponseAccount.java -src/main/java/com/dropbox/sign/model/TemplateResponseAccountQuota.java -src/main/java/com/dropbox/sign/model/TemplateResponseCCRole.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocument.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentCustomFieldBase.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentCustomFieldCheckbox.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentCustomFieldText.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFieldGroup.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFieldGroupRule.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldBase.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldCheckbox.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldDateSigned.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldDropdown.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldHyperlink.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldInitials.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldRadio.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldSignature.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldText.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldBase.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldCheckbox.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldDateSigned.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldDropdown.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldHyperlink.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldInitials.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldRadio.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldSignature.java -src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldText.java -src/main/java/com/dropbox/sign/model/TemplateResponseFieldAvgTextLength.java -src/main/java/com/dropbox/sign/model/TemplateResponseSignerRole.java -src/main/java/com/dropbox/sign/model/TemplateUpdateFilesRequest.java -src/main/java/com/dropbox/sign/model/TemplateUpdateFilesResponse.java -src/main/java/com/dropbox/sign/model/TemplateUpdateFilesResponseTemplate.java -src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateEmbeddedRequest.java -src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.java -src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateRequest.java -src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateResponse.java -src/main/java/com/dropbox/sign/model/UnclaimedDraftEditAndResendRequest.java -src/main/java/com/dropbox/sign/model/UnclaimedDraftResponse.java -src/main/java/com/dropbox/sign/model/WarningResponse.java diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION deleted file mode 100644 index e230c83..0000000 --- a/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -5.3.0 \ No newline at end of file diff --git a/README.md b/README.md index 7c19307..8c1a7ad 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Add this dependency to your project's POM: com.dropbox.sign dropbox-sign - 1.5.0 + 1.6.0 compile ``` @@ -71,7 +71,7 @@ Add this dependency to your project's build file: } dependencies { - implementation "com.dropbox.sign:dropbox-sign:1.5.0" + implementation "com.dropbox.sign:dropbox-sign:1.6.0" } ``` @@ -85,7 +85,7 @@ mvn clean package Then manually install the following JARs: -- `target/dropbox-sign-1.5.0.jar` +- `target/dropbox-sign-1.6.0.jar` - `target/lib/*.jar` ## Getting Started @@ -132,31 +132,30 @@ public class Example { ``` - ## Using a Proxy +## Using a Proxy - To add a HTTP proxy for the API client, use `ClientConfig`: +To add a HTTP proxy for the API client, use `ClientConfig`: +```java + +import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; +import com.dropbox.sign.*; +import com.dropbox.sign.api.AccountApi; - ```java - - import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; - import org.glassfish.jersey.client.ClientConfig; - import org.glassfish.jersey.client.ClientProperties; - import com.dropbox.sign.*; - import com.dropbox.sign.api.AccountApi; +... - ... +ApiClient defaultClient = Configuration.getDefaultApiClient(); +ClientConfig clientConfig = defaultClient.getClientConfig(); +clientConfig.connectorProvider(new ApacheConnectorProvider()); +clientConfig.property(ClientProperties.PROXY_URI, "http://proxy_url_here"); +clientConfig.property(ClientProperties.PROXY_USERNAME, "proxy_username"); +clientConfig.property(ClientProperties.PROXY_PASSWORD, "proxy_password"); +defaultClient.setClientConfig(clientConfig); - ApiClient defaultClient = Configuration.getDefaultApiClient(); - ClientConfig clientConfig = defaultClient.getClientConfig(); - clientConfig.connectorProvider(new ApacheConnectorProvider()); - clientConfig.property(ClientProperties.PROXY_URI, "http://proxy_url_here"); - clientConfig.property(ClientProperties.PROXY_USERNAME, "proxy_username"); - clientConfig.property(ClientProperties.PROXY_PASSWORD, "proxy_password"); - defaultClient.setClientConfig(clientConfig); +AccountApi apiInstance = new AccountApi(defaultClient); - AccountApi apiInstance = new AccountApi(defaultClient); - - ``` +``` ## Documentation for API Endpoints @@ -178,6 +177,13 @@ Class | Method | HTTP request | Description *BulkSendJobApi* | [**bulkSendJobList**](docs/BulkSendJobApi.md#bulkSendJobList) | **GET** /bulk_send_job/list | List Bulk Send Jobs *EmbeddedApi* | [**embeddedEditUrl**](docs/EmbeddedApi.md#embeddedEditUrl) | **POST** /embedded/edit_url/{template_id} | Get Embedded Template Edit URL *EmbeddedApi* | [**embeddedSignUrl**](docs/EmbeddedApi.md#embeddedSignUrl) | **GET** /embedded/sign_url/{signature_id} | Get Embedded Sign URL +*FaxLineApi* | [**faxLineAddUser**](docs/FaxLineApi.md#faxLineAddUser) | **PUT** /fax_line/add_user | Add Fax Line User +*FaxLineApi* | [**faxLineAreaCodeGet**](docs/FaxLineApi.md#faxLineAreaCodeGet) | **GET** /fax_line/area_codes | Get Available Fax Line Area Codes +*FaxLineApi* | [**faxLineCreate**](docs/FaxLineApi.md#faxLineCreate) | **POST** /fax_line/create | Purchase Fax Line +*FaxLineApi* | [**faxLineDelete**](docs/FaxLineApi.md#faxLineDelete) | **DELETE** /fax_line | Delete Fax Line +*FaxLineApi* | [**faxLineGet**](docs/FaxLineApi.md#faxLineGet) | **GET** /fax_line | Get Fax Line +*FaxLineApi* | [**faxLineList**](docs/FaxLineApi.md#faxLineList) | **GET** /fax_line/list | List Fax Lines +*FaxLineApi* | [**faxLineRemoveUser**](docs/FaxLineApi.md#faxLineRemoveUser) | **PUT** /fax_line/remove_user | Remove Fax Line Access *OAuthApi* | [**oauthTokenGenerate**](docs/OAuthApi.md#oauthTokenGenerate) | **POST** /oauth/token | OAuth Token Generate *OAuthApi* | [**oauthTokenRefresh**](docs/OAuthApi.md#oauthTokenRefresh) | **POST** /oauth/token?refresh | OAuth Token Refresh *ReportApi* | [**reportCreate**](docs/ReportApi.md#reportCreate) | **POST** /report/create | Create Report @@ -260,6 +266,17 @@ Class | Method | HTTP request | Description - [EventCallbackRequest](docs/EventCallbackRequest.md) - [EventCallbackRequestEvent](docs/EventCallbackRequestEvent.md) - [EventCallbackRequestEventMetadata](docs/EventCallbackRequestEventMetadata.md) + - [FaxLineAddUserRequest](docs/FaxLineAddUserRequest.md) + - [FaxLineAreaCodeGetCountryEnum](docs/FaxLineAreaCodeGetCountryEnum.md) + - [FaxLineAreaCodeGetProvinceEnum](docs/FaxLineAreaCodeGetProvinceEnum.md) + - [FaxLineAreaCodeGetResponse](docs/FaxLineAreaCodeGetResponse.md) + - [FaxLineAreaCodeGetStateEnum](docs/FaxLineAreaCodeGetStateEnum.md) + - [FaxLineCreateRequest](docs/FaxLineCreateRequest.md) + - [FaxLineDeleteRequest](docs/FaxLineDeleteRequest.md) + - [FaxLineListResponse](docs/FaxLineListResponse.md) + - [FaxLineRemoveUserRequest](docs/FaxLineRemoveUserRequest.md) + - [FaxLineResponse](docs/FaxLineResponse.md) + - [FaxLineResponseFaxLine](docs/FaxLineResponseFaxLine.md) - [FileResponse](docs/FileResponse.md) - [FileResponseDataUri](docs/FileResponseDataUri.md) - [ListInfoResponse](docs/ListInfoResponse.md) @@ -400,18 +417,22 @@ Class | Method | HTTP request | Description - [WarningResponse](docs/WarningResponse.md) + ## Documentation for Authorization + Authentication schemes defined for the API: + ### api_key - **Type**: HTTP basic authentication + ### oauth2 -- **Type**: HTTP basic authentication +- **Type**: HTTP Bearer Token authentication (JWT) ## Recommendation @@ -428,7 +449,7 @@ apisupport@hellosign.com This Java package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: `3.0.0` - - Package version: `1.5.0` + - Package version: `1.6.0` - Build package: `org.openapitools.codegen.languages.JavaClientCodegen` diff --git a/VERSION b/VERSION index bc80560..dc1e644 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.0 +1.6.0 diff --git a/build.gradle b/build.gradle index fb44753..ba1071a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,12 @@ + buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' - classpath 'com.diffplug.spotless:spotless-plugin-gradle:5.17.1' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.3.0' } } @@ -20,7 +21,7 @@ apply plugin: 'signing' group = 'com.dropbox.sign' archivesBaseName = 'dropbox-sign' -version = '1.5.0' +version = '1.6.0' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -115,13 +116,12 @@ publishing { } ext { - swagger_annotations_version = "1.6.3" - jackson_version = "2.13.0" - jackson_databind_version = "2.13.0" + swagger_annotations_version = "1.6.5" + jackson_version = "2.17.1" + jackson_databind_version = "2.17.1" jakarta_annotation_version = "1.3.5" jersey_version = "2.35" - junit_version = "4.13.2" - threetenbp_version = "2.9.10" + junit_version = "5.8.2" mockito_version = "3.12.4" } @@ -138,12 +138,16 @@ dependencies { implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" - implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version" implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation "junit:junit:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" testImplementation "org.mockito:mockito-core:$mockito_version" } +test { + useJUnitPlatform() +} + javadoc { options.tags = [ "http.response.details:a:Http Response Details" ] } diff --git a/build.sbt b/build.sbt index db5c3e9..cb4b33a 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "com.dropbox.sign", name := "dropbox-sign", - version := "1.5.0", + version := "1.6.0", scalaVersion := "2.11.4", scalacOptions ++= Seq("-feature"), Compile / javacOptions ++= Seq("-Xlint:deprecation"), @@ -11,19 +11,17 @@ lazy val root = (project in file(".")). libraryDependencies ++= Seq( libraryDependencies += "commons-codec" % "commons-codec" % "1.15" "com.google.code.findbugs" % "jsr305" % "3.0.0", - "io.swagger" % "swagger-annotations" % "1.6.3", + "io.swagger" % "swagger-annotations" % "1.6.5", "org.glassfish.jersey.core" % "jersey-client" % "2.35", "org.glassfish.jersey.inject" % "jersey-hk2" % "2.35", "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.35", "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.35", "org.glassfish.jersey.connectors" % "jersey-apache-connector" % "2.35", - "com.fasterxml.jackson.core" % "jackson-core" % "2.13.0" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.0" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.0" % "compile", - "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile", - "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.12.5" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.17.1" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.17.1" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.17.1" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.17.1" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "junit" % "junit" % "4.13.2" % "test", - "com.novocode" % "junit-interface" % "0.10" % "test" + "org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test" ) ) diff --git a/docs/AccountApi.md b/docs/AccountApi.md index 6f258c3..494853d 100644 --- a/docs/AccountApi.md +++ b/docs/AccountApi.md @@ -2,8 +2,8 @@ All URIs are relative to *https://api.hellosign.com/v3* -Method | HTTP request | Description -------------- | ------------- | ------------- +| Method | HTTP request | Description | +|------------- | ------------- | -------------| [**accountCreate**](AccountApi.md#accountCreate) | **POST** /account/create | Create Account [**accountGet**](AccountApi.md#accountGet) | **GET** /account | Get Account [**accountUpdate**](AccountApi.md#accountUpdate) | **PUT** /account | Update Account @@ -62,8 +62,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **accountCreateRequest** | [**AccountCreateRequest**](AccountCreateRequest.md)| | ### Return type @@ -134,8 +134,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **accountId** | **String**| `account_id` or `email_address` is required. If both are provided, the account id prevails. The ID of the Account. | [optional] **emailAddress** | **String**| `account_id` or `email_address` is required, If both are provided, the account id prevails. The email address of the Account. | [optional] @@ -210,8 +210,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **accountUpdateRequest** | [**AccountUpdateRequest**](AccountUpdateRequest.md)| | ### Return type @@ -285,8 +285,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **accountVerifyRequest** | [**AccountVerifyRequest**](AccountVerifyRequest.md)| | ### Return type diff --git a/docs/AccountCreateRequest.md b/docs/AccountCreateRequest.md index a10ed08..9c75292 100644 --- a/docs/AccountCreateRequest.md +++ b/docs/AccountCreateRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `emailAddress`*_required_ | ```String``` | The email address which will be associated with the new Account. | | | `clientId` | ```String``` | Used when creating a new account with OAuth authorization.

See [OAuth 2.0 Authorization](https://app.hellosign.com/api/oauthWalkthrough#OAuthAuthorization) | | | `clientSecret` | ```String``` | Used when creating a new account with OAuth authorization.

See [OAuth 2.0 Authorization](https://app.hellosign.com/api/oauthWalkthrough#OAuthAuthorization) | | diff --git a/docs/AccountCreateResponse.md b/docs/AccountCreateResponse.md index 59279d1..7e09def 100644 --- a/docs/AccountCreateResponse.md +++ b/docs/AccountCreateResponse.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `account` | [```AccountResponse```](AccountResponse.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `account`*_required_ | [```AccountResponse```](AccountResponse.md) | | | | `oauthData` | [```OAuthTokenResponse```](OAuthTokenResponse.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/AccountGetResponse.md b/docs/AccountGetResponse.md index 41508ab..f5ed78b 100644 --- a/docs/AccountGetResponse.md +++ b/docs/AccountGetResponse.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `account` | [```AccountResponse```](AccountResponse.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `account`*_required_ | [```AccountResponse```](AccountResponse.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/AccountResponse.md b/docs/AccountResponse.md index e763487..5b73aa0 100644 --- a/docs/AccountResponse.md +++ b/docs/AccountResponse.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `accountId` | ```String``` | The ID of the Account | | | `emailAddress` | ```String``` | The email address associated with the Account. | | | `isLocked` | ```Boolean``` | Returns `true` if the user has been locked out of their account by a team admin. | | diff --git a/docs/AccountResponseQuotas.md b/docs/AccountResponseQuotas.md index c591ff8..3b7fe4e 100644 --- a/docs/AccountResponseQuotas.md +++ b/docs/AccountResponseQuotas.md @@ -6,8 +6,8 @@ Details concerning remaining monthly quotas. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `apiSignatureRequestsLeft` | ```Integer``` | API signature requests remaining. | | | `documentsLeft` | ```Integer``` | Signature requests remaining. | | | `templatesTotal` | ```Integer``` | Total API templates allowed. | | diff --git a/docs/AccountResponseUsage.md b/docs/AccountResponseUsage.md index f9f3671..1cdb766 100644 --- a/docs/AccountResponseUsage.md +++ b/docs/AccountResponseUsage.md @@ -6,8 +6,8 @@ Details concerning monthly usage ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `faxPagesSent` | ```Integer``` | Number of fax pages sent | | diff --git a/docs/AccountUpdateRequest.md b/docs/AccountUpdateRequest.md index d1dac21..43121c8 100644 --- a/docs/AccountUpdateRequest.md +++ b/docs/AccountUpdateRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `accountId` | ```String``` | The ID of the Account | | | `callbackUrl` | ```String``` | The URL that Dropbox Sign should POST events to. | | | `locale` | ```String``` | The locale used in this Account. Check out the list of [supported locales](/api/reference/constants/#supported-locales) to learn more about the possible values. | | diff --git a/docs/AccountVerifyRequest.md b/docs/AccountVerifyRequest.md index de912c5..d14a8eb 100644 --- a/docs/AccountVerifyRequest.md +++ b/docs/AccountVerifyRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `emailAddress`*_required_ | ```String``` | Email address to run the verification for. | | diff --git a/docs/AccountVerifyResponse.md b/docs/AccountVerifyResponse.md index 07f01ff..8868f15 100644 --- a/docs/AccountVerifyResponse.md +++ b/docs/AccountVerifyResponse.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `account` | [```AccountVerifyResponseAccount```](AccountVerifyResponseAccount.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/AccountVerifyResponseAccount.md b/docs/AccountVerifyResponseAccount.md index efa24dc..f83f9f0 100644 --- a/docs/AccountVerifyResponseAccount.md +++ b/docs/AccountVerifyResponseAccount.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `emailAddress` | ```String``` | The email address associated with the Account. | | diff --git a/docs/ApiAppApi.md b/docs/ApiAppApi.md index a22cd2e..02630c9 100644 --- a/docs/ApiAppApi.md +++ b/docs/ApiAppApi.md @@ -2,8 +2,8 @@ All URIs are relative to *https://api.hellosign.com/v3* -Method | HTTP request | Description -------------- | ------------- | ------------- +| Method | HTTP request | Description | +|------------- | ------------- | -------------| [**apiAppCreate**](ApiAppApi.md#apiAppCreate) | **POST** /api_app | Create API App [**apiAppDelete**](ApiAppApi.md#apiAppDelete) | **DELETE** /api_app/{client_id} | Delete API App [**apiAppGet**](ApiAppApi.md#apiAppGet) | **GET** /api_app/{client_id} | Get API App @@ -80,8 +80,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **apiAppCreateRequest** | [**ApiAppCreateRequest**](ApiAppCreateRequest.md)| | ### Return type @@ -152,8 +152,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **clientId** | **String**| The client id of the API App to delete. | ### Return type @@ -226,8 +226,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **clientId** | **String**| The client id of the API App to retrieve. | ### Return type @@ -301,8 +301,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **page** | **Integer**| Which page number of the API App List to return. Defaults to `1`. | [optional] [default to 1] **pageSize** | **Integer**| Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. | [optional] [default to 20] @@ -396,8 +396,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **clientId** | **String**| The client id of the API App to update. | **apiAppUpdateRequest** | [**ApiAppUpdateRequest**](ApiAppUpdateRequest.md)| | diff --git a/docs/ApiAppCreateRequest.md b/docs/ApiAppCreateRequest.md index 59c2028..b787bc7 100644 --- a/docs/ApiAppCreateRequest.md +++ b/docs/ApiAppCreateRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `domains`*_required_ | ```List``` | The domain names the ApiApp will be associated with. | | | `name`*_required_ | ```String``` | The name you want to assign to the ApiApp. | | | `callbackUrl` | ```String``` | The URL at which the ApiApp should receive event callbacks. | | diff --git a/docs/ApiAppGetResponse.md b/docs/ApiAppGetResponse.md index b90c30a..98e2f98 100644 --- a/docs/ApiAppGetResponse.md +++ b/docs/ApiAppGetResponse.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `apiApp` | [```ApiAppResponse```](ApiAppResponse.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `apiApp`*_required_ | [```ApiAppResponse```](ApiAppResponse.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/ApiAppListResponse.md b/docs/ApiAppListResponse.md index 144b0f4..14c287f 100644 --- a/docs/ApiAppListResponse.md +++ b/docs/ApiAppListResponse.md @@ -6,10 +6,10 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `apiApps` | [```List```](ApiAppResponse.md) | Contains information about API Apps. | | -| `listInfo` | [```ListInfoResponse```](ListInfoResponse.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `apiApps`*_required_ | [```List```](ApiAppResponse.md) | Contains information about API Apps. | | +| `listInfo`*_required_ | [```ListInfoResponse```](ListInfoResponse.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/ApiAppResponse.md b/docs/ApiAppResponse.md index bb0836d..afe95c8 100644 --- a/docs/ApiAppResponse.md +++ b/docs/ApiAppResponse.md @@ -6,8 +6,8 @@ Contains information about an API App. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `callbackUrl` | ```String``` | The app's callback URL (for events) | | | `clientId` | ```String``` | The app's client id | | | `createdAt` | ```Integer``` | The time that the app was created | | diff --git a/docs/ApiAppResponseOAuth.md b/docs/ApiAppResponseOAuth.md index 20c678a..c2f705c 100644 --- a/docs/ApiAppResponseOAuth.md +++ b/docs/ApiAppResponseOAuth.md @@ -6,8 +6,8 @@ An object describing the app's OAuth properties, or null if OAuth is not con ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `callbackUrl` | ```String``` | The app's OAuth callback URL. | | | `secret` | ```String``` | The app's OAuth secret, or null if the app does not belong to user. | | | `scopes` | ```List``` | Array of OAuth scopes used by the app. | | diff --git a/docs/ApiAppResponseOptions.md b/docs/ApiAppResponseOptions.md index 827b3b5..07979f3 100644 --- a/docs/ApiAppResponseOptions.md +++ b/docs/ApiAppResponseOptions.md @@ -6,8 +6,8 @@ An object with options that override account settings. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `canInsertEverywhere` | ```Boolean``` | Boolean denoting if signers can "Insert Everywhere" in one click while signing a document | | diff --git a/docs/ApiAppResponseOwnerAccount.md b/docs/ApiAppResponseOwnerAccount.md index 0ac35ee..b4d6d42 100644 --- a/docs/ApiAppResponseOwnerAccount.md +++ b/docs/ApiAppResponseOwnerAccount.md @@ -6,8 +6,8 @@ An object describing the app's owner ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `accountId` | ```String``` | The owner account's ID | | | `emailAddress` | ```String``` | The owner account's email address | | diff --git a/docs/ApiAppResponseWhiteLabelingOptions.md b/docs/ApiAppResponseWhiteLabelingOptions.md index 1ed534a..be6d022 100644 --- a/docs/ApiAppResponseWhiteLabelingOptions.md +++ b/docs/ApiAppResponseWhiteLabelingOptions.md @@ -6,8 +6,8 @@ An object with options to customize the app's signer page ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `headerBackgroundColor` | ```String``` | | | | `legalVersion` | ```String``` | | | | `linkColor` | ```String``` | | | diff --git a/docs/ApiAppUpdateRequest.md b/docs/ApiAppUpdateRequest.md index 62bc8fd..1c0efaf 100644 --- a/docs/ApiAppUpdateRequest.md +++ b/docs/ApiAppUpdateRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `callbackUrl` | ```String``` | The URL at which the API App should receive event callbacks. | | | `customLogoFile` | ```File``` | An image file to use as a custom logo in embedded contexts. (Only applies to some API plans) | | | `domains` | ```List``` | The domain names the ApiApp will be associated with. | | diff --git a/docs/BulkSendJobApi.md b/docs/BulkSendJobApi.md index c369376..5d7335a 100644 --- a/docs/BulkSendJobApi.md +++ b/docs/BulkSendJobApi.md @@ -2,8 +2,8 @@ All URIs are relative to *https://api.hellosign.com/v3* -Method | HTTP request | Description -------------- | ------------- | ------------- +| Method | HTTP request | Description | +|------------- | ------------- | -------------| [**bulkSendJobGet**](BulkSendJobApi.md#bulkSendJobGet) | **GET** /bulk_send_job/{bulk_send_job_id} | Get Bulk Send Job [**bulkSendJobList**](BulkSendJobApi.md#bulkSendJobList) | **GET** /bulk_send_job/list | List Bulk Send Jobs @@ -59,8 +59,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **bulkSendJobId** | **String**| The id of the BulkSendJob to retrieve. | **page** | **Integer**| Which page number of the BulkSendJob list to return. Defaults to `1`. | [optional] [default to 1] **pageSize** | **Integer**| Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. | [optional] [default to 20] @@ -136,8 +136,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **page** | **Integer**| Which page number of the BulkSendJob List to return. Defaults to `1`. | [optional] [default to 1] **pageSize** | **Integer**| Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. | [optional] [default to 20] diff --git a/docs/BulkSendJobGetResponse.md b/docs/BulkSendJobGetResponse.md index 977a108..93395ee 100644 --- a/docs/BulkSendJobGetResponse.md +++ b/docs/BulkSendJobGetResponse.md @@ -6,11 +6,11 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `bulkSendJob` | [```BulkSendJobResponse```](BulkSendJobResponse.md) | | | -| `listInfo` | [```ListInfoResponse```](ListInfoResponse.md) | | | -| `signatureRequests` | [```List```](BulkSendJobGetResponseSignatureRequests.md) | Contains information about the Signature Requests sent in bulk. | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `bulkSendJob`*_required_ | [```BulkSendJobResponse```](BulkSendJobResponse.md) | | | +| `listInfo`*_required_ | [```ListInfoResponse```](ListInfoResponse.md) | | | +| `signatureRequests`*_required_ | [```List```](BulkSendJobGetResponseSignatureRequests.md) | Contains information about the Signature Requests sent in bulk. | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/BulkSendJobGetResponseSignatureRequests.md b/docs/BulkSendJobGetResponseSignatureRequests.md index 8cf2c0b..ba283af 100644 --- a/docs/BulkSendJobGetResponseSignatureRequests.md +++ b/docs/BulkSendJobGetResponseSignatureRequests.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `testMode` | ```Boolean``` | Whether this is a test signature request. Test requests have no legal value. Defaults to `false`. | | | `signatureRequestId` | ```String``` | The id of the SignatureRequest. | | | `requesterEmailAddress` | ```String``` | The email address of the initiator of the SignatureRequest. | | diff --git a/docs/BulkSendJobListResponse.md b/docs/BulkSendJobListResponse.md index f0ef7df..e5eb231 100644 --- a/docs/BulkSendJobListResponse.md +++ b/docs/BulkSendJobListResponse.md @@ -6,10 +6,10 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `bulkSendJobs` | [```List```](BulkSendJobResponse.md) | Contains a list of BulkSendJobs that the API caller has access to. | | -| `listInfo` | [```ListInfoResponse```](ListInfoResponse.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `bulkSendJobs`*_required_ | [```List```](BulkSendJobResponse.md) | Contains a list of BulkSendJobs that the API caller has access to. | | +| `listInfo`*_required_ | [```ListInfoResponse```](ListInfoResponse.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/BulkSendJobResponse.md b/docs/BulkSendJobResponse.md index c97fb3d..eb2278a 100644 --- a/docs/BulkSendJobResponse.md +++ b/docs/BulkSendJobResponse.md @@ -6,8 +6,8 @@ Contains information about the BulkSendJob such as when it was created and how m ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `bulkSendJobId` | ```String``` | The id of the BulkSendJob. | | | `total` | ```Integer``` | The total amount of Signature Requests queued for sending. | | | `isCreator` | ```Boolean``` | True if you are the owner of this BulkSendJob, false if it's been shared with you by a team member. | | diff --git a/docs/BulkSendJobSendResponse.md b/docs/BulkSendJobSendResponse.md index 9ca5095..532b64b 100644 --- a/docs/BulkSendJobSendResponse.md +++ b/docs/BulkSendJobSendResponse.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `bulkSendJob` | [```BulkSendJobResponse```](BulkSendJobResponse.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `bulkSendJob`*_required_ | [```BulkSendJobResponse```](BulkSendJobResponse.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/EmbeddedApi.md b/docs/EmbeddedApi.md index 7ea121b..62955f9 100644 --- a/docs/EmbeddedApi.md +++ b/docs/EmbeddedApi.md @@ -2,8 +2,8 @@ All URIs are relative to *https://api.hellosign.com/v3* -Method | HTTP request | Description -------------- | ------------- | ------------- +| Method | HTTP request | Description | +|------------- | ------------- | -------------| [**embeddedEditUrl**](EmbeddedApi.md#embeddedEditUrl) | **POST** /embedded/edit_url/{template_id} | Get Embedded Template Edit URL [**embeddedSignUrl**](EmbeddedApi.md#embeddedSignUrl) | **GET** /embedded/sign_url/{signature_id} | Get Embedded Sign URL @@ -65,8 +65,8 @@ public class Main { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **templateId** | **String**| The id of the template to edit. | **embeddedEditUrlRequest** | [**EmbeddedEditUrlRequest**](EmbeddedEditUrlRequest.md)| | @@ -140,8 +140,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **signatureId** | **String**| The id of the signature to get a signature url for. | ### Return type diff --git a/docs/EmbeddedEditUrlRequest.md b/docs/EmbeddedEditUrlRequest.md index 3026512..4e2d8c2 100644 --- a/docs/EmbeddedEditUrlRequest.md +++ b/docs/EmbeddedEditUrlRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `allowEditCcs` | ```Boolean``` | This allows the requester to enable/disable to add or change CC roles when editing the template. | | | `ccRoles` | ```List``` | The CC roles that must be assigned when using the template to send a signature request. To remove all CC roles, pass in a single role with no name. For use in a POST request. | | | `editorOptions` | [```SubEditorOptions```](SubEditorOptions.md) | | | diff --git a/docs/EmbeddedEditUrlResponse.md b/docs/EmbeddedEditUrlResponse.md index ec2ce55..959e0c7 100644 --- a/docs/EmbeddedEditUrlResponse.md +++ b/docs/EmbeddedEditUrlResponse.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `embedded` | [```EmbeddedEditUrlResponseEmbedded```](EmbeddedEditUrlResponseEmbedded.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `embedded`*_required_ | [```EmbeddedEditUrlResponseEmbedded```](EmbeddedEditUrlResponseEmbedded.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/EmbeddedEditUrlResponseEmbedded.md b/docs/EmbeddedEditUrlResponseEmbedded.md index 6406555..78ad702 100644 --- a/docs/EmbeddedEditUrlResponseEmbedded.md +++ b/docs/EmbeddedEditUrlResponseEmbedded.md @@ -6,8 +6,8 @@ An embedded template object. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `editUrl` | ```String``` | A template url that can be opened in an iFrame. | | | `expiresAt` | ```Integer``` | The specific time that the the `edit_url` link expires, in epoch. | | diff --git a/docs/EmbeddedSignUrlResponse.md b/docs/EmbeddedSignUrlResponse.md index a6f119c..6f39b97 100644 --- a/docs/EmbeddedSignUrlResponse.md +++ b/docs/EmbeddedSignUrlResponse.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `embedded` | [```EmbeddedSignUrlResponseEmbedded```](EmbeddedSignUrlResponseEmbedded.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `embedded`*_required_ | [```EmbeddedSignUrlResponseEmbedded```](EmbeddedSignUrlResponseEmbedded.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/EmbeddedSignUrlResponseEmbedded.md b/docs/EmbeddedSignUrlResponseEmbedded.md index 4f3a834..b2fd6c9 100644 --- a/docs/EmbeddedSignUrlResponseEmbedded.md +++ b/docs/EmbeddedSignUrlResponseEmbedded.md @@ -6,8 +6,8 @@ An object that contains necessary information to set up embedded signing. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `signUrl` | ```String``` | A signature url that can be opened in an iFrame. | | | `expiresAt` | ```Integer``` | The specific time that the the `sign_url` link expires, in epoch. | | diff --git a/docs/ErrorResponse.md b/docs/ErrorResponse.md index e3153c6..f1a560c 100644 --- a/docs/ErrorResponse.md +++ b/docs/ErrorResponse.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `error`*_required_ | [```ErrorResponseError```](ErrorResponseError.md) | | | diff --git a/docs/ErrorResponseError.md b/docs/ErrorResponseError.md index 91f1e8e..656aa5c 100644 --- a/docs/ErrorResponseError.md +++ b/docs/ErrorResponseError.md @@ -6,8 +6,8 @@ Contains information about an error that occurred. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `errorMsg`*_required_ | ```String``` | Message describing an error. | | | `errorName`*_required_ | ```String``` | Name of the error. | | | `errorPath` | ```String``` | Path at which an error occurred. | | diff --git a/docs/EventCallbackRequest.md b/docs/EventCallbackRequest.md index 9286aec..73daf94 100644 --- a/docs/EventCallbackRequest.md +++ b/docs/EventCallbackRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `event`*_required_ | [```EventCallbackRequestEvent```](EventCallbackRequestEvent.md) | | | | `account` | [```AccountResponse```](AccountResponse.md) | | | | `signatureRequest` | [```SignatureRequestResponse```](SignatureRequestResponse.md) | | | diff --git a/docs/EventCallbackRequestEvent.md b/docs/EventCallbackRequestEvent.md index 1e71c97..19ab491 100644 --- a/docs/EventCallbackRequestEvent.md +++ b/docs/EventCallbackRequestEvent.md @@ -6,8 +6,8 @@ Basic information about the event that occurred. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `eventTime`*_required_ | ```String``` | Time the event was created (using Unix time). | | | `eventType`*_required_ | [```EventTypeEnum```](#EventTypeEnum) | Type of callback event that was triggered. | | | `eventHash`*_required_ | ```String``` | Generated hash used to verify source of event data. | | @@ -17,7 +17,7 @@ Name | Type | Description | Notes ## Enum: EventTypeEnum -Name | Value +| Name | Value | ---- | ----- | ACCOUNT_CONFIRMED | "account_confirmed" | | UNKNOWN_ERROR | "unknown_error" | diff --git a/docs/EventCallbackRequestEventMetadata.md b/docs/EventCallbackRequestEventMetadata.md index c8a911f..13208c2 100644 --- a/docs/EventCallbackRequestEventMetadata.md +++ b/docs/EventCallbackRequestEventMetadata.md @@ -6,8 +6,8 @@ Specific metadata about the event. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `relatedSignatureId` | ```String``` | Signature ID for a specific signer. Applicable to `signature_request_signed` and `signature_request_viewed` events. | | | `reportedForAccountId` | ```String``` | Account ID the event was reported for. | | | `reportedForAppId` | ```String``` | App ID the event was reported for. | | diff --git a/docs/FaxLineAddUserRequest.md b/docs/FaxLineAddUserRequest.md new file mode 100644 index 0000000..1c9e997 --- /dev/null +++ b/docs/FaxLineAddUserRequest.md @@ -0,0 +1,16 @@ + + +# FaxLineAddUserRequest + + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `number`*_required_ | ```String``` | The Fax Line number. | | +| `accountId` | ```String``` | Account ID | | +| `emailAddress` | ```String``` | Email address | | + + + diff --git a/docs/FaxLineApi.md b/docs/FaxLineApi.md new file mode 100644 index 0000000..1997f1f --- /dev/null +++ b/docs/FaxLineApi.md @@ -0,0 +1,504 @@ +# FaxLineApi + +All URIs are relative to *https://api.hellosign.com/v3* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +[**faxLineAddUser**](FaxLineApi.md#faxLineAddUser) | **PUT** /fax_line/add_user | Add Fax Line User +[**faxLineAreaCodeGet**](FaxLineApi.md#faxLineAreaCodeGet) | **GET** /fax_line/area_codes | Get Available Fax Line Area Codes +[**faxLineCreate**](FaxLineApi.md#faxLineCreate) | **POST** /fax_line/create | Purchase Fax Line +[**faxLineDelete**](FaxLineApi.md#faxLineDelete) | **DELETE** /fax_line | Delete Fax Line +[**faxLineGet**](FaxLineApi.md#faxLineGet) | **GET** /fax_line | Get Fax Line +[**faxLineList**](FaxLineApi.md#faxLineList) | **GET** /fax_line/list | List Fax Lines +[**faxLineRemoveUser**](FaxLineApi.md#faxLineRemoveUser) | **PUT** /fax_line/remove_user | Remove Fax Line Access + + + +## faxLineAddUser + +> FaxLineResponse faxLineAddUser(faxLineAddUserRequest) + +Add Fax Line User + +Grants a user access to the specified Fax Line. + +### Example + +```java +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.model.*; + +import java.util.List; + +public class Example { + public static void main(String[] args) { + var apiClient = Configuration.getDefaultApiClient() + .setApiKey("YOUR_API_KEY"); + + var faxLineApi = new FaxLineApi(apiClient); + + var data = new FaxLineAddUserRequest() + .number("[FAX_NUMBER]") + .emailAddress("member@dropboxsign.com"); + + try { + FaxLineResponse result = faxLineApi.faxLineAddUser(data); + System.out.println(result); + } catch (ApiException e) { + 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 | +|------------- | ------------- | ------------- | -------------| + **faxLineAddUserRequest** | [**FaxLineAddUserRequest**](FaxLineAddUserRequest.md)| | + +### Return type + +[**FaxLineResponse**](FaxLineResponse.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **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 | - | + + +## faxLineAreaCodeGet + +> FaxLineAreaCodeGetResponse faxLineAreaCodeGet(country, state, province, city) + +Get Available Fax Line Area Codes + +Returns a response with the area codes available for a given state/provice and city. + +### Example + +```java +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.model.*; + +import java.util.List; + +public class Example { + public static void main(String[] args) { + var apiClient = Configuration.getDefaultApiClient() + .setApiKey("YOUR_API_KEY"); + + var faxLineApi = new FaxLineApi(apiClient); + + try { + FaxLineAreaCodeGetResponse result = faxLineApi.faxLineAreaCodeGet("US", "CA"); + System.out.println(result); + } catch (ApiException e) { + 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 | +|------------- | ------------- | ------------- | -------------| + **country** | **String**| Filter area codes by country. | [enum: CA, US, UK] + **state** | **String**| Filter area codes by state. | [optional] [enum: AK, AL, AR, AZ, CA, CO, CT, DC, DE, FL, GA, HI, IA, ID, IL, IN, KS, KY, LA, MA, MD, ME, MI, MN, MO, MS, MT, NC, ND, NE, NH, NJ, NM, NV, NY, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VA, VT, WA, WI, WV, WY] + **province** | **String**| Filter area codes by province. | [optional] [enum: AB, BC, MB, NB, NL, NT, NS, NU, ON, PE, QC, SK, YT] + **city** | **String**| Filter area codes by city. | [optional] + +### Return type + +[**FaxLineAreaCodeGetResponse**](FaxLineAreaCodeGetResponse.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **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 | - | + + +## faxLineCreate + +> FaxLineResponse faxLineCreate(faxLineCreateRequest) + +Purchase Fax Line + +Purchases a new Fax Line. + +### Example + +```java +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.model.*; + +import java.util.List; + +public class Example { + public static void main(String[] args) { + var apiClient = Configuration.getDefaultApiClient() + .setApiKey("YOUR_API_KEY"); + + var faxLineApi = new FaxLineApi(apiClient); + + var data = new FaxLineCreateRequest() + .areaCode(209) + .country("US"); + + try { + FaxLineResponse result = faxLineApi.faxLineCreate(data); + System.out.println(result); + } catch (ApiException e) { + 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 | +|------------- | ------------- | ------------- | -------------| + **faxLineCreateRequest** | [**FaxLineCreateRequest**](FaxLineCreateRequest.md)| | + +### Return type + +[**FaxLineResponse**](FaxLineResponse.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **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 | - | + + +## faxLineDelete + +> faxLineDelete(faxLineDeleteRequest) + +Delete Fax Line + +Deletes the specified Fax Line from the subscription. + +### Example + +```java +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.model.*; + +import java.util.List; + +public class Example { + public static void main(String[] args) { + var apiClient = Configuration.getDefaultApiClient() + .setApiKey("YOUR_API_KEY"); + + var faxLineApi = new FaxLineApi(apiClient); + + var data = new FaxLineDeleteRequest() + .number("[FAX_NUMBER]"); + + try { + faxLineApi.faxLineDelete(data); + } catch (ApiException e) { + 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 | +|------------- | ------------- | ------------- | -------------| + **faxLineDeleteRequest** | [**FaxLineDeleteRequest**](FaxLineDeleteRequest.md)| | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **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 | - | + + +## faxLineGet + +> FaxLineResponse faxLineGet(number) + +Get Fax Line + +Returns the properties and settings of a Fax Line. + +### Example + +```java +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.model.*; + +import java.util.List; + +public class Example { + public static void main(String[] args) { + var apiClient = Configuration.getDefaultApiClient() + .setApiKey("YOUR_API_KEY"); + + var faxLineApi = new FaxLineApi(apiClient); + + try { + FaxLineResponse result = faxLineApi.faxLineGet("[FAX_NUMBER]"); + System.out.println(result); + } catch (ApiException e) { + 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 | +|------------- | ------------- | ------------- | -------------| + **number** | **String**| The Fax Line number. | + +### Return type + +[**FaxLineResponse**](FaxLineResponse.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **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 | - | + + +## faxLineList + +> FaxLineListResponse faxLineList(accountId, page, pageSize, showTeamLines) + +List Fax Lines + +Returns the properties and settings of multiple Fax Lines. + +### Example + +```java +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.model.*; + +import java.util.List; + +public class Example { + public static void main(String[] args) { + var apiClient = Configuration.getDefaultApiClient() + .setApiKey("YOUR_API_KEY"); + + var faxLineApi = new FaxLineApi(apiClient); + + try { + FaxLineListResponse result = faxLineApi.faxLineList(); + System.out.println(result); + } catch (ApiException e) { + 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 | +|------------- | ------------- | ------------- | -------------| + **accountId** | **String**| Account ID | [optional] + **page** | **Integer**| Page | [optional] [default to 1] + **pageSize** | **Integer**| Page size | [optional] [default to 20] + **showTeamLines** | **Boolean**| Show team lines | [optional] + +### Return type + +[**FaxLineListResponse**](FaxLineListResponse.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **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 | - | + + +## faxLineRemoveUser + +> FaxLineResponse faxLineRemoveUser(faxLineRemoveUserRequest) + +Remove Fax Line Access + +Removes a user's access to the specified Fax Line. + +### Example + +```java +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.model.*; + +import java.util.List; + +public class Example { + public static void main(String[] args) { + var apiClient = Configuration.getDefaultApiClient() + .setApiKey("YOUR_API_KEY"); + + var faxLineApi = new FaxLineApi(apiClient); + + var data = new FaxLineRemoveUserRequest() + .number("[FAX_NUMBER]") + .emailAddress("member@dropboxsign.com"); + + try { + FaxLineResponse result = faxLineApi.faxLineRemoveUser(data); + System.out.println(result); + } catch (ApiException e) { + 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 | +|------------- | ------------- | ------------- | -------------| + **faxLineRemoveUserRequest** | [**FaxLineRemoveUserRequest**](FaxLineRemoveUserRequest.md)| | + +### Return type + +[**FaxLineResponse**](FaxLineResponse.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **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 | - | + diff --git a/docs/FaxLineAreaCodeGetCountryEnum.md b/docs/FaxLineAreaCodeGetCountryEnum.md new file mode 100644 index 0000000..10275bc --- /dev/null +++ b/docs/FaxLineAreaCodeGetCountryEnum.md @@ -0,0 +1,15 @@ + + +# FaxLineAreaCodeGetCountryEnum + +## Enum + + +* `CA` (value: `"CA"`) + +* `US` (value: `"US"`) + +* `UK` (value: `"UK"`) + + + diff --git a/docs/FaxLineAreaCodeGetProvinceEnum.md b/docs/FaxLineAreaCodeGetProvinceEnum.md new file mode 100644 index 0000000..13cf500 --- /dev/null +++ b/docs/FaxLineAreaCodeGetProvinceEnum.md @@ -0,0 +1,35 @@ + + +# FaxLineAreaCodeGetProvinceEnum + +## Enum + + +* `AB` (value: `"AB"`) + +* `BC` (value: `"BC"`) + +* `MB` (value: `"MB"`) + +* `NB` (value: `"NB"`) + +* `NL` (value: `"NL"`) + +* `NT` (value: `"NT"`) + +* `NS` (value: `"NS"`) + +* `NU` (value: `"NU"`) + +* `ON` (value: `"ON"`) + +* `PE` (value: `"PE"`) + +* `QC` (value: `"QC"`) + +* `SK` (value: `"SK"`) + +* `YT` (value: `"YT"`) + + + diff --git a/docs/FaxLineAreaCodeGetResponse.md b/docs/FaxLineAreaCodeGetResponse.md new file mode 100644 index 0000000..0026193 --- /dev/null +++ b/docs/FaxLineAreaCodeGetResponse.md @@ -0,0 +1,14 @@ + + +# FaxLineAreaCodeGetResponse + + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `areaCodes`*_required_ | ```List``` | | | + + + diff --git a/docs/FaxLineAreaCodeGetStateEnum.md b/docs/FaxLineAreaCodeGetStateEnum.md new file mode 100644 index 0000000..577a48c --- /dev/null +++ b/docs/FaxLineAreaCodeGetStateEnum.md @@ -0,0 +1,111 @@ + + +# FaxLineAreaCodeGetStateEnum + +## Enum + + +* `AK` (value: `"AK"`) + +* `AL` (value: `"AL"`) + +* `AR` (value: `"AR"`) + +* `AZ` (value: `"AZ"`) + +* `CA` (value: `"CA"`) + +* `CO` (value: `"CO"`) + +* `CT` (value: `"CT"`) + +* `DC` (value: `"DC"`) + +* `DE` (value: `"DE"`) + +* `FL` (value: `"FL"`) + +* `GA` (value: `"GA"`) + +* `HI` (value: `"HI"`) + +* `IA` (value: `"IA"`) + +* `ID` (value: `"ID"`) + +* `IL` (value: `"IL"`) + +* `IN` (value: `"IN"`) + +* `KS` (value: `"KS"`) + +* `KY` (value: `"KY"`) + +* `LA` (value: `"LA"`) + +* `MA` (value: `"MA"`) + +* `MD` (value: `"MD"`) + +* `ME` (value: `"ME"`) + +* `MI` (value: `"MI"`) + +* `MN` (value: `"MN"`) + +* `MO` (value: `"MO"`) + +* `MS` (value: `"MS"`) + +* `MT` (value: `"MT"`) + +* `NC` (value: `"NC"`) + +* `ND` (value: `"ND"`) + +* `NE` (value: `"NE"`) + +* `NH` (value: `"NH"`) + +* `NJ` (value: `"NJ"`) + +* `NM` (value: `"NM"`) + +* `NV` (value: `"NV"`) + +* `NY` (value: `"NY"`) + +* `OH` (value: `"OH"`) + +* `OK` (value: `"OK"`) + +* `OR` (value: `"OR"`) + +* `PA` (value: `"PA"`) + +* `RI` (value: `"RI"`) + +* `SC` (value: `"SC"`) + +* `SD` (value: `"SD"`) + +* `TN` (value: `"TN"`) + +* `TX` (value: `"TX"`) + +* `UT` (value: `"UT"`) + +* `VA` (value: `"VA"`) + +* `VT` (value: `"VT"`) + +* `WA` (value: `"WA"`) + +* `WI` (value: `"WI"`) + +* `WV` (value: `"WV"`) + +* `WY` (value: `"WY"`) + + + diff --git a/docs/FaxLineCreateRequest.md b/docs/FaxLineCreateRequest.md new file mode 100644 index 0000000..da9ba39 --- /dev/null +++ b/docs/FaxLineCreateRequest.md @@ -0,0 +1,27 @@ + + +# FaxLineCreateRequest + + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `areaCode`*_required_ | ```Integer``` | Area code | | +| `country`*_required_ | [```CountryEnum```](#CountryEnum) | Country | | +| `city` | ```String``` | City | | +| `accountId` | ```String``` | Account ID | | + + + +## Enum: CountryEnum + +| Name | Value | +---- | ----- +| CA | "CA" | +| US | "US" | +| UK | "UK" | + + + diff --git a/docs/FaxLineDeleteRequest.md b/docs/FaxLineDeleteRequest.md new file mode 100644 index 0000000..de1748f --- /dev/null +++ b/docs/FaxLineDeleteRequest.md @@ -0,0 +1,14 @@ + + +# FaxLineDeleteRequest + + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `number`*_required_ | ```String``` | The Fax Line number. | | + + + diff --git a/docs/FaxLineListResponse.md b/docs/FaxLineListResponse.md new file mode 100644 index 0000000..69891dc --- /dev/null +++ b/docs/FaxLineListResponse.md @@ -0,0 +1,16 @@ + + +# FaxLineListResponse + + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `listInfo`*_required_ | [```ListInfoResponse```](ListInfoResponse.md) | | | +| `faxLines`*_required_ | [```List```](FaxLineResponseFaxLine.md) | | | +| `warnings` | [```WarningResponse```](WarningResponse.md) | | | + + + diff --git a/docs/FaxLineRemoveUserRequest.md b/docs/FaxLineRemoveUserRequest.md new file mode 100644 index 0000000..51d81b8 --- /dev/null +++ b/docs/FaxLineRemoveUserRequest.md @@ -0,0 +1,16 @@ + + +# FaxLineRemoveUserRequest + + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `number`*_required_ | ```String``` | The Fax Line number. | | +| `accountId` | ```String``` | Account ID | | +| `emailAddress` | ```String``` | Email address | | + + + diff --git a/docs/FaxLineResponse.md b/docs/FaxLineResponse.md new file mode 100644 index 0000000..c5256bb --- /dev/null +++ b/docs/FaxLineResponse.md @@ -0,0 +1,15 @@ + + +# FaxLineResponse + + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `faxLine`*_required_ | [```FaxLineResponseFaxLine```](FaxLineResponseFaxLine.md) | | | +| `warnings` | [```WarningResponse```](WarningResponse.md) | | | + + + diff --git a/docs/FaxLineResponseFaxLine.md b/docs/FaxLineResponseFaxLine.md new file mode 100644 index 0000000..daf0d20 --- /dev/null +++ b/docs/FaxLineResponseFaxLine.md @@ -0,0 +1,17 @@ + + +# FaxLineResponseFaxLine + + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `number` | ```String``` | Number | | +| `createdAt` | ```Integer``` | Created at | | +| `updatedAt` | ```Integer``` | Updated at | | +| `accounts` | [```List```](AccountResponse.md) | | | + + + diff --git a/docs/FileResponse.md b/docs/FileResponse.md index 4851cb4..058a80e 100644 --- a/docs/FileResponse.md +++ b/docs/FileResponse.md @@ -6,10 +6,10 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `fileUrl` | ```String``` | URL to the file. | | -| `expiresAt` | ```Integer``` | When the link expires. | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `fileUrl`*_required_ | ```String``` | URL to the file. | | +| `expiresAt`*_required_ | ```Integer``` | When the link expires. | | diff --git a/docs/FileResponseDataUri.md b/docs/FileResponseDataUri.md index 1950223..65c0b7d 100644 --- a/docs/FileResponseDataUri.md +++ b/docs/FileResponseDataUri.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `dataUri` | ```String``` | File as base64 encoded string. | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `dataUri`*_required_ | ```String``` | File as base64 encoded string. | | diff --git a/docs/ListInfoResponse.md b/docs/ListInfoResponse.md index 02063e7..b9d464e 100644 --- a/docs/ListInfoResponse.md +++ b/docs/ListInfoResponse.md @@ -6,8 +6,8 @@ Contains pagination information about the data returned. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `numPages` | ```Integer``` | Total number of pages available. | | | `numResults` | ```Integer``` | Total number of objects available. | | | `page` | ```Integer``` | Number of the page being returned. | | diff --git a/docs/OAuthApi.md b/docs/OAuthApi.md index 466367a..533052b 100644 --- a/docs/OAuthApi.md +++ b/docs/OAuthApi.md @@ -2,8 +2,8 @@ All URIs are relative to *https://api.hellosign.com/v3* -Method | HTTP request | Description -------------- | ------------- | ------------- +| Method | HTTP request | Description | +|------------- | ------------- | -------------| [**oauthTokenGenerate**](OAuthApi.md#oauthTokenGenerate) | **POST** /oauth/token | OAuth Token Generate [**oauthTokenRefresh**](OAuthApi.md#oauthTokenRefresh) | **POST** /oauth/token?refresh | OAuth Token Refresh @@ -56,8 +56,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **oauthTokenGenerateRequest** | [**OAuthTokenGenerateRequest**](OAuthTokenGenerateRequest.md)| | ### Return type @@ -123,8 +123,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **oauthTokenRefreshRequest** | [**OAuthTokenRefreshRequest**](OAuthTokenRefreshRequest.md)| | ### Return type diff --git a/docs/OAuthTokenGenerateRequest.md b/docs/OAuthTokenGenerateRequest.md index 7f376db..45ad0b0 100644 --- a/docs/OAuthTokenGenerateRequest.md +++ b/docs/OAuthTokenGenerateRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `clientId`*_required_ | ```String``` | The client id of the app requesting authorization. | | | `clientSecret`*_required_ | ```String``` | The secret token of your app. | | | `code`*_required_ | ```String``` | The code passed to your callback when the user granted access. | | diff --git a/docs/OAuthTokenRefreshRequest.md b/docs/OAuthTokenRefreshRequest.md index b88bb9e..2b985fa 100644 --- a/docs/OAuthTokenRefreshRequest.md +++ b/docs/OAuthTokenRefreshRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `grantType`*_required_ | ```String``` | When refreshing an existing token use `refresh_token`. | | | `refreshToken`*_required_ | ```String``` | The token provided when you got the expired access token. | | diff --git a/docs/OAuthTokenResponse.md b/docs/OAuthTokenResponse.md index 28da620..86824cc 100644 --- a/docs/OAuthTokenResponse.md +++ b/docs/OAuthTokenResponse.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `accessToken` | ```String``` | | | | `tokenType` | ```String``` | | | | `refreshToken` | ```String``` | | | diff --git a/docs/ReportApi.md b/docs/ReportApi.md index e6af8fa..e0a4097 100644 --- a/docs/ReportApi.md +++ b/docs/ReportApi.md @@ -2,8 +2,8 @@ All URIs are relative to *https://api.hellosign.com/v3* -Method | HTTP request | Description -------------- | ------------- | ------------- +| Method | HTTP request | Description | +|------------- | ------------- | -------------| [**reportCreate**](ReportApi.md#reportCreate) | **POST** /report/create | Create Report @@ -68,8 +68,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **reportCreateRequest** | [**ReportCreateRequest**](ReportCreateRequest.md)| | ### Return type diff --git a/docs/ReportCreateRequest.md b/docs/ReportCreateRequest.md index 99053df..d2f4b67 100644 --- a/docs/ReportCreateRequest.md +++ b/docs/ReportCreateRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `endDate`*_required_ | ```String``` | The (inclusive) end date for the report data in `MM/DD/YYYY` format. | | | `reportType`*_required_ | [```List<ReportTypeEnum>```](#List<ReportTypeEnum>) | The type(s) of the report you are requesting. Allowed values are `user_activity` and `document_status`. User activity reports contain list of all users and their activity during the specified date range. Document status report contain a list of signature requests created in the specified time range (and their status). | | | `startDate`*_required_ | ```String``` | The (inclusive) start date for the report data in `MM/DD/YYYY` format. | | @@ -16,7 +16,7 @@ Name | Type | Description | Notes ## Enum: List<ReportTypeEnum> -Name | Value +| Name | Value | ---- | ----- | USER_ACTIVITY | "user_activity" | | DOCUMENT_STATUS | "document_status" | diff --git a/docs/ReportCreateResponse.md b/docs/ReportCreateResponse.md index 9f8c117..9fc8565 100644 --- a/docs/ReportCreateResponse.md +++ b/docs/ReportCreateResponse.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `report` | [```ReportResponse```](ReportResponse.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `report`*_required_ | [```ReportResponse```](ReportResponse.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/ReportResponse.md b/docs/ReportResponse.md index ade5b63..b48dde6 100644 --- a/docs/ReportResponse.md +++ b/docs/ReportResponse.md @@ -6,8 +6,8 @@ Contains information about the report request. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `success` | ```String``` | A message indicating the requested operation's success | | | `startDate` | ```String``` | The (inclusive) start date for the report data in MM/DD/YYYY format. | | | `endDate` | ```String``` | The (inclusive) end date for the report data in MM/DD/YYYY format. | | @@ -17,7 +17,7 @@ Name | Type | Description | Notes ## Enum: List<ReportTypeEnum> -Name | Value +| Name | Value | ---- | ----- | USER_ACTIVITY | "user_activity" | | DOCUMENT_STATUS | "document_status" | diff --git a/docs/SignatureRequestApi.md b/docs/SignatureRequestApi.md index f8e0100..ee42461 100644 --- a/docs/SignatureRequestApi.md +++ b/docs/SignatureRequestApi.md @@ -2,8 +2,8 @@ All URIs are relative to *https://api.hellosign.com/v3* -Method | HTTP request | Description -------------- | ------------- | ------------- +| Method | HTTP request | Description | +|------------- | ------------- | -------------| [**signatureRequestBulkCreateEmbeddedWithTemplate**](SignatureRequestApi.md#signatureRequestBulkCreateEmbeddedWithTemplate) | **POST** /signature_request/bulk_create_embedded_with_template | Embedded Bulk Send with Template [**signatureRequestBulkSendWithTemplate**](SignatureRequestApi.md#signatureRequestBulkSendWithTemplate) | **POST** /signature_request/bulk_send_with_template | Bulk Send with Template [**signatureRequestCancel**](SignatureRequestApi.md#signatureRequestCancel) | **POST** /signature_request/cancel/{signature_request_id} | Cancel Incomplete Signature Request @@ -115,8 +115,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **signatureRequestBulkCreateEmbeddedWithTemplateRequest** | [**SignatureRequestBulkCreateEmbeddedWithTemplateRequest**](SignatureRequestBulkCreateEmbeddedWithTemplateRequest.md)| | ### Return type @@ -231,8 +231,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **signatureRequestBulkSendWithTemplateRequest** | [**SignatureRequestBulkSendWithTemplateRequest**](SignatureRequestBulkSendWithTemplateRequest.md)| | ### Return type @@ -311,8 +311,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **signatureRequestId** | **String**| The id of the incomplete SignatureRequest to cancel. | ### Return type @@ -414,8 +414,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **signatureRequestCreateEmbeddedRequest** | [**SignatureRequestCreateEmbeddedRequest**](SignatureRequestCreateEmbeddedRequest.md)| | ### Return type @@ -508,8 +508,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **signatureRequestCreateEmbeddedWithTemplateRequest** | [**SignatureRequestCreateEmbeddedWithTemplateRequest**](SignatureRequestCreateEmbeddedWithTemplateRequest.md)| | ### Return type @@ -585,8 +585,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **signatureRequestId** | **String**| The id of the SignatureRequest to retrieve. | **fileType** | **String**| Set to `pdf` for a single merged document or `zip` for a collection of individual documents. | [optional] [default to pdf] [enum: pdf, zip] @@ -662,8 +662,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **signatureRequestId** | **String**| The id of the SignatureRequest to retrieve. | ### Return type @@ -738,8 +738,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **signatureRequestId** | **String**| The id of the SignatureRequest to retrieve. | **forceDownload** | **Integer**| By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. | [optional] [default to 1] @@ -813,8 +813,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **signatureRequestId** | **String**| The id of the SignatureRequest to retrieve. | ### Return type @@ -897,8 +897,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **accountId** | **String**| Which account to return SignatureRequests for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. | [optional] **page** | **Integer**| Which page number of the SignatureRequest List to return. Defaults to `1`. | [optional] [default to 1] **pageSize** | **Integer**| Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. | [optional] [default to 20] @@ -974,8 +974,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **signatureRequestId** | **String**| The id of the SignatureRequest to release. | ### Return type @@ -1053,8 +1053,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **signatureRequestId** | **String**| The id of the SignatureRequest to send a reminder for. | **signatureRequestRemindRequest** | [**SignatureRequestRemindRequest**](SignatureRequestRemindRequest.md)| | @@ -1130,8 +1130,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **signatureRequestId** | **String**| The id of the SignatureRequest to remove. | ### Return type @@ -1238,8 +1238,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **signatureRequestSendRequest** | [**SignatureRequestSendRequest**](SignatureRequestSendRequest.md)| | ### Return type @@ -1344,8 +1344,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **signatureRequestSendWithTemplateRequest** | [**SignatureRequestSendWithTemplateRequest**](SignatureRequestSendWithTemplateRequest.md)| | ### Return type @@ -1426,8 +1426,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **signatureRequestId** | **String**| The id of the SignatureRequest to update. | **signatureRequestUpdateRequest** | [**SignatureRequestUpdateRequest**](SignatureRequestUpdateRequest.md)| | diff --git a/docs/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.md b/docs/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.md index fae117a..4243ead 100644 --- a/docs/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.md +++ b/docs/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `templateIds`*_required_ | ```List``` | Use `template_ids` to create a SignatureRequest from one or more templates, in the order in which the template will be used. | | | `clientId`*_required_ | ```String``` | Client id of the app you're using to create this embedded signature request. Used for security purposes. | | | `signerFile` | ```File``` | `signer_file` is a CSV file defining values and options for signer fields. Required unless a `signer_list` is used, you may not use both. The CSV can have the following columns:

- `name`: the name of the signer filling the role of RoleName - `email_address`: email address of the signer filling the role of RoleName - `pin`: the 4- to 12-character access code that will secure this signer's signature page (optional) - `sms_phone_number`: An E.164 formatted phone number that will receive a code via SMS to access this signer's signature page. (optional)

By using the feature, you agree you are responsible for obtaining a signer's consent to receive text messages from Dropbox Sign related to this signature request and confirm you have obtained such consent from all signers prior to enabling SMS delivery for this signature request. [Learn more](https://faq.hellosign.com/hc/en-us/articles/15815316468877-Dropbox-Sign-SMS-tools-add-on).

**NOTE:** Not available in test mode and requires a Standard plan or higher. - `*_field`: any column with a _field" suffix will be treated as a custom field (optional)

You may only specify field values here, any other options should be set in the custom_fields request parameter.

Example CSV:

``` name, email_address, pin, company_field George, george@example.com, d79a3td, ABC Corp Mary, mary@example.com, gd9as5b, 123 LLC ``` | | diff --git a/docs/SignatureRequestBulkSendWithTemplateRequest.md b/docs/SignatureRequestBulkSendWithTemplateRequest.md index e573522..1798f6f 100644 --- a/docs/SignatureRequestBulkSendWithTemplateRequest.md +++ b/docs/SignatureRequestBulkSendWithTemplateRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `templateIds`*_required_ | ```List``` | Use `template_ids` to create a SignatureRequest from one or more templates, in the order in which the template will be used. | | | `signerFile` | ```File``` | `signer_file` is a CSV file defining values and options for signer fields. Required unless a `signer_list` is used, you may not use both. The CSV can have the following columns:

- `name`: the name of the signer filling the role of RoleName - `email_address`: email address of the signer filling the role of RoleName - `pin`: the 4- to 12-character access code that will secure this signer's signature page (optional) - `sms_phone_number`: An E.164 formatted phone number that will receive a code via SMS to access this signer's signature page. (optional)

By using the feature, you agree you are responsible for obtaining a signer's consent to receive text messages from Dropbox Sign related to this signature request and confirm you have obtained such consent from all signers prior to enabling SMS delivery for this signature request. [Learn more](https://faq.hellosign.com/hc/en-us/articles/15815316468877-Dropbox-Sign-SMS-tools-add-on).

**NOTE:** Not available in test mode and requires a Standard plan or higher. - `*_field`: any column with a _field" suffix will be treated as a custom field (optional)

You may only specify field values here, any other options should be set in the custom_fields request parameter.

Example CSV:

``` name, email_address, pin, company_field George, george@example.com, d79a3td, ABC Corp Mary, mary@example.com, gd9as5b, 123 LLC ``` | | | `signerList` | [```List```](SubBulkSignerList.md) | `signer_list` is an array defining values and options for signer fields. Required unless a `signer_file` is used, you may not use both. | | diff --git a/docs/SignatureRequestCreateEmbeddedRequest.md b/docs/SignatureRequestCreateEmbeddedRequest.md index fcfd185..383f8a8 100644 --- a/docs/SignatureRequestCreateEmbeddedRequest.md +++ b/docs/SignatureRequestCreateEmbeddedRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `clientId`*_required_ | ```String``` | Client id of the app you're using to create this embedded signature request. Used for security purposes. | | | `files` | ```List``` | Use `files[]` to indicate the uploaded file(s) to send for signature.

This endpoint requires either **files** or **file_urls[]**, but not both. | | | `fileUrls` | ```List``` | Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature.

This endpoint requires either **files** or **file_urls[]**, but not both. | | diff --git a/docs/SignatureRequestCreateEmbeddedWithTemplateRequest.md b/docs/SignatureRequestCreateEmbeddedWithTemplateRequest.md index a4dd8ce..050a7e6 100644 --- a/docs/SignatureRequestCreateEmbeddedWithTemplateRequest.md +++ b/docs/SignatureRequestCreateEmbeddedWithTemplateRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `templateIds`*_required_ | ```List``` | Use `template_ids` to create a SignatureRequest from one or more templates, in the order in which the template will be used. | | | `clientId`*_required_ | ```String``` | Client id of the app you're using to create this embedded signature request. Used for security purposes. | | | `signers`*_required_ | [```List```](SubSignatureRequestTemplateSigner.md) | Add Signers to your Templated-based Signature Request. | | diff --git a/docs/SignatureRequestGetResponse.md b/docs/SignatureRequestGetResponse.md index 7ce17ba..25ce665 100644 --- a/docs/SignatureRequestGetResponse.md +++ b/docs/SignatureRequestGetResponse.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `signatureRequest` | [```SignatureRequestResponse```](SignatureRequestResponse.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `signatureRequest`*_required_ | [```SignatureRequestResponse```](SignatureRequestResponse.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/SignatureRequestListResponse.md b/docs/SignatureRequestListResponse.md index 94fb156..6384d2a 100644 --- a/docs/SignatureRequestListResponse.md +++ b/docs/SignatureRequestListResponse.md @@ -6,10 +6,10 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `signatureRequests` | [```List```](SignatureRequestResponse.md) | Contains information about signature requests. | | -| `listInfo` | [```ListInfoResponse```](ListInfoResponse.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `signatureRequests`*_required_ | [```List```](SignatureRequestResponse.md) | Contains information about signature requests. | | +| `listInfo`*_required_ | [```ListInfoResponse```](ListInfoResponse.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/SignatureRequestRemindRequest.md b/docs/SignatureRequestRemindRequest.md index 1a16fc5..bf76e08 100644 --- a/docs/SignatureRequestRemindRequest.md +++ b/docs/SignatureRequestRemindRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `emailAddress`*_required_ | ```String``` | The email address of the signer to send a reminder to. | | | `name` | ```String``` | The name of the signer to send a reminder to. Include if two or more signers share an email address. | | diff --git a/docs/SignatureRequestResponse.md b/docs/SignatureRequestResponse.md index 50ae417..2c9efa5 100644 --- a/docs/SignatureRequestResponse.md +++ b/docs/SignatureRequestResponse.md @@ -6,8 +6,8 @@ Contains information about a signature request. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `testMode` | ```Boolean``` | Whether this is a test signature request. Test requests have no legal value. Defaults to `false`. | | | `signatureRequestId` | ```String``` | The id of the SignatureRequest. | | | `requesterEmailAddress` | ```String``` | The email address of the initiator of the SignatureRequest. | | diff --git a/docs/SignatureRequestResponseAttachment.md b/docs/SignatureRequestResponseAttachment.md index 23267b6..1ef3a20 100644 --- a/docs/SignatureRequestResponseAttachment.md +++ b/docs/SignatureRequestResponseAttachment.md @@ -6,8 +6,8 @@ Signer attachments. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `id`*_required_ | ```String``` | The unique ID for this attachment. | | | `signer`*_required_ | ```String``` | The Signer this attachment is assigned to. | | | `name`*_required_ | ```String``` | The name of this attachment. | | diff --git a/docs/SignatureRequestResponseCustomFieldBase.md b/docs/SignatureRequestResponseCustomFieldBase.md index 7dbca6c..7b5f104 100644 --- a/docs/SignatureRequestResponseCustomFieldBase.md +++ b/docs/SignatureRequestResponseCustomFieldBase.md @@ -9,8 +9,8 @@ An array of Custom Field objects containing the name and type of each custom fie ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this Custom Field. Only 'text' and 'checkbox' are currently supported. | | | `name`*_required_ | ```String``` | The name of the Custom Field. | | | `required` | ```Boolean``` | A boolean value denoting if this field is required. | | diff --git a/docs/SignatureRequestResponseCustomFieldCheckbox.md b/docs/SignatureRequestResponseCustomFieldCheckbox.md index e0f8e10..c2cb841 100644 --- a/docs/SignatureRequestResponseCustomFieldCheckbox.md +++ b/docs/SignatureRequestResponseCustomFieldCheckbox.md @@ -6,8 +6,8 @@ This class extends `SignatureRequestResponseCustomFieldBase`. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this Custom Field. Only 'text' and 'checkbox' are currently supported. | | | `value` | ```Boolean``` | A true/false for checkbox fields | | diff --git a/docs/SignatureRequestResponseCustomFieldText.md b/docs/SignatureRequestResponseCustomFieldText.md index c78e24d..23ceb56 100644 --- a/docs/SignatureRequestResponseCustomFieldText.md +++ b/docs/SignatureRequestResponseCustomFieldText.md @@ -6,8 +6,8 @@ This class extends `SignatureRequestResponseCustomFieldBase`. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this Custom Field. Only 'text' and 'checkbox' are currently supported. | | | `value` | ```String``` | A text string for text fields | | diff --git a/docs/SignatureRequestResponseDataBase.md b/docs/SignatureRequestResponseDataBase.md index 7504c49..a9605a4 100644 --- a/docs/SignatureRequestResponseDataBase.md +++ b/docs/SignatureRequestResponseDataBase.md @@ -6,8 +6,8 @@ An array of form field objects containing the name, value, and type of each text ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `apiId` | ```String``` | The unique ID for this field. | | | `signatureId` | ```String``` | The ID of the signature to which this response is linked. | | | `name` | ```String``` | The name of the form field. | | diff --git a/docs/SignatureRequestResponseDataValueCheckbox.md b/docs/SignatureRequestResponseDataValueCheckbox.md index 972c48d..fda5704 100644 --- a/docs/SignatureRequestResponseDataValueCheckbox.md +++ b/docs/SignatureRequestResponseDataValueCheckbox.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type` | ```String``` | A yes/no checkbox | | | `value` | ```Boolean``` | The value of the form field. | | diff --git a/docs/SignatureRequestResponseDataValueCheckboxMerge.md b/docs/SignatureRequestResponseDataValueCheckboxMerge.md index 6abdf96..96af5eb 100644 --- a/docs/SignatureRequestResponseDataValueCheckboxMerge.md +++ b/docs/SignatureRequestResponseDataValueCheckboxMerge.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type` | ```String``` | A checkbox field that has default value set by the api | | | `value` | ```String``` | The value of the form field. | | diff --git a/docs/SignatureRequestResponseDataValueDateSigned.md b/docs/SignatureRequestResponseDataValueDateSigned.md index 2b9e5a7..308bd8b 100644 --- a/docs/SignatureRequestResponseDataValueDateSigned.md +++ b/docs/SignatureRequestResponseDataValueDateSigned.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type` | ```String``` | A date | | | `value` | ```String``` | The value of the form field. | | diff --git a/docs/SignatureRequestResponseDataValueDropdown.md b/docs/SignatureRequestResponseDataValueDropdown.md index 8b5a0f1..599cb3c 100644 --- a/docs/SignatureRequestResponseDataValueDropdown.md +++ b/docs/SignatureRequestResponseDataValueDropdown.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type` | ```String``` | An input field for dropdowns | | | `value` | ```String``` | The value of the form field. | | diff --git a/docs/SignatureRequestResponseDataValueInitials.md b/docs/SignatureRequestResponseDataValueInitials.md index f1d0453..7f82d74 100644 --- a/docs/SignatureRequestResponseDataValueInitials.md +++ b/docs/SignatureRequestResponseDataValueInitials.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type` | ```String``` | An input field for initials | | | `value` | ```String``` | The value of the form field. | | diff --git a/docs/SignatureRequestResponseDataValueRadio.md b/docs/SignatureRequestResponseDataValueRadio.md index 2897f89..b8e073f 100644 --- a/docs/SignatureRequestResponseDataValueRadio.md +++ b/docs/SignatureRequestResponseDataValueRadio.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type` | ```String``` | An input field for radios | | | `value` | ```Boolean``` | The value of the form field. | | diff --git a/docs/SignatureRequestResponseDataValueSignature.md b/docs/SignatureRequestResponseDataValueSignature.md index bb7ce7f..910932c 100644 --- a/docs/SignatureRequestResponseDataValueSignature.md +++ b/docs/SignatureRequestResponseDataValueSignature.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type` | ```String``` | A signature input field | | | `value` | ```String``` | The value of the form field. | | diff --git a/docs/SignatureRequestResponseDataValueText.md b/docs/SignatureRequestResponseDataValueText.md index 837f27c..e08ec8f 100644 --- a/docs/SignatureRequestResponseDataValueText.md +++ b/docs/SignatureRequestResponseDataValueText.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type` | ```String``` | A text input field | | | `value` | ```String``` | The value of the form field. | | diff --git a/docs/SignatureRequestResponseDataValueTextMerge.md b/docs/SignatureRequestResponseDataValueTextMerge.md index 60349e2..2b5e0d3 100644 --- a/docs/SignatureRequestResponseDataValueTextMerge.md +++ b/docs/SignatureRequestResponseDataValueTextMerge.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type` | ```String``` | A text field that has default text set by the api | | | `value` | ```String``` | The value of the form field. | | diff --git a/docs/SignatureRequestResponseSignatures.md b/docs/SignatureRequestResponseSignatures.md index 3eac9df..2f0e16d 100644 --- a/docs/SignatureRequestResponseSignatures.md +++ b/docs/SignatureRequestResponseSignatures.md @@ -6,8 +6,8 @@ An array of signature objects, 1 for each signer. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `signatureId` | ```String``` | Signature identifier. | | | `signerGroupGuid` | ```String``` | Signer Group GUID | | | `signerEmailAddress` | ```String``` | The email address of the signer. | | diff --git a/docs/SignatureRequestSendRequest.md b/docs/SignatureRequestSendRequest.md index 5b156ef..9143039 100644 --- a/docs/SignatureRequestSendRequest.md +++ b/docs/SignatureRequestSendRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `files` | ```List``` | Use `files[]` to indicate the uploaded file(s) to send for signature.

This endpoint requires either **files** or **file_urls[]**, but not both. | | | `fileUrls` | ```List``` | Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature.

This endpoint requires either **files** or **file_urls[]**, but not both. | | | `signers` | [```List```](SubSignatureRequestSigner.md) | Add Signers to your Signature Request.

This endpoint requires either **signers** or **grouped_signers**, but not both. | | diff --git a/docs/SignatureRequestSendWithTemplateRequest.md b/docs/SignatureRequestSendWithTemplateRequest.md index 5ccd15d..7a8d8c8 100644 --- a/docs/SignatureRequestSendWithTemplateRequest.md +++ b/docs/SignatureRequestSendWithTemplateRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `templateIds`*_required_ | ```List``` | Use `template_ids` to create a SignatureRequest from one or more templates, in the order in which the template will be used. | | | `signers`*_required_ | [```List```](SubSignatureRequestTemplateSigner.md) | Add Signers to your Templated-based Signature Request. | | | `allowDecline` | ```Boolean``` | Allows signers to decline to sign a document if `true`. Defaults to `false`. | | diff --git a/docs/SignatureRequestUpdateRequest.md b/docs/SignatureRequestUpdateRequest.md index 4e11595..4b38c53 100644 --- a/docs/SignatureRequestUpdateRequest.md +++ b/docs/SignatureRequestUpdateRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `signatureId`*_required_ | ```String``` | The signature ID for the recipient. | | | `emailAddress` | ```String``` | The new email address for the recipient.

This will generate a new `signature_id` value.

**NOTE:** Optional if `name` is provided. | | | `name` | ```String``` | The new name for the recipient.

**NOTE:** Optional if `email_address` is provided. | | diff --git a/docs/SubAttachment.md b/docs/SubAttachment.md index a7e00e0..b5e9c80 100644 --- a/docs/SubAttachment.md +++ b/docs/SubAttachment.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `name`*_required_ | ```String``` | The name of attachment. | | | `signerIndex`*_required_ | ```Integer``` | The signer's index in the `signers` parameter (0-based indexing).

**NOTE:** Only one signer can be assigned per attachment. | | | `instructions` | ```String``` | The instructions for uploading the attachment. | | diff --git a/docs/SubBulkSignerList.md b/docs/SubBulkSignerList.md index 043abbb..918c935 100644 --- a/docs/SubBulkSignerList.md +++ b/docs/SubBulkSignerList.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `customFields` | [```List```](SubBulkSignerListCustomField.md) | An array of custom field values. | | | `signers` | [```List```](SubSignatureRequestTemplateSigner.md) | Add Signers to your Templated-based Signature Request. Allows the requester to specify editor options when a preparing a document.

Currently only templates with a single role are supported. All signers must have the same `role` value. | | diff --git a/docs/SubBulkSignerListCustomField.md b/docs/SubBulkSignerListCustomField.md index 2a7c9c0..b37ad53 100644 --- a/docs/SubBulkSignerListCustomField.md +++ b/docs/SubBulkSignerListCustomField.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `name`*_required_ | ```String``` | The name of the custom field. Must be the field's `name` or `api_id`. | | | `value`*_required_ | ```String``` | The value of the custom field. | | diff --git a/docs/SubCC.md b/docs/SubCC.md index 4f59a76..37eacd3 100644 --- a/docs/SubCC.md +++ b/docs/SubCC.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `role`*_required_ | ```String``` | Must match an existing CC role in chosen Template(s). Multiple CC recipients cannot share the same CC role. | | | `emailAddress`*_required_ | ```String``` | The email address of the CC recipient. | | diff --git a/docs/SubCustomField.md b/docs/SubCustomField.md index b65f804..a309fd6 100644 --- a/docs/SubCustomField.md +++ b/docs/SubCustomField.md @@ -10,8 +10,8 @@ For using pre-filled on repeatable signature requests, merge fields are added to ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `name`*_required_ | ```String``` | The name of a custom field. When working with pre-filled data, the custom field's name must have a matching merge field name or the field will remain empty on the document during signing. | | | `editor` | ```String``` | Used to create editable merge fields. When the value matches a role passed in with `signers`, that role can edit the data that was pre-filled to that field. This field is optional, but required when this custom field object is set to `required = true`.

**NOTE:** Editable merge fields are only supported for single signer requests (or the first signer in ordered signature requests). If used when there are multiple signers in an unordered signature request, the editor value is ignored and the field won't be editable. | | | `required` | ```Boolean``` | Used to set an editable merge field when working with pre-filled data. When `true`, the custom field must specify a signer role in `editor`. | | diff --git a/docs/SubEditorOptions.md b/docs/SubEditorOptions.md index b1c284b..5483d25 100644 --- a/docs/SubEditorOptions.md +++ b/docs/SubEditorOptions.md @@ -6,8 +6,8 @@ This allows the requester to specify editor options when a preparing a document ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `allowEditSigners` | ```Boolean``` | Allows requesters to edit the list of signers | | | `allowEditDocuments` | ```Boolean``` | Allows requesters to edit documents, including delete and add | | diff --git a/docs/SubFieldOptions.md b/docs/SubFieldOptions.md index 92ef40d..e1be769 100644 --- a/docs/SubFieldOptions.md +++ b/docs/SubFieldOptions.md @@ -6,15 +6,15 @@ This allows the requester to specify field options for a signature request. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `dateFormat`*_required_ | [```DateFormatEnum```](#DateFormatEnum) | Allows requester to specify the date format (see list of allowed [formats](/api/reference/constants/#date-formats))

**NOTE:** Only available for Premium and higher. | | ## Enum: DateFormatEnum -Name | Value +| Name | Value | ---- | ----- | MMDDYYYY | "MM / DD / YYYY" | | MM_DD_YYYY | "MM - DD - YYYY" | diff --git a/docs/SubFormFieldGroup.md b/docs/SubFormFieldGroup.md index 676afdd..c55ffa3 100644 --- a/docs/SubFormFieldGroup.md +++ b/docs/SubFormFieldGroup.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `groupId`*_required_ | ```String``` | ID of group. Use this to reference a specific group from the `group` value in `form_fields_per_document`. | | | `groupLabel`*_required_ | ```String``` | Name of the group | | | `requirement`*_required_ | ```String``` | Examples: `require_0-1` `require_1` `require_1-ormore`

- Check out the list of [acceptable `requirement` checkbox type values](/api/reference/constants/#checkbox-field-grouping). - Check out the list of [acceptable `requirement` radio type fields](/api/reference/constants/#radio-field-grouping). - Radio groups require **at least** two fields per group. | | diff --git a/docs/SubFormFieldRule.md b/docs/SubFormFieldRule.md index eb4d25e..ca44afd 100644 --- a/docs/SubFormFieldRule.md +++ b/docs/SubFormFieldRule.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `id`*_required_ | ```String``` | Must be unique across all defined rules. | | | `triggerOperator`*_required_ | ```String``` | Currently only `AND` is supported. Support for `OR` is being worked on. | | | `triggers`*_required_ | [```List```](SubFormFieldRuleTrigger.md) | An array of trigger definitions, the "if this" part of "**if this**, then that". Currently only a single trigger per rule is allowed. | | diff --git a/docs/SubFormFieldRuleAction.md b/docs/SubFormFieldRuleAction.md index 12828ad..6a2d434 100644 --- a/docs/SubFormFieldRuleAction.md +++ b/docs/SubFormFieldRuleAction.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `hidden`*_required_ | ```Boolean``` | `true` to hide the target field when rule is satisfied, otherwise `false`. | | | `type`*_required_ | [```TypeEnum```](#TypeEnum) | | | | `fieldId` | ```String``` | **field_id** or **group_id** is required, but not both.

Must reference the `api_id` of an existing field defined within `form_fields_per_document`.

Cannot use with `group_id`. Trigger and action fields must belong to the same signer. | | @@ -17,7 +17,7 @@ Name | Type | Description | Notes ## Enum: TypeEnum -Name | Value +| Name | Value | ---- | ----- | FIELD_VISIBILITY | "change-field-visibility" | | GROUP_VISIBILITY | "change-group-visibility" | diff --git a/docs/SubFormFieldRuleTrigger.md b/docs/SubFormFieldRuleTrigger.md index ed866d0..3a82561 100644 --- a/docs/SubFormFieldRuleTrigger.md +++ b/docs/SubFormFieldRuleTrigger.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `id`*_required_ | ```String``` | Must reference the `api_id` of an existing field defined within `form_fields_per_document`. Trigger and action fields and groups must belong to the same signer. | | | `operator`*_required_ | [```OperatorEnum```](#OperatorEnum) | Different field types allow different `operator` values: - Field type of **text**: - **is**: exact match - **not**: not exact match - **match**: regular expression, without /. Example: - OK `[a-zA-Z0-9]` - Not OK `/[a-zA-Z0-9]/` - Field type of **dropdown**: - **is**: exact match, single value - **not**: not exact match, single value - **any**: exact match, array of values. - **none**: not exact match, array of values. - Field type of **checkbox**: - **is**: exact match, single value - **not**: not exact match, single value - Field type of **radio**: - **is**: exact match, single value - **not**: not exact match, single value | | | `value` | ```String``` | **value** or **values** is required, but not both.

The value to match against **operator**.

- When **operator** is one of the following, **value** must be `String`: - `is` - `not` - `match`

Otherwise, - **checkbox**: When **type** of trigger is **checkbox**, **value** must be `0` or `1` - **radio**: When **type** of trigger is **radio**, **value** must be `1` | | @@ -17,7 +17,7 @@ Name | Type | Description | Notes ## Enum: OperatorEnum -Name | Value +| Name | Value | ---- | ----- | ANY | "any" | | IS | "is" | diff --git a/docs/SubFormFieldsPerDocumentBase.md b/docs/SubFormFieldsPerDocumentBase.md index 26ce88d..a44994a 100644 --- a/docs/SubFormFieldsPerDocumentBase.md +++ b/docs/SubFormFieldsPerDocumentBase.md @@ -19,8 +19,8 @@ The fields that should appear on the document, expressed as an array of objects. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `documentIndex`*_required_ | ```Integer``` | Represents the integer index of the `file` or `file_url` document the field should be attached to. | | | `apiId`*_required_ | ```String``` | An identifier for the field that is unique across all documents in the request. | | | `height`*_required_ | ```Integer``` | Size of the field in pixels. | | diff --git a/docs/SubFormFieldsPerDocumentCheckbox.md b/docs/SubFormFieldsPerDocumentCheckbox.md index efcf95d..c4e473f 100644 --- a/docs/SubFormFieldsPerDocumentCheckbox.md +++ b/docs/SubFormFieldsPerDocumentCheckbox.md @@ -6,8 +6,8 @@ This class extends `SubFormFieldsPerDocumentBase`. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | A yes/no checkbox. Use the `SubFormFieldsPerDocumentCheckbox` class. | | | `isChecked`*_required_ | ```Boolean``` | `true` for checking the checkbox field by default, otherwise `false`. | | | `group` | ```String``` | String referencing group defined in `form_field_groups` parameter. | | diff --git a/docs/SubFormFieldsPerDocumentCheckboxMerge.md b/docs/SubFormFieldsPerDocumentCheckboxMerge.md index efdc811..8243596 100644 --- a/docs/SubFormFieldsPerDocumentCheckboxMerge.md +++ b/docs/SubFormFieldsPerDocumentCheckboxMerge.md @@ -6,8 +6,8 @@ This class extends `SubFormFieldsPerDocumentBase`. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | A checkbox field that has default value set using pre-filled data. Use the `SubFormFieldsPerDocumentCheckboxMerge` class. | | diff --git a/docs/SubFormFieldsPerDocumentDateSigned.md b/docs/SubFormFieldsPerDocumentDateSigned.md index 49d4b5f..bffc1a4 100644 --- a/docs/SubFormFieldsPerDocumentDateSigned.md +++ b/docs/SubFormFieldsPerDocumentDateSigned.md @@ -6,8 +6,8 @@ This class extends `SubFormFieldsPerDocumentBase`. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | A date. Use the `SubFormFieldsPerDocumentDateSigned` class. | | | `fontFamily` | [```FontFamilyEnum```](#FontFamilyEnum) | Font family for the field. | | | `fontSize` | ```Integer``` | The initial px font size for the field contents. Can be any integer value between `7` and `49`.

**NOTE:** Font size may be reduced during processing in order to fit the contents within the dimensions of the field. | | @@ -16,7 +16,7 @@ Name | Type | Description | Notes ## Enum: FontFamilyEnum -Name | Value +| Name | Value | ---- | ----- | HELVETICA | "helvetica" | | ARIAL | "arial" | @@ -28,12 +28,12 @@ Name | Value | TREBUCHET | "trebuchet" | | VERDANA | "verdana" | | ROBOTO | "roboto" | -| ROBOTOMONO | "robotoMono" | -| NOTOSANS | "notoSans" | -| NOTOSERIF | "notoSerif" | -| NOTOCJK_JP_REGULAR | "notoCJK-JP-Regular" | -| NOTOHEBREW_REGULAR | "notoHebrew-Regular" | -| NOTOSANTHAIMERGED | "notoSanThaiMerged" | +| ROBOTO_MONO | "robotoMono" | +| NOTO_SANS | "notoSans" | +| NOTO_SERIF | "notoSerif" | +| NOTO_CJK_JP_REGULAR | "notoCJK-JP-Regular" | +| NOTO_HEBREW_REGULAR | "notoHebrew-Regular" | +| NOTO_SAN_THAI_MERGED | "notoSanThaiMerged" | diff --git a/docs/SubFormFieldsPerDocumentDropdown.md b/docs/SubFormFieldsPerDocumentDropdown.md index afed12e..ca470ea 100644 --- a/docs/SubFormFieldsPerDocumentDropdown.md +++ b/docs/SubFormFieldsPerDocumentDropdown.md @@ -6,8 +6,8 @@ This class extends `SubFormFieldsPerDocumentBase`. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | An input field for dropdowns. Use the `SubFormFieldsPerDocumentDropdown` class. | | | `options`*_required_ | ```List``` | Array of string values representing dropdown values. | | | `content` | ```String``` | Selected value in `options` array. Value must exist in array. | | @@ -18,7 +18,7 @@ Name | Type | Description | Notes ## Enum: FontFamilyEnum -Name | Value +| Name | Value | ---- | ----- | HELVETICA | "helvetica" | | ARIAL | "arial" | @@ -30,12 +30,12 @@ Name | Value | TREBUCHET | "trebuchet" | | VERDANA | "verdana" | | ROBOTO | "roboto" | -| ROBOTOMONO | "robotoMono" | -| NOTOSANS | "notoSans" | -| NOTOSERIF | "notoSerif" | -| NOTOCJK_JP_REGULAR | "notoCJK-JP-Regular" | -| NOTOHEBREW_REGULAR | "notoHebrew-Regular" | -| NOTOSANTHAIMERGED | "notoSanThaiMerged" | +| ROBOTO_MONO | "robotoMono" | +| NOTO_SANS | "notoSans" | +| NOTO_SERIF | "notoSerif" | +| NOTO_CJK_JP_REGULAR | "notoCJK-JP-Regular" | +| NOTO_HEBREW_REGULAR | "notoHebrew-Regular" | +| NOTO_SAN_THAI_MERGED | "notoSanThaiMerged" | diff --git a/docs/SubFormFieldsPerDocumentFontEnum.md b/docs/SubFormFieldsPerDocumentFontEnum.md index c4ea623..b7582a2 100644 --- a/docs/SubFormFieldsPerDocumentFontEnum.md +++ b/docs/SubFormFieldsPerDocumentFontEnum.md @@ -25,17 +25,17 @@ * `ROBOTO` (value: `"roboto"`) -* `ROBOTOMONO` (value: `"robotoMono"`) +* `ROBOTO_MONO` (value: `"robotoMono"`) -* `NOTOSANS` (value: `"notoSans"`) +* `NOTO_SANS` (value: `"notoSans"`) -* `NOTOSERIF` (value: `"notoSerif"`) +* `NOTO_SERIF` (value: `"notoSerif"`) -* `NOTOCJK_JP_REGULAR` (value: `"notoCJK-JP-Regular"`) +* `NOTO_CJK_JP_REGULAR` (value: `"notoCJK-JP-Regular"`) -* `NOTOHEBREW_REGULAR` (value: `"notoHebrew-Regular"`) +* `NOTO_HEBREW_REGULAR` (value: `"notoHebrew-Regular"`) -* `NOTOSANTHAIMERGED` (value: `"notoSanThaiMerged"`) +* `NOTO_SAN_THAI_MERGED` (value: `"notoSanThaiMerged"`) diff --git a/docs/SubFormFieldsPerDocumentHyperlink.md b/docs/SubFormFieldsPerDocumentHyperlink.md index 220f6f9..543312b 100644 --- a/docs/SubFormFieldsPerDocumentHyperlink.md +++ b/docs/SubFormFieldsPerDocumentHyperlink.md @@ -6,8 +6,8 @@ This class extends `SubFormFieldsPerDocumentBase`. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | A hyperlink field. Use the `SubFormFieldsPerDocumentHyperlink` class. | | | `content`*_required_ | ```String``` | Link Text. | | | `contentUrl`*_required_ | ```String``` | Link URL. | | @@ -18,7 +18,7 @@ Name | Type | Description | Notes ## Enum: FontFamilyEnum -Name | Value +| Name | Value | ---- | ----- | HELVETICA | "helvetica" | | ARIAL | "arial" | @@ -30,12 +30,12 @@ Name | Value | TREBUCHET | "trebuchet" | | VERDANA | "verdana" | | ROBOTO | "roboto" | -| ROBOTOMONO | "robotoMono" | -| NOTOSANS | "notoSans" | -| NOTOSERIF | "notoSerif" | -| NOTOCJK_JP_REGULAR | "notoCJK-JP-Regular" | -| NOTOHEBREW_REGULAR | "notoHebrew-Regular" | -| NOTOSANTHAIMERGED | "notoSanThaiMerged" | +| ROBOTO_MONO | "robotoMono" | +| NOTO_SANS | "notoSans" | +| NOTO_SERIF | "notoSerif" | +| NOTO_CJK_JP_REGULAR | "notoCJK-JP-Regular" | +| NOTO_HEBREW_REGULAR | "notoHebrew-Regular" | +| NOTO_SAN_THAI_MERGED | "notoSanThaiMerged" | diff --git a/docs/SubFormFieldsPerDocumentInitials.md b/docs/SubFormFieldsPerDocumentInitials.md index 155c7a5..c3537c2 100644 --- a/docs/SubFormFieldsPerDocumentInitials.md +++ b/docs/SubFormFieldsPerDocumentInitials.md @@ -6,8 +6,8 @@ This class extends `SubFormFieldsPerDocumentBase`. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | An input field for initials. Use the `SubFormFieldsPerDocumentInitials` class. | | diff --git a/docs/SubFormFieldsPerDocumentRadio.md b/docs/SubFormFieldsPerDocumentRadio.md index 38150a4..c194876 100644 --- a/docs/SubFormFieldsPerDocumentRadio.md +++ b/docs/SubFormFieldsPerDocumentRadio.md @@ -6,8 +6,8 @@ This class extends `SubFormFieldsPerDocumentBase`. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | An input field for radios. Use the `SubFormFieldsPerDocumentRadio` class. | | | `group`*_required_ | ```String``` | String referencing group defined in `form_field_groups` parameter. | | | `isChecked`*_required_ | ```Boolean``` | `true` for checking the radio field by default, otherwise `false`. Only one radio field per group can be `true`. | | diff --git a/docs/SubFormFieldsPerDocumentSignature.md b/docs/SubFormFieldsPerDocumentSignature.md index 949922a..187b145 100644 --- a/docs/SubFormFieldsPerDocumentSignature.md +++ b/docs/SubFormFieldsPerDocumentSignature.md @@ -6,8 +6,8 @@ This class extends `SubFormFieldsPerDocumentBase`. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | A signature input field. Use the `SubFormFieldsPerDocumentSignature` class. | | diff --git a/docs/SubFormFieldsPerDocumentText.md b/docs/SubFormFieldsPerDocumentText.md index 9a0c2d6..d431f54 100644 --- a/docs/SubFormFieldsPerDocumentText.md +++ b/docs/SubFormFieldsPerDocumentText.md @@ -6,8 +6,8 @@ This class extends `SubFormFieldsPerDocumentBase`. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | A text input field. Use the `SubFormFieldsPerDocumentText` class. | | | `placeholder` | ```String``` | Placeholder value for text field. | | | `autoFillType` | ```String``` | Auto fill type for populating fields automatically. Check out the list of [auto fill types](/api/reference/constants/#auto-fill-types) to learn more about the possible values. | | @@ -24,7 +24,7 @@ Name | Type | Description | Notes ## Enum: ValidationTypeEnum -Name | Value +| Name | Value | ---- | ----- | NUMBERS_ONLY | "numbers_only" | | LETTERS_ONLY | "letters_only" | @@ -41,7 +41,7 @@ Name | Value ## Enum: FontFamilyEnum -Name | Value +| Name | Value | ---- | ----- | HELVETICA | "helvetica" | | ARIAL | "arial" | @@ -53,12 +53,12 @@ Name | Value | TREBUCHET | "trebuchet" | | VERDANA | "verdana" | | ROBOTO | "roboto" | -| ROBOTOMONO | "robotoMono" | -| NOTOSANS | "notoSans" | -| NOTOSERIF | "notoSerif" | -| NOTOCJK_JP_REGULAR | "notoCJK-JP-Regular" | -| NOTOHEBREW_REGULAR | "notoHebrew-Regular" | -| NOTOSANTHAIMERGED | "notoSanThaiMerged" | +| ROBOTO_MONO | "robotoMono" | +| NOTO_SANS | "notoSans" | +| NOTO_SERIF | "notoSerif" | +| NOTO_CJK_JP_REGULAR | "notoCJK-JP-Regular" | +| NOTO_HEBREW_REGULAR | "notoHebrew-Regular" | +| NOTO_SAN_THAI_MERGED | "notoSanThaiMerged" | diff --git a/docs/SubFormFieldsPerDocumentTextMerge.md b/docs/SubFormFieldsPerDocumentTextMerge.md index a5fc080..e1876cc 100644 --- a/docs/SubFormFieldsPerDocumentTextMerge.md +++ b/docs/SubFormFieldsPerDocumentTextMerge.md @@ -6,8 +6,8 @@ This class extends `SubFormFieldsPerDocumentBase`. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | A text field that has default text set using pre-filled data. Use the `SubFormFieldsPerDocumentTextMerge` class. | | | `fontFamily` | [```FontFamilyEnum```](#FontFamilyEnum) | Font family for the field. | | | `fontSize` | ```Integer``` | The initial px font size for the field contents. Can be any integer value between `7` and `49`.

**NOTE:** Font size may be reduced during processing in order to fit the contents within the dimensions of the field. | | @@ -16,7 +16,7 @@ Name | Type | Description | Notes ## Enum: FontFamilyEnum -Name | Value +| Name | Value | ---- | ----- | HELVETICA | "helvetica" | | ARIAL | "arial" | @@ -28,12 +28,12 @@ Name | Value | TREBUCHET | "trebuchet" | | VERDANA | "verdana" | | ROBOTO | "roboto" | -| ROBOTOMONO | "robotoMono" | -| NOTOSANS | "notoSans" | -| NOTOSERIF | "notoSerif" | -| NOTOCJK_JP_REGULAR | "notoCJK-JP-Regular" | -| NOTOHEBREW_REGULAR | "notoHebrew-Regular" | -| NOTOSANTHAIMERGED | "notoSanThaiMerged" | +| ROBOTO_MONO | "robotoMono" | +| NOTO_SANS | "notoSans" | +| NOTO_SERIF | "notoSerif" | +| NOTO_CJK_JP_REGULAR | "notoCJK-JP-Regular" | +| NOTO_HEBREW_REGULAR | "notoHebrew-Regular" | +| NOTO_SAN_THAI_MERGED | "notoSanThaiMerged" | diff --git a/docs/SubMergeField.md b/docs/SubMergeField.md index f509e12..6658235 100644 --- a/docs/SubMergeField.md +++ b/docs/SubMergeField.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `name`*_required_ | ```String``` | The name of the merge field. Must be unique. | | | `type`*_required_ | [```TypeEnum```](#TypeEnum) | The type of merge field. | | @@ -15,7 +15,7 @@ Name | Type | Description | Notes ## Enum: TypeEnum -Name | Value +| Name | Value | ---- | ----- | TEXT | "text" | | CHECKBOX | "checkbox" | diff --git a/docs/SubOAuth.md b/docs/SubOAuth.md index 23beca8..527d0be 100644 --- a/docs/SubOAuth.md +++ b/docs/SubOAuth.md @@ -6,8 +6,8 @@ OAuth related parameters. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `callbackUrl` | ```String``` | The callback URL to be used for OAuth flows. (Required if `oauth[scopes]` is provided) | | | `scopes` | [```List<ScopesEnum>```](#List<ScopesEnum>) | A list of [OAuth scopes](/api/reference/tag/OAuth) to be granted to the app. (Required if `oauth[callback_url]` is provided). | | @@ -15,7 +15,7 @@ Name | Type | Description | Notes ## Enum: List<ScopesEnum> -Name | Value +| Name | Value | ---- | ----- | REQUEST_SIGNATURE | "request_signature" | | BASIC_ACCOUNT_INFO | "basic_account_info" | diff --git a/docs/SubOptions.md b/docs/SubOptions.md index 3ddab2e..c36523a 100644 --- a/docs/SubOptions.md +++ b/docs/SubOptions.md @@ -6,8 +6,8 @@ Additional options supported by API App. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `canInsertEverywhere` | ```Boolean``` | Determines if signers can use "Insert Everywhere" when signing a document. | | diff --git a/docs/SubSignatureRequestGroupedSigners.md b/docs/SubSignatureRequestGroupedSigners.md index d1845fb..80ace34 100644 --- a/docs/SubSignatureRequestGroupedSigners.md +++ b/docs/SubSignatureRequestGroupedSigners.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `group`*_required_ | ```String``` | The name of the group. | | | `signers`*_required_ | [```List```](SubSignatureRequestSigner.md) | Signers belonging to this Group.

**NOTE:** Only `name`, `email_address`, and `pin` are available to Grouped Signers. We will ignore all other properties, even though they are listed below. | | | `order` | ```Integer``` | The order the group is required to sign in. Use this instead of Signer-level `order`. | | diff --git a/docs/SubSignatureRequestSigner.md b/docs/SubSignatureRequestSigner.md index affc504..109c422 100644 --- a/docs/SubSignatureRequestSigner.md +++ b/docs/SubSignatureRequestSigner.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `name`*_required_ | ```String``` | The name of the signer. | | | `emailAddress`*_required_ | ```String``` | The email address of the signer. | | | `order` | ```Integer``` | The order the signer is required to sign in. | | @@ -19,7 +19,7 @@ Name | Type | Description | Notes ## Enum: SmsPhoneNumberTypeEnum -Name | Value +| Name | Value | ---- | ----- | AUTHENTICATION | "authentication" | | DELIVERY | "delivery" | diff --git a/docs/SubSignatureRequestTemplateSigner.md b/docs/SubSignatureRequestTemplateSigner.md index 0db962b..866b373 100644 --- a/docs/SubSignatureRequestTemplateSigner.md +++ b/docs/SubSignatureRequestTemplateSigner.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `role`*_required_ | ```String``` | Must match an existing role in chosen Template(s). It's case-sensitive. | | | `name`*_required_ | ```String``` | The name of the signer. | | | `emailAddress`*_required_ | ```String``` | The email address of the signer. | | @@ -19,7 +19,7 @@ Name | Type | Description | Notes ## Enum: SmsPhoneNumberTypeEnum -Name | Value +| Name | Value | ---- | ----- | AUTHENTICATION | "authentication" | | DELIVERY | "delivery" | diff --git a/docs/SubSigningOptions.md b/docs/SubSigningOptions.md index b4acf7f..bca1160 100644 --- a/docs/SubSigningOptions.md +++ b/docs/SubSigningOptions.md @@ -8,8 +8,8 @@ This allows the requester to specify the types allowed for creating a signature. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `defaultType`*_required_ | [```DefaultTypeEnum```](#DefaultTypeEnum) | The default type shown (limited to the listed types) | | | `draw` | ```Boolean``` | Allows drawing the signature | | | `phone` | ```Boolean``` | Allows using a smartphone to email the signature | | @@ -20,7 +20,7 @@ Name | Type | Description | Notes ## Enum: DefaultTypeEnum -Name | Value +| Name | Value | ---- | ----- | DRAW | "draw" | | PHONE | "phone" | diff --git a/docs/SubTeamResponse.md b/docs/SubTeamResponse.md index 2b67530..df784d0 100644 --- a/docs/SubTeamResponse.md +++ b/docs/SubTeamResponse.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `teamId` | ```String``` | The id of a team | | | `name` | ```String``` | The name of a team | | diff --git a/docs/SubTemplateRole.md b/docs/SubTemplateRole.md index 88784cd..a1ee8e0 100644 --- a/docs/SubTemplateRole.md +++ b/docs/SubTemplateRole.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `name` | ```String``` | The role name of the signer that will be displayed when the template is used to create a signature request. | | | `order` | ```Integer``` | The order in which this signer role is required to sign. | | diff --git a/docs/SubUnclaimedDraftSigner.md b/docs/SubUnclaimedDraftSigner.md index 70eeb3b..fec680a 100644 --- a/docs/SubUnclaimedDraftSigner.md +++ b/docs/SubUnclaimedDraftSigner.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `emailAddress`*_required_ | ```String``` | The email address of the signer. | | | `name`*_required_ | ```String``` | The name of the signer. | | | `order` | ```Integer``` | The order the signer is required to sign in. | | diff --git a/docs/SubUnclaimedDraftTemplateSigner.md b/docs/SubUnclaimedDraftTemplateSigner.md index 5e164c4..1c65476 100644 --- a/docs/SubUnclaimedDraftTemplateSigner.md +++ b/docs/SubUnclaimedDraftTemplateSigner.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `role`*_required_ | ```String``` | Must match an existing role in chosen Template(s). | | | `name`*_required_ | ```String``` | The name of the signer filling the role of `role`. | | | `emailAddress`*_required_ | ```String``` | The email address of the signer filling the role of `role`. | | diff --git a/docs/SubWhiteLabelingOptions.md b/docs/SubWhiteLabelingOptions.md index c3cb045..0a5880d 100644 --- a/docs/SubWhiteLabelingOptions.md +++ b/docs/SubWhiteLabelingOptions.md @@ -8,8 +8,8 @@ Take a look at our [white labeling guide](https://developers.hellosign.com/api/r ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `headerBackgroundColor` | ```String``` | | | | `legalVersion` | [```LegalVersionEnum```](#LegalVersionEnum) | | | | `linkColor` | ```String``` | | | @@ -30,7 +30,7 @@ Name | Type | Description | Notes ## Enum: LegalVersionEnum -Name | Value +| Name | Value | ---- | ----- | TERMS1 | "terms1" | | TERMS2 | "terms2" | diff --git a/docs/TeamAddMemberRequest.md b/docs/TeamAddMemberRequest.md index 062c8b8..122e45b 100644 --- a/docs/TeamAddMemberRequest.md +++ b/docs/TeamAddMemberRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `accountId` | ```String``` | `account_id` or `email_address` is required. If both are provided, the account id prevails.

Account id of the user to invite to your Team. | | | `emailAddress` | ```String``` | `account_id` or `email_address` is required, If both are provided, the account id prevails.

Email address of the user to invite to your Team. | | | `role` | [```RoleEnum```](#RoleEnum) | A role member will take in a new Team.

**NOTE:** This parameter is used only if `team_id` is provided. | | @@ -16,7 +16,7 @@ Name | Type | Description | Notes ## Enum: RoleEnum -Name | Value +| Name | Value | ---- | ----- | MEMBER | "Member" | | DEVELOPER | "Developer" | diff --git a/docs/TeamApi.md b/docs/TeamApi.md index 2525598..b35b40e 100644 --- a/docs/TeamApi.md +++ b/docs/TeamApi.md @@ -2,8 +2,8 @@ All URIs are relative to *https://api.hellosign.com/v3* -Method | HTTP request | Description -------------- | ------------- | ------------- +| Method | HTTP request | Description | +|------------- | ------------- | -------------| [**teamAddMember**](TeamApi.md#teamAddMember) | **PUT** /team/add_member | Add User to Team [**teamCreate**](TeamApi.md#teamCreate) | **POST** /team/create | Create Team [**teamDelete**](TeamApi.md#teamDelete) | **DELETE** /team/destroy | Delete Team @@ -70,8 +70,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **teamAddMemberRequest** | [**TeamAddMemberRequest**](TeamAddMemberRequest.md)| | **teamId** | **String**| The id of the team. | [optional] @@ -146,8 +146,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **teamCreateRequest** | [**TeamCreateRequest**](TeamCreateRequest.md)| | ### Return type @@ -354,8 +354,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **teamId** | **String**| The id of the team. | [optional] ### Return type @@ -428,8 +428,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **emailAddress** | **String**| The email address for which to display the team invites. | [optional] ### Return type @@ -504,8 +504,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **teamId** | **String**| The id of the team that a member list is being requested from. | **page** | **Integer**| Which page number of the team member list to return. Defaults to `1`. | [optional] [default to 1] **pageSize** | **Integer**| Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. | [optional] [default to 20] @@ -582,8 +582,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **teamRemoveMemberRequest** | [**TeamRemoveMemberRequest**](TeamRemoveMemberRequest.md)| | ### Return type @@ -658,8 +658,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **teamId** | **String**| The id of the parent Team. | **page** | **Integer**| Which page number of the SubTeam List to return. Defaults to `1`. | [optional] [default to 1] **pageSize** | **Integer**| Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. | [optional] [default to 20] @@ -735,8 +735,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **teamUpdateRequest** | [**TeamUpdateRequest**](TeamUpdateRequest.md)| | ### Return type diff --git a/docs/TeamCreateRequest.md b/docs/TeamCreateRequest.md index cb70adc..1a48616 100644 --- a/docs/TeamCreateRequest.md +++ b/docs/TeamCreateRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `name` | ```String``` | The name of your Team. | | diff --git a/docs/TeamGetInfoResponse.md b/docs/TeamGetInfoResponse.md index 3b6d3e3..1d2bc62 100644 --- a/docs/TeamGetInfoResponse.md +++ b/docs/TeamGetInfoResponse.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `team` | [```TeamInfoResponse```](TeamInfoResponse.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `team`*_required_ | [```TeamInfoResponse```](TeamInfoResponse.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/TeamGetResponse.md b/docs/TeamGetResponse.md index fe2d79f..690796e 100644 --- a/docs/TeamGetResponse.md +++ b/docs/TeamGetResponse.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `team` | [```TeamResponse```](TeamResponse.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `team`*_required_ | [```TeamResponse```](TeamResponse.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/TeamInfoResponse.md b/docs/TeamInfoResponse.md index aaf76ca..a776d4e 100644 --- a/docs/TeamInfoResponse.md +++ b/docs/TeamInfoResponse.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `teamId` | ```String``` | The id of a team | | | `teamParent` | [```TeamParentResponse```](TeamParentResponse.md) | | | | `name` | ```String``` | The name of a team | | diff --git a/docs/TeamInviteResponse.md b/docs/TeamInviteResponse.md index 317bec3..c23aa4e 100644 --- a/docs/TeamInviteResponse.md +++ b/docs/TeamInviteResponse.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `emailAddress` | ```String``` | Email address of the user invited to this team. | | | `teamId` | ```String``` | Id of the team. | | | `role` | ```String``` | Role of the user invited to this team. | | diff --git a/docs/TeamInvitesResponse.md b/docs/TeamInvitesResponse.md index 5f0e669..bdb648b 100644 --- a/docs/TeamInvitesResponse.md +++ b/docs/TeamInvitesResponse.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `teamInvites` | [```List```](TeamInviteResponse.md) | Contains a list of team invites and their roles. | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `teamInvites`*_required_ | [```List```](TeamInviteResponse.md) | Contains a list of team invites and their roles. | | | `warnings` | [```List```](WarningResponse.md) | | | diff --git a/docs/TeamMemberResponse.md b/docs/TeamMemberResponse.md index e35f8f6..eb42aa0 100644 --- a/docs/TeamMemberResponse.md +++ b/docs/TeamMemberResponse.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `accountId` | ```String``` | Account id of the team member. | | | `emailAddress` | ```String``` | Email address of the team member. | | | `role` | ```String``` | The specific role a member has on the team. | | diff --git a/docs/TeamMembersResponse.md b/docs/TeamMembersResponse.md index d3e5e67..7853182 100644 --- a/docs/TeamMembersResponse.md +++ b/docs/TeamMembersResponse.md @@ -6,10 +6,10 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `teamMembers` | [```List```](TeamMemberResponse.md) | Contains a list of team members and their roles for a specific team. | | -| `listInfo` | [```ListInfoResponse```](ListInfoResponse.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `teamMembers`*_required_ | [```List```](TeamMemberResponse.md) | Contains a list of team members and their roles for a specific team. | | +| `listInfo`*_required_ | [```ListInfoResponse```](ListInfoResponse.md) | | | | `warnings` | [```List```](WarningResponse.md) | | | diff --git a/docs/TeamParentResponse.md b/docs/TeamParentResponse.md index 1a0d49c..c6ba18a 100644 --- a/docs/TeamParentResponse.md +++ b/docs/TeamParentResponse.md @@ -6,8 +6,8 @@ Information about the parent team if a team has one, set to `null` otherwise. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `teamId` | ```String``` | The id of a team | | | `name` | ```String``` | The name of a team | | diff --git a/docs/TeamRemoveMemberRequest.md b/docs/TeamRemoveMemberRequest.md index 79d3a4c..46f4853 100644 --- a/docs/TeamRemoveMemberRequest.md +++ b/docs/TeamRemoveMemberRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `accountId` | ```String``` | **account_id** or **email_address** is required. If both are provided, the account id prevails.

Account id to remove from your Team. | | | `emailAddress` | ```String``` | **account_id** or **email_address** is required. If both are provided, the account id prevails.

Email address of the Account to remove from your Team. | | | `newOwnerEmailAddress` | ```String``` | The email address of an Account on this Team to receive all documents, templates, and API apps (if applicable) from the removed Account. If not provided, and on an Enterprise plan, this data will remain with the removed Account.

**NOTE:** Only available for Enterprise plans. | | @@ -18,7 +18,7 @@ Name | Type | Description | Notes ## Enum: NewRoleEnum -Name | Value +| Name | Value | ---- | ----- | MEMBER | "Member" | | DEVELOPER | "Developer" | diff --git a/docs/TeamResponse.md b/docs/TeamResponse.md index 2606103..ca6344c 100644 --- a/docs/TeamResponse.md +++ b/docs/TeamResponse.md @@ -6,8 +6,8 @@ Contains information about your team and its members ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `name` | ```String``` | The name of your Team | | | `accounts` | [```List```](AccountResponse.md) | | | | `invitedAccounts` | [```List```](AccountResponse.md) | A list of all Accounts that have an outstanding invitation to join your Team. Note that this response is a subset of the response parameters found in `GET /account`. | | diff --git a/docs/TeamSubTeamsResponse.md b/docs/TeamSubTeamsResponse.md index 1b618f8..636aa33 100644 --- a/docs/TeamSubTeamsResponse.md +++ b/docs/TeamSubTeamsResponse.md @@ -6,10 +6,10 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `subTeams` | [```List```](SubTeamResponse.md) | Contains a list with sub teams. | | -| `listInfo` | [```ListInfoResponse```](ListInfoResponse.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `subTeams`*_required_ | [```List```](SubTeamResponse.md) | Contains a list with sub teams. | | +| `listInfo`*_required_ | [```ListInfoResponse```](ListInfoResponse.md) | | | | `warnings` | [```List```](WarningResponse.md) | | | diff --git a/docs/TeamUpdateRequest.md b/docs/TeamUpdateRequest.md index 545510d..9df0fe1 100644 --- a/docs/TeamUpdateRequest.md +++ b/docs/TeamUpdateRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `name` | ```String``` | The name of your Team. | | diff --git a/docs/TemplateAddUserRequest.md b/docs/TemplateAddUserRequest.md index 5415106..7496619 100644 --- a/docs/TemplateAddUserRequest.md +++ b/docs/TemplateAddUserRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `accountId` | ```String``` | The id of the Account to give access to the Template.
**NOTE:** The account id prevails if email address is also provided. | | | `emailAddress` | ```String``` | The email address of the Account to give access to the Template.
**NOTE:** The account id prevails if it is also provided. | | | `skipNotification` | ```Boolean``` | If set to `true`, the user does not receive an email notification when a template has been shared with them. Defaults to `false`. | | diff --git a/docs/TemplateApi.md b/docs/TemplateApi.md index 0a2a448..a3394d6 100644 --- a/docs/TemplateApi.md +++ b/docs/TemplateApi.md @@ -2,8 +2,8 @@ All URIs are relative to *https://api.hellosign.com/v3* -Method | HTTP request | Description -------------- | ------------- | ------------- +| Method | HTTP request | Description | +|------------- | ------------- | -------------| [**templateAddUser**](TemplateApi.md#templateAddUser) | **POST** /template/add_user/{template_id} | Add User to Template [**templateCreate**](TemplateApi.md#templateCreate) | **POST** /template/create | Create Template [**templateCreateEmbeddedDraft**](TemplateApi.md#templateCreateEmbeddedDraft) | **POST** /template/create_embedded_draft | Create Embedded Template Draft @@ -71,8 +71,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **templateId** | **String**| The id of the Template to give the Account access to. | **templateAddUserRequest** | [**TemplateAddUserRequest**](TemplateAddUserRequest.md)| | @@ -178,8 +178,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **templateCreateRequest** | [**TemplateCreateRequest**](TemplateCreateRequest.md)| | ### Return type @@ -284,8 +284,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **templateCreateEmbeddedDraftRequest** | [**TemplateCreateEmbeddedDraftRequest**](TemplateCreateEmbeddedDraftRequest.md)| | ### Return type @@ -356,8 +356,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **templateId** | **String**| The id of the Template to delete. | ### Return type @@ -433,8 +433,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **templateId** | **String**| The id of the template files to retrieve. | **fileType** | **String**| Set to `pdf` for a single merged document or `zip` for a collection of individual documents. | [optional] [enum: pdf, zip] @@ -510,8 +510,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **templateId** | **String**| The id of the template files to retrieve. | ### Return type @@ -586,8 +586,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **templateId** | **String**| The id of the template files to retrieve. | **forceDownload** | **Integer**| By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. | [optional] [default to 1] @@ -661,8 +661,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **templateId** | **String**| The id of the Template to retrieve. | ### Return type @@ -740,8 +740,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **accountId** | **String**| Which account to return Templates for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. | [optional] **page** | **Integer**| Which page number of the Template List to return. Defaults to `1`. | [optional] [default to 1] **pageSize** | **Integer**| Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. | [optional] [default to 20] @@ -820,8 +820,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **templateId** | **String**| The id of the Template to remove the Account's access to. | **templateRemoveUserRequest** | [**TemplateRemoveUserRequest**](TemplateRemoveUserRequest.md)| | @@ -911,8 +911,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **templateId** | **String**| The ID of the template whose files to update. | **templateUpdateFilesRequest** | [**TemplateUpdateFilesRequest**](TemplateUpdateFilesRequest.md)| | diff --git a/docs/TemplateCreateEmbeddedDraftRequest.md b/docs/TemplateCreateEmbeddedDraftRequest.md index be051c8..05f2497 100644 --- a/docs/TemplateCreateEmbeddedDraftRequest.md +++ b/docs/TemplateCreateEmbeddedDraftRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `clientId`*_required_ | ```String``` | Client id of the app you're using to create this draft. Used to apply the branding and callback url defined for the app. | | | `files` | ```List``` | Use `files[]` to indicate the uploaded file(s) to send for signature.

This endpoint requires either **files** or **file_urls[]**, but not both. | | | `fileUrls` | ```List``` | Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature.

This endpoint requires either **files** or **file_urls[]**, but not both. | | diff --git a/docs/TemplateCreateEmbeddedDraftResponse.md b/docs/TemplateCreateEmbeddedDraftResponse.md index 2109e4f..f25b48d 100644 --- a/docs/TemplateCreateEmbeddedDraftResponse.md +++ b/docs/TemplateCreateEmbeddedDraftResponse.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `template` | [```TemplateCreateEmbeddedDraftResponseTemplate```](TemplateCreateEmbeddedDraftResponseTemplate.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `template`*_required_ | [```TemplateCreateEmbeddedDraftResponseTemplate```](TemplateCreateEmbeddedDraftResponseTemplate.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/TemplateCreateEmbeddedDraftResponseTemplate.md b/docs/TemplateCreateEmbeddedDraftResponseTemplate.md index 7b7dc1e..770cce4 100644 --- a/docs/TemplateCreateEmbeddedDraftResponseTemplate.md +++ b/docs/TemplateCreateEmbeddedDraftResponseTemplate.md @@ -6,8 +6,8 @@ Template object with parameters: `template_id`, `edit_url`, `expires_at`. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `templateId` | ```String``` | The id of the Template. | | | `editUrl` | ```String``` | Link to edit the template. | | | `expiresAt` | ```Integer``` | When the link expires. | | diff --git a/docs/TemplateCreateRequest.md b/docs/TemplateCreateRequest.md index 4d529fd..5f99510 100644 --- a/docs/TemplateCreateRequest.md +++ b/docs/TemplateCreateRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `formFieldsPerDocument`*_required_ | [```List```](SubFormFieldsPerDocumentBase.md) | The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).)

**NOTE:** Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types.

* Text Field use `SubFormFieldsPerDocumentText`
* Dropdown Field use `SubFormFieldsPerDocumentDropdown`
* Hyperlink Field use `SubFormFieldsPerDocumentHyperlink`
* Checkbox Field use `SubFormFieldsPerDocumentCheckbox`
* Radio Field use `SubFormFieldsPerDocumentRadio`
* Signature Field use `SubFormFieldsPerDocumentSignature`
* Date Signed Field use `SubFormFieldsPerDocumentDateSigned`
* Initials Field use `SubFormFieldsPerDocumentInitials`
* Text Merge Field use `SubFormFieldsPerDocumentTextMerge`
* Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge` | | | `signerRoles`*_required_ | [```List```](SubTemplateRole.md) | An array of the designated signer roles that must be specified when sending a SignatureRequest using this Template. | | | `files` | ```List``` | Use `files[]` to indicate the uploaded file(s) to send for signature.

This endpoint requires either **files** or **file_urls[]**, but not both. | | diff --git a/docs/TemplateCreateResponse.md b/docs/TemplateCreateResponse.md index 6554466..3c73896 100644 --- a/docs/TemplateCreateResponse.md +++ b/docs/TemplateCreateResponse.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `template` | [```TemplateCreateResponseTemplate```](TemplateCreateResponseTemplate.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `template`*_required_ | [```TemplateCreateResponseTemplate```](TemplateCreateResponseTemplate.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/TemplateCreateResponseTemplate.md b/docs/TemplateCreateResponseTemplate.md index ae09826..1dcd4bd 100644 --- a/docs/TemplateCreateResponseTemplate.md +++ b/docs/TemplateCreateResponseTemplate.md @@ -6,8 +6,8 @@ Template object with parameters: `template_id`. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `templateId` | ```String``` | The id of the Template. | | diff --git a/docs/TemplateEditResponse.md b/docs/TemplateEditResponse.md index fe7f907..88d225e 100644 --- a/docs/TemplateEditResponse.md +++ b/docs/TemplateEditResponse.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `templateId` | ```String``` | The id of the Template. | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `templateId`*_required_ | ```String``` | The id of the Template. | | diff --git a/docs/TemplateGetResponse.md b/docs/TemplateGetResponse.md index 3e073ba..2ee4867 100644 --- a/docs/TemplateGetResponse.md +++ b/docs/TemplateGetResponse.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `template` | [```TemplateResponse```](TemplateResponse.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `template`*_required_ | [```TemplateResponse```](TemplateResponse.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/TemplateListResponse.md b/docs/TemplateListResponse.md index 83e54d7..92b720c 100644 --- a/docs/TemplateListResponse.md +++ b/docs/TemplateListResponse.md @@ -6,10 +6,10 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `templates` | [```List```](TemplateResponse.md) | List of templates that the API caller has access to. | | -| `listInfo` | [```ListInfoResponse```](ListInfoResponse.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `templates`*_required_ | [```List```](TemplateResponse.md) | List of templates that the API caller has access to. | | +| `listInfo`*_required_ | [```ListInfoResponse```](ListInfoResponse.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/TemplateRemoveUserRequest.md b/docs/TemplateRemoveUserRequest.md index c269702..72a3a58 100644 --- a/docs/TemplateRemoveUserRequest.md +++ b/docs/TemplateRemoveUserRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `accountId` | ```String``` | The id or email address of the Account to remove access to the Template. The account id prevails if both are provided. | | | `emailAddress` | ```String``` | The id or email address of the Account to remove access to the Template. The account id prevails if both are provided. | | diff --git a/docs/TemplateResponse.md b/docs/TemplateResponse.md index 7811ccc..078685f 100644 --- a/docs/TemplateResponse.md +++ b/docs/TemplateResponse.md @@ -6,8 +6,8 @@ Contains information about the templates you and your team have created. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `templateId` | ```String``` | The id of the Template. | | | `title` | ```String``` | The title of the Template. This will also be the default subject of the message sent to signers when using this Template to send a SignatureRequest. This can be overridden when sending the SignatureRequest. | | | `message` | ```String``` | The default message that will be sent to signers when using this Template to send a SignatureRequest. This can be overridden when sending the SignatureRequest. | | diff --git a/docs/TemplateResponseAccount.md b/docs/TemplateResponseAccount.md index bf956bf..10c9964 100644 --- a/docs/TemplateResponseAccount.md +++ b/docs/TemplateResponseAccount.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `accountId` | ```String``` | The id of the Account. | | | `emailAddress` | ```String``` | The email address associated with the Account. | | | `isLocked` | ```Boolean``` | Returns `true` if the user has been locked out of their account by a team admin. | | diff --git a/docs/TemplateResponseAccountQuota.md b/docs/TemplateResponseAccountQuota.md index 2ef4344..ad94c24 100644 --- a/docs/TemplateResponseAccountQuota.md +++ b/docs/TemplateResponseAccountQuota.md @@ -6,8 +6,8 @@ An array of the designated CC roles that must be specified when sending a Signat ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `templatesLeft` | ```Integer``` | API templates remaining. | | | `apiSignatureRequestsLeft` | ```Integer``` | API signature requests remaining. | | | `documentsLeft` | ```Integer``` | Signature requests remaining. | | diff --git a/docs/TemplateResponseCCRole.md b/docs/TemplateResponseCCRole.md index 1701c97..64069b8 100644 --- a/docs/TemplateResponseCCRole.md +++ b/docs/TemplateResponseCCRole.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `name` | ```String``` | The name of the Role. | | diff --git a/docs/TemplateResponseDocument.md b/docs/TemplateResponseDocument.md index e0a090d..65da85d 100644 --- a/docs/TemplateResponseDocument.md +++ b/docs/TemplateResponseDocument.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `name` | ```String``` | Name of the associated file. | | | `index` | ```Integer``` | Document ordering, the lowest index is displayed first and the highest last (0-based indexing). | | | `fieldGroups` | [```List```](TemplateResponseDocumentFieldGroup.md) | An array of Form Field Group objects. | | diff --git a/docs/TemplateResponseDocumentCustomFieldBase.md b/docs/TemplateResponseDocumentCustomFieldBase.md index 33ba5cd..edd4617 100644 --- a/docs/TemplateResponseDocumentCustomFieldBase.md +++ b/docs/TemplateResponseDocumentCustomFieldBase.md @@ -6,8 +6,8 @@ An array of Form Field objects containing the name and type of each named field. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | | | | `apiId` | ```String``` | The unique ID for this field. | | | `name` | ```String``` | The name of the Custom Field. | | diff --git a/docs/TemplateResponseDocumentCustomFieldCheckbox.md b/docs/TemplateResponseDocumentCustomFieldCheckbox.md index f69fa79..dbde790 100644 --- a/docs/TemplateResponseDocumentCustomFieldCheckbox.md +++ b/docs/TemplateResponseDocumentCustomFieldCheckbox.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentCustomFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this Custom Field. Only `text` and `checkbox` are currently supported.

* Text uses `TemplateResponseDocumentCustomFieldText`
* Checkbox uses `TemplateResponseDocumentCustomFieldCheckbox` | | diff --git a/docs/TemplateResponseDocumentCustomFieldText.md b/docs/TemplateResponseDocumentCustomFieldText.md index 9fa8d7a..ccaf193 100644 --- a/docs/TemplateResponseDocumentCustomFieldText.md +++ b/docs/TemplateResponseDocumentCustomFieldText.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentCustomFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this Custom Field. Only `text` and `checkbox` are currently supported.

* Text uses `TemplateResponseDocumentCustomFieldText`
* Checkbox uses `TemplateResponseDocumentCustomFieldCheckbox` | | | `avgTextLength` | [```TemplateResponseFieldAvgTextLength```](TemplateResponseFieldAvgTextLength.md) | | | | `isMultiline` | ```Boolean``` | Whether this form field is multiline text. | | diff --git a/docs/TemplateResponseDocumentFieldGroup.md b/docs/TemplateResponseDocumentFieldGroup.md index 568bd52..03b5ffb 100644 --- a/docs/TemplateResponseDocumentFieldGroup.md +++ b/docs/TemplateResponseDocumentFieldGroup.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `name` | ```String``` | The name of the form field group. | | | `rule` | [```TemplateResponseDocumentFieldGroupRule```](TemplateResponseDocumentFieldGroupRule.md) | | | diff --git a/docs/TemplateResponseDocumentFieldGroupRule.md b/docs/TemplateResponseDocumentFieldGroupRule.md index 48b234a..e0f4dcc 100644 --- a/docs/TemplateResponseDocumentFieldGroupRule.md +++ b/docs/TemplateResponseDocumentFieldGroupRule.md @@ -6,8 +6,8 @@ The rule used to validate checkboxes in the form field group. See [checkbox fiel ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `requirement` | ```String``` | Examples: `require_0-1` `require_1` `require_1-ormore`

- Check out the list of [acceptable `requirement` checkbox type values](/api/reference/constants/#checkbox-field-grouping). - Check out the list of [acceptable `requirement` radio type fields](/api/reference/constants/#radio-field-grouping). - Radio groups require **at least** two fields per group. | | | `groupLabel` | ```String``` | Name of the group | | diff --git a/docs/TemplateResponseDocumentFormFieldBase.md b/docs/TemplateResponseDocumentFormFieldBase.md index 00696c3..656070a 100644 --- a/docs/TemplateResponseDocumentFormFieldBase.md +++ b/docs/TemplateResponseDocumentFormFieldBase.md @@ -6,8 +6,8 @@ An array of Form Field objects containing the name and type of each named field. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | | | | `apiId` | ```String``` | A unique id for the form field. | | | `name` | ```String``` | The name of the form field. | | diff --git a/docs/TemplateResponseDocumentFormFieldCheckbox.md b/docs/TemplateResponseDocumentFormFieldCheckbox.md index 95a9c47..83d36e0 100644 --- a/docs/TemplateResponseDocumentFormFieldCheckbox.md +++ b/docs/TemplateResponseDocumentFormFieldCheckbox.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentFormFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this form field. See [field types](/api/reference/constants/#field-types).

* Text Field uses `TemplateResponseDocumentFormFieldText`
* Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown`
* Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink`
* Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox`
* Radio Field uses `TemplateResponseDocumentFormFieldRadio`
* Signature Field uses `TemplateResponseDocumentFormFieldSignature`
* Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned`
* Initials Field uses `TemplateResponseDocumentFormFieldInitials` | | diff --git a/docs/TemplateResponseDocumentFormFieldDateSigned.md b/docs/TemplateResponseDocumentFormFieldDateSigned.md index 4aeb9b3..5ba66ef 100644 --- a/docs/TemplateResponseDocumentFormFieldDateSigned.md +++ b/docs/TemplateResponseDocumentFormFieldDateSigned.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentFormFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this form field. See [field types](/api/reference/constants/#field-types).

* Text Field uses `TemplateResponseDocumentFormFieldText`
* Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown`
* Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink`
* Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox`
* Radio Field uses `TemplateResponseDocumentFormFieldRadio`
* Signature Field uses `TemplateResponseDocumentFormFieldSignature`
* Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned`
* Initials Field uses `TemplateResponseDocumentFormFieldInitials` | | diff --git a/docs/TemplateResponseDocumentFormFieldDropdown.md b/docs/TemplateResponseDocumentFormFieldDropdown.md index f4abfa6..b4f2030 100644 --- a/docs/TemplateResponseDocumentFormFieldDropdown.md +++ b/docs/TemplateResponseDocumentFormFieldDropdown.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentFormFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this form field. See [field types](/api/reference/constants/#field-types).

* Text Field uses `TemplateResponseDocumentFormFieldText`
* Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown`
* Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink`
* Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox`
* Radio Field uses `TemplateResponseDocumentFormFieldRadio`
* Signature Field uses `TemplateResponseDocumentFormFieldSignature`
* Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned`
* Initials Field uses `TemplateResponseDocumentFormFieldInitials` | | diff --git a/docs/TemplateResponseDocumentFormFieldHyperlink.md b/docs/TemplateResponseDocumentFormFieldHyperlink.md index c59fa68..0cf89df 100644 --- a/docs/TemplateResponseDocumentFormFieldHyperlink.md +++ b/docs/TemplateResponseDocumentFormFieldHyperlink.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentFormFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this form field. See [field types](/api/reference/constants/#field-types).

* Text Field uses `TemplateResponseDocumentFormFieldText`
* Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown`
* Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink`
* Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox`
* Radio Field uses `TemplateResponseDocumentFormFieldRadio`
* Signature Field uses `TemplateResponseDocumentFormFieldSignature`
* Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned`
* Initials Field uses `TemplateResponseDocumentFormFieldInitials` | | | `avgTextLength` | [```TemplateResponseFieldAvgTextLength```](TemplateResponseFieldAvgTextLength.md) | | | | `isMultiline` | ```Boolean``` | Whether this form field is multiline text. | | diff --git a/docs/TemplateResponseDocumentFormFieldInitials.md b/docs/TemplateResponseDocumentFormFieldInitials.md index 487fde4..707d67e 100644 --- a/docs/TemplateResponseDocumentFormFieldInitials.md +++ b/docs/TemplateResponseDocumentFormFieldInitials.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentFormFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this form field. See [field types](/api/reference/constants/#field-types).

* Text Field uses `TemplateResponseDocumentFormFieldText`
* Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown`
* Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink`
* Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox`
* Radio Field uses `TemplateResponseDocumentFormFieldRadio`
* Signature Field uses `TemplateResponseDocumentFormFieldSignature`
* Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned`
* Initials Field uses `TemplateResponseDocumentFormFieldInitials` | | diff --git a/docs/TemplateResponseDocumentFormFieldRadio.md b/docs/TemplateResponseDocumentFormFieldRadio.md index d08e650..b83d96d 100644 --- a/docs/TemplateResponseDocumentFormFieldRadio.md +++ b/docs/TemplateResponseDocumentFormFieldRadio.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentFormFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this form field. See [field types](/api/reference/constants/#field-types).

* Text Field uses `TemplateResponseDocumentFormFieldText`
* Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown`
* Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink`
* Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox`
* Radio Field uses `TemplateResponseDocumentFormFieldRadio`
* Signature Field uses `TemplateResponseDocumentFormFieldSignature`
* Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned`
* Initials Field uses `TemplateResponseDocumentFormFieldInitials` | | diff --git a/docs/TemplateResponseDocumentFormFieldSignature.md b/docs/TemplateResponseDocumentFormFieldSignature.md index 08173e8..8be2987 100644 --- a/docs/TemplateResponseDocumentFormFieldSignature.md +++ b/docs/TemplateResponseDocumentFormFieldSignature.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentFormFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this form field. See [field types](/api/reference/constants/#field-types).

* Text Field uses `TemplateResponseDocumentFormFieldText`
* Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown`
* Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink`
* Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox`
* Radio Field uses `TemplateResponseDocumentFormFieldRadio`
* Signature Field uses `TemplateResponseDocumentFormFieldSignature`
* Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned`
* Initials Field uses `TemplateResponseDocumentFormFieldInitials` | | diff --git a/docs/TemplateResponseDocumentFormFieldText.md b/docs/TemplateResponseDocumentFormFieldText.md index a7eec6d..3581d38 100644 --- a/docs/TemplateResponseDocumentFormFieldText.md +++ b/docs/TemplateResponseDocumentFormFieldText.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentFormFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this form field. See [field types](/api/reference/constants/#field-types).

* Text Field uses `TemplateResponseDocumentFormFieldText`
* Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown`
* Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink`
* Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox`
* Radio Field uses `TemplateResponseDocumentFormFieldRadio`
* Signature Field uses `TemplateResponseDocumentFormFieldSignature`
* Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned`
* Initials Field uses `TemplateResponseDocumentFormFieldInitials` | | | `avgTextLength` | [```TemplateResponseFieldAvgTextLength```](TemplateResponseFieldAvgTextLength.md) | | | | `isMultiline` | ```Boolean``` | Whether this form field is multiline text. | | @@ -19,7 +19,7 @@ Name | Type | Description | Notes ## Enum: ValidationTypeEnum -Name | Value +| Name | Value | ---- | ----- | NUMBERS_ONLY | "numbers_only" | | LETTERS_ONLY | "letters_only" | diff --git a/docs/TemplateResponseDocumentStaticFieldBase.md b/docs/TemplateResponseDocumentStaticFieldBase.md index 18c56b8..4be3cf0 100644 --- a/docs/TemplateResponseDocumentStaticFieldBase.md +++ b/docs/TemplateResponseDocumentStaticFieldBase.md @@ -6,8 +6,8 @@ An array describing static overlay fields. **NOTE:** Only available for certain ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | | | | `apiId` | ```String``` | A unique id for the static field. | | | `name` | ```String``` | The name of the static field. | | diff --git a/docs/TemplateResponseDocumentStaticFieldCheckbox.md b/docs/TemplateResponseDocumentStaticFieldCheckbox.md index d33f03d..6cd9485 100644 --- a/docs/TemplateResponseDocumentStaticFieldCheckbox.md +++ b/docs/TemplateResponseDocumentStaticFieldCheckbox.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentStaticFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this static field. See [field types](/api/reference/constants/#field-types).

* Text Field uses `TemplateResponseDocumentStaticFieldText`
* Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown`
* Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink`
* Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox`
* Radio Field uses `TemplateResponseDocumentStaticFieldRadio`
* Signature Field uses `TemplateResponseDocumentStaticFieldSignature`
* Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned`
* Initials Field uses `TemplateResponseDocumentStaticFieldInitials` | | diff --git a/docs/TemplateResponseDocumentStaticFieldDateSigned.md b/docs/TemplateResponseDocumentStaticFieldDateSigned.md index 5e0eaa6..d5c530d 100644 --- a/docs/TemplateResponseDocumentStaticFieldDateSigned.md +++ b/docs/TemplateResponseDocumentStaticFieldDateSigned.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentStaticFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this static field. See [field types](/api/reference/constants/#field-types).

* Text Field uses `TemplateResponseDocumentStaticFieldText`
* Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown`
* Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink`
* Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox`
* Radio Field uses `TemplateResponseDocumentStaticFieldRadio`
* Signature Field uses `TemplateResponseDocumentStaticFieldSignature`
* Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned`
* Initials Field uses `TemplateResponseDocumentStaticFieldInitials` | | diff --git a/docs/TemplateResponseDocumentStaticFieldDropdown.md b/docs/TemplateResponseDocumentStaticFieldDropdown.md index bb9f131..5350531 100644 --- a/docs/TemplateResponseDocumentStaticFieldDropdown.md +++ b/docs/TemplateResponseDocumentStaticFieldDropdown.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentStaticFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this static field. See [field types](/api/reference/constants/#field-types).

* Text Field uses `TemplateResponseDocumentStaticFieldText`
* Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown`
* Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink`
* Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox`
* Radio Field uses `TemplateResponseDocumentStaticFieldRadio`
* Signature Field uses `TemplateResponseDocumentStaticFieldSignature`
* Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned`
* Initials Field uses `TemplateResponseDocumentStaticFieldInitials` | | diff --git a/docs/TemplateResponseDocumentStaticFieldHyperlink.md b/docs/TemplateResponseDocumentStaticFieldHyperlink.md index a38e229..930658b 100644 --- a/docs/TemplateResponseDocumentStaticFieldHyperlink.md +++ b/docs/TemplateResponseDocumentStaticFieldHyperlink.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentStaticFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this static field. See [field types](/api/reference/constants/#field-types).

* Text Field uses `TemplateResponseDocumentStaticFieldText`
* Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown`
* Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink`
* Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox`
* Radio Field uses `TemplateResponseDocumentStaticFieldRadio`
* Signature Field uses `TemplateResponseDocumentStaticFieldSignature`
* Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned`
* Initials Field uses `TemplateResponseDocumentStaticFieldInitials` | | diff --git a/docs/TemplateResponseDocumentStaticFieldInitials.md b/docs/TemplateResponseDocumentStaticFieldInitials.md index 2026401..67d7557 100644 --- a/docs/TemplateResponseDocumentStaticFieldInitials.md +++ b/docs/TemplateResponseDocumentStaticFieldInitials.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentStaticFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this static field. See [field types](/api/reference/constants/#field-types).

* Text Field uses `TemplateResponseDocumentStaticFieldText`
* Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown`
* Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink`
* Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox`
* Radio Field uses `TemplateResponseDocumentStaticFieldRadio`
* Signature Field uses `TemplateResponseDocumentStaticFieldSignature`
* Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned`
* Initials Field uses `TemplateResponseDocumentStaticFieldInitials` | | diff --git a/docs/TemplateResponseDocumentStaticFieldRadio.md b/docs/TemplateResponseDocumentStaticFieldRadio.md index 7a140fa..ed32ccc 100644 --- a/docs/TemplateResponseDocumentStaticFieldRadio.md +++ b/docs/TemplateResponseDocumentStaticFieldRadio.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentStaticFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this static field. See [field types](/api/reference/constants/#field-types).

* Text Field uses `TemplateResponseDocumentStaticFieldText`
* Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown`
* Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink`
* Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox`
* Radio Field uses `TemplateResponseDocumentStaticFieldRadio`
* Signature Field uses `TemplateResponseDocumentStaticFieldSignature`
* Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned`
* Initials Field uses `TemplateResponseDocumentStaticFieldInitials` | | diff --git a/docs/TemplateResponseDocumentStaticFieldSignature.md b/docs/TemplateResponseDocumentStaticFieldSignature.md index e9a0372..61f8902 100644 --- a/docs/TemplateResponseDocumentStaticFieldSignature.md +++ b/docs/TemplateResponseDocumentStaticFieldSignature.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentStaticFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this static field. See [field types](/api/reference/constants/#field-types).

* Text Field uses `TemplateResponseDocumentStaticFieldText`
* Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown`
* Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink`
* Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox`
* Radio Field uses `TemplateResponseDocumentStaticFieldRadio`
* Signature Field uses `TemplateResponseDocumentStaticFieldSignature`
* Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned`
* Initials Field uses `TemplateResponseDocumentStaticFieldInitials` | | diff --git a/docs/TemplateResponseDocumentStaticFieldText.md b/docs/TemplateResponseDocumentStaticFieldText.md index 4135e5f..3dced01 100644 --- a/docs/TemplateResponseDocumentStaticFieldText.md +++ b/docs/TemplateResponseDocumentStaticFieldText.md @@ -6,8 +6,8 @@ This class extends `TemplateResponseDocumentStaticFieldBase` ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | ```String``` | The type of this static field. See [field types](/api/reference/constants/#field-types).

* Text Field uses `TemplateResponseDocumentStaticFieldText`
* Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown`
* Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink`
* Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox`
* Radio Field uses `TemplateResponseDocumentStaticFieldRadio`
* Signature Field uses `TemplateResponseDocumentStaticFieldSignature`
* Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned`
* Initials Field uses `TemplateResponseDocumentStaticFieldInitials` | | diff --git a/docs/TemplateResponseFieldAvgTextLength.md b/docs/TemplateResponseFieldAvgTextLength.md index c1fda15..bb66f30 100644 --- a/docs/TemplateResponseFieldAvgTextLength.md +++ b/docs/TemplateResponseFieldAvgTextLength.md @@ -6,8 +6,8 @@ Average text length in this field. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `numLines` | ```Integer``` | Number of lines. | | | `numCharsPerLine` | ```Integer``` | Number of characters per line. | | diff --git a/docs/TemplateResponseSignerRole.md b/docs/TemplateResponseSignerRole.md index b95231d..15b48cf 100644 --- a/docs/TemplateResponseSignerRole.md +++ b/docs/TemplateResponseSignerRole.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `name` | ```String``` | The name of the Role. | | | `order` | ```Integer``` | If signer order is assigned this is the 0-based index for this role. | | diff --git a/docs/TemplateUpdateFilesRequest.md b/docs/TemplateUpdateFilesRequest.md index 2bebedb..8671b87 100644 --- a/docs/TemplateUpdateFilesRequest.md +++ b/docs/TemplateUpdateFilesRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `clientId` | ```String``` | Client id of the app you're using to update this template. | | | `files` | ```List``` | Use `files[]` to indicate the uploaded file(s) to use for the template.

This endpoint requires either **files** or **file_urls[]**, but not both. | | | `fileUrls` | ```List``` | Use `file_urls[]` to have Dropbox Sign download the file(s) to use for the template.

This endpoint requires either **files** or **file_urls[]**, but not both. | | diff --git a/docs/TemplateUpdateFilesResponse.md b/docs/TemplateUpdateFilesResponse.md index 127b295..70930e1 100644 --- a/docs/TemplateUpdateFilesResponse.md +++ b/docs/TemplateUpdateFilesResponse.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `template` | [```TemplateUpdateFilesResponseTemplate```](TemplateUpdateFilesResponseTemplate.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `template`*_required_ | [```TemplateUpdateFilesResponseTemplate```](TemplateUpdateFilesResponseTemplate.md) | | | diff --git a/docs/TemplateUpdateFilesResponseTemplate.md b/docs/TemplateUpdateFilesResponseTemplate.md index 9c198aa..6289a99 100644 --- a/docs/TemplateUpdateFilesResponseTemplate.md +++ b/docs/TemplateUpdateFilesResponseTemplate.md @@ -6,8 +6,8 @@ Contains template id ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `templateId` | ```String``` | The id of the Template. | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/UnclaimedDraftApi.md b/docs/UnclaimedDraftApi.md index fbdf782..4d6d124 100644 --- a/docs/UnclaimedDraftApi.md +++ b/docs/UnclaimedDraftApi.md @@ -2,8 +2,8 @@ All URIs are relative to *https://api.hellosign.com/v3* -Method | HTTP request | Description -------------- | ------------- | ------------- +| Method | HTTP request | Description | +|------------- | ------------- | -------------| [**unclaimedDraftCreate**](UnclaimedDraftApi.md#unclaimedDraftCreate) | **POST** /unclaimed_draft/create | Create Unclaimed Draft [**unclaimedDraftCreateEmbedded**](UnclaimedDraftApi.md#unclaimedDraftCreateEmbedded) | **POST** /unclaimed_draft/create_embedded | Create Embedded Unclaimed Draft [**unclaimedDraftCreateEmbeddedWithTemplate**](UnclaimedDraftApi.md#unclaimedDraftCreateEmbeddedWithTemplate) | **POST** /unclaimed_draft/create_embedded_with_template | Create Embedded Unclaimed Draft with Template @@ -95,8 +95,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **unclaimedDraftCreateRequest** | [**UnclaimedDraftCreateRequest**](UnclaimedDraftCreateRequest.md)| | ### Return type @@ -177,8 +177,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **unclaimedDraftCreateEmbeddedRequest** | [**UnclaimedDraftCreateEmbeddedRequest**](UnclaimedDraftCreateEmbeddedRequest.md)| | ### Return type @@ -270,8 +270,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **unclaimedDraftCreateEmbeddedWithTemplateRequest** | [**UnclaimedDraftCreateEmbeddedWithTemplateRequest**](UnclaimedDraftCreateEmbeddedWithTemplateRequest.md)| | ### Return type @@ -350,8 +350,8 @@ public class Example { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| **signatureRequestId** | **String**| The ID of the signature request to edit and resend. | **unclaimedDraftEditAndResendRequest** | [**UnclaimedDraftEditAndResendRequest**](UnclaimedDraftEditAndResendRequest.md)| | diff --git a/docs/UnclaimedDraftCreateEmbeddedRequest.md b/docs/UnclaimedDraftCreateEmbeddedRequest.md index 60eebef..aab362d 100644 --- a/docs/UnclaimedDraftCreateEmbeddedRequest.md +++ b/docs/UnclaimedDraftCreateEmbeddedRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `clientId`*_required_ | ```String``` | Client id of the app used to create the draft. Used to apply the branding and callback url defined for the app. | | | `requesterEmailAddress`*_required_ | ```String``` | The email address of the user that should be designated as the requester of this draft, if the draft type is `request_signature`. | | | `files` | ```List``` | Use `files[]` to indicate the uploaded file(s) to send for signature.

This endpoint requires either **files** or **file_urls[]**, but not both. | | @@ -49,7 +49,7 @@ Name | Type | Description | Notes ## Enum: TypeEnum -Name | Value +| Name | Value | ---- | ----- | SEND_DOCUMENT | "send_document" | | REQUEST_SIGNATURE | "request_signature" | diff --git a/docs/UnclaimedDraftCreateEmbeddedWithTemplateRequest.md b/docs/UnclaimedDraftCreateEmbeddedWithTemplateRequest.md index 52b5175..03ad8b9 100644 --- a/docs/UnclaimedDraftCreateEmbeddedWithTemplateRequest.md +++ b/docs/UnclaimedDraftCreateEmbeddedWithTemplateRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `clientId`*_required_ | ```String``` | Client id of the app used to create the draft. Used to apply the branding and callback url defined for the app. | | | `requesterEmailAddress`*_required_ | ```String``` | The email address of the user that should be designated as the requester of this draft. | | | `templateIds`*_required_ | ```List``` | Use `template_ids` to create a SignatureRequest from one or more templates, in the order in which the templates will be used. | | diff --git a/docs/UnclaimedDraftCreateRequest.md b/docs/UnclaimedDraftCreateRequest.md index cd8249a..f23c6f4 100644 --- a/docs/UnclaimedDraftCreateRequest.md +++ b/docs/UnclaimedDraftCreateRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `type`*_required_ | [```TypeEnum```](#TypeEnum) | The type of unclaimed draft to create. Use `send_document` to create a claimable file, and `request_signature` for a claimable signature request. If the type is `request_signature` then signers name and email_address are not optional. | | | `files` | ```List``` | Use `files[]` to indicate the uploaded file(s) to send for signature.

This endpoint requires either **files** or **file_urls[]**, but not both. | | | `fileUrls` | ```List``` | Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature.

This endpoint requires either **files** or **file_urls[]**, but not both. | | @@ -37,7 +37,7 @@ Name | Type | Description | Notes ## Enum: TypeEnum -Name | Value +| Name | Value | ---- | ----- | SEND_DOCUMENT | "send_document" | | REQUEST_SIGNATURE | "request_signature" | diff --git a/docs/UnclaimedDraftCreateResponse.md b/docs/UnclaimedDraftCreateResponse.md index 65ed7f9..d2d3a7c 100644 --- a/docs/UnclaimedDraftCreateResponse.md +++ b/docs/UnclaimedDraftCreateResponse.md @@ -6,9 +6,9 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -| `unclaimedDraft` | [```UnclaimedDraftResponse```](UnclaimedDraftResponse.md) | | | +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +| `unclaimedDraft`*_required_ | [```UnclaimedDraftResponse```](UnclaimedDraftResponse.md) | | | | `warnings` | [```List```](WarningResponse.md) | A list of warnings. | | diff --git a/docs/UnclaimedDraftEditAndResendRequest.md b/docs/UnclaimedDraftEditAndResendRequest.md index daefa5a..8eb306a 100644 --- a/docs/UnclaimedDraftEditAndResendRequest.md +++ b/docs/UnclaimedDraftEditAndResendRequest.md @@ -6,8 +6,8 @@ ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `clientId`*_required_ | ```String``` | Client id of the app used to create the draft. Used to apply the branding and callback url defined for the app. | | | `editorOptions` | [```SubEditorOptions```](SubEditorOptions.md) | | | | `isForEmbeddedSigning` | ```Boolean``` | The request created from this draft will also be signable in embedded mode if set to `true`. | | diff --git a/docs/UnclaimedDraftResponse.md b/docs/UnclaimedDraftResponse.md index ab1858d..ab470a2 100644 --- a/docs/UnclaimedDraftResponse.md +++ b/docs/UnclaimedDraftResponse.md @@ -6,8 +6,8 @@ A group of documents that a user can take ownership of via the claim URL. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `signatureRequestId` | ```String``` | The ID of the signature request that is represented by this UnclaimedDraft. | | | `claimUrl` | ```String``` | The URL to be used to claim this UnclaimedDraft. | | | `signingRedirectUrl` | ```String``` | The URL you want signers redirected to after they successfully sign. | | diff --git a/docs/WarningResponse.md b/docs/WarningResponse.md index b041bb3..50cad9b 100644 --- a/docs/WarningResponse.md +++ b/docs/WarningResponse.md @@ -6,8 +6,8 @@ A list of warnings. ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| | `warningMsg`*_required_ | ```String``` | Warning message | | | `warningName`*_required_ | ```String``` | Warning name | | diff --git a/examples/FaxLineAddUser.java b/examples/FaxLineAddUser.java new file mode 100644 index 0000000..34e455d --- /dev/null +++ b/examples/FaxLineAddUser.java @@ -0,0 +1,30 @@ +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.model.*; + +import java.util.List; + +public class Example { + public static void main(String[] args) { + var apiClient = Configuration.getDefaultApiClient() + .setApiKey("YOUR_API_KEY"); + + var faxLineApi = new FaxLineApi(apiClient); + + var data = new FaxLineAddUserRequest() + .number("[FAX_NUMBER]") + .emailAddress("member@dropboxsign.com"); + + try { + FaxLineResponse result = faxLineApi.faxLineAddUser(data); + System.out.println(result); + } catch (ApiException e) { + 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/FaxLineAreaCodeGet.java b/examples/FaxLineAreaCodeGet.java new file mode 100644 index 0000000..1df071a --- /dev/null +++ b/examples/FaxLineAreaCodeGet.java @@ -0,0 +1,26 @@ +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.model.*; + +import java.util.List; + +public class Example { + public static void main(String[] args) { + var apiClient = Configuration.getDefaultApiClient() + .setApiKey("YOUR_API_KEY"); + + var faxLineApi = new FaxLineApi(apiClient); + + try { + FaxLineAreaCodeGetResponse result = faxLineApi.faxLineAreaCodeGet("US", "CA"); + System.out.println(result); + } catch (ApiException e) { + 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/FaxLineCreate.java b/examples/FaxLineCreate.java new file mode 100644 index 0000000..fca1018 --- /dev/null +++ b/examples/FaxLineCreate.java @@ -0,0 +1,30 @@ +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.model.*; + +import java.util.List; + +public class Example { + public static void main(String[] args) { + var apiClient = Configuration.getDefaultApiClient() + .setApiKey("YOUR_API_KEY"); + + var faxLineApi = new FaxLineApi(apiClient); + + var data = new FaxLineCreateRequest() + .areaCode(209) + .country("US"); + + try { + FaxLineResponse result = faxLineApi.faxLineCreate(data); + System.out.println(result); + } catch (ApiException e) { + 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/FaxLineDelete.java b/examples/FaxLineDelete.java new file mode 100644 index 0000000..6b989d2 --- /dev/null +++ b/examples/FaxLineDelete.java @@ -0,0 +1,28 @@ +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.model.*; + +import java.util.List; + +public class Example { + public static void main(String[] args) { + var apiClient = Configuration.getDefaultApiClient() + .setApiKey("YOUR_API_KEY"); + + var faxLineApi = new FaxLineApi(apiClient); + + var data = new FaxLineDeleteRequest() + .number("[FAX_NUMBER]"); + + try { + faxLineApi.faxLineDelete(data); + } catch (ApiException e) { + 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/FaxLineGet.java b/examples/FaxLineGet.java new file mode 100644 index 0000000..69281b3 --- /dev/null +++ b/examples/FaxLineGet.java @@ -0,0 +1,26 @@ +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.model.*; + +import java.util.List; + +public class Example { + public static void main(String[] args) { + var apiClient = Configuration.getDefaultApiClient() + .setApiKey("YOUR_API_KEY"); + + var faxLineApi = new FaxLineApi(apiClient); + + try { + FaxLineResponse result = faxLineApi.faxLineGet("[FAX_NUMBER]"); + System.out.println(result); + } catch (ApiException e) { + 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/FaxLineList.java b/examples/FaxLineList.java new file mode 100644 index 0000000..df1d0bd --- /dev/null +++ b/examples/FaxLineList.java @@ -0,0 +1,26 @@ +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.model.*; + +import java.util.List; + +public class Example { + public static void main(String[] args) { + var apiClient = Configuration.getDefaultApiClient() + .setApiKey("YOUR_API_KEY"); + + var faxLineApi = new FaxLineApi(apiClient); + + try { + FaxLineListResponse result = faxLineApi.faxLineList(); + System.out.println(result); + } catch (ApiException e) { + 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/FaxLineRemoveUser.java b/examples/FaxLineRemoveUser.java new file mode 100644 index 0000000..7864b05 --- /dev/null +++ b/examples/FaxLineRemoveUser.java @@ -0,0 +1,30 @@ +import com.dropbox.sign.ApiException; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.api.*; +import com.dropbox.sign.auth.*; +import com.dropbox.sign.model.*; + +import java.util.List; + +public class Example { + public static void main(String[] args) { + var apiClient = Configuration.getDefaultApiClient() + .setApiKey("YOUR_API_KEY"); + + var faxLineApi = new FaxLineApi(apiClient); + + var data = new FaxLineRemoveUserRequest() + .number("[FAX_NUMBER]") + .emailAddress("member@dropboxsign.com"); + + try { + FaxLineResponse result = faxLineApi.faxLineRemoveUser(data); + System.out.println(result); + } catch (ApiException e) { + 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/gradle.properties b/gradle.properties index 77ba83c..53d9dbe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ #target = android GROUP=com.dropbox.sign POM_ARTIFACT_ID=dropbox-sign -VERSION_NAME=1.5.0 +VERSION_NAME=1.6.0 POM_NAME=Dropbox Sign Java SDK POM_DESCRIPTION=Use the Dropbox Sign Java SDK to connect your Java app to the service of Dropbox Sign in microseconds! diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..e644113 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 774fae8..5c6f89d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 005bcde..9d0ce63 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -69,37 +69,35 @@ app_path=$0 # Need this for daisy-chained symlinks. while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum warn () { - echo "$*" +echo "$*" } >&2 die () { - echo - echo "$*" - echo - exit 1 +echo +echo "$*" +echo +exit 1 } >&2 # OS specific support (must be 'true' or 'false'). @@ -108,10 +106,10 @@ msys=false darwin=false nonstop=false case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -119,39 +117,46 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." - fi +fi else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi +fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac fi # Collect all arguments for the java command, stacking in reverse order: @@ -164,46 +169,56 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi # Use "xargs" to parse quoted args. # @@ -225,10 +240,10 @@ set -- \ # eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 6a68175..25da30d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -33,20 +34,20 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/openapi-config.yaml b/openapi-config.yaml index 459ef9c..a6ecfdc 100644 --- a/openapi-config.yaml +++ b/openapi-config.yaml @@ -16,7 +16,7 @@ additionalProperties: groupId: com.dropbox.sign artifactId: dropbox-sign artifactName: Dropbox Sign Java SDK - artifactVersion: "1.5.0" + artifactVersion: "1.6.0" artifactUrl: https://github.com/hellosign/dropbox-sign-java artifactDescription: Use the Dropbox Sign Java SDK to connect your Java app to the service of Dropbox Sign in microseconds! scmConnection: scm:git:git://github.com/hellosign/dropbox-sign-java.git @@ -24,7 +24,7 @@ additionalProperties: scmUrl: https://github.com/hellosign/dropbox-sign-java licenseName: MIT License licenseUrl: https://www.opensource.org/licenses/mit-license.php - + useCustomTemplateCode: true files: EventCallbackHelper.mustache: templateType: SupportingFiles diff --git a/openapi-sdk.yaml b/openapi-sdk.yaml index 9bf5a68..c7189fd 100644 --- a/openapi-sdk.yaml +++ b/openapi-sdk.yaml @@ -1409,6 +1409,803 @@ paths: seo: title: 'Get Embedded Sign URL | iFrame | Dropbox Sign for Developers' description: 'The Dropbox Sign API allows you to build custom integrations. To find out how to retrieve an embedded iFrame object containing a signature url, click here.' + /fax_line/add_user: + put: + tags: + - 'Fax Line' + summary: 'Add Fax Line User' + description: 'Grants a user access to the specified Fax Line.' + operationId: faxLineAddUser + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/FaxLineAddUserRequest' + examples: + default_example: + $ref: '#/components/examples/FaxLineAddUserRequestExample' + 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/FaxLineResponse' + examples: + default_example: + $ref: '#/components/examples/FaxLineResponseExample' + 4XX: + description: failed_operation + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + examples: + 400_example: + $ref: '#/components/examples/Error400ResponseExample' + 401_example: + $ref: '#/components/examples/Error401ResponseExample' + 402_example: + $ref: '#/components/examples/Error402ResponseExample' + 403_example: + $ref: '#/components/examples/Error403ResponseExample' + 404_example: + $ref: '#/components/examples/Error404ResponseExample' + 4XX_example: + $ref: '#/components/examples/Error4XXResponseExample' + security: + - + api_key: [] + x-codeSamples: + - + lang: PHP + label: PHP + source: + $ref: examples/FaxLineAddUser.php + - + lang: 'C#' + label: 'C#' + source: + $ref: examples/FaxLineAddUser.cs + - + lang: JavaScript + label: JavaScript + source: + $ref: examples/FaxLineAddUser.js + - + lang: TypeScript + label: TypeScript + source: + $ref: examples/FaxLineAddUser.ts + - + lang: Java + label: Java + source: + $ref: examples/FaxLineAddUser.java + - + lang: Ruby + label: Ruby + source: + $ref: examples/FaxLineAddUser.rb + - + lang: Python + label: Python + source: + $ref: examples/FaxLineAddUser.py + - + lang: cURL + label: cURL + source: + $ref: examples/FaxLineAddUser.sh + x-meta: + seo: + title: 'Fax Line Add User | API Documentation | Dropbox Fax for Developers' + description: 'The Dropbox Fax API allows you to build custom integrations. To find out how to add a user to an existing fax line, click here.' + /fax_line/area_codes: + get: + tags: + - 'Fax Line' + summary: 'Get Available Fax Line Area Codes' + description: 'Returns a response with the area codes available for a given state/provice and city.' + operationId: faxLineAreaCodeGet + parameters: + - + name: country + in: query + description: 'Filter area codes by country.' + required: true + schema: + type: string + enum: + - CA + - US + - UK + - + name: state + in: query + description: 'Filter area codes by state.' + schema: + type: string + enum: + - AK + - AL + - AR + - AZ + - CA + - CO + - CT + - DC + - DE + - FL + - GA + - HI + - IA + - ID + - IL + - IN + - KS + - KY + - LA + - MA + - MD + - ME + - MI + - MN + - MO + - MS + - MT + - NC + - ND + - NE + - NH + - NJ + - NM + - NV + - NY + - OH + - OK + - OR + - PA + - RI + - SC + - SD + - TN + - TX + - UT + - VA + - VT + - WA + - WI + - WV + - WY + - + name: province + in: query + description: 'Filter area codes by province.' + schema: + type: string + enum: + - AB + - BC + - MB + - NB + - NL + - NT + - NS + - NU + - 'ON' + - PE + - QC + - SK + - YT + - + name: city + in: query + description: 'Filter area codes by city.' + schema: + type: string + 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/FaxLineAreaCodeGetResponse' + examples: + default_example: + $ref: '#/components/examples/FaxLineAreaCodeGetResponseExample' + 4XX: + description: failed_operation + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + examples: + 400_example: + $ref: '#/components/examples/Error400ResponseExample' + 401_example: + $ref: '#/components/examples/Error401ResponseExample' + 402_example: + $ref: '#/components/examples/Error402ResponseExample' + 403_example: + $ref: '#/components/examples/Error403ResponseExample' + 4XX_example: + $ref: '#/components/examples/Error4XXResponseExample' + security: + - + api_key: [] + x-codeSamples: + - + lang: PHP + label: PHP + source: + $ref: examples/FaxLineAreaCodeGet.php + - + lang: 'C#' + label: 'C#' + source: + $ref: examples/FaxLineAreaCodeGet.cs + - + lang: JavaScript + label: JavaScript + source: + $ref: examples/FaxLineAreaCodeGet.js + - + lang: TypeScript + label: TypeScript + source: + $ref: examples/FaxLineAreaCodeGet.ts + - + lang: Java + label: Java + source: + $ref: examples/FaxLineAreaCodeGet.java + - + lang: Ruby + label: Ruby + source: + $ref: examples/FaxLineAreaCodeGet.rb + - + lang: Python + label: Python + source: + $ref: examples/FaxLineAreaCodeGet.py + - + lang: cURL + label: cURL + source: + $ref: examples/FaxLineAreaCodeGet.sh + x-meta: + seo: + title: 'Fax Line Get Area Codes | API Documentation | Dropbox Fax for Developers' + description: 'The Dropbox Fax API allows you to build custom integrations. To find out how to purchase a new fax line, click here.' + /fax_line/create: + post: + tags: + - 'Fax Line' + summary: 'Purchase Fax Line' + description: 'Purchases a new Fax Line.' + operationId: faxLineCreate + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/FaxLineCreateRequest' + examples: + default_example: + $ref: '#/components/examples/FaxLineCreateRequestExample' + 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/FaxLineResponse' + examples: + default_example: + $ref: '#/components/examples/FaxLineResponseExample' + 4XX: + description: failed_operation + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + examples: + 400_example: + $ref: '#/components/examples/Error400ResponseExample' + 401_example: + $ref: '#/components/examples/Error401ResponseExample' + 402_example: + $ref: '#/components/examples/Error402ResponseExample' + 403_example: + $ref: '#/components/examples/Error403ResponseExample' + 404_example: + $ref: '#/components/examples/Error404ResponseExample' + 4XX_example: + $ref: '#/components/examples/Error4XXResponseExample' + security: + - + api_key: [] + x-codeSamples: + - + lang: PHP + label: PHP + source: + $ref: examples/FaxLineCreate.php + - + lang: 'C#' + label: 'C#' + source: + $ref: examples/FaxLineCreate.cs + - + lang: JavaScript + label: JavaScript + source: + $ref: examples/FaxLineCreate.js + - + lang: TypeScript + label: TypeScript + source: + $ref: examples/FaxLineCreate.ts + - + lang: Java + label: Java + source: + $ref: examples/FaxLineCreate.java + - + lang: Ruby + label: Ruby + source: + $ref: examples/FaxLineCreate.rb + - + lang: Python + label: Python + source: + $ref: examples/FaxLineCreate.py + - + lang: cURL + label: cURL + source: + $ref: examples/FaxLineCreate.sh + x-meta: + seo: + title: 'Purchase Fax Line | API Documentation | Dropbox Fax for Developers' + description: 'The Dropbox Fax API allows you to build custom integrations. To find out how to purchase a new fax line, click here.' + /fax_line: + get: + tags: + - 'Fax Line' + summary: 'Get Fax Line' + description: 'Returns the properties and settings of a Fax Line.' + operationId: faxLineGet + parameters: + - + name: number + in: query + description: 'The Fax Line number.' + required: true + schema: + type: string + 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/FaxLineResponse' + examples: + default_example: + $ref: '#/components/examples/FaxLineResponseExample' + 4XX: + description: failed_operation + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + examples: + 400_example: + $ref: '#/components/examples/Error400ResponseExample' + 401_example: + $ref: '#/components/examples/Error401ResponseExample' + 402_example: + $ref: '#/components/examples/Error402ResponseExample' + 403_example: + $ref: '#/components/examples/Error403ResponseExample' + 404_example: + $ref: '#/components/examples/Error404ResponseExample' + 4XX_example: + $ref: '#/components/examples/Error4XXResponseExample' + security: + - + api_key: [] + x-codeSamples: + - + lang: PHP + label: PHP + source: + $ref: examples/FaxLineGet.php + - + lang: 'C#' + label: 'C#' + source: + $ref: examples/FaxLineGet.cs + - + lang: JavaScript + label: JavaScript + source: + $ref: examples/FaxLineGet.js + - + lang: TypeScript + label: TypeScript + source: + $ref: examples/FaxLineGet.ts + - + lang: Java + label: Java + source: + $ref: examples/FaxLineGet.java + - + lang: Ruby + label: Ruby + source: + $ref: examples/FaxLineGet.rb + - + lang: Python + label: Python + source: + $ref: examples/FaxLineGet.py + - + lang: cURL + label: cURL + source: + $ref: examples/FaxLineGet.sh + x-meta: + seo: + title: 'Get Fax Line | API Documentation | Dropbox Fax for Developers' + description: 'The Dropbox Fax API allows you to build custom integrations. To find out how to retrieve a fax line, click here.' + delete: + tags: + - 'Fax Line' + summary: 'Delete Fax Line' + description: 'Deletes the specified Fax Line from the subscription.' + operationId: faxLineDelete + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/FaxLineDeleteRequest' + examples: + default_example: + $ref: '#/components/examples/FaxLineDeleteRequestExample' + 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: {} + 4XX: + description: failed_operation + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + examples: + 400_example: + $ref: '#/components/examples/Error400ResponseExample' + 401_example: + $ref: '#/components/examples/Error401ResponseExample' + 402_example: + $ref: '#/components/examples/Error402ResponseExample' + 403_example: + $ref: '#/components/examples/Error403ResponseExample' + 404_example: + $ref: '#/components/examples/Error404ResponseExample' + 4XX_example: + $ref: '#/components/examples/Error4XXResponseExample' + security: + - + api_key: [] + x-codeSamples: + - + lang: PHP + label: PHP + source: + $ref: examples/FaxLineDelete.php + - + lang: 'C#' + label: 'C#' + source: + $ref: examples/FaxLineDelete.cs + - + lang: JavaScript + label: JavaScript + source: + $ref: examples/FaxLineDelete.js + - + lang: TypeScript + label: TypeScript + source: + $ref: examples/FaxLineDelete.ts + - + lang: Java + label: Java + source: + $ref: examples/FaxLineDelete.java + - + lang: Ruby + label: Ruby + source: + $ref: examples/FaxLineDelete.rb + - + lang: Python + label: Python + source: + $ref: examples/FaxLineDelete.py + - + lang: cURL + label: cURL + source: + $ref: examples/FaxLineDelete.sh + x-meta: + seo: + title: 'Delete Fax Line | API Documentation | Dropbox Fax for Developers' + description: 'The Dropbox Fax API allows you to build custom integrations. To find out how to delete a fax line, click here.' + /fax_line/list: + get: + tags: + - 'Fax Line' + summary: 'List Fax Lines' + description: 'Returns the properties and settings of multiple Fax Lines.' + operationId: faxLineList + parameters: + - + name: account_id + in: query + description: 'Account ID' + schema: + type: string + example: ab55cd14a97219e36b5ff5fe23f2f9329b0c1e97 + - + name: page + in: query + description: Page + schema: + type: integer + default: 1 + example: 1 + - + name: page_size + in: query + description: 'Page size' + schema: + type: integer + default: 20 + example: 20 + - + name: show_team_lines + in: query + description: 'Show team lines' + schema: + type: boolean + 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/FaxLineListResponse' + examples: + default_example: + $ref: '#/components/examples/FaxLineListResponseExample' + 4XX: + description: failed_operation + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + examples: + 400_example: + $ref: '#/components/examples/Error400ResponseExample' + 401_example: + $ref: '#/components/examples/Error401ResponseExample' + 402_example: + $ref: '#/components/examples/Error402ResponseExample' + 403_example: + $ref: '#/components/examples/Error403ResponseExample' + 4XX_example: + $ref: '#/components/examples/Error4XXResponseExample' + security: + - + api_key: [] + x-codeSamples: + - + lang: PHP + label: PHP + source: + $ref: examples/FaxLineList.php + - + lang: 'C#' + label: 'C#' + source: + $ref: examples/FaxLineList.cs + - + lang: JavaScript + label: JavaScript + source: + $ref: examples/FaxLineList.js + - + lang: TypeScript + label: TypeScript + source: + $ref: examples/FaxLineList.ts + - + lang: Java + label: Java + source: + $ref: examples/FaxLineList.java + - + lang: Ruby + label: Ruby + source: + $ref: examples/FaxLineList.rb + - + lang: Python + label: Python + source: + $ref: examples/FaxLineList.py + - + lang: cURL + label: cURL + source: + $ref: examples/FaxLineList.sh + x-meta: + seo: + title: 'List Fax Lines | API Documentation | Dropbox Fax for Developers' + description: 'The Dropbox Fax API allows you to build custom integrations. To find out how to list your fax lines, click here.' + /fax_line/remove_user: + put: + tags: + - 'Fax Line' + summary: 'Remove Fax Line Access' + description: 'Removes a user''s access to the specified Fax Line.' + operationId: faxLineRemoveUser + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/FaxLineRemoveUserRequest' + examples: + default_example: + $ref: '#/components/examples/FaxLineRemoveUserRequestExample' + 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/FaxLineResponse' + examples: + default_example: + $ref: '#/components/examples/FaxLineResponseExample' + 4XX: + description: failed_operation + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + examples: + 400_example: + $ref: '#/components/examples/Error400ResponseExample' + 401_example: + $ref: '#/components/examples/Error401ResponseExample' + 402_example: + $ref: '#/components/examples/Error402ResponseExample' + 403_example: + $ref: '#/components/examples/Error403ResponseExample' + 404_example: + $ref: '#/components/examples/Error404ResponseExample' + 4XX_example: + $ref: '#/components/examples/Error4XXResponseExample' + security: + - + api_key: [] + x-codeSamples: + - + lang: PHP + label: PHP + source: + $ref: examples/FaxLineRemoveUser.php + - + lang: 'C#' + label: 'C#' + source: + $ref: examples/FaxLineRemoveUser.cs + - + lang: JavaScript + label: JavaScript + source: + $ref: examples/FaxLineRemoveUser.js + - + lang: TypeScript + label: TypeScript + source: + $ref: examples/FaxLineRemoveUser.ts + - + lang: Java + label: Java + source: + $ref: examples/FaxLineRemoveUser.java + - + lang: Ruby + label: Ruby + source: + $ref: examples/FaxLineRemoveUser.rb + - + lang: Python + label: Python + source: + $ref: examples/FaxLineRemoveUser.py + - + lang: cURL + label: cURL + source: + $ref: examples/FaxLineRemoveUser.sh + x-meta: + seo: + title: 'Fax Line Remove User | API Documentation | Dropbox Fax for Developers' + description: 'The Dropbox Fax API allows you to build custom integrations. To find out how to remove a user from an existing fax line, click here.' /oauth/token: post: tags: @@ -6409,6 +7206,145 @@ components: type: boolean default: false type: object + FaxLineAddUserRequest: + required: + - number + properties: + number: + description: 'The Fax Line number.' + type: string + account_id: + description: 'Account ID' + type: string + example: ab55cd14a97219e36b5ff5fe23f2f9329b0c1e97 + email_address: + description: 'Email address' + type: string + format: email + type: object + FaxLineAreaCodeGetStateEnum: + type: string + enum: + - AK + - AL + - AR + - AZ + - CA + - CO + - CT + - DC + - DE + - FL + - GA + - HI + - IA + - ID + - IL + - IN + - KS + - KY + - LA + - MA + - MD + - ME + - MI + - MN + - MO + - MS + - MT + - NC + - ND + - NE + - NH + - NJ + - NM + - NV + - NY + - OH + - OK + - OR + - PA + - RI + - SC + - SD + - TN + - TX + - UT + - VA + - VT + - WA + - WI + - WV + - WY + FaxLineAreaCodeGetProvinceEnum: + type: string + enum: + - AB + - BC + - MB + - NB + - NL + - NT + - NS + - NU + - 'ON' + - PE + - QC + - SK + - YT + FaxLineAreaCodeGetCountryEnum: + type: string + enum: + - CA + - US + - UK + FaxLineCreateRequest: + required: + - area_code + - country + properties: + area_code: + description: 'Area code' + type: integer + country: + description: Country + type: string + enum: + - CA + - US + - UK + city: + description: City + type: string + account_id: + description: 'Account ID' + type: string + example: ab55cd14a97219e36b5ff5fe23f2f9329b0c1e97 + type: object + FaxLineDeleteRequest: + required: + - number + properties: + number: + description: 'The Fax Line number.' + type: string + type: object + FaxLineRemoveUserRequest: + required: + - number + properties: + number: + description: 'The Fax Line number.' + type: string + account_id: + description: 'Account ID' + type: string + example: ab55cd14a97219e36b5ff5fe23f2f9329b0c1e97 + email_address: + description: 'Email address' + type: string + format: email + type: object OAuthTokenGenerateRequest: required: - client_id @@ -9118,6 +10054,8 @@ components: default: false type: object AccountCreateResponse: + required: + - account properties: account: $ref: '#/components/schemas/AccountResponse' @@ -9131,6 +10069,8 @@ components: type: object x-internal-class: true AccountGetResponse: + required: + - account properties: account: $ref: '#/components/schemas/AccountResponse' @@ -9153,6 +10093,8 @@ components: type: object x-internal-class: true ApiAppGetResponse: + required: + - api_app properties: api_app: $ref: '#/components/schemas/ApiAppResponse' @@ -9164,6 +10106,9 @@ components: type: object x-internal-class: true ApiAppListResponse: + required: + - api_apps + - list_info properties: api_apps: description: 'Contains information about API Apps.' @@ -9180,6 +10125,10 @@ components: type: object x-internal-class: true BulkSendJobGetResponse: + required: + - bulk_send_job + - list_info + - signature_requests properties: bulk_send_job: $ref: '#/components/schemas/BulkSendJobResponse' @@ -9198,6 +10147,9 @@ components: type: object x-internal-class: true BulkSendJobListResponse: + required: + - bulk_send_jobs + - list_info properties: bulk_send_jobs: description: 'Contains a list of BulkSendJobs that the API caller has access to.' @@ -9214,6 +10166,8 @@ components: type: object x-internal-class: true BulkSendJobSendResponse: + required: + - bulk_send_job properties: bulk_send_job: $ref: '#/components/schemas/BulkSendJobResponse' @@ -9225,6 +10179,8 @@ components: type: object x-internal-class: true EmbeddedEditUrlResponse: + required: + - embedded properties: embedded: $ref: '#/components/schemas/EmbeddedEditUrlResponseEmbedded' @@ -9236,6 +10192,8 @@ components: type: object x-internal-class: true EmbeddedSignUrlResponse: + required: + - embedded properties: embedded: $ref: '#/components/schemas/EmbeddedSignUrlResponseEmbedded' @@ -9253,7 +10211,45 @@ components: error: $ref: '#/components/schemas/ErrorResponseError' type: object + FaxLineResponse: + required: + - fax_line + properties: + fax_line: + $ref: '#/components/schemas/FaxLineResponseFaxLine' + warnings: + $ref: '#/components/schemas/WarningResponse' + type: object + x-internal-class: true + FaxLineAreaCodeGetResponse: + required: + - area_codes + properties: + area_codes: + type: array + items: + type: integer + type: object + x-internal-class: true + FaxLineListResponse: + required: + - fax_lines + - list_info + properties: + list_info: + $ref: '#/components/schemas/ListInfoResponse' + fax_lines: + type: array + items: + $ref: '#/components/schemas/FaxLineResponseFaxLine' + warnings: + $ref: '#/components/schemas/WarningResponse' + type: object + x-internal-class: true FileResponse: + required: + - file_url + - expires_at properties: file_url: description: 'URL to the file.' @@ -9264,6 +10260,8 @@ components: type: object x-internal-class: true FileResponseDataUri: + required: + - data_uri properties: data_uri: description: 'File as base64 encoded string.' @@ -9271,6 +10269,8 @@ components: type: object x-internal-class: true ReportCreateResponse: + required: + - report properties: report: $ref: '#/components/schemas/ReportResponse' @@ -9282,6 +10282,8 @@ components: type: object x-internal-class: true SignatureRequestGetResponse: + required: + - signature_request properties: signature_request: $ref: '#/components/schemas/SignatureRequestResponse' @@ -9293,6 +10295,9 @@ components: type: object x-internal-class: true SignatureRequestListResponse: + required: + - signature_requests + - list_info properties: signature_requests: description: 'Contains information about signature requests.' @@ -9584,6 +10589,23 @@ components: description: 'Name of the error.' type: string type: object + FaxLineResponseFaxLine: + properties: + number: + description: Number + type: string + created_at: + description: 'Created at' + type: integer + updated_at: + description: 'Updated at' + type: integer + accounts: + type: array + items: + $ref: '#/components/schemas/AccountResponse' + type: object + x-internal-class: true ListInfoResponse: description: 'Contains pagination information about the data returned.' properties: @@ -9745,6 +10767,7 @@ components: signer: description: 'The Signer this attachment is assigned to.' type: string + x-int-or-string: true name: description: 'The name of this attachment.' type: string @@ -10374,6 +11397,7 @@ components: description: 'The signer of the Custom Field. Can be `null` if field is a merge field (assigned to Sender).' type: string nullable: true + x-int-or-string: true x: description: 'The horizontal offset in pixels for this form field.' type: integer @@ -10489,6 +11513,7 @@ components: signer: description: 'The signer of the Form Field.' type: string + x-int-or-string: true x: description: 'The horizontal offset in pixels for this form field.' type: integer @@ -11100,6 +12125,8 @@ components: type: string type: object TeamGetResponse: + required: + - team properties: team: $ref: '#/components/schemas/TeamResponse' @@ -11111,6 +12138,8 @@ components: type: object x-internal-class: true TeamGetInfoResponse: + required: + - team properties: team: $ref: '#/components/schemas/TeamInfoResponse' @@ -11122,6 +12151,8 @@ components: type: object x-internal-class: true TeamInvitesResponse: + required: + - team_invites properties: team_invites: description: 'Contains a list of team invites and their roles.' @@ -11135,6 +12166,9 @@ components: type: object x-internal-class: true TeamMembersResponse: + required: + - team_members + - list_info properties: team_members: description: 'Contains a list of team members and their roles for a specific team.' @@ -11150,6 +12184,9 @@ components: type: object x-internal-class: true TeamSubTeamsResponse: + required: + - sub_teams + - list_info properties: sub_teams: description: 'Contains a list with sub teams.' @@ -11165,6 +12202,8 @@ components: type: object x-internal-class: true TemplateCreateResponse: + required: + - template properties: template: $ref: '#/components/schemas/TemplateCreateResponseTemplate' @@ -11176,6 +12215,8 @@ components: type: object x-internal-class: true TemplateCreateEmbeddedDraftResponse: + required: + - template properties: template: $ref: '#/components/schemas/TemplateCreateEmbeddedDraftResponseTemplate' @@ -11187,12 +12228,16 @@ components: 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 properties: template: $ref: '#/components/schemas/TemplateResponse' @@ -11204,6 +12249,9 @@ components: type: object x-internal-class: true TemplateListResponse: + required: + - templates + - list_info properties: templates: description: 'List of templates that the API caller has access to.' @@ -11220,12 +12268,16 @@ components: type: object x-internal-class: true TemplateUpdateFilesResponse: + required: + - template properties: template: $ref: '#/components/schemas/TemplateUpdateFilesResponseTemplate' type: object x-internal-class: true UnclaimedDraftCreateResponse: + required: + - unclaimed_draft properties: unclaimed_draft: $ref: '#/components/schemas/UnclaimedDraftResponse' @@ -11350,6 +12402,22 @@ components: summary: 'Default Example' value: $ref: examples/json/EmbeddedEditUrlRequestDefaultExample.json + FaxLineAddUserRequestExample: + summary: 'Default Example' + value: + $ref: examples/json/FaxLineAddUserRequestExample.json + FaxLineCreateRequestExample: + summary: 'Default Example' + value: + $ref: examples/json/FaxLineCreateRequestExample.json + FaxLineDeleteRequestExample: + summary: 'Default Example' + value: + $ref: examples/json/FaxLineDeleteRequestExample.json + FaxLineRemoveUserRequestExample: + summary: 'Default Example' + value: + $ref: examples/json/FaxLineRemoveUserRequestExample.json OAuthTokenGenerateRequestExample: summary: 'OAuth Token Generate Example' value: @@ -11594,6 +12662,18 @@ components: summary: 'Error 4XX failed_operation' value: $ref: examples/json/Error4XXResponseExample.json + FaxLineResponseExample: + summary: 'Sample Fax Line Response' + value: + $ref: examples/json/FaxLineResponseExample.json + FaxLineAreaCodeGetResponseExample: + summary: 'Sample Area Code Response' + value: + $ref: examples/json/FaxLineAreaCodeGetResponseExample.json + FaxLineListResponseExample: + summary: 'Sample Fax Line List Response' + value: + $ref: examples/json/FaxLineListResponseExample.json ReportCreateResponseExample: summary: Report value: diff --git a/pom.xml b/pom.xml index e8b3eed..93887dd 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ dropbox-sign jar dropbox-sign - 1.5.0 + 1.6.0 https://github.com/hellosign/dropbox-sign-java Use the Dropbox Sign Java SDK to connect your Java app to the service of Dropbox Sign in microseconds! @@ -58,12 +58,12 @@ maven-surefire-plugin 3.0.0-M5 - + loggerPath conf/log4j.properties - + -Xms512m -Xmx1500m methods 10 @@ -104,7 +104,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.2.0 + 3.2.2 @@ -118,7 +118,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.2.0 + 3.3.0 add_sources @@ -149,7 +149,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.10.1 1.8 1.8 @@ -165,7 +165,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.3.1 + 3.3.2 attach-javadocs @@ -250,7 +250,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 + 3.0.1 sign-artifacts @@ -267,12 +267,6 @@ - - io.swagger - swagger-annotations - ${swagger-annotations-version} - - commons-codec commons-codec @@ -329,11 +323,6 @@ jackson-datatype-jsr310 ${jackson-version} - - com.github.joschi.jackson - jackson-datatype-threetenbp - ${threetenbp-version} - jakarta.annotation jakarta.annotation-api @@ -347,8 +336,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-api ${junit-version} test @@ -361,15 +350,13 @@ UTF-8 - 1.6.3 - 2.35 - 2.13.0 - 2.13.0 - 0.2.2 - 2.9.10 + 2.37 + 2.17.1 + 2.17.1 + 0.2.6 1.3.5 - 4.13.2 - 2.17.3 + 5.10.0 + 2.21.0 3.12.4 diff --git a/run-build b/run-build index 82ab396..1e1cfec 100755 --- a/run-build +++ b/run-build @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# see https://github.com/OpenAPITools/openapi-generator/tree/v5.4.0/modules/openapi-generator/src/main/resources/Java +# see https://github.com/OpenAPITools/openapi-generator/tree/v7.8.0/modules/openapi-generator/src/main/resources/Java set -e @@ -9,7 +9,7 @@ WORKING_DIR="/app/java" docker run --rm \ -v "${DIR}/:/local" \ - openapitools/openapi-generator-cli:v5.3.0 generate \ + openapitools/openapi-generator-cli:v7.8.0 generate \ -i "/local/openapi-sdk.yaml" \ -c "/local/openapi-config.yaml" \ -t "/local/templates" \ diff --git a/src/main/java/com/dropbox/sign/ApiClient.java b/src/main/java/com/dropbox/sign/ApiClient.java index 635c863..09041f2 100644 --- a/src/main/java/com/dropbox/sign/ApiClient.java +++ b/src/main/java/com/dropbox/sign/ApiClient.java @@ -1,3 +1,16 @@ +/* + * 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; import javax.ws.rs.client.Client; @@ -35,6 +48,7 @@ import java.nio.file.Paths; import java.nio.file.StandardCopyOption; import org.glassfish.jersey.logging.LoggingFeature; +import java.util.AbstractMap.SimpleEntry; import java.util.logging.Level; import java.util.logging.Logger; import java.util.Collection; @@ -42,12 +56,15 @@ import java.util.Map; import java.util.Map.Entry; import java.util.HashMap; -import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.List; import java.util.Arrays; import java.util.ArrayList; import java.util.Date; -import org.threeten.bp.OffsetDateTime; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import java.time.OffsetDateTime; import java.net.URLEncoder; @@ -62,47 +79,53 @@ import com.dropbox.sign.auth.HttpBasicAuth; import com.dropbox.sign.auth.HttpBearerAuth; import com.dropbox.sign.auth.ApiKeyAuth; - import com.dropbox.sign.model.ErrorResponse; /** *

ApiClient class.

*/ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ApiClient extends JavaTimeFormatter { - protected Map defaultHeaderMap = new HashMap(); - protected Map defaultCookieMap = new HashMap(); + private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + protected Map defaultHeaderMap = new HashMap<>(); + protected Map defaultCookieMap = new HashMap<>(); protected String basePath = "https://api.hellosign.com/v3"; protected String userAgent; private static final Logger log = Logger.getLogger(ApiClient.class.getName()); - protected List servers = new ArrayList(Arrays.asList( - new ServerConfiguration( - "https://api.hellosign.com/v3", - "No description provided", - new HashMap() - ) + protected List servers = new ArrayList<>(Arrays.asList( + new ServerConfiguration( + "https://api.hellosign.com/v3", + "No description provided", + new LinkedHashMap<>() + ) )); protected Integer serverIndex = 0; protected Map serverVariables = null; - protected Map> operationServers = new HashMap>() {{ - put("OAuthApi.oauthTokenGenerate", new ArrayList(Arrays.asList( - new ServerConfiguration( - "https://app.hellosign.com", - "No description provided", - new HashMap() - ) + protected Map> operationServers; + + { + Map> operationServers = new HashMap<>(); + operationServers.put("OAuthApi.oauthTokenGenerate", new ArrayList<>(Arrays.asList( + new ServerConfiguration( + "https://app.hellosign.com", + "No description provided", + new LinkedHashMap<>() + ) ))); - put("OAuthApi.oauthTokenRefresh", new ArrayList(Arrays.asList( - new ServerConfiguration( - "https://app.hellosign.com", - "No description provided", - new HashMap() - ) + operationServers.put("OAuthApi.oauthTokenRefresh", new ArrayList<>(Arrays.asList( + new ServerConfiguration( + "https://app.hellosign.com", + "No description provided", + new LinkedHashMap<>() + ) ))); - }}; - protected Map operationServerIndex = new HashMap(); - protected Map> operationServerVariables = new HashMap>(); + this.operationServers = operationServers; + } + + protected Map operationServerIndex = new HashMap<>(); + protected Map> operationServerVariables = new HashMap<>(); protected boolean debugging = false; protected ClientConfig clientConfig; protected int connectionTimeout = 0; @@ -136,10 +159,10 @@ public ApiClient(Map authMap) { this.dateFormat = new RFC3339DateFormat(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/1.5.0/java"); + setUserAgent("OpenAPI-Generator/1.6.0/java"); // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap(); + authentications = new HashMap<>(); Authentication auth = null; if (authMap != null) { auth = authMap.get("api_key"); @@ -161,7 +184,7 @@ public ApiClient(Map authMap) { authentications = Collections.unmodifiableMap(authentications); // Setup authentication lookup (key: authentication alias, value: authentication name) - authenticationLookup = new HashMap(); + authenticationLookup = new HashMap<>(); } /** @@ -186,7 +209,7 @@ public Client getHttpClient() { *

Setter for the field httpClient.

* * @param httpClient a {@link javax.ws.rs.client.Client} object. - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setHttpClient(Client httpClient) { this.httpClient = httpClient; @@ -206,7 +229,7 @@ public String getBasePath() { * Sets the base URL to the location where the OpenAPI document is being served. * * @param basePath The base URL to the target host. - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setBasePath(String basePath) { this.basePath = basePath; @@ -226,7 +249,7 @@ public List getServers() { *

Setter for the field servers.

* * @param servers a {@link java.util.List} of servers. - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setServers(List servers) { this.servers = servers; @@ -247,7 +270,7 @@ public Integer getServerIndex() { *

Setter for the field serverIndex.

* * @param serverIndex the server index - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setServerIndex(Integer serverIndex) { this.serverIndex = serverIndex; @@ -268,7 +291,7 @@ public Map getServerVariables() { *

Setter for the field serverVariables.

* * @param serverVariables a {@link java.util.Map} of server variables. - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setServerVariables(Map serverVariables) { this.serverVariables = serverVariables; @@ -305,7 +328,7 @@ public Authentication getAuthentication(String authName) { * Helper method to set username for the first HTTP basic authentication. * * @param username Username - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setUsername(String username) { for (Authentication auth : authentications.values()) { @@ -321,7 +344,7 @@ public ApiClient setUsername(String username) { * Helper method to set password for the first HTTP basic authentication. * * @param password Password - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setPassword(String password) { for (Authentication auth : authentications.values()) { @@ -337,7 +360,7 @@ public ApiClient setPassword(String password) { * Helper method to set API key value for the first API key authentication. * * @param apiKey API key - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setApiKey(String apiKey) { for (Authentication auth : authentications.values()) { @@ -352,11 +375,12 @@ public ApiClient setApiKey(String apiKey) { throw new RuntimeException("No API key authentication configured!"); } + /** * Helper method to set bearer token for the first Bearer authentication. * * @param bearerToken Bearer token - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setBearerToken(String bearerToken) { for (Authentication auth : authentications.values()) { @@ -372,7 +396,7 @@ public ApiClient setBearerToken(String bearerToken) { * Set the User-Agent header's value (by adding to the default header map). * * @param userAgent Http user agent - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setUserAgent(String userAgent) { this.userAgent = userAgent; @@ -394,7 +418,7 @@ public String getUserAgent(){ * * @param key The header's key * @param value The header's value - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient addDefaultHeader(String key, String value) { defaultHeaderMap.put(key, value); @@ -406,7 +430,7 @@ public ApiClient addDefaultHeader(String key, String value) { * * @param key The cookie's key * @param value The cookie's value - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient addDefaultCookie(String key, String value) { defaultCookieMap.put(key, value); @@ -426,7 +450,7 @@ public ClientConfig getClientConfig() { * Set the client config. * * @param clientConfig Set the client config - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setClientConfig(ClientConfig clientConfig) { this.clientConfig = clientConfig; @@ -448,7 +472,7 @@ public boolean isDebugging() { * Enable/disable debugging for this API client. * * @param debugging To enable (true) or disable (false) debugging - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setDebugging(boolean debugging) { this.debugging = debugging; @@ -472,7 +496,7 @@ public String getTempFolderPath() { * Set temp folder path * * @param tempFolderPath Temp folder path - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setTempFolderPath(String tempFolderPath) { this.tempFolderPath = tempFolderPath; @@ -494,7 +518,7 @@ public int getConnectTimeout() { * {@link Integer#MAX_VALUE}. * * @param connectionTimeout Connection timeout in milliseconds - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setConnectTimeout(int connectionTimeout) { this.connectionTimeout = connectionTimeout; @@ -517,7 +541,7 @@ public int getReadTimeout() { * {@link Integer#MAX_VALUE}. * * @param readTimeout Read timeout in milliseconds - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setReadTimeout(int readTimeout) { this.readTimeout = readTimeout; @@ -538,7 +562,7 @@ public DateFormat getDateFormat() { * Set the date format used to parse/format date parameters. * * @param dateFormat Date format - * @return a {@link com.dropbox.sign.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setDateFormat(DateFormat dateFormat) { this.dateFormat = dateFormat; @@ -584,9 +608,9 @@ public String parameterToString(Object param) { return formatDate((Date) param); } else if (param instanceof OffsetDateTime) { return formatOffsetDateTime((OffsetDateTime) param); - } else if (param instanceof Collection) { + } else if (param instanceof Collection) { StringBuilder b = new StringBuilder(); - for(Object o : (Collection)param) { + for(Object o : (Collection)param) { if(b.length() > 0) { b.append(','); } @@ -607,14 +631,14 @@ public String parameterToString(Object param) { * @return List of pairs */ public List parameterToPairs(String collectionFormat, String name, Object value){ - List params = new ArrayList(); + List params = new ArrayList<>(); // preconditions if (name == null || name.isEmpty() || value == null) return params; - Collection valueCollection; - if (value instanceof Collection) { - valueCollection = (Collection) value; + Collection valueCollection; + if (value instanceof Collection) { + valueCollection = (Collection) value; } else { params.add(new Pair(name, parameterToString(value))); return params; @@ -666,14 +690,13 @@ public List parameterToPairs(String collectionFormat, String name, Object * application/json; charset=UTF8 * APPLICATION/JSON * application/vnd.company+json - * "* / *" is also default to JSON + * "*{@literal /}*" is also considered JSON by this method. * * @param mime MIME * @return True if the MIME type is JSON */ public boolean isJsonMime(String mime) { - String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + return mime != null && (mime.equals("*/*") || JSON_MIME_PATTERN.matcher(mime).matches()); } /** @@ -685,8 +708,8 @@ public boolean isJsonMime(String mime) { * @return The Accept header to use. If the given array is empty, * null will be returned (not to set the Accept header explicitly). */ - public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) { + public String selectHeaderAccept(String... accepts) { + if (accepts == null || accepts.length == 0) { return null; } for (String accept : accepts) { @@ -706,8 +729,8 @@ public String selectHeaderAccept(String[] accepts) { * @return The Content-Type header to use. If the given array is empty, * JSON will be used. */ - public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0) { + public String selectHeaderContentType(String... contentTypes) { + if (contentTypes == null || contentTypes.length == 0) { return "application/json"; } for (String contentType : contentTypes) { @@ -751,7 +774,17 @@ public Entity serialize(Object obj, Map formParams, String co File file = (File) param.getValue(); FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()) .fileName(file.getName()).size(file.length()).build(); - multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); + + // Attempt to probe the content type for the file so that the form part is more correctly + // and precisely identified, but fall back to application/octet-stream if that fails. + MediaType type; + try { + type = MediaType.valueOf(Files.probeContentType(file.toPath())); + } catch (IOException | IllegalArgumentException e) { + type = MediaType.APPLICATION_OCTET_STREAM_TYPE; + } + + multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, type)); } else { FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build(); multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(param.getValue()))); @@ -845,11 +878,6 @@ public T deserialize(Response response, GenericType returnType) throws Ap return file; } - String contentType = null; - List contentTypes = response.getHeaders().get("Content-Type"); - if (contentTypes != null && !contentTypes.isEmpty()) - contentType = String.valueOf(contentTypes.get(0)); - // read the entity stream multiple times response.bufferEntity(); @@ -951,14 +979,11 @@ public ApiResponse invokeAPI( boolean isBodyNullable) throws ApiException { - // Not using `.target(targetURL).path(path)` below, - // to support (constant) query string in `path`, e.g. "/posts?draft=1" String targetURL; - if (serverIndex != null && operationServers.containsKey(operation)) { - Integer index = operationServerIndex.containsKey(operation) ? operationServerIndex.get(operation) : serverIndex; - Map variables = operationServerVariables.containsKey(operation) ? - operationServerVariables.get(operation) : serverVariables; - List serverConfigurations = operationServers.get(operation); + List serverConfigurations; + if (serverIndex != null && (serverConfigurations = operationServers.get(operation)) != null) { + int index = operationServerIndex.getOrDefault(operation, serverIndex).intValue(); + Map variables = operationServerVariables.getOrDefault(operation, serverVariables); if (index < 0 || index >= serverConfigurations.size()) { throw new ArrayIndexOutOfBoundsException( String.format( @@ -969,6 +994,8 @@ public ApiResponse invokeAPI( } else { targetURL = this.basePath + path; } + // Not using `.target(targetURL).path(path)` below, + // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); if (queryParams != null) { @@ -979,11 +1006,10 @@ public ApiResponse invokeAPI( } } - Invocation.Builder invocationBuilder; + Invocation.Builder invocationBuilder = target.request(); + if (accept != null) { - invocationBuilder = target.request().accept(accept); - } else { - invocationBuilder = target.request(); + invocationBuilder = invocationBuilder.accept(accept); } for (Entry entry : cookieParams.entrySet()) { @@ -1006,15 +1032,17 @@ public ApiResponse invokeAPI( Map allHeaderParams = new HashMap<>(defaultHeaderMap); allHeaderParams.putAll(headerParams); - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); @@ -1028,10 +1056,11 @@ public ApiResponse invokeAPI( try { response = sendRequest(method, invocationBuilder, entity); - int statusCode = response.getStatusInfo().getStatusCode(); + final int statusCode = response.getStatusInfo().getStatusCode(); + Map> responseHeaders = buildResponseHeaders(response); - if (response.getStatusInfo() == Status.NO_CONTENT) { + if (statusCode == Status.NO_CONTENT.getStatusCode()) { return new ApiResponse(statusCode, responseHeaders); } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { if (returnType == null) { @@ -1104,8 +1133,8 @@ protected Client buildHttpClient() { clientConfig = getDefaultClientConfig(); ClientBuilder clientBuilder = ClientBuilder.newBuilder(); - customizeClientBuilder(clientBuilder); clientBuilder = clientBuilder.withConfig(clientConfig); + customizeClientBuilder(clientBuilder); return clientBuilder.build(); } @@ -1192,10 +1221,10 @@ public void checkServerTrusted(X509Certificate[] certs, String authType) { * @return a {@link java.util.Map} of response headers. */ protected Map> buildResponseHeaders(Response response) { - Map> responseHeaders = new HashMap>(); + Map> responseHeaders = new HashMap<>(); for (Entry> entry: response.getHeaders().entrySet()) { List values = entry.getValue(); - List headers = new ArrayList(); + List headers = new ArrayList<>(); for (Object o : values) { headers.add(String.valueOf(o)); } diff --git a/src/main/java/com/dropbox/sign/ApiException.java b/src/main/java/com/dropbox/sign/ApiException.java index 6bb15f2..92ae80e 100644 --- a/src/main/java/com/dropbox/sign/ApiException.java +++ b/src/main/java/com/dropbox/sign/ApiException.java @@ -13,15 +13,17 @@ package com.dropbox.sign; -import com.dropbox.sign.model.ErrorResponse; import java.util.Map; import java.util.List; +import com.dropbox.sign.model.ErrorResponse; /** * API Exception */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + private int code = 0; private Map> responseHeaders = null; private String responseBody = null; diff --git a/src/main/java/com/dropbox/sign/Configuration.java b/src/main/java/com/dropbox/sign/Configuration.java index a7dda5b..4b06232 100644 --- a/src/main/java/com/dropbox/sign/Configuration.java +++ b/src/main/java/com/dropbox/sign/Configuration.java @@ -13,8 +13,10 @@ package com.dropbox.sign; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class Configuration { + public static final String VERSION = "1.6.0"; + private static ApiClient defaultApiClient = new ApiClient(); /** diff --git a/src/main/java/com/dropbox/sign/CustomInstantDeserializer.java b/src/main/java/com/dropbox/sign/CustomInstantDeserializer.java deleted file mode 100644 index a58fea4..0000000 --- a/src/main/java/com/dropbox/sign/CustomInstantDeserializer.java +++ /dev/null @@ -1,232 +0,0 @@ -package com.dropbox.sign; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonTokenId; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils; -import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase; -import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction; -import com.fasterxml.jackson.datatype.threetenbp.function.Function; -import org.threeten.bp.DateTimeException; -import org.threeten.bp.DateTimeUtils; -import org.threeten.bp.Instant; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.ZoneId; -import org.threeten.bp.ZonedDateTime; -import org.threeten.bp.format.DateTimeFormatter; -import org.threeten.bp.temporal.Temporal; -import org.threeten.bp.temporal.TemporalAccessor; - -import java.io.IOException; -import java.math.BigDecimal; - -/** - * Deserializer for ThreeTen temporal {@link Instant}s, {@link OffsetDateTime}, and {@link ZonedDateTime}s. - * Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format. - * - * @author Nick Williams - */ -public class CustomInstantDeserializer - extends ThreeTenDateTimeDeserializerBase { - private static final long serialVersionUID = 1L; - - public static final CustomInstantDeserializer INSTANT = new CustomInstantDeserializer( - Instant.class, DateTimeFormatter.ISO_INSTANT, - new Function() { - @Override - public Instant apply(TemporalAccessor temporalAccessor) { - return Instant.from(temporalAccessor); - } - }, - new Function() { - @Override - public Instant apply(FromIntegerArguments a) { - return Instant.ofEpochMilli(a.value); - } - }, - new Function() { - @Override - public Instant apply(FromDecimalArguments a) { - return Instant.ofEpochSecond(a.integer, a.fraction); - } - }, - null - ); - - public static final CustomInstantDeserializer OFFSET_DATE_TIME = new CustomInstantDeserializer( - OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, - new Function() { - @Override - public OffsetDateTime apply(TemporalAccessor temporalAccessor) { - return OffsetDateTime.from(temporalAccessor); - } - }, - new Function() { - @Override - public OffsetDateTime apply(FromIntegerArguments a) { - return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); - } - }, - new Function() { - @Override - public OffsetDateTime apply(FromDecimalArguments a) { - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); - } - }, - new BiFunction() { - @Override - public OffsetDateTime apply(OffsetDateTime d, ZoneId z) { - return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime())); - } - } - ); - - public static final CustomInstantDeserializer ZONED_DATE_TIME = new CustomInstantDeserializer( - ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, - new Function() { - @Override - public ZonedDateTime apply(TemporalAccessor temporalAccessor) { - return ZonedDateTime.from(temporalAccessor); - } - }, - new Function() { - @Override - public ZonedDateTime apply(FromIntegerArguments a) { - return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); - } - }, - new Function() { - @Override - public ZonedDateTime apply(FromDecimalArguments a) { - return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); - } - }, - new BiFunction() { - @Override - public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) { - return zonedDateTime.withZoneSameInstant(zoneId); - } - } - ); - - protected final Function fromMilliseconds; - - protected final Function fromNanoseconds; - - protected final Function parsedToValue; - - protected final BiFunction adjust; - - protected CustomInstantDeserializer(Class supportedType, - DateTimeFormatter parser, - Function parsedToValue, - Function fromMilliseconds, - Function fromNanoseconds, - BiFunction adjust) { - super(supportedType, parser); - this.parsedToValue = parsedToValue; - this.fromMilliseconds = fromMilliseconds; - this.fromNanoseconds = fromNanoseconds; - this.adjust = adjust == null ? new BiFunction() { - @Override - public T apply(T t, ZoneId zoneId) { - return t; - } - } : adjust; - } - - @SuppressWarnings("unchecked") - protected CustomInstantDeserializer(CustomInstantDeserializer base, DateTimeFormatter f) { - super((Class) base.handledType(), f); - parsedToValue = base.parsedToValue; - fromMilliseconds = base.fromMilliseconds; - fromNanoseconds = base.fromNanoseconds; - adjust = base.adjust; - } - - @Override - protected JsonDeserializer withDateFormat(DateTimeFormatter dtf) { - if (dtf == _formatter) { - return this; - } - return new CustomInstantDeserializer(this, dtf); - } - - @Override - public T deserialize(JsonParser parser, DeserializationContext context) throws IOException { - //NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only - //string values have to be adjusted to the configured TZ. - switch (parser.getCurrentTokenId()) { - case JsonTokenId.ID_NUMBER_FLOAT: { - BigDecimal value = parser.getDecimalValue(); - long seconds = value.longValue(); - int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds); - return fromNanoseconds.apply(new FromDecimalArguments( - seconds, nanoseconds, getZone(context))); - } - - case JsonTokenId.ID_NUMBER_INT: { - long timestamp = parser.getLongValue(); - if (context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) { - return this.fromNanoseconds.apply(new FromDecimalArguments( - timestamp, 0, this.getZone(context) - )); - } - return this.fromMilliseconds.apply(new FromIntegerArguments( - timestamp, this.getZone(context) - )); - } - - case JsonTokenId.ID_STRING: { - String string = parser.getText().trim(); - if (string.length() == 0) { - return null; - } - if (string.endsWith("+0000")) { - string = string.substring(0, string.length() - 5) + "Z"; - } - T value; - try { - TemporalAccessor acc = _formatter.parse(string); - value = parsedToValue.apply(acc); - if (context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) { - return adjust.apply(value, this.getZone(context)); - } - } catch (DateTimeException e) { - throw _peelDTE(e); - } - return value; - } - } - throw context.mappingException("Expected type float, integer, or string."); - } - - private ZoneId getZone(DeserializationContext context) { - // Instants are always in UTC, so don't waste compute cycles - return (_valueClass == Instant.class) ? null : DateTimeUtils.toZoneId(context.getTimeZone()); - } - - private static class FromIntegerArguments { - public final long value; - public final ZoneId zoneId; - - private FromIntegerArguments(long value, ZoneId zoneId) { - this.value = value; - this.zoneId = zoneId; - } - } - - private static class FromDecimalArguments { - public final long integer; - public final int fraction; - public final ZoneId zoneId; - - private FromDecimalArguments(long integer, int fraction, ZoneId zoneId) { - this.integer = integer; - this.fraction = fraction; - this.zoneId = zoneId; - } - } -} diff --git a/src/main/java/com/dropbox/sign/EventCallbackHelper.java b/src/main/java/com/dropbox/sign/EventCallbackHelper.java index 47f5a81..39eb4b7 100644 --- a/src/main/java/com/dropbox/sign/EventCallbackHelper.java +++ b/src/main/java/com/dropbox/sign/EventCallbackHelper.java @@ -18,7 +18,7 @@ import org.apache.commons.codec.digest.HmacAlgorithms; import org.apache.commons.codec.digest.HmacUtils; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class EventCallbackHelper { public static final String EVENT_TYPE_ACCOUNT_CALLBACK = "account_callback"; diff --git a/src/main/java/com/dropbox/sign/JSON.java b/src/main/java/com/dropbox/sign/JSON.java index 49a25e1..638c43f 100644 --- a/src/main/java/com/dropbox/sign/JSON.java +++ b/src/main/java/com/dropbox/sign/JSON.java @@ -1,11 +1,22 @@ +/* + * 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; -import org.threeten.bp.*; import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; import com.dropbox.sign.model.*; import java.text.DateFormat; @@ -16,26 +27,22 @@ import javax.ws.rs.core.GenericType; import javax.ws.rs.ext.ContextResolver; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class JSON implements ContextResolver { private ObjectMapper mapper; public JSON() { - mapper = new ObjectMapper(); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); - mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); - mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); - mapper.setDateFormat(new RFC3339DateFormat()); - mapper.registerModule(new JavaTimeModule()); - ThreeTenModule module = new ThreeTenModule(); - module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); - module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); - module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); - mapper.registerModule(module); + mapper = JsonMapper.builder() + .serializationInclusion(JsonInclude.Include.NON_NULL) + .configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false) + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) + .configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) + .enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING) + .defaultDateFormat(new RFC3339DateFormat()) + .addModule(new JavaTimeModule()) + .build(); } /** @@ -68,7 +75,7 @@ public ObjectMapper getContext(Class type) { public static Class getClassForElement(JsonNode node, Class modelClass) { ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); if (cdm != null) { - return cdm.getClassForElement(node, new HashSet>()); + return cdm.getClassForElement(node, new HashSet<>()); } return null; } @@ -88,7 +95,7 @@ private static class ClassDiscriminatorMapping { ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { modelClass = cls; discriminatorName = propertyName; - discriminatorMappings = new HashMap>(); + discriminatorMappings = new HashMap<>(); if (mappings != null) { discriminatorMappings.putAll(mappings); } @@ -182,9 +189,9 @@ public static boolean isInstanceOf(Class modelClass, Object inst, Set descendants = modelDescendants.get(modelClass); + Map> descendants = modelDescendants.get(modelClass); if (descendants != null) { - for (GenericType childType : descendants.values()) { + for (GenericType childType : descendants.values()) { if (isInstanceOf(childType.getRawType(), inst, visitedClasses)) { return true; } @@ -196,12 +203,12 @@ public static boolean isInstanceOf(Class modelClass, Object inst, Set, ClassDiscriminatorMapping> modelDiscriminators = new HashMap, ClassDiscriminatorMapping>(); + private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<>(); /** * A map of oneOf/anyOf descendants for each model class. */ - private static Map, Map> modelDescendants = new HashMap, Map>(); + private static Map, Map>> modelDescendants = new HashMap<>(); /** * Register a model class discriminator. @@ -221,7 +228,7 @@ public static void registerDiscriminator(Class modelClass, String discriminat * @param modelClass the model class * @param descendants a map of oneOf/anyOf descendants. */ - public static void registerDescendants(Class modelClass, Map descendants) { + public static void registerDescendants(Class modelClass, Map> descendants) { modelDescendants.put(modelClass, descendants); } diff --git a/src/main/java/com/dropbox/sign/JavaTimeFormatter.java b/src/main/java/com/dropbox/sign/JavaTimeFormatter.java index f39f995..5458541 100644 --- a/src/main/java/com/dropbox/sign/JavaTimeFormatter.java +++ b/src/main/java/com/dropbox/sign/JavaTimeFormatter.java @@ -12,15 +12,15 @@ package com.dropbox.sign; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; -import org.threeten.bp.format.DateTimeParseException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; /** * Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class. * It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class JavaTimeFormatter { private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME; diff --git a/src/main/java/com/dropbox/sign/Pair.java b/src/main/java/com/dropbox/sign/Pair.java index 2e0fd72..93293ef 100644 --- a/src/main/java/com/dropbox/sign/Pair.java +++ b/src/main/java/com/dropbox/sign/Pair.java @@ -13,7 +13,7 @@ package com.dropbox.sign; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class Pair { private String name = ""; private String value = ""; diff --git a/src/main/java/com/dropbox/sign/RFC3339DateFormat.java b/src/main/java/com/dropbox/sign/RFC3339DateFormat.java index 6187eb3..6c3ae75 100644 --- a/src/main/java/com/dropbox/sign/RFC3339DateFormat.java +++ b/src/main/java/com/dropbox/sign/RFC3339DateFormat.java @@ -18,9 +18,11 @@ import java.text.FieldPosition; import java.text.ParsePosition; import java.util.Date; +import java.text.DecimalFormat; import java.util.GregorianCalendar; import java.util.TimeZone; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); @@ -31,6 +33,7 @@ public class RFC3339DateFormat extends DateFormat { public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.numberFormat = new DecimalFormat(); } @Override @@ -52,4 +55,4 @@ public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fie public Object clone() { return super.clone(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/dropbox/sign/ServerConfiguration.java b/src/main/java/com/dropbox/sign/ServerConfiguration.java index f275a14..3d10c64 100644 --- a/src/main/java/com/dropbox/sign/ServerConfiguration.java +++ b/src/main/java/com/dropbox/sign/ServerConfiguration.java @@ -1,3 +1,16 @@ +/* + * 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; import java.util.Map; @@ -5,6 +18,7 @@ /** * Representing a Server configuration. */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ServerConfiguration { public String URL; public String description; @@ -39,10 +53,10 @@ public String URL(Map variables) { if (variables != null && variables.containsKey(name)) { value = variables.get(name); if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { - throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + "."); + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); } } - url = url.replaceAll("\\{" + name + "\\}", value); + url = url.replace("{" + name + "}", value); } return url; } diff --git a/src/main/java/com/dropbox/sign/ServerVariable.java b/src/main/java/com/dropbox/sign/ServerVariable.java index d38fd30..39b0850 100644 --- a/src/main/java/com/dropbox/sign/ServerVariable.java +++ b/src/main/java/com/dropbox/sign/ServerVariable.java @@ -1,3 +1,16 @@ +/* + * 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; import java.util.HashSet; @@ -5,6 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ServerVariable { public String description; public String defaultValue; diff --git a/src/main/java/com/dropbox/sign/StringUtil.java b/src/main/java/com/dropbox/sign/StringUtil.java index 527d88a..b71b4c2 100644 --- a/src/main/java/com/dropbox/sign/StringUtil.java +++ b/src/main/java/com/dropbox/sign/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/src/main/java/com/dropbox/sign/api/AccountApi.java b/src/main/java/com/dropbox/sign/api/AccountApi.java index 094c9e7..7417244 100644 --- a/src/main/java/com/dropbox/sign/api/AccountApi.java +++ b/src/main/java/com/dropbox/sign/api/AccountApi.java @@ -18,10 +18,11 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class AccountApi { private ApiClient apiClient; @@ -84,47 +85,34 @@ public AccountCreateResponse accountCreate(AccountCreateRequest accountCreateReq */ public ApiResponse accountCreateWithHttpInfo(AccountCreateRequest accountCreateRequest) throws ApiException { - Object localVarPostBody = accountCreateRequest; - - // verify the required parameter 'accountCreateRequest' is set + // Check required parameters if (accountCreateRequest == null) { throw new ApiException(400, "Missing the required parameter 'accountCreateRequest' when calling accountCreate"); } - - // create path and map variables - String localVarPath = "/account/create"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = accountCreateRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "AccountApi.accountCreate", + "/account/create", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : accountCreateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("AccountApi.accountCreate", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Get Account @@ -200,44 +188,35 @@ public ApiResponse accountGetWithHttpInfo(String accountId) */ public ApiResponse accountGetWithHttpInfo(String accountId, String emailAddress) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/account"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "account_id", accountId)); + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "account_id", accountId) + ); localVarQueryParams.addAll(apiClient.parameterToPairs("", "email_address", emailAddress)); - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "AccountApi.accountGet", + "/account", + "GET", + localVarQueryParams, + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("AccountApi.accountGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Update Account @@ -272,47 +251,34 @@ public AccountGetResponse accountUpdate(AccountUpdateRequest accountUpdateReques */ public ApiResponse accountUpdateWithHttpInfo(AccountUpdateRequest accountUpdateRequest) throws ApiException { - Object localVarPostBody = accountUpdateRequest; - - // verify the required parameter 'accountUpdateRequest' is set + // Check required parameters if (accountUpdateRequest == null) { throw new ApiException(400, "Missing the required parameter 'accountUpdateRequest' when calling accountUpdate"); } - - // create path and map variables - String localVarPath = "/account"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = accountUpdateRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "AccountApi.accountUpdate", + "/account", + "PUT", + new ArrayList<>(), + isFileTypeFound ? null : accountUpdateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("AccountApi.accountUpdate", localVarPath, "PUT", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Verify Account @@ -347,46 +313,33 @@ public AccountVerifyResponse accountVerify(AccountVerifyRequest accountVerifyReq */ public ApiResponse accountVerifyWithHttpInfo(AccountVerifyRequest accountVerifyRequest) throws ApiException { - Object localVarPostBody = accountVerifyRequest; - - // verify the required parameter 'accountVerifyRequest' is set + // Check required parameters if (accountVerifyRequest == null) { throw new ApiException(400, "Missing the required parameter 'accountVerifyRequest' when calling accountVerify"); } - - // create path and map variables - String localVarPath = "/account/verify"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = accountVerifyRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "AccountApi.accountVerify", + "/account/verify", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : accountVerifyRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("AccountApi.accountVerify", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } } \ No newline at end of file diff --git a/src/main/java/com/dropbox/sign/api/ApiAppApi.java b/src/main/java/com/dropbox/sign/api/ApiAppApi.java index b3431cb..2ca807e 100644 --- a/src/main/java/com/dropbox/sign/api/ApiAppApi.java +++ b/src/main/java/com/dropbox/sign/api/ApiAppApi.java @@ -16,10 +16,11 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ApiAppApi { private ApiClient apiClient; @@ -82,47 +83,34 @@ public ApiAppGetResponse apiAppCreate(ApiAppCreateRequest apiAppCreateRequest) t */ public ApiResponse apiAppCreateWithHttpInfo(ApiAppCreateRequest apiAppCreateRequest) throws ApiException { - Object localVarPostBody = apiAppCreateRequest; - - // verify the required parameter 'apiAppCreateRequest' is set + // Check required parameters if (apiAppCreateRequest == null) { throw new ApiException(400, "Missing the required parameter 'apiAppCreateRequest' when calling apiAppCreate"); } - - // create path and map variables - String localVarPath = "/api_app"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "multipart/form-data" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = apiAppCreateRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + 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( + "ApiAppApi.apiAppCreate", + "/api_app", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : apiAppCreateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("ApiAppApi.apiAppCreate", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Delete API App @@ -156,46 +144,37 @@ public void apiAppDelete(String clientId) throws ApiException { */ public ApiResponse apiAppDeleteWithHttpInfo(String clientId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'clientId' is set + // Check required parameters if (clientId == null) { throw new ApiException(400, "Missing the required parameter 'clientId' when calling apiAppDelete"); } - - // create path and map variables - String localVarPath = "/api_app/{client_id}" - .replaceAll("\\{" + "client_id" + "\\}", apiClient.escapeString(clientId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); + // Path parameters + String localVarPath = "/api_app/{client_id}" + .replaceAll("\\{client_id}", apiClient.escapeString(clientId.toString())); - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; + return apiClient.invokeAPI( + "ApiAppApi.apiAppDelete", + localVarPath, + "DELETE", + new ArrayList<>(), + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + false + ); - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - - return apiClient.invokeAPI("ApiAppApi.apiAppDelete", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, false); } /** * Get API App @@ -230,48 +209,38 @@ public ApiAppGetResponse apiAppGet(String clientId) throws ApiException { */ public ApiResponse apiAppGetWithHttpInfo(String clientId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'clientId' is set + // Check required parameters if (clientId == null) { throw new ApiException(400, "Missing the required parameter 'clientId' when calling apiAppGet"); } - - // create path and map variables - String localVarPath = "/api_app/{client_id}" - .replaceAll("\\{" + "client_id" + "\\}", apiClient.escapeString(clientId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + // Path parameters + String localVarPath = "/api_app/{client_id}" + .replaceAll("\\{client_id}", apiClient.escapeString(clientId.toString())); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "ApiAppApi.apiAppGet", + localVarPath, + "GET", + new ArrayList<>(), + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("ApiAppApi.apiAppGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * List API Apps @@ -353,44 +322,35 @@ public ApiResponse apiAppListWithHttpInfo(Integer page, Inte if (pageSize == null) { pageSize = 20; } - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/api_app/list"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "page", page) + ); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page_size", pageSize)); - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "ApiAppApi.apiAppList", + "/api_app/list", + "GET", + localVarQueryParams, + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("ApiAppApi.apiAppList", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Update API App @@ -427,52 +387,40 @@ public ApiAppGetResponse apiAppUpdate(String clientId, ApiAppUpdateRequest apiAp */ public ApiResponse apiAppUpdateWithHttpInfo(String clientId, ApiAppUpdateRequest apiAppUpdateRequest) throws ApiException { - Object localVarPostBody = apiAppUpdateRequest; - - // verify the required parameter 'clientId' is set + // Check required parameters if (clientId == null) { throw new ApiException(400, "Missing the required parameter 'clientId' when calling apiAppUpdate"); } - - // verify the required parameter 'apiAppUpdateRequest' is set if (apiAppUpdateRequest == null) { throw new ApiException(400, "Missing the required parameter 'apiAppUpdateRequest' when calling apiAppUpdate"); } - - // create path and map variables - String localVarPath = "/api_app/{client_id}" - .replaceAll("\\{" + "client_id" + "\\}", apiClient.escapeString(clientId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); + // Path parameters + String localVarPath = "/api_app/{client_id}" + .replaceAll("\\{client_id}", apiClient.escapeString(clientId.toString())); - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "multipart/form-data" - }; - + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = apiAppUpdateRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + 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( + "ApiAppApi.apiAppUpdate", + localVarPath, + "PUT", + new ArrayList<>(), + isFileTypeFound ? null : apiAppUpdateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("ApiAppApi.apiAppUpdate", localVarPath, "PUT", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } } \ No newline at end of file diff --git a/src/main/java/com/dropbox/sign/api/BulkSendJobApi.java b/src/main/java/com/dropbox/sign/api/BulkSendJobApi.java index e2921ac..5657327 100644 --- a/src/main/java/com/dropbox/sign/api/BulkSendJobApi.java +++ b/src/main/java/com/dropbox/sign/api/BulkSendJobApi.java @@ -14,10 +14,11 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class BulkSendJobApi { private ApiClient apiClient; @@ -129,50 +130,44 @@ public ApiResponse bulkSendJobGetWithHttpInfo(String bul if (pageSize == null) { pageSize = 20; } - Object localVarPostBody = null; - - // verify the required parameter 'bulkSendJobId' is set + // Check required parameters if (bulkSendJobId == null) { throw new ApiException(400, "Missing the required parameter 'bulkSendJobId' when calling bulkSendJobGet"); } - - // create path and map variables - String localVarPath = "/bulk_send_job/{bulk_send_job_id}" - .replaceAll("\\{" + "bulk_send_job_id" + "\\}", apiClient.escapeString(bulkSendJobId.toString())); - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); + // Path parameters + String localVarPath = "/bulk_send_job/{bulk_send_job_id}" + .replaceAll("\\{bulk_send_job_id}", apiClient.escapeString(bulkSendJobId.toString())); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "page", page) + ); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page_size", pageSize)); - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "BulkSendJobApi.bulkSendJobGet", + localVarPath, + "GET", + localVarQueryParams, + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("BulkSendJobApi.bulkSendJobGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * List Bulk Send Jobs @@ -254,43 +249,34 @@ public ApiResponse bulkSendJobListWithHttpInfo(Integer if (pageSize == null) { pageSize = 20; } - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/bulk_send_job/list"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "page", page) + ); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page_size", pageSize)); - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "BulkSendJobApi.bulkSendJobList", + "/bulk_send_job/list", + "GET", + localVarQueryParams, + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("BulkSendJobApi.bulkSendJobList", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } } \ No newline at end of file diff --git a/src/main/java/com/dropbox/sign/api/EmbeddedApi.java b/src/main/java/com/dropbox/sign/api/EmbeddedApi.java index f033333..536cb71 100644 --- a/src/main/java/com/dropbox/sign/api/EmbeddedApi.java +++ b/src/main/java/com/dropbox/sign/api/EmbeddedApi.java @@ -15,10 +15,11 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class EmbeddedApi { private ApiClient apiClient; @@ -83,53 +84,41 @@ public EmbeddedEditUrlResponse embeddedEditUrl(String templateId, EmbeddedEditUr */ public ApiResponse embeddedEditUrlWithHttpInfo(String templateId, EmbeddedEditUrlRequest embeddedEditUrlRequest) throws ApiException { - Object localVarPostBody = embeddedEditUrlRequest; - - // verify the required parameter 'templateId' is set + // Check required parameters if (templateId == null) { throw new ApiException(400, "Missing the required parameter 'templateId' when calling embeddedEditUrl"); } - - // verify the required parameter 'embeddedEditUrlRequest' is set if (embeddedEditUrlRequest == null) { throw new ApiException(400, "Missing the required parameter 'embeddedEditUrlRequest' when calling embeddedEditUrl"); } - - // create path and map variables - String localVarPath = "/embedded/edit_url/{template_id}" - .replaceAll("\\{" + "template_id" + "\\}", apiClient.escapeString(templateId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/json" - }; + // Path parameters + String localVarPath = "/embedded/edit_url/{template_id}" + .replaceAll("\\{template_id}", apiClient.escapeString(templateId.toString())); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = embeddedEditUrlRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "EmbeddedApi.embeddedEditUrl", + localVarPath, + "POST", + new ArrayList<>(), + isFileTypeFound ? null : embeddedEditUrlRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("EmbeddedApi.embeddedEditUrl", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Get Embedded Sign URL @@ -164,47 +153,37 @@ public EmbeddedSignUrlResponse embeddedSignUrl(String signatureId) throws ApiExc */ public ApiResponse embeddedSignUrlWithHttpInfo(String signatureId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'signatureId' is set + // Check required parameters if (signatureId == null) { throw new ApiException(400, "Missing the required parameter 'signatureId' when calling embeddedSignUrl"); } - - // create path and map variables - String localVarPath = "/embedded/sign_url/{signature_id}" - .replaceAll("\\{" + "signature_id" + "\\}", apiClient.escapeString(signatureId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); + // Path parameters + String localVarPath = "/embedded/sign_url/{signature_id}" + .replaceAll("\\{signature_id}", apiClient.escapeString(signatureId.toString())); - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "EmbeddedApi.embeddedSignUrl", + localVarPath, + "GET", + new ArrayList<>(), + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("EmbeddedApi.embeddedSignUrl", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } } \ No newline at end of file diff --git a/src/main/java/com/dropbox/sign/api/FaxLineApi.java b/src/main/java/com/dropbox/sign/api/FaxLineApi.java new file mode 100644 index 0000000..8bc5356 --- /dev/null +++ b/src/main/java/com/dropbox/sign/api/FaxLineApi.java @@ -0,0 +1,668 @@ +package com.dropbox.sign.api; + +import com.dropbox.sign.ApiException; +import com.dropbox.sign.ApiClient; +import com.dropbox.sign.ApiResponse; +import com.dropbox.sign.Configuration; +import com.dropbox.sign.Pair; + +import javax.ws.rs.core.GenericType; + +import com.dropbox.sign.model.ErrorResponse; +import com.dropbox.sign.model.FaxLineAddUserRequest; +import com.dropbox.sign.model.FaxLineAreaCodeGetResponse; +import com.dropbox.sign.model.FaxLineCreateRequest; +import com.dropbox.sign.model.FaxLineDeleteRequest; +import com.dropbox.sign.model.FaxLineListResponse; +import com.dropbox.sign.model.FaxLineRemoveUserRequest; +import com.dropbox.sign.model.FaxLineResponse; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +public class FaxLineApi { + private ApiClient apiClient; + + public FaxLineApi() { + this(Configuration.getDefaultApiClient()); + } + + public FaxLineApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Add Fax Line User + * Grants a user access to the specified Fax Line. + * @param faxLineAddUserRequest (required) + * @return FaxLineResponse + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public FaxLineResponse faxLineAddUser(FaxLineAddUserRequest faxLineAddUserRequest) throws ApiException { + return faxLineAddUserWithHttpInfo(faxLineAddUserRequest).getData(); + } + + + /** + * Add Fax Line User + * Grants a user access to the specified Fax Line. + * @param faxLineAddUserRequest (required) + * @return ApiResponse<FaxLineResponse> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public ApiResponse faxLineAddUserWithHttpInfo(FaxLineAddUserRequest faxLineAddUserRequest) throws ApiException { + + // Check required parameters + if (faxLineAddUserRequest == null) { + throw new ApiException(400, "Missing the required parameter 'faxLineAddUserRequest' when calling faxLineAddUser"); + } + + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); + localVarFormParams = faxLineAddUserRequest.createFormData(); + boolean isFileTypeFound = !localVarFormParams.isEmpty(); + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key"}; + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "FaxLineApi.faxLineAddUser", + "/fax_line/add_user", + "PUT", + new ArrayList<>(), + isFileTypeFound ? null : faxLineAddUserRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); + + } + /** + * Get Available Fax Line Area Codes + * Returns a response with the area codes available for a given state/provice and city. + * @param country Filter area codes by country. (required) + * @param state Filter area codes by state. (optional) + * @param province Filter area codes by province. (optional) + * @param city Filter area codes by city. (optional) + * @return FaxLineAreaCodeGetResponse + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public FaxLineAreaCodeGetResponse faxLineAreaCodeGet(String country, String state, String province, String city) throws ApiException { + return faxLineAreaCodeGetWithHttpInfo(country, state, province, city).getData(); + } + + + /** + * @see FaxLineApi#faxLineAreaCodeGet(String, String, String, String) + */ + public FaxLineAreaCodeGetResponse faxLineAreaCodeGet(String country) throws ApiException { + String state = null; + String province = null; + String city = null; + + return faxLineAreaCodeGetWithHttpInfo(country, state, province, city).getData(); + } + + /** + * @see FaxLineApi#faxLineAreaCodeGetWithHttpInfo(String, String, String, String) + */ + public ApiResponse faxLineAreaCodeGetWithHttpInfo(String country) throws ApiException { + String state = null; + String province = null; + String city = null; + + return faxLineAreaCodeGetWithHttpInfo(country, state, province, city); + } + + /** + * @see FaxLineApi#faxLineAreaCodeGet(String, String, String, String) + */ + public FaxLineAreaCodeGetResponse faxLineAreaCodeGet(String country, String state) throws ApiException { + String province = null; + String city = null; + + return faxLineAreaCodeGetWithHttpInfo(country, state, province, city).getData(); + } + + /** + * @see FaxLineApi#faxLineAreaCodeGetWithHttpInfo(String, String, String, String) + */ + public ApiResponse faxLineAreaCodeGetWithHttpInfo(String country, String state) throws ApiException { + String province = null; + String city = null; + + return faxLineAreaCodeGetWithHttpInfo(country, state, province, city); + } + + /** + * @see FaxLineApi#faxLineAreaCodeGet(String, String, String, String) + */ + public FaxLineAreaCodeGetResponse faxLineAreaCodeGet(String country, String state, String province) throws ApiException { + String city = null; + + return faxLineAreaCodeGetWithHttpInfo(country, state, province, city).getData(); + } + + /** + * @see FaxLineApi#faxLineAreaCodeGetWithHttpInfo(String, String, String, String) + */ + public ApiResponse faxLineAreaCodeGetWithHttpInfo(String country, String state, String province) throws ApiException { + String city = null; + + return faxLineAreaCodeGetWithHttpInfo(country, state, province, city); + } + + + /** + * Get Available Fax Line Area Codes + * Returns a response with the area codes available for a given state/provice and city. + * @param country Filter area codes by country. (required) + * @param state Filter area codes by state. (optional) + * @param province Filter area codes by province. (optional) + * @param city Filter area codes by city. (optional) + * @return ApiResponse<FaxLineAreaCodeGetResponse> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public ApiResponse faxLineAreaCodeGetWithHttpInfo(String country, String state, String province, String city) throws ApiException { + + // Check required parameters + if (country == null) { + throw new ApiException(400, "Missing the required parameter 'country' when calling faxLineAreaCodeGet"); + } + + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "country", country) + ); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "state", state)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "province", province)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "city", city)); + + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); + localVarFormParams = new HashMap(); + boolean isFileTypeFound = !localVarFormParams.isEmpty(); + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key"}; + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "FaxLineApi.faxLineAreaCodeGet", + "/fax_line/area_codes", + "GET", + localVarQueryParams, + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); + + } + /** + * Purchase Fax Line + * Purchases a new Fax Line. + * @param faxLineCreateRequest (required) + * @return FaxLineResponse + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public FaxLineResponse faxLineCreate(FaxLineCreateRequest faxLineCreateRequest) throws ApiException { + return faxLineCreateWithHttpInfo(faxLineCreateRequest).getData(); + } + + + /** + * Purchase Fax Line + * Purchases a new Fax Line. + * @param faxLineCreateRequest (required) + * @return ApiResponse<FaxLineResponse> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public ApiResponse faxLineCreateWithHttpInfo(FaxLineCreateRequest faxLineCreateRequest) throws ApiException { + + // Check required parameters + if (faxLineCreateRequest == null) { + throw new ApiException(400, "Missing the required parameter 'faxLineCreateRequest' when calling faxLineCreate"); + } + + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); + localVarFormParams = faxLineCreateRequest.createFormData(); + boolean isFileTypeFound = !localVarFormParams.isEmpty(); + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key"}; + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "FaxLineApi.faxLineCreate", + "/fax_line/create", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : faxLineCreateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); + + } + /** + * Delete Fax Line + * Deletes the specified Fax Line from the subscription. + * @param faxLineDeleteRequest (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public void faxLineDelete(FaxLineDeleteRequest faxLineDeleteRequest) throws ApiException { + faxLineDeleteWithHttpInfo(faxLineDeleteRequest); + } + + + /** + * Delete Fax Line + * Deletes the specified Fax Line from the subscription. + * @param faxLineDeleteRequest (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public ApiResponse faxLineDeleteWithHttpInfo(FaxLineDeleteRequest faxLineDeleteRequest) throws ApiException { + + // Check required parameters + if (faxLineDeleteRequest == null) { + throw new ApiException(400, "Missing the required parameter 'faxLineDeleteRequest' when calling faxLineDelete"); + } + + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); + localVarFormParams = faxLineDeleteRequest.createFormData(); + boolean isFileTypeFound = !localVarFormParams.isEmpty(); + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key"}; + return apiClient.invokeAPI( + "FaxLineApi.faxLineDelete", + "/fax_line", + "DELETE", + new ArrayList<>(), + isFileTypeFound ? null : faxLineDeleteRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + false + ); + + } + /** + * Get Fax Line + * Returns the properties and settings of a Fax Line. + * @param number The Fax Line number. (required) + * @return FaxLineResponse + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public FaxLineResponse faxLineGet(String number) throws ApiException { + return faxLineGetWithHttpInfo(number).getData(); + } + + + /** + * Get Fax Line + * Returns the properties and settings of a Fax Line. + * @param number The Fax Line number. (required) + * @return ApiResponse<FaxLineResponse> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public ApiResponse faxLineGetWithHttpInfo(String number) throws ApiException { + + // Check required parameters + if (number == null) { + throw new ApiException(400, "Missing the required parameter 'number' when calling faxLineGet"); + } + + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "number", number) + ); + + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); + localVarFormParams = new HashMap(); + boolean isFileTypeFound = !localVarFormParams.isEmpty(); + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key"}; + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "FaxLineApi.faxLineGet", + "/fax_line", + "GET", + localVarQueryParams, + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); + + } + /** + * List Fax Lines + * Returns the properties and settings of multiple Fax Lines. + * @param accountId Account ID (optional) + * @param page Page (optional, default to 1) + * @param pageSize Page size (optional, default to 20) + * @param showTeamLines Show team lines (optional) + * @return FaxLineListResponse + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public FaxLineListResponse faxLineList(String accountId, Integer page, Integer pageSize, Boolean showTeamLines) throws ApiException { + return faxLineListWithHttpInfo(accountId, page, pageSize, showTeamLines).getData(); + } + + + /** + * @see FaxLineApi#faxLineList(String, Integer, Integer, Boolean) + */ + public FaxLineListResponse faxLineList() throws ApiException { + String accountId = null; + Integer page = 1; + Integer pageSize = 20; + Boolean showTeamLines = null; + + return faxLineListWithHttpInfo(accountId, page, pageSize, showTeamLines).getData(); + } + + /** + * @see FaxLineApi#faxLineListWithHttpInfo(String, Integer, Integer, Boolean) + */ + public ApiResponse faxLineListWithHttpInfo() throws ApiException { + String accountId = null; + Integer page = 1; + Integer pageSize = 20; + Boolean showTeamLines = null; + + return faxLineListWithHttpInfo(accountId, page, pageSize, showTeamLines); + } + + /** + * @see FaxLineApi#faxLineList(String, Integer, Integer, Boolean) + */ + public FaxLineListResponse faxLineList(String accountId) throws ApiException { + Integer page = 1; + Integer pageSize = 20; + Boolean showTeamLines = null; + + return faxLineListWithHttpInfo(accountId, page, pageSize, showTeamLines).getData(); + } + + /** + * @see FaxLineApi#faxLineListWithHttpInfo(String, Integer, Integer, Boolean) + */ + public ApiResponse faxLineListWithHttpInfo(String accountId) throws ApiException { + Integer page = 1; + Integer pageSize = 20; + Boolean showTeamLines = null; + + return faxLineListWithHttpInfo(accountId, page, pageSize, showTeamLines); + } + + /** + * @see FaxLineApi#faxLineList(String, Integer, Integer, Boolean) + */ + public FaxLineListResponse faxLineList(String accountId, Integer page) throws ApiException { + Integer pageSize = 20; + Boolean showTeamLines = null; + + return faxLineListWithHttpInfo(accountId, page, pageSize, showTeamLines).getData(); + } + + /** + * @see FaxLineApi#faxLineListWithHttpInfo(String, Integer, Integer, Boolean) + */ + public ApiResponse faxLineListWithHttpInfo(String accountId, Integer page) throws ApiException { + Integer pageSize = 20; + Boolean showTeamLines = null; + + return faxLineListWithHttpInfo(accountId, page, pageSize, showTeamLines); + } + + /** + * @see FaxLineApi#faxLineList(String, Integer, Integer, Boolean) + */ + public FaxLineListResponse faxLineList(String accountId, Integer page, Integer pageSize) throws ApiException { + Boolean showTeamLines = null; + + return faxLineListWithHttpInfo(accountId, page, pageSize, showTeamLines).getData(); + } + + /** + * @see FaxLineApi#faxLineListWithHttpInfo(String, Integer, Integer, Boolean) + */ + public ApiResponse faxLineListWithHttpInfo(String accountId, Integer page, Integer pageSize) throws ApiException { + Boolean showTeamLines = null; + + return faxLineListWithHttpInfo(accountId, page, pageSize, showTeamLines); + } + + + /** + * List Fax Lines + * Returns the properties and settings of multiple Fax Lines. + * @param accountId Account ID (optional) + * @param page Page (optional, default to 1) + * @param pageSize Page size (optional, default to 20) + * @param showTeamLines Show team lines (optional) + * @return ApiResponse<FaxLineListResponse> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public ApiResponse faxLineListWithHttpInfo(String accountId, Integer page, Integer pageSize, Boolean showTeamLines) throws ApiException { + + if (page == null) { + page = 1; + } + if (pageSize == null) { + pageSize = 20; + } + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "account_id", accountId) + ); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page_size", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "show_team_lines", showTeamLines)); + + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); + localVarFormParams = new HashMap(); + boolean isFileTypeFound = !localVarFormParams.isEmpty(); + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key"}; + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "FaxLineApi.faxLineList", + "/fax_line/list", + "GET", + localVarQueryParams, + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); + + } + /** + * Remove Fax Line Access + * Removes a user's access to the specified Fax Line. + * @param faxLineRemoveUserRequest (required) + * @return FaxLineResponse + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public FaxLineResponse faxLineRemoveUser(FaxLineRemoveUserRequest faxLineRemoveUserRequest) throws ApiException { + return faxLineRemoveUserWithHttpInfo(faxLineRemoveUserRequest).getData(); + } + + + /** + * Remove Fax Line Access + * Removes a user's access to the specified Fax Line. + * @param faxLineRemoveUserRequest (required) + * @return ApiResponse<FaxLineResponse> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -
+ */ + public ApiResponse faxLineRemoveUserWithHttpInfo(FaxLineRemoveUserRequest faxLineRemoveUserRequest) throws ApiException { + + // Check required parameters + if (faxLineRemoveUserRequest == null) { + throw new ApiException(400, "Missing the required parameter 'faxLineRemoveUserRequest' when calling faxLineRemoveUser"); + } + + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); + localVarFormParams = faxLineRemoveUserRequest.createFormData(); + boolean isFileTypeFound = !localVarFormParams.isEmpty(); + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key"}; + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "FaxLineApi.faxLineRemoveUser", + "/fax_line/remove_user", + "PUT", + new ArrayList<>(), + isFileTypeFound ? null : faxLineRemoveUserRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); + + } +} \ No newline at end of file diff --git a/src/main/java/com/dropbox/sign/api/OAuthApi.java b/src/main/java/com/dropbox/sign/api/OAuthApi.java index f49cbda..be563cb 100644 --- a/src/main/java/com/dropbox/sign/api/OAuthApi.java +++ b/src/main/java/com/dropbox/sign/api/OAuthApi.java @@ -14,10 +14,11 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class OAuthApi { private ApiClient apiClient; @@ -78,47 +79,33 @@ public OAuthTokenResponse oauthTokenGenerate(OAuthTokenGenerateRequest oauthToke */ public ApiResponse oauthTokenGenerateWithHttpInfo(OAuthTokenGenerateRequest oauthTokenGenerateRequest) throws ApiException { - Object localVarPostBody = oauthTokenGenerateRequest; - - // verify the required parameter 'oauthTokenGenerateRequest' is set + // Check required parameters if (oauthTokenGenerateRequest == null) { throw new ApiException(400, "Missing the required parameter 'oauthTokenGenerateRequest' when calling oauthTokenGenerate"); } - - // create path and map variables - String localVarPath = "/oauth/token"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = oauthTokenGenerateRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "OAuthApi.oauthTokenGenerate", + "/oauth/token", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : oauthTokenGenerateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + null, + localVarReturnType, + false + ); - return apiClient.invokeAPI("OAuthApi.oauthTokenGenerate", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * OAuth Token Refresh @@ -151,46 +138,32 @@ public OAuthTokenResponse oauthTokenRefresh(OAuthTokenRefreshRequest oauthTokenR */ public ApiResponse oauthTokenRefreshWithHttpInfo(OAuthTokenRefreshRequest oauthTokenRefreshRequest) throws ApiException { - Object localVarPostBody = oauthTokenRefreshRequest; - - // verify the required parameter 'oauthTokenRefreshRequest' is set + // Check required parameters if (oauthTokenRefreshRequest == null) { throw new ApiException(400, "Missing the required parameter 'oauthTokenRefreshRequest' when calling oauthTokenRefresh"); } - - // create path and map variables - String localVarPath = "/oauth/token?refresh"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = oauthTokenRefreshRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "OAuthApi.oauthTokenRefresh", + "/oauth/token?refresh", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : oauthTokenRefreshRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + null, + localVarReturnType, + false + ); - return apiClient.invokeAPI("OAuthApi.oauthTokenRefresh", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } } \ No newline at end of file diff --git a/src/main/java/com/dropbox/sign/api/ReportApi.java b/src/main/java/com/dropbox/sign/api/ReportApi.java index 0705290..b6fbf56 100644 --- a/src/main/java/com/dropbox/sign/api/ReportApi.java +++ b/src/main/java/com/dropbox/sign/api/ReportApi.java @@ -14,10 +14,11 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ReportApi { private ApiClient apiClient; @@ -80,46 +81,33 @@ public ReportCreateResponse reportCreate(ReportCreateRequest reportCreateRequest */ public ApiResponse reportCreateWithHttpInfo(ReportCreateRequest reportCreateRequest) throws ApiException { - Object localVarPostBody = reportCreateRequest; - - // verify the required parameter 'reportCreateRequest' is set + // Check required parameters if (reportCreateRequest == null) { throw new ApiException(400, "Missing the required parameter 'reportCreateRequest' when calling reportCreate"); } - - // create path and map variables - String localVarPath = "/report/create"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = reportCreateRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "ReportApi.reportCreate", + "/report/create", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : reportCreateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("ReportApi.reportCreate", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } } \ No newline at end of file diff --git a/src/main/java/com/dropbox/sign/api/SignatureRequestApi.java b/src/main/java/com/dropbox/sign/api/SignatureRequestApi.java index 93ecaf8..7fc3cc6 100644 --- a/src/main/java/com/dropbox/sign/api/SignatureRequestApi.java +++ b/src/main/java/com/dropbox/sign/api/SignatureRequestApi.java @@ -26,10 +26,11 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class SignatureRequestApi { private ApiClient apiClient; @@ -92,47 +93,34 @@ public BulkSendJobSendResponse signatureRequestBulkCreateEmbeddedWithTemplate(Si */ public ApiResponse signatureRequestBulkCreateEmbeddedWithTemplateWithHttpInfo(SignatureRequestBulkCreateEmbeddedWithTemplateRequest signatureRequestBulkCreateEmbeddedWithTemplateRequest) throws ApiException { - Object localVarPostBody = signatureRequestBulkCreateEmbeddedWithTemplateRequest; - - // verify the required parameter 'signatureRequestBulkCreateEmbeddedWithTemplateRequest' is set + // Check required parameters if (signatureRequestBulkCreateEmbeddedWithTemplateRequest == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestBulkCreateEmbeddedWithTemplateRequest' when calling signatureRequestBulkCreateEmbeddedWithTemplate"); } - - // create path and map variables - String localVarPath = "/signature_request/bulk_create_embedded_with_template"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "multipart/form-data" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = signatureRequestBulkCreateEmbeddedWithTemplateRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json", "multipart/form-data"); + String[] localVarAuthNames = new String[] {"api_key"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "SignatureRequestApi.signatureRequestBulkCreateEmbeddedWithTemplate", + "/signature_request/bulk_create_embedded_with_template", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : signatureRequestBulkCreateEmbeddedWithTemplateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("SignatureRequestApi.signatureRequestBulkCreateEmbeddedWithTemplate", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Bulk Send with Template @@ -167,47 +155,34 @@ public BulkSendJobSendResponse signatureRequestBulkSendWithTemplate(SignatureReq */ public ApiResponse signatureRequestBulkSendWithTemplateWithHttpInfo(SignatureRequestBulkSendWithTemplateRequest signatureRequestBulkSendWithTemplateRequest) throws ApiException { - Object localVarPostBody = signatureRequestBulkSendWithTemplateRequest; - - // verify the required parameter 'signatureRequestBulkSendWithTemplateRequest' is set + // Check required parameters if (signatureRequestBulkSendWithTemplateRequest == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestBulkSendWithTemplateRequest' when calling signatureRequestBulkSendWithTemplate"); } - - // create path and map variables - String localVarPath = "/signature_request/bulk_send_with_template"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "multipart/form-data" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = signatureRequestBulkSendWithTemplateRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + 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( + "SignatureRequestApi.signatureRequestBulkSendWithTemplate", + "/signature_request/bulk_send_with_template", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : signatureRequestBulkSendWithTemplateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("SignatureRequestApi.signatureRequestBulkSendWithTemplate", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Cancel Incomplete Signature Request @@ -241,46 +216,37 @@ public void signatureRequestCancel(String signatureRequestId) throws ApiExceptio */ public ApiResponse signatureRequestCancelWithHttpInfo(String signatureRequestId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'signatureRequestId' is set + // Check required parameters if (signatureRequestId == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestId' when calling signatureRequestCancel"); } - - // create path and map variables - String localVarPath = "/signature_request/cancel/{signature_request_id}" - .replaceAll("\\{" + "signature_request_id" + "\\}", apiClient.escapeString(signatureRequestId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; + // Path parameters + String localVarPath = "/signature_request/cancel/{signature_request_id}" + .replaceAll("\\{signature_request_id}", apiClient.escapeString(signatureRequestId.toString())); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; + return apiClient.invokeAPI( + "SignatureRequestApi.signatureRequestCancel", + localVarPath, + "POST", + new ArrayList<>(), + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + false + ); - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - - return apiClient.invokeAPI("SignatureRequestApi.signatureRequestCancel", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, false); } /** * Create Embedded Signature Request @@ -315,47 +281,34 @@ public SignatureRequestGetResponse signatureRequestCreateEmbedded(SignatureReque */ public ApiResponse signatureRequestCreateEmbeddedWithHttpInfo(SignatureRequestCreateEmbeddedRequest signatureRequestCreateEmbeddedRequest) throws ApiException { - Object localVarPostBody = signatureRequestCreateEmbeddedRequest; - - // verify the required parameter 'signatureRequestCreateEmbeddedRequest' is set + // Check required parameters if (signatureRequestCreateEmbeddedRequest == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestCreateEmbeddedRequest' when calling signatureRequestCreateEmbedded"); } - - // create path and map variables - String localVarPath = "/signature_request/create_embedded"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "multipart/form-data" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = signatureRequestCreateEmbeddedRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + 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( + "SignatureRequestApi.signatureRequestCreateEmbedded", + "/signature_request/create_embedded", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : signatureRequestCreateEmbeddedRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("SignatureRequestApi.signatureRequestCreateEmbedded", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Create Embedded Signature Request with Template @@ -390,47 +343,34 @@ public SignatureRequestGetResponse signatureRequestCreateEmbeddedWithTemplate(Si */ public ApiResponse signatureRequestCreateEmbeddedWithTemplateWithHttpInfo(SignatureRequestCreateEmbeddedWithTemplateRequest signatureRequestCreateEmbeddedWithTemplateRequest) throws ApiException { - Object localVarPostBody = signatureRequestCreateEmbeddedWithTemplateRequest; - - // verify the required parameter 'signatureRequestCreateEmbeddedWithTemplateRequest' is set + // Check required parameters if (signatureRequestCreateEmbeddedWithTemplateRequest == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestCreateEmbeddedWithTemplateRequest' when calling signatureRequestCreateEmbeddedWithTemplate"); } - - // create path and map variables - String localVarPath = "/signature_request/create_embedded_with_template"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "multipart/form-data" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = signatureRequestCreateEmbeddedWithTemplateRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + 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( + "SignatureRequestApi.signatureRequestCreateEmbeddedWithTemplate", + "/signature_request/create_embedded_with_template", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : signatureRequestCreateEmbeddedWithTemplateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("SignatureRequestApi.signatureRequestCreateEmbeddedWithTemplate", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Download Files @@ -489,49 +429,43 @@ public ApiResponse signatureRequestFilesWithHttpInfo(String signatureReque if (fileType == null) { fileType = "pdf"; } - Object localVarPostBody = null; - - // verify the required parameter 'signatureRequestId' is set + // Check required parameters if (signatureRequestId == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestId' when calling signatureRequestFiles"); } - - // create path and map variables - String localVarPath = "/signature_request/files/{signature_request_id}" - .replaceAll("\\{" + "signature_request_id" + "\\}", apiClient.escapeString(signatureRequestId.toString())); - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "file_type", fileType)); - - - - - final String[] localVarAccepts = { - "application/pdf", "application/zip", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + // Path parameters + String localVarPath = "/signature_request/files/{signature_request_id}" + .replaceAll("\\{signature_request_id}", apiClient.escapeString(signatureRequestId.toString())); - final String[] localVarContentTypes = { - - }; + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "file_type", fileType) + ); + String localVarAccept = apiClient.selectHeaderAccept("application/pdf", "application/zip", "application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "SignatureRequestApi.signatureRequestFiles", + localVarPath, + "GET", + localVarQueryParams, + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("SignatureRequestApi.signatureRequestFiles", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Download Files as Data Uri @@ -566,48 +500,38 @@ public FileResponseDataUri signatureRequestFilesAsDataUri(String signatureReques */ public ApiResponse signatureRequestFilesAsDataUriWithHttpInfo(String signatureRequestId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'signatureRequestId' is set + // Check required parameters if (signatureRequestId == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestId' when calling signatureRequestFilesAsDataUri"); } - - // create path and map variables - String localVarPath = "/signature_request/files_as_data_uri/{signature_request_id}" - .replaceAll("\\{" + "signature_request_id" + "\\}", apiClient.escapeString(signatureRequestId.toString())); - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; + // Path parameters + String localVarPath = "/signature_request/files_as_data_uri/{signature_request_id}" + .replaceAll("\\{signature_request_id}", apiClient.escapeString(signatureRequestId.toString())); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "SignatureRequestApi.signatureRequestFilesAsDataUri", + localVarPath, + "GET", + new ArrayList<>(), + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("SignatureRequestApi.signatureRequestFilesAsDataUri", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Download Files as File Url @@ -666,49 +590,43 @@ public ApiResponse signatureRequestFilesAsFileUrlWithHttpInfo(Stri if (forceDownload == null) { forceDownload = 1; } - Object localVarPostBody = null; - - // verify the required parameter 'signatureRequestId' is set + // Check required parameters if (signatureRequestId == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestId' when calling signatureRequestFilesAsFileUrl"); } - - // create path and map variables - String localVarPath = "/signature_request/files_as_file_url/{signature_request_id}" - .replaceAll("\\{" + "signature_request_id" + "\\}", apiClient.escapeString(signatureRequestId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "force_download", forceDownload)); - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + // Path parameters + String localVarPath = "/signature_request/files_as_file_url/{signature_request_id}" + .replaceAll("\\{signature_request_id}", apiClient.escapeString(signatureRequestId.toString())); - final String[] localVarContentTypes = { - - }; + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "force_download", forceDownload) + ); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "SignatureRequestApi.signatureRequestFilesAsFileUrl", + localVarPath, + "GET", + localVarQueryParams, + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("SignatureRequestApi.signatureRequestFilesAsFileUrl", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Get Signature Request @@ -743,48 +661,38 @@ public SignatureRequestGetResponse signatureRequestGet(String signatureRequestId */ public ApiResponse signatureRequestGetWithHttpInfo(String signatureRequestId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'signatureRequestId' is set + // Check required parameters if (signatureRequestId == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestId' when calling signatureRequestGet"); } - - // create path and map variables - String localVarPath = "/signature_request/{signature_request_id}" - .replaceAll("\\{" + "signature_request_id" + "\\}", apiClient.escapeString(signatureRequestId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + // Path parameters + String localVarPath = "/signature_request/{signature_request_id}" + .replaceAll("\\{signature_request_id}", apiClient.escapeString(signatureRequestId.toString())); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "SignatureRequestApi.signatureRequestGet", + localVarPath, + "GET", + new ArrayList<>(), + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("SignatureRequestApi.signatureRequestGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * List Signature Requests @@ -916,46 +824,37 @@ public ApiResponse signatureRequestListWithHttpInf if (pageSize == null) { pageSize = 20; } - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/signature_request/list"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "account_id", accountId)); + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "account_id", accountId) + ); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page_size", pageSize)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "SignatureRequestApi.signatureRequestList", + "/signature_request/list", + "GET", + localVarQueryParams, + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("SignatureRequestApi.signatureRequestList", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Release On-Hold Signature Request @@ -990,48 +889,38 @@ public SignatureRequestGetResponse signatureRequestReleaseHold(String signatureR */ public ApiResponse signatureRequestReleaseHoldWithHttpInfo(String signatureRequestId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'signatureRequestId' is set + // Check required parameters if (signatureRequestId == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestId' when calling signatureRequestReleaseHold"); } - - // create path and map variables - String localVarPath = "/signature_request/release_hold/{signature_request_id}" - .replaceAll("\\{" + "signature_request_id" + "\\}", apiClient.escapeString(signatureRequestId.toString())); - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; + // Path parameters + String localVarPath = "/signature_request/release_hold/{signature_request_id}" + .replaceAll("\\{signature_request_id}", apiClient.escapeString(signatureRequestId.toString())); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "SignatureRequestApi.signatureRequestReleaseHold", + localVarPath, + "POST", + new ArrayList<>(), + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("SignatureRequestApi.signatureRequestReleaseHold", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Send Request Reminder @@ -1068,53 +957,41 @@ public SignatureRequestGetResponse signatureRequestRemind(String signatureReques */ public ApiResponse signatureRequestRemindWithHttpInfo(String signatureRequestId, SignatureRequestRemindRequest signatureRequestRemindRequest) throws ApiException { - Object localVarPostBody = signatureRequestRemindRequest; - - // verify the required parameter 'signatureRequestId' is set + // Check required parameters if (signatureRequestId == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestId' when calling signatureRequestRemind"); } - - // verify the required parameter 'signatureRequestRemindRequest' is set if (signatureRequestRemindRequest == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestRemindRequest' when calling signatureRequestRemind"); } - - // create path and map variables - String localVarPath = "/signature_request/remind/{signature_request_id}" - .replaceAll("\\{" + "signature_request_id" + "\\}", apiClient.escapeString(signatureRequestId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/json" - }; + // Path parameters + String localVarPath = "/signature_request/remind/{signature_request_id}" + .replaceAll("\\{signature_request_id}", apiClient.escapeString(signatureRequestId.toString())); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = signatureRequestRemindRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "SignatureRequestApi.signatureRequestRemind", + localVarPath, + "POST", + new ArrayList<>(), + isFileTypeFound ? null : signatureRequestRemindRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("SignatureRequestApi.signatureRequestRemind", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Remove Signature Request Access @@ -1148,46 +1025,37 @@ public void signatureRequestRemove(String signatureRequestId) throws ApiExceptio */ public ApiResponse signatureRequestRemoveWithHttpInfo(String signatureRequestId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'signatureRequestId' is set + // Check required parameters if (signatureRequestId == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestId' when calling signatureRequestRemove"); } - - // create path and map variables - String localVarPath = "/signature_request/remove/{signature_request_id}" - .replaceAll("\\{" + "signature_request_id" + "\\}", apiClient.escapeString(signatureRequestId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; + // Path parameters + String localVarPath = "/signature_request/remove/{signature_request_id}" + .replaceAll("\\{signature_request_id}", apiClient.escapeString(signatureRequestId.toString())); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key"}; + return apiClient.invokeAPI( + "SignatureRequestApi.signatureRequestRemove", + localVarPath, + "POST", + new ArrayList<>(), + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + false + ); - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key" }; - - return apiClient.invokeAPI("SignatureRequestApi.signatureRequestRemove", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, false); } /** * Send Signature Request @@ -1222,47 +1090,34 @@ public SignatureRequestGetResponse signatureRequestSend(SignatureRequestSendRequ */ public ApiResponse signatureRequestSendWithHttpInfo(SignatureRequestSendRequest signatureRequestSendRequest) throws ApiException { - Object localVarPostBody = signatureRequestSendRequest; - - // verify the required parameter 'signatureRequestSendRequest' is set + // Check required parameters if (signatureRequestSendRequest == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestSendRequest' when calling signatureRequestSend"); } - - // create path and map variables - String localVarPath = "/signature_request/send"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "multipart/form-data" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = signatureRequestSendRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + 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( + "SignatureRequestApi.signatureRequestSend", + "/signature_request/send", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : signatureRequestSendRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("SignatureRequestApi.signatureRequestSend", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Send with Template @@ -1297,47 +1152,34 @@ public SignatureRequestGetResponse signatureRequestSendWithTemplate(SignatureReq */ public ApiResponse signatureRequestSendWithTemplateWithHttpInfo(SignatureRequestSendWithTemplateRequest signatureRequestSendWithTemplateRequest) throws ApiException { - Object localVarPostBody = signatureRequestSendWithTemplateRequest; - - // verify the required parameter 'signatureRequestSendWithTemplateRequest' is set + // Check required parameters if (signatureRequestSendWithTemplateRequest == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestSendWithTemplateRequest' when calling signatureRequestSendWithTemplate"); } - - // create path and map variables - String localVarPath = "/signature_request/send_with_template"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "multipart/form-data" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = signatureRequestSendWithTemplateRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + 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( + "SignatureRequestApi.signatureRequestSendWithTemplate", + "/signature_request/send_with_template", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : signatureRequestSendWithTemplateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("SignatureRequestApi.signatureRequestSendWithTemplate", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Update Signature Request @@ -1374,52 +1216,40 @@ public SignatureRequestGetResponse signatureRequestUpdate(String signatureReques */ public ApiResponse signatureRequestUpdateWithHttpInfo(String signatureRequestId, SignatureRequestUpdateRequest signatureRequestUpdateRequest) throws ApiException { - Object localVarPostBody = signatureRequestUpdateRequest; - - // verify the required parameter 'signatureRequestId' is set + // Check required parameters if (signatureRequestId == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestId' when calling signatureRequestUpdate"); } - - // verify the required parameter 'signatureRequestUpdateRequest' is set if (signatureRequestUpdateRequest == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestUpdateRequest' when calling signatureRequestUpdate"); } - - // create path and map variables - String localVarPath = "/signature_request/update/{signature_request_id}" - .replaceAll("\\{" + "signature_request_id" + "\\}", apiClient.escapeString(signatureRequestId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/json" - }; + // Path parameters + String localVarPath = "/signature_request/update/{signature_request_id}" + .replaceAll("\\{signature_request_id}", apiClient.escapeString(signatureRequestId.toString())); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = signatureRequestUpdateRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "SignatureRequestApi.signatureRequestUpdate", + localVarPath, + "POST", + new ArrayList<>(), + isFileTypeFound ? null : signatureRequestUpdateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("SignatureRequestApi.signatureRequestUpdate", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } } \ No newline at end of file diff --git a/src/main/java/com/dropbox/sign/api/TeamApi.java b/src/main/java/com/dropbox/sign/api/TeamApi.java index 0ec4149..c894e07 100644 --- a/src/main/java/com/dropbox/sign/api/TeamApi.java +++ b/src/main/java/com/dropbox/sign/api/TeamApi.java @@ -21,10 +21,11 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class TeamApi { private ApiClient apiClient; @@ -108,48 +109,39 @@ public ApiResponse teamAddMemberWithHttpInfo(TeamAddMemberReque */ public ApiResponse teamAddMemberWithHttpInfo(TeamAddMemberRequest teamAddMemberRequest, String teamId) throws ApiException { - Object localVarPostBody = teamAddMemberRequest; - - // verify the required parameter 'teamAddMemberRequest' is set + // Check required parameters if (teamAddMemberRequest == null) { throw new ApiException(400, "Missing the required parameter 'teamAddMemberRequest' when calling teamAddMember"); } - - // create path and map variables - String localVarPath = "/team/add_member"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "team_id", teamId)); - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/json" - }; + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "team_id", teamId) + ); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = teamAddMemberRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "TeamApi.teamAddMember", + "/team/add_member", + "PUT", + localVarQueryParams, + isFileTypeFound ? null : teamAddMemberRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TeamApi.teamAddMember", localVarPath, "PUT", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Create Team @@ -184,47 +176,34 @@ public TeamGetResponse teamCreate(TeamCreateRequest teamCreateRequest) throws Ap */ public ApiResponse teamCreateWithHttpInfo(TeamCreateRequest teamCreateRequest) throws ApiException { - Object localVarPostBody = teamCreateRequest; - - // verify the required parameter 'teamCreateRequest' is set + // Check required parameters if (teamCreateRequest == null) { throw new ApiException(400, "Missing the required parameter 'teamCreateRequest' when calling teamCreate"); } - - // create path and map variables - String localVarPath = "/team/create"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = teamCreateRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "TeamApi.teamCreate", + "/team/create", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : teamCreateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TeamApi.teamCreate", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Delete Team @@ -256,40 +235,28 @@ public void teamDelete() throws ApiException { */ public ApiResponse teamDeleteWithHttpInfo() throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/team/destroy"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; + return apiClient.invokeAPI( + "TeamApi.teamDelete", + "/team/destroy", + "DELETE", + new ArrayList<>(), + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + false + ); - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - - return apiClient.invokeAPI("TeamApi.teamDelete", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, false); } /** * Get Team @@ -322,42 +289,29 @@ public TeamGetResponse teamGet() throws ApiException { */ public ApiResponse teamGetWithHttpInfo() throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/team"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "TeamApi.teamGet", + "/team", + "GET", + new ArrayList<>(), + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TeamApi.teamGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Get Team Info @@ -411,43 +365,34 @@ public ApiResponse teamInfoWithHttpInfo() throws ApiExcepti */ public ApiResponse teamInfoWithHttpInfo(String teamId) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/team/info"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "team_id", teamId)); - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "team_id", teamId) + ); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "TeamApi.teamInfo", + "/team/info", + "GET", + localVarQueryParams, + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TeamApi.teamInfo", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * List Team Invites @@ -501,43 +446,34 @@ public ApiResponse teamInvitesWithHttpInfo() throws ApiExce */ public ApiResponse teamInvitesWithHttpInfo(String emailAddress) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/team/invites"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "email_address", emailAddress)); - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "email_address", emailAddress) + ); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "TeamApi.teamInvites", + "/team/invites", + "GET", + localVarQueryParams, + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TeamApi.teamInvites", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * List Team Members @@ -621,50 +557,44 @@ public ApiResponse teamMembersWithHttpInfo(String teamId, I if (pageSize == null) { pageSize = 20; } - Object localVarPostBody = null; - - // verify the required parameter 'teamId' is set + // Check required parameters if (teamId == null) { throw new ApiException(400, "Missing the required parameter 'teamId' when calling teamMembers"); } - - // create path and map variables - String localVarPath = "/team/members/{team_id}" - .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())); - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); + // Path parameters + String localVarPath = "/team/members/{team_id}" + .replaceAll("\\{team_id}", apiClient.escapeString(teamId.toString())); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "page", page) + ); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page_size", pageSize)); - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "TeamApi.teamMembers", + localVarPath, + "GET", + localVarQueryParams, + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TeamApi.teamMembers", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Remove User from Team @@ -699,47 +629,34 @@ public TeamGetResponse teamRemoveMember(TeamRemoveMemberRequest teamRemoveMember */ public ApiResponse teamRemoveMemberWithHttpInfo(TeamRemoveMemberRequest teamRemoveMemberRequest) throws ApiException { - Object localVarPostBody = teamRemoveMemberRequest; - - // verify the required parameter 'teamRemoveMemberRequest' is set + // Check required parameters if (teamRemoveMemberRequest == null) { throw new ApiException(400, "Missing the required parameter 'teamRemoveMemberRequest' when calling teamRemoveMember"); } - - // create path and map variables - String localVarPath = "/team/remove_member"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = teamRemoveMemberRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "TeamApi.teamRemoveMember", + "/team/remove_member", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : teamRemoveMemberRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TeamApi.teamRemoveMember", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * List Sub Teams @@ -823,50 +740,44 @@ public ApiResponse teamSubTeamsWithHttpInfo(String teamId, if (pageSize == null) { pageSize = 20; } - Object localVarPostBody = null; - - // verify the required parameter 'teamId' is set + // Check required parameters if (teamId == null) { throw new ApiException(400, "Missing the required parameter 'teamId' when calling teamSubTeams"); } - - // create path and map variables - String localVarPath = "/team/sub_teams/{team_id}" - .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())); - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); + // Path parameters + String localVarPath = "/team/sub_teams/{team_id}" + .replaceAll("\\{team_id}", apiClient.escapeString(teamId.toString())); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "page", page) + ); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page_size", pageSize)); - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "TeamApi.teamSubTeams", + localVarPath, + "GET", + localVarQueryParams, + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TeamApi.teamSubTeams", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Update Team @@ -901,46 +812,33 @@ public TeamGetResponse teamUpdate(TeamUpdateRequest teamUpdateRequest) throws Ap */ public ApiResponse teamUpdateWithHttpInfo(TeamUpdateRequest teamUpdateRequest) throws ApiException { - Object localVarPostBody = teamUpdateRequest; - - // verify the required parameter 'teamUpdateRequest' is set + // Check required parameters if (teamUpdateRequest == null) { throw new ApiException(400, "Missing the required parameter 'teamUpdateRequest' when calling teamUpdate"); } - - // create path and map variables - String localVarPath = "/team"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = teamUpdateRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "TeamApi.teamUpdate", + "/team", + "PUT", + new ArrayList<>(), + isFileTypeFound ? null : teamUpdateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TeamApi.teamUpdate", localVarPath, "PUT", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } } \ No newline at end of file diff --git a/src/main/java/com/dropbox/sign/api/TemplateApi.java b/src/main/java/com/dropbox/sign/api/TemplateApi.java index cea05de..3779ff5 100644 --- a/src/main/java/com/dropbox/sign/api/TemplateApi.java +++ b/src/main/java/com/dropbox/sign/api/TemplateApi.java @@ -25,10 +25,11 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class TemplateApi { private ApiClient apiClient; @@ -93,53 +94,41 @@ public TemplateGetResponse templateAddUser(String templateId, TemplateAddUserReq */ public ApiResponse templateAddUserWithHttpInfo(String templateId, TemplateAddUserRequest templateAddUserRequest) throws ApiException { - Object localVarPostBody = templateAddUserRequest; - - // verify the required parameter 'templateId' is set + // Check required parameters if (templateId == null) { throw new ApiException(400, "Missing the required parameter 'templateId' when calling templateAddUser"); } - - // verify the required parameter 'templateAddUserRequest' is set if (templateAddUserRequest == null) { throw new ApiException(400, "Missing the required parameter 'templateAddUserRequest' when calling templateAddUser"); } - - // create path and map variables - String localVarPath = "/template/add_user/{template_id}" - .replaceAll("\\{" + "template_id" + "\\}", apiClient.escapeString(templateId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/json" - }; + // Path parameters + String localVarPath = "/template/add_user/{template_id}" + .replaceAll("\\{template_id}", apiClient.escapeString(templateId.toString())); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = templateAddUserRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "TemplateApi.templateAddUser", + localVarPath, + "POST", + new ArrayList<>(), + isFileTypeFound ? null : templateAddUserRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TemplateApi.templateAddUser", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Create Template @@ -174,47 +163,34 @@ public TemplateCreateResponse templateCreate(TemplateCreateRequest templateCreat */ public ApiResponse templateCreateWithHttpInfo(TemplateCreateRequest templateCreateRequest) throws ApiException { - Object localVarPostBody = templateCreateRequest; - - // verify the required parameter 'templateCreateRequest' is set + // Check required parameters if (templateCreateRequest == null) { throw new ApiException(400, "Missing the required parameter 'templateCreateRequest' when calling templateCreate"); } - - // create path and map variables - String localVarPath = "/template/create"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "multipart/form-data" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = templateCreateRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + 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.templateCreate", + "/template/create", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : templateCreateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TemplateApi.templateCreate", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Create Embedded Template Draft @@ -249,47 +225,34 @@ public TemplateCreateEmbeddedDraftResponse templateCreateEmbeddedDraft(TemplateC */ public ApiResponse templateCreateEmbeddedDraftWithHttpInfo(TemplateCreateEmbeddedDraftRequest templateCreateEmbeddedDraftRequest) throws ApiException { - Object localVarPostBody = templateCreateEmbeddedDraftRequest; - - // verify the required parameter 'templateCreateEmbeddedDraftRequest' is set + // Check required parameters if (templateCreateEmbeddedDraftRequest == null) { throw new ApiException(400, "Missing the required parameter 'templateCreateEmbeddedDraftRequest' when calling templateCreateEmbeddedDraft"); } - - // create path and map variables - String localVarPath = "/template/create_embedded_draft"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "multipart/form-data" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = templateCreateEmbeddedDraftRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + 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.templateCreateEmbeddedDraft", + "/template/create_embedded_draft", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : templateCreateEmbeddedDraftRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TemplateApi.templateCreateEmbeddedDraft", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Delete Template @@ -323,46 +286,37 @@ public void templateDelete(String templateId) throws ApiException { */ public ApiResponse templateDeleteWithHttpInfo(String templateId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'templateId' is set + // Check required parameters if (templateId == null) { throw new ApiException(400, "Missing the required parameter 'templateId' when calling templateDelete"); } - - // create path and map variables - String localVarPath = "/template/delete/{template_id}" - .replaceAll("\\{" + "template_id" + "\\}", apiClient.escapeString(templateId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + // Path parameters + String localVarPath = "/template/delete/{template_id}" + .replaceAll("\\{template_id}", apiClient.escapeString(templateId.toString())); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; + return apiClient.invokeAPI( + "TemplateApi.templateDelete", + localVarPath, + "POST", + new ArrayList<>(), + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + false + ); - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - - return apiClient.invokeAPI("TemplateApi.templateDelete", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, false); } /** * Get Template Files @@ -418,49 +372,43 @@ public ApiResponse templateFilesWithHttpInfo(String templateId) throws Api */ public ApiResponse templateFilesWithHttpInfo(String templateId, String fileType) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'templateId' is set + // Check required parameters if (templateId == null) { throw new ApiException(400, "Missing the required parameter 'templateId' when calling templateFiles"); } - - // create path and map variables - String localVarPath = "/template/files/{template_id}" - .replaceAll("\\{" + "template_id" + "\\}", apiClient.escapeString(templateId.toString())); - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "file_type", fileType)); - - - - - final String[] localVarAccepts = { - "application/pdf", "application/zip", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + // Path parameters + String localVarPath = "/template/files/{template_id}" + .replaceAll("\\{template_id}", apiClient.escapeString(templateId.toString())); - final String[] localVarContentTypes = { - - }; + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "file_type", fileType) + ); + String localVarAccept = apiClient.selectHeaderAccept("application/pdf", "application/zip", "application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "TemplateApi.templateFiles", + localVarPath, + "GET", + localVarQueryParams, + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TemplateApi.templateFiles", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Get Template Files as Data Uri @@ -495,48 +443,38 @@ public FileResponseDataUri templateFilesAsDataUri(String templateId) throws ApiE */ public ApiResponse templateFilesAsDataUriWithHttpInfo(String templateId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'templateId' is set + // Check required parameters if (templateId == null) { throw new ApiException(400, "Missing the required parameter 'templateId' when calling templateFilesAsDataUri"); } - - // create path and map variables - String localVarPath = "/template/files_as_data_uri/{template_id}" - .replaceAll("\\{" + "template_id" + "\\}", apiClient.escapeString(templateId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); + // Path parameters + String localVarPath = "/template/files_as_data_uri/{template_id}" + .replaceAll("\\{template_id}", apiClient.escapeString(templateId.toString())); - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "TemplateApi.templateFilesAsDataUri", + localVarPath, + "GET", + new ArrayList<>(), + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TemplateApi.templateFilesAsDataUri", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Get Template Files as File Url @@ -595,49 +533,43 @@ public ApiResponse templateFilesAsFileUrlWithHttpInfo(String templ if (forceDownload == null) { forceDownload = 1; } - Object localVarPostBody = null; - - // verify the required parameter 'templateId' is set + // Check required parameters if (templateId == null) { throw new ApiException(400, "Missing the required parameter 'templateId' when calling templateFilesAsFileUrl"); } - - // create path and map variables - String localVarPath = "/template/files_as_file_url/{template_id}" - .replaceAll("\\{" + "template_id" + "\\}", apiClient.escapeString(templateId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "force_download", forceDownload)); - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + // Path parameters + String localVarPath = "/template/files_as_file_url/{template_id}" + .replaceAll("\\{template_id}", apiClient.escapeString(templateId.toString())); - final String[] localVarContentTypes = { - - }; + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "force_download", forceDownload) + ); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "TemplateApi.templateFilesAsFileUrl", + localVarPath, + "GET", + localVarQueryParams, + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TemplateApi.templateFilesAsFileUrl", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Get Template @@ -672,48 +604,38 @@ public TemplateGetResponse templateGet(String templateId) throws ApiException { */ public ApiResponse templateGetWithHttpInfo(String templateId) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'templateId' is set + // Check required parameters if (templateId == null) { throw new ApiException(400, "Missing the required parameter 'templateId' when calling templateGet"); } - - // create path and map variables - String localVarPath = "/template/{template_id}" - .replaceAll("\\{" + "template_id" + "\\}", apiClient.escapeString(templateId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); + // Path parameters + String localVarPath = "/template/{template_id}" + .replaceAll("\\{template_id}", apiClient.escapeString(templateId.toString())); - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "TemplateApi.templateGet", + localVarPath, + "GET", + new ArrayList<>(), + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TemplateApi.templateGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * List Templates @@ -845,46 +767,37 @@ public ApiResponse templateListWithHttpInfo(String account if (pageSize == null) { pageSize = 20; } - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/template/list"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "account_id", accountId)); + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("", "account_id", accountId) + ); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page_size", pageSize)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - - }; - + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = new HashMap(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "TemplateApi.templateList", + "/template/list", + "GET", + localVarQueryParams, + null, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TemplateApi.templateList", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Remove User from Template @@ -921,53 +834,41 @@ public TemplateGetResponse templateRemoveUser(String templateId, TemplateRemoveU */ public ApiResponse templateRemoveUserWithHttpInfo(String templateId, TemplateRemoveUserRequest templateRemoveUserRequest) throws ApiException { - Object localVarPostBody = templateRemoveUserRequest; - - // verify the required parameter 'templateId' is set + // Check required parameters if (templateId == null) { throw new ApiException(400, "Missing the required parameter 'templateId' when calling templateRemoveUser"); } - - // verify the required parameter 'templateRemoveUserRequest' is set if (templateRemoveUserRequest == null) { throw new ApiException(400, "Missing the required parameter 'templateRemoveUserRequest' when calling templateRemoveUser"); } - - // create path and map variables - String localVarPath = "/template/remove_user/{template_id}" - .replaceAll("\\{" + "template_id" + "\\}", apiClient.escapeString(templateId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/json" - }; + // Path parameters + String localVarPath = "/template/remove_user/{template_id}" + .replaceAll("\\{template_id}", apiClient.escapeString(templateId.toString())); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = templateRemoveUserRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "TemplateApi.templateRemoveUser", + localVarPath, + "POST", + new ArrayList<>(), + isFileTypeFound ? null : templateRemoveUserRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TemplateApi.templateRemoveUser", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Update Template Files @@ -1004,52 +905,40 @@ public TemplateUpdateFilesResponse templateUpdateFiles(String templateId, Templa */ public ApiResponse templateUpdateFilesWithHttpInfo(String templateId, TemplateUpdateFilesRequest templateUpdateFilesRequest) throws ApiException { - Object localVarPostBody = templateUpdateFilesRequest; - - // verify the required parameter 'templateId' is set + // Check required parameters if (templateId == null) { throw new ApiException(400, "Missing the required parameter 'templateId' when calling templateUpdateFiles"); } - - // verify the required parameter 'templateUpdateFilesRequest' is set if (templateUpdateFilesRequest == null) { throw new ApiException(400, "Missing the required parameter 'templateUpdateFilesRequest' when calling templateUpdateFiles"); } - - // create path and map variables - String localVarPath = "/template/update_files/{template_id}" - .replaceAll("\\{" + "template_id" + "\\}", apiClient.escapeString(templateId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "multipart/form-data" - }; + // Path parameters + String localVarPath = "/template/update_files/{template_id}" + .replaceAll("\\{template_id}", apiClient.escapeString(templateId.toString())); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = templateUpdateFilesRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + 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.templateUpdateFiles", + localVarPath, + "POST", + new ArrayList<>(), + isFileTypeFound ? null : templateUpdateFilesRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("TemplateApi.templateUpdateFiles", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } } \ No newline at end of file diff --git a/src/main/java/com/dropbox/sign/api/UnclaimedDraftApi.java b/src/main/java/com/dropbox/sign/api/UnclaimedDraftApi.java index 67e922c..7d84200 100644 --- a/src/main/java/com/dropbox/sign/api/UnclaimedDraftApi.java +++ b/src/main/java/com/dropbox/sign/api/UnclaimedDraftApi.java @@ -17,10 +17,11 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class UnclaimedDraftApi { private ApiClient apiClient; @@ -83,47 +84,34 @@ public UnclaimedDraftCreateResponse unclaimedDraftCreate(UnclaimedDraftCreateReq */ public ApiResponse unclaimedDraftCreateWithHttpInfo(UnclaimedDraftCreateRequest unclaimedDraftCreateRequest) throws ApiException { - Object localVarPostBody = unclaimedDraftCreateRequest; - - // verify the required parameter 'unclaimedDraftCreateRequest' is set + // Check required parameters if (unclaimedDraftCreateRequest == null) { throw new ApiException(400, "Missing the required parameter 'unclaimedDraftCreateRequest' when calling unclaimedDraftCreate"); } - - // create path and map variables - String localVarPath = "/unclaimed_draft/create"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "multipart/form-data" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = unclaimedDraftCreateRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + 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( + "UnclaimedDraftApi.unclaimedDraftCreate", + "/unclaimed_draft/create", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : unclaimedDraftCreateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("UnclaimedDraftApi.unclaimedDraftCreate", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Create Embedded Unclaimed Draft @@ -158,47 +146,34 @@ public UnclaimedDraftCreateResponse unclaimedDraftCreateEmbedded(UnclaimedDraftC */ public ApiResponse unclaimedDraftCreateEmbeddedWithHttpInfo(UnclaimedDraftCreateEmbeddedRequest unclaimedDraftCreateEmbeddedRequest) throws ApiException { - Object localVarPostBody = unclaimedDraftCreateEmbeddedRequest; - - // verify the required parameter 'unclaimedDraftCreateEmbeddedRequest' is set + // Check required parameters if (unclaimedDraftCreateEmbeddedRequest == null) { throw new ApiException(400, "Missing the required parameter 'unclaimedDraftCreateEmbeddedRequest' when calling unclaimedDraftCreateEmbedded"); } - - // create path and map variables - String localVarPath = "/unclaimed_draft/create_embedded"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "multipart/form-data" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = unclaimedDraftCreateEmbeddedRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + 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( + "UnclaimedDraftApi.unclaimedDraftCreateEmbedded", + "/unclaimed_draft/create_embedded", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : unclaimedDraftCreateEmbeddedRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("UnclaimedDraftApi.unclaimedDraftCreateEmbedded", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Create Embedded Unclaimed Draft with Template @@ -233,47 +208,34 @@ public UnclaimedDraftCreateResponse unclaimedDraftCreateEmbeddedWithTemplate(Unc */ public ApiResponse unclaimedDraftCreateEmbeddedWithTemplateWithHttpInfo(UnclaimedDraftCreateEmbeddedWithTemplateRequest unclaimedDraftCreateEmbeddedWithTemplateRequest) throws ApiException { - Object localVarPostBody = unclaimedDraftCreateEmbeddedWithTemplateRequest; - - // verify the required parameter 'unclaimedDraftCreateEmbeddedWithTemplateRequest' is set + // Check required parameters if (unclaimedDraftCreateEmbeddedWithTemplateRequest == null) { throw new ApiException(400, "Missing the required parameter 'unclaimedDraftCreateEmbeddedWithTemplateRequest' when calling unclaimedDraftCreateEmbeddedWithTemplate"); } - - // create path and map variables - String localVarPath = "/unclaimed_draft/create_embedded_with_template"; - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - "application/json", "multipart/form-data" - }; + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = unclaimedDraftCreateEmbeddedWithTemplateRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + 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( + "UnclaimedDraftApi.unclaimedDraftCreateEmbeddedWithTemplate", + "/unclaimed_draft/create_embedded_with_template", + "POST", + new ArrayList<>(), + isFileTypeFound ? null : unclaimedDraftCreateEmbeddedWithTemplateRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("UnclaimedDraftApi.unclaimedDraftCreateEmbeddedWithTemplate", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } /** * Edit and Resend Unclaimed Draft @@ -310,52 +272,40 @@ public UnclaimedDraftCreateResponse unclaimedDraftEditAndResend(String signature */ public ApiResponse unclaimedDraftEditAndResendWithHttpInfo(String signatureRequestId, UnclaimedDraftEditAndResendRequest unclaimedDraftEditAndResendRequest) throws ApiException { - Object localVarPostBody = unclaimedDraftEditAndResendRequest; - - // verify the required parameter 'signatureRequestId' is set + // Check required parameters if (signatureRequestId == null) { throw new ApiException(400, "Missing the required parameter 'signatureRequestId' when calling unclaimedDraftEditAndResend"); } - - // verify the required parameter 'unclaimedDraftEditAndResendRequest' is set if (unclaimedDraftEditAndResendRequest == null) { throw new ApiException(400, "Missing the required parameter 'unclaimedDraftEditAndResendRequest' when calling unclaimedDraftEditAndResend"); } - - // create path and map variables - String localVarPath = "/unclaimed_draft/edit_and_resend/{signature_request_id}" - .replaceAll("\\{" + "signature_request_id" + "\\}", apiClient.escapeString(signatureRequestId.toString())); - - // query params - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - - - - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/json" - }; + // Path parameters + String localVarPath = "/unclaimed_draft/edit_and_resend/{signature_request_id}" + .replaceAll("\\{signature_request_id}", apiClient.escapeString(signatureRequestId.toString())); + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = unclaimedDraftEditAndResendRequest.createFormData(); boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key", "oauth2" }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType("application/json"); + String[] localVarAuthNames = new String[] {"api_key", "oauth2"}; GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI( + "UnclaimedDraftApi.unclaimedDraftEditAndResend", + localVarPath, + "POST", + new ArrayList<>(), + isFileTypeFound ? null : unclaimedDraftEditAndResendRequest, + new LinkedHashMap<>(), + new LinkedHashMap<>(), + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false + ); - return apiClient.invokeAPI("UnclaimedDraftApi.unclaimedDraftEditAndResend", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); } } \ No newline at end of file diff --git a/src/main/java/com/dropbox/sign/auth/ApiKeyAuth.java b/src/main/java/com/dropbox/sign/auth/ApiKeyAuth.java index 198eb94..912c621 100644 --- a/src/main/java/com/dropbox/sign/auth/ApiKeyAuth.java +++ b/src/main/java/com/dropbox/sign/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/src/main/java/com/dropbox/sign/auth/HttpBasicAuth.java b/src/main/java/com/dropbox/sign/auth/HttpBasicAuth.java index 4bc93a2..e6da24f 100644 --- a/src/main/java/com/dropbox/sign/auth/HttpBasicAuth.java +++ b/src/main/java/com/dropbox/sign/auth/HttpBasicAuth.java @@ -23,8 +23,7 @@ import java.util.Map; import java.util.List; - -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/src/main/java/com/dropbox/sign/auth/HttpBearerAuth.java b/src/main/java/com/dropbox/sign/auth/HttpBearerAuth.java index 91e53ca..1212c21 100644 --- a/src/main/java/com/dropbox/sign/auth/HttpBearerAuth.java +++ b/src/main/java/com/dropbox/sign/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/src/main/java/com/dropbox/sign/model/AbstractOpenApiSchema.java b/src/main/java/com/dropbox/sign/model/AbstractOpenApiSchema.java index 36e3d75..7c7b3b9 100644 --- a/src/main/java/com/dropbox/sign/model/AbstractOpenApiSchema.java +++ b/src/main/java/com/dropbox/sign/model/AbstractOpenApiSchema.java @@ -24,7 +24,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object @@ -46,7 +46,7 @@ public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { * * @return an instance of the actual schema/object */ - public abstract Map getSchemas(); + public abstract Map> getSchemas(); /** * Get the actual instance diff --git a/src/main/java/com/dropbox/sign/model/AccountCreateRequest.java b/src/main/java/com/dropbox/sign/model/AccountCreateRequest.java index 052a33e..e214889 100644 --- a/src/main/java/com/dropbox/sign/model/AccountCreateRequest.java +++ b/src/main/java/com/dropbox/sign/model/AccountCreateRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,13 +33,13 @@ * AccountCreateRequest */ @JsonPropertyOrder({ - AccountCreateRequest.JSON_PROPERTY_EMAIL_ADDRESS, - AccountCreateRequest.JSON_PROPERTY_CLIENT_ID, - AccountCreateRequest.JSON_PROPERTY_CLIENT_SECRET, - AccountCreateRequest.JSON_PROPERTY_LOCALE + AccountCreateRequest.JSON_PROPERTY_EMAIL_ADDRESS, + AccountCreateRequest.JSON_PROPERTY_CLIENT_ID, + AccountCreateRequest.JSON_PROPERTY_CLIENT_SECRET, + AccountCreateRequest.JSON_PROPERTY_LOCALE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class AccountCreateRequest { public static final String JSON_PROPERTY_EMAIL_ADDRESS = "email_address"; private String emailAddress; @@ -78,12 +76,11 @@ public AccountCreateRequest emailAddress(String emailAddress) { return this; } - /** + /** * The email address which will be associated with the new Account. * @return emailAddress - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The email address which will be associated with the new Account.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -104,12 +101,11 @@ public AccountCreateRequest clientId(String clientId) { return this; } - /** + /** * Used when creating a new account with OAuth authorization. See [OAuth 2.0 Authorization](https://app.hellosign.com/api/oauthWalkthrough#OAuthAuthorization) * @return clientId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Used when creating a new account with OAuth authorization. See [OAuth 2.0 Authorization](https://app.hellosign.com/api/oauthWalkthrough#OAuthAuthorization)") @JsonProperty(JSON_PROPERTY_CLIENT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -130,12 +126,11 @@ public AccountCreateRequest clientSecret(String clientSecret) { return this; } - /** + /** * Used when creating a new account with OAuth authorization. See [OAuth 2.0 Authorization](https://app.hellosign.com/api/oauthWalkthrough#OAuthAuthorization) * @return clientSecret - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Used when creating a new account with OAuth authorization. See [OAuth 2.0 Authorization](https://app.hellosign.com/api/oauthWalkthrough#OAuthAuthorization)") @JsonProperty(JSON_PROPERTY_CLIENT_SECRET) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -156,12 +151,11 @@ public AccountCreateRequest locale(String locale) { return this; } - /** + /** * The locale used in this Account. Check out the list of [supported locales](/api/reference/constants/#supported-locales) to learn more about the possible values. * @return locale - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The locale used in this Account. Check out the list of [supported locales](/api/reference/constants/#supported-locales) to learn more about the possible values.") @JsonProperty(JSON_PROPERTY_LOCALE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/AccountCreateResponse.java b/src/main/java/com/dropbox/sign/model/AccountCreateResponse.java index 88654d7..173433d 100644 --- a/src/main/java/com/dropbox/sign/model/AccountCreateResponse.java +++ b/src/main/java/com/dropbox/sign/model/AccountCreateResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.AccountResponse; @@ -25,14 +24,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -40,12 +38,12 @@ * AccountCreateResponse */ @JsonPropertyOrder({ - AccountCreateResponse.JSON_PROPERTY_ACCOUNT, - AccountCreateResponse.JSON_PROPERTY_OAUTH_DATA, - AccountCreateResponse.JSON_PROPERTY_WARNINGS + AccountCreateResponse.JSON_PROPERTY_ACCOUNT, + AccountCreateResponse.JSON_PROPERTY_OAUTH_DATA, + AccountCreateResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class AccountCreateResponse { public static final String JSON_PROPERTY_ACCOUNT = "account"; private AccountResponse account; @@ -79,14 +77,13 @@ public AccountCreateResponse account(AccountResponse account) { return this; } - /** + /** * Get account * @return account - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_ACCOUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public AccountResponse getAccount() { return account; @@ -94,7 +91,7 @@ public AccountResponse getAccount() { @JsonProperty(JSON_PROPERTY_ACCOUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setAccount(AccountResponse account) { this.account = account; } @@ -105,12 +102,11 @@ public AccountCreateResponse oauthData(OAuthTokenResponse oauthData) { return this; } - /** + /** * Get oauthData * @return oauthData - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_OAUTH_DATA) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -139,12 +135,11 @@ public AccountCreateResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/AccountGetResponse.java b/src/main/java/com/dropbox/sign/model/AccountGetResponse.java index 15f1e3e..b642115 100644 --- a/src/main/java/com/dropbox/sign/model/AccountGetResponse.java +++ b/src/main/java/com/dropbox/sign/model/AccountGetResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.AccountResponse; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,11 +37,11 @@ * AccountGetResponse */ @JsonPropertyOrder({ - AccountGetResponse.JSON_PROPERTY_ACCOUNT, - AccountGetResponse.JSON_PROPERTY_WARNINGS + AccountGetResponse.JSON_PROPERTY_ACCOUNT, + AccountGetResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class AccountGetResponse { public static final String JSON_PROPERTY_ACCOUNT = "account"; private AccountResponse account; @@ -74,14 +72,13 @@ public AccountGetResponse account(AccountResponse account) { return this; } - /** + /** * Get account * @return account - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_ACCOUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public AccountResponse getAccount() { return account; @@ -89,7 +86,7 @@ public AccountResponse getAccount() { @JsonProperty(JSON_PROPERTY_ACCOUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setAccount(AccountResponse account) { this.account = account; } @@ -108,12 +105,11 @@ public AccountGetResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/AccountResponse.java b/src/main/java/com/dropbox/sign/model/AccountResponse.java index 65f2550..6c1e562 100644 --- a/src/main/java/com/dropbox/sign/model/AccountResponse.java +++ b/src/main/java/com/dropbox/sign/model/AccountResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.AccountResponseQuotas; @@ -24,12 +23,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -37,20 +35,20 @@ * AccountResponse */ @JsonPropertyOrder({ - AccountResponse.JSON_PROPERTY_ACCOUNT_ID, - AccountResponse.JSON_PROPERTY_EMAIL_ADDRESS, - AccountResponse.JSON_PROPERTY_IS_LOCKED, - AccountResponse.JSON_PROPERTY_IS_PAID_HS, - AccountResponse.JSON_PROPERTY_IS_PAID_HF, - AccountResponse.JSON_PROPERTY_QUOTAS, - AccountResponse.JSON_PROPERTY_CALLBACK_URL, - AccountResponse.JSON_PROPERTY_ROLE_CODE, - AccountResponse.JSON_PROPERTY_TEAM_ID, - AccountResponse.JSON_PROPERTY_LOCALE, - AccountResponse.JSON_PROPERTY_USAGE + AccountResponse.JSON_PROPERTY_ACCOUNT_ID, + AccountResponse.JSON_PROPERTY_EMAIL_ADDRESS, + AccountResponse.JSON_PROPERTY_IS_LOCKED, + AccountResponse.JSON_PROPERTY_IS_PAID_HS, + AccountResponse.JSON_PROPERTY_IS_PAID_HF, + AccountResponse.JSON_PROPERTY_QUOTAS, + AccountResponse.JSON_PROPERTY_CALLBACK_URL, + AccountResponse.JSON_PROPERTY_ROLE_CODE, + AccountResponse.JSON_PROPERTY_TEAM_ID, + AccountResponse.JSON_PROPERTY_LOCALE, + AccountResponse.JSON_PROPERTY_USAGE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class AccountResponse { public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; private String accountId; @@ -108,12 +106,11 @@ public AccountResponse accountId(String accountId) { return this; } - /** + /** * The ID of the Account * @return accountId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The ID of the Account") @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -134,12 +131,11 @@ public AccountResponse emailAddress(String emailAddress) { return this; } - /** + /** * The email address associated with the Account. * @return emailAddress - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The email address associated with the Account.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -160,12 +156,11 @@ public AccountResponse isLocked(Boolean isLocked) { return this; } - /** + /** * Returns `true` if the user has been locked out of their account by a team admin. * @return isLocked - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Returns `true` if the user has been locked out of their account by a team admin.") @JsonProperty(JSON_PROPERTY_IS_LOCKED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -186,12 +181,11 @@ public AccountResponse isPaidHs(Boolean isPaidHs) { return this; } - /** + /** * Returns `true` if the user has a paid Dropbox Sign account. * @return isPaidHs - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Returns `true` if the user has a paid Dropbox Sign account.") @JsonProperty(JSON_PROPERTY_IS_PAID_HS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -212,12 +206,11 @@ public AccountResponse isPaidHf(Boolean isPaidHf) { return this; } - /** + /** * Returns `true` if the user has a paid HelloFax account. * @return isPaidHf - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Returns `true` if the user has a paid HelloFax account.") @JsonProperty(JSON_PROPERTY_IS_PAID_HF) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -238,12 +231,11 @@ public AccountResponse quotas(AccountResponseQuotas quotas) { return this; } - /** + /** * Get quotas * @return quotas - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_QUOTAS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -264,12 +256,11 @@ public AccountResponse callbackUrl(String callbackUrl) { return this; } - /** + /** * The URL that Dropbox Sign events will `POST` to. * @return callbackUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL that Dropbox Sign events will `POST` to.") @JsonProperty(JSON_PROPERTY_CALLBACK_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -290,12 +281,11 @@ public AccountResponse roleCode(String roleCode) { return this; } - /** + /** * The membership role for the team. * @return roleCode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The membership role for the team.") @JsonProperty(JSON_PROPERTY_ROLE_CODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -316,12 +306,11 @@ public AccountResponse teamId(String teamId) { return this; } - /** + /** * The id of the team account belongs to. * @return teamId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the team account belongs to.") @JsonProperty(JSON_PROPERTY_TEAM_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -342,12 +331,11 @@ public AccountResponse locale(String locale) { return this; } - /** + /** * The locale used in this Account. Check out the list of [supported locales](/api/reference/constants/#supported-locales) to learn more about the possible values. * @return locale - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The locale used in this Account. Check out the list of [supported locales](/api/reference/constants/#supported-locales) to learn more about the possible values.") @JsonProperty(JSON_PROPERTY_LOCALE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -368,12 +356,11 @@ public AccountResponse usage(AccountResponseUsage usage) { return this; } - /** + /** * Get usage * @return usage - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/AccountResponseQuotas.java b/src/main/java/com/dropbox/sign/model/AccountResponseQuotas.java index e0ca922..85ee5e8 100644 --- a/src/main/java/com/dropbox/sign/model/AccountResponseQuotas.java +++ b/src/main/java/com/dropbox/sign/model/AccountResponseQuotas.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,29 +21,27 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * Details concerning remaining monthly quotas. */ -@ApiModel(description = "Details concerning remaining monthly quotas.") @JsonPropertyOrder({ - AccountResponseQuotas.JSON_PROPERTY_API_SIGNATURE_REQUESTS_LEFT, - AccountResponseQuotas.JSON_PROPERTY_DOCUMENTS_LEFT, - AccountResponseQuotas.JSON_PROPERTY_TEMPLATES_TOTAL, - AccountResponseQuotas.JSON_PROPERTY_TEMPLATES_LEFT, - AccountResponseQuotas.JSON_PROPERTY_SMS_VERIFICATIONS_LEFT, - AccountResponseQuotas.JSON_PROPERTY_NUM_FAX_PAGES_LEFT + AccountResponseQuotas.JSON_PROPERTY_API_SIGNATURE_REQUESTS_LEFT, + AccountResponseQuotas.JSON_PROPERTY_DOCUMENTS_LEFT, + AccountResponseQuotas.JSON_PROPERTY_TEMPLATES_TOTAL, + AccountResponseQuotas.JSON_PROPERTY_TEMPLATES_LEFT, + AccountResponseQuotas.JSON_PROPERTY_SMS_VERIFICATIONS_LEFT, + AccountResponseQuotas.JSON_PROPERTY_NUM_FAX_PAGES_LEFT }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class AccountResponseQuotas { public static final String JSON_PROPERTY_API_SIGNATURE_REQUESTS_LEFT = "api_signature_requests_left"; private Integer apiSignatureRequestsLeft; @@ -87,12 +84,11 @@ public AccountResponseQuotas apiSignatureRequestsLeft(Integer apiSignatureReques return this; } - /** + /** * API signature requests remaining. * @return apiSignatureRequestsLeft - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "API signature requests remaining.") @JsonProperty(JSON_PROPERTY_API_SIGNATURE_REQUESTS_LEFT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -113,12 +109,11 @@ public AccountResponseQuotas documentsLeft(Integer documentsLeft) { return this; } - /** + /** * Signature requests remaining. * @return documentsLeft - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Signature requests remaining.") @JsonProperty(JSON_PROPERTY_DOCUMENTS_LEFT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -139,12 +134,11 @@ public AccountResponseQuotas templatesTotal(Integer templatesTotal) { return this; } - /** + /** * Total API templates allowed. * @return templatesTotal - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Total API templates allowed.") @JsonProperty(JSON_PROPERTY_TEMPLATES_TOTAL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -165,12 +159,11 @@ public AccountResponseQuotas templatesLeft(Integer templatesLeft) { return this; } - /** + /** * API templates remaining. * @return templatesLeft - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "API templates remaining.") @JsonProperty(JSON_PROPERTY_TEMPLATES_LEFT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -191,12 +184,11 @@ public AccountResponseQuotas smsVerificationsLeft(Integer smsVerificationsLeft) return this; } - /** + /** * SMS verifications remaining. * @return smsVerificationsLeft - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "SMS verifications remaining.") @JsonProperty(JSON_PROPERTY_SMS_VERIFICATIONS_LEFT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -217,12 +209,11 @@ public AccountResponseQuotas numFaxPagesLeft(Integer numFaxPagesLeft) { return this; } - /** + /** * Number of fax pages left * @return numFaxPagesLeft - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Number of fax pages left") @JsonProperty(JSON_PROPERTY_NUM_FAX_PAGES_LEFT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/AccountResponseUsage.java b/src/main/java/com/dropbox/sign/model/AccountResponseUsage.java index 6de3340..1d87ae1 100644 --- a/src/main/java/com/dropbox/sign/model/AccountResponseUsage.java +++ b/src/main/java/com/dropbox/sign/model/AccountResponseUsage.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,24 +21,22 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * Details concerning monthly usage */ -@ApiModel(description = "Details concerning monthly usage") @JsonPropertyOrder({ - AccountResponseUsage.JSON_PROPERTY_FAX_PAGES_SENT + AccountResponseUsage.JSON_PROPERTY_FAX_PAGES_SENT }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class AccountResponseUsage { public static final String JSON_PROPERTY_FAX_PAGES_SENT = "fax_pages_sent"; private Integer faxPagesSent; @@ -67,12 +64,11 @@ public AccountResponseUsage faxPagesSent(Integer faxPagesSent) { return this; } - /** + /** * Number of fax pages sent * @return faxPagesSent - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Number of fax pages sent") @JsonProperty(JSON_PROPERTY_FAX_PAGES_SENT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/AccountUpdateRequest.java b/src/main/java/com/dropbox/sign/model/AccountUpdateRequest.java index e3c9b13..79d8c75 100644 --- a/src/main/java/com/dropbox/sign/model/AccountUpdateRequest.java +++ b/src/main/java/com/dropbox/sign/model/AccountUpdateRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,12 +33,12 @@ * AccountUpdateRequest */ @JsonPropertyOrder({ - AccountUpdateRequest.JSON_PROPERTY_ACCOUNT_ID, - AccountUpdateRequest.JSON_PROPERTY_CALLBACK_URL, - AccountUpdateRequest.JSON_PROPERTY_LOCALE + AccountUpdateRequest.JSON_PROPERTY_ACCOUNT_ID, + AccountUpdateRequest.JSON_PROPERTY_CALLBACK_URL, + AccountUpdateRequest.JSON_PROPERTY_LOCALE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class AccountUpdateRequest { public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; private String accountId; @@ -74,12 +72,11 @@ public AccountUpdateRequest accountId(String accountId) { return this; } - /** + /** * The ID of the Account * @return accountId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The ID of the Account") @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -100,12 +97,11 @@ public AccountUpdateRequest callbackUrl(String callbackUrl) { return this; } - /** + /** * The URL that Dropbox Sign should POST events to. * @return callbackUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL that Dropbox Sign should POST events to.") @JsonProperty(JSON_PROPERTY_CALLBACK_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -126,12 +122,11 @@ public AccountUpdateRequest locale(String locale) { return this; } - /** + /** * The locale used in this Account. Check out the list of [supported locales](/api/reference/constants/#supported-locales) to learn more about the possible values. * @return locale - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The locale used in this Account. Check out the list of [supported locales](/api/reference/constants/#supported-locales) to learn more about the possible values.") @JsonProperty(JSON_PROPERTY_LOCALE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/AccountVerifyRequest.java b/src/main/java/com/dropbox/sign/model/AccountVerifyRequest.java index 0c2e630..4d9d206 100644 --- a/src/main/java/com/dropbox/sign/model/AccountVerifyRequest.java +++ b/src/main/java/com/dropbox/sign/model/AccountVerifyRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,10 +33,10 @@ * AccountVerifyRequest */ @JsonPropertyOrder({ - AccountVerifyRequest.JSON_PROPERTY_EMAIL_ADDRESS + AccountVerifyRequest.JSON_PROPERTY_EMAIL_ADDRESS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class AccountVerifyRequest { public static final String JSON_PROPERTY_EMAIL_ADDRESS = "email_address"; private String emailAddress; @@ -66,12 +64,11 @@ public AccountVerifyRequest emailAddress(String emailAddress) { return this; } - /** + /** * Email address to run the verification for. * @return emailAddress - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Email address to run the verification for.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.ALWAYS) diff --git a/src/main/java/com/dropbox/sign/model/AccountVerifyResponse.java b/src/main/java/com/dropbox/sign/model/AccountVerifyResponse.java index 1fd35ea..5b32e1d 100644 --- a/src/main/java/com/dropbox/sign/model/AccountVerifyResponse.java +++ b/src/main/java/com/dropbox/sign/model/AccountVerifyResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.AccountVerifyResponseAccount; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,11 +37,11 @@ * AccountVerifyResponse */ @JsonPropertyOrder({ - AccountVerifyResponse.JSON_PROPERTY_ACCOUNT, - AccountVerifyResponse.JSON_PROPERTY_WARNINGS + AccountVerifyResponse.JSON_PROPERTY_ACCOUNT, + AccountVerifyResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class AccountVerifyResponse { public static final String JSON_PROPERTY_ACCOUNT = "account"; private AccountVerifyResponseAccount account; @@ -74,12 +72,11 @@ public AccountVerifyResponse account(AccountVerifyResponseAccount account) { return this; } - /** + /** * Get account * @return account - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ACCOUNT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -108,12 +105,11 @@ public AccountVerifyResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/AccountVerifyResponseAccount.java b/src/main/java/com/dropbox/sign/model/AccountVerifyResponseAccount.java index 6b8cd0f..5da20c9 100644 --- a/src/main/java/com/dropbox/sign/model/AccountVerifyResponseAccount.java +++ b/src/main/java/com/dropbox/sign/model/AccountVerifyResponseAccount.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,10 +33,10 @@ * AccountVerifyResponseAccount */ @JsonPropertyOrder({ - AccountVerifyResponseAccount.JSON_PROPERTY_EMAIL_ADDRESS + AccountVerifyResponseAccount.JSON_PROPERTY_EMAIL_ADDRESS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class AccountVerifyResponseAccount { public static final String JSON_PROPERTY_EMAIL_ADDRESS = "email_address"; private String emailAddress; @@ -66,12 +64,11 @@ public AccountVerifyResponseAccount emailAddress(String emailAddress) { return this; } - /** + /** * The email address associated with the Account. * @return emailAddress - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The email address associated with the Account.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/ApiAppCreateRequest.java b/src/main/java/com/dropbox/sign/model/ApiAppCreateRequest.java index c8eb867..04a26e0 100644 --- a/src/main/java/com/dropbox/sign/model/ApiAppCreateRequest.java +++ b/src/main/java/com/dropbox/sign/model/ApiAppCreateRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubOAuth; @@ -25,15 +24,14 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.File; 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.JSON; import com.dropbox.sign.ApiException; @@ -41,16 +39,16 @@ * ApiAppCreateRequest */ @JsonPropertyOrder({ - ApiAppCreateRequest.JSON_PROPERTY_DOMAINS, - ApiAppCreateRequest.JSON_PROPERTY_NAME, - ApiAppCreateRequest.JSON_PROPERTY_CALLBACK_URL, - ApiAppCreateRequest.JSON_PROPERTY_CUSTOM_LOGO_FILE, - ApiAppCreateRequest.JSON_PROPERTY_OAUTH, - ApiAppCreateRequest.JSON_PROPERTY_OPTIONS, - ApiAppCreateRequest.JSON_PROPERTY_WHITE_LABELING_OPTIONS + ApiAppCreateRequest.JSON_PROPERTY_DOMAINS, + ApiAppCreateRequest.JSON_PROPERTY_NAME, + ApiAppCreateRequest.JSON_PROPERTY_CALLBACK_URL, + ApiAppCreateRequest.JSON_PROPERTY_CUSTOM_LOGO_FILE, + ApiAppCreateRequest.JSON_PROPERTY_OAUTH, + ApiAppCreateRequest.JSON_PROPERTY_OPTIONS, + ApiAppCreateRequest.JSON_PROPERTY_WHITE_LABELING_OPTIONS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ApiAppCreateRequest { public static final String JSON_PROPERTY_DOMAINS = "domains"; private List domains = new ArrayList<>(); @@ -97,16 +95,18 @@ public ApiAppCreateRequest domains(List domains) { } public ApiAppCreateRequest addDomainsItem(String domainsItem) { + if (this.domains == null) { + this.domains = new ArrayList<>(); + } this.domains.add(domainsItem); return this; } - /** + /** * The domain names the ApiApp will be associated with. * @return domains - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The domain names the ApiApp will be associated with.") @JsonProperty(JSON_PROPERTY_DOMAINS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -127,12 +127,11 @@ public ApiAppCreateRequest name(String name) { return this; } - /** + /** * The name you want to assign to the ApiApp. * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name you want to assign to the ApiApp.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -153,12 +152,11 @@ public ApiAppCreateRequest callbackUrl(String callbackUrl) { return this; } - /** + /** * The URL at which the ApiApp should receive event callbacks. * @return callbackUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL at which the ApiApp should receive event callbacks.") @JsonProperty(JSON_PROPERTY_CALLBACK_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -179,12 +177,11 @@ public ApiAppCreateRequest customLogoFile(File customLogoFile) { return this; } - /** + /** * An image file to use as a custom logo in embedded contexts. (Only applies to some API plans) * @return customLogoFile - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An image file to use as a custom logo in embedded contexts. (Only applies to some API plans)") @JsonProperty(JSON_PROPERTY_CUSTOM_LOGO_FILE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -205,12 +202,11 @@ public ApiAppCreateRequest oauth(SubOAuth oauth) { return this; } - /** + /** * Get oauth * @return oauth - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_OAUTH) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -231,12 +227,11 @@ public ApiAppCreateRequest options(SubOptions options) { return this; } - /** + /** * Get options * @return options - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -257,12 +252,11 @@ public ApiAppCreateRequest whiteLabelingOptions(SubWhiteLabelingOptions whiteLab return this; } - /** + /** * Get whiteLabelingOptions * @return whiteLabelingOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_WHITE_LABELING_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/ApiAppGetResponse.java b/src/main/java/com/dropbox/sign/model/ApiAppGetResponse.java index 6d31593..0b9eb3f 100644 --- a/src/main/java/com/dropbox/sign/model/ApiAppGetResponse.java +++ b/src/main/java/com/dropbox/sign/model/ApiAppGetResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.ApiAppResponse; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,11 +37,11 @@ * ApiAppGetResponse */ @JsonPropertyOrder({ - ApiAppGetResponse.JSON_PROPERTY_API_APP, - ApiAppGetResponse.JSON_PROPERTY_WARNINGS + ApiAppGetResponse.JSON_PROPERTY_API_APP, + ApiAppGetResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ApiAppGetResponse { public static final String JSON_PROPERTY_API_APP = "api_app"; private ApiAppResponse apiApp; @@ -74,14 +72,13 @@ public ApiAppGetResponse apiApp(ApiAppResponse apiApp) { return this; } - /** + /** * Get apiApp * @return apiApp - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_API_APP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public ApiAppResponse getApiApp() { return apiApp; @@ -89,7 +86,7 @@ public ApiAppResponse getApiApp() { @JsonProperty(JSON_PROPERTY_API_APP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setApiApp(ApiAppResponse apiApp) { this.apiApp = apiApp; } @@ -108,12 +105,11 @@ public ApiAppGetResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/ApiAppListResponse.java b/src/main/java/com/dropbox/sign/model/ApiAppListResponse.java index 298fc09..7078480 100644 --- a/src/main/java/com/dropbox/sign/model/ApiAppListResponse.java +++ b/src/main/java/com/dropbox/sign/model/ApiAppListResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.ApiAppResponse; @@ -25,14 +24,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -40,15 +38,15 @@ * ApiAppListResponse */ @JsonPropertyOrder({ - ApiAppListResponse.JSON_PROPERTY_API_APPS, - ApiAppListResponse.JSON_PROPERTY_LIST_INFO, - ApiAppListResponse.JSON_PROPERTY_WARNINGS + ApiAppListResponse.JSON_PROPERTY_API_APPS, + ApiAppListResponse.JSON_PROPERTY_LIST_INFO, + ApiAppListResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ApiAppListResponse { public static final String JSON_PROPERTY_API_APPS = "api_apps"; - private List apiApps = null; + private List apiApps = new ArrayList<>(); public static final String JSON_PROPERTY_LIST_INFO = "list_info"; private ListInfoResponse listInfo; @@ -87,14 +85,13 @@ public ApiAppListResponse addApiAppsItem(ApiAppResponse apiAppsItem) { return this; } - /** + /** * Contains information about API Apps. * @return apiApps - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Contains information about API Apps.") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_API_APPS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getApiApps() { return apiApps; @@ -102,7 +99,7 @@ public List getApiApps() { @JsonProperty(JSON_PROPERTY_API_APPS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setApiApps(List apiApps) { this.apiApps = apiApps; } @@ -113,14 +110,13 @@ public ApiAppListResponse listInfo(ListInfoResponse listInfo) { return this; } - /** + /** * Get listInfo * @return listInfo - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_LIST_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public ListInfoResponse getListInfo() { return listInfo; @@ -128,7 +124,7 @@ public ListInfoResponse getListInfo() { @JsonProperty(JSON_PROPERTY_LIST_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setListInfo(ListInfoResponse listInfo) { this.listInfo = listInfo; } @@ -147,12 +143,11 @@ public ApiAppListResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/ApiAppResponse.java b/src/main/java/com/dropbox/sign/model/ApiAppResponse.java index fe2caff..6679f9f 100644 --- a/src/main/java/com/dropbox/sign/model/ApiAppResponse.java +++ b/src/main/java/com/dropbox/sign/model/ApiAppResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.ApiAppResponseOAuth; @@ -26,35 +25,33 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; /** * Contains information about an API App. */ -@ApiModel(description = "Contains information about an API App.") @JsonPropertyOrder({ - ApiAppResponse.JSON_PROPERTY_CALLBACK_URL, - ApiAppResponse.JSON_PROPERTY_CLIENT_ID, - ApiAppResponse.JSON_PROPERTY_CREATED_AT, - ApiAppResponse.JSON_PROPERTY_DOMAINS, - ApiAppResponse.JSON_PROPERTY_NAME, - ApiAppResponse.JSON_PROPERTY_IS_APPROVED, - ApiAppResponse.JSON_PROPERTY_OAUTH, - ApiAppResponse.JSON_PROPERTY_OPTIONS, - ApiAppResponse.JSON_PROPERTY_OWNER_ACCOUNT, - ApiAppResponse.JSON_PROPERTY_WHITE_LABELING_OPTIONS + ApiAppResponse.JSON_PROPERTY_CALLBACK_URL, + ApiAppResponse.JSON_PROPERTY_CLIENT_ID, + ApiAppResponse.JSON_PROPERTY_CREATED_AT, + ApiAppResponse.JSON_PROPERTY_DOMAINS, + ApiAppResponse.JSON_PROPERTY_NAME, + ApiAppResponse.JSON_PROPERTY_IS_APPROVED, + ApiAppResponse.JSON_PROPERTY_OAUTH, + ApiAppResponse.JSON_PROPERTY_OPTIONS, + ApiAppResponse.JSON_PROPERTY_OWNER_ACCOUNT, + ApiAppResponse.JSON_PROPERTY_WHITE_LABELING_OPTIONS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ApiAppResponse { public static final String JSON_PROPERTY_CALLBACK_URL = "callback_url"; private String callbackUrl; @@ -109,12 +106,11 @@ public ApiAppResponse callbackUrl(String callbackUrl) { return this; } - /** + /** * The app's callback URL (for events) * @return callbackUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The app's callback URL (for events)") @JsonProperty(JSON_PROPERTY_CALLBACK_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -135,12 +131,11 @@ public ApiAppResponse clientId(String clientId) { return this; } - /** + /** * The app's client id * @return clientId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The app's client id") @JsonProperty(JSON_PROPERTY_CLIENT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -161,12 +156,11 @@ public ApiAppResponse createdAt(Integer createdAt) { return this; } - /** + /** * The time that the app was created * @return createdAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The time that the app was created") @JsonProperty(JSON_PROPERTY_CREATED_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -195,12 +189,11 @@ public ApiAppResponse addDomainsItem(String domainsItem) { return this; } - /** + /** * The domain name(s) associated with the app * @return domains - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The domain name(s) associated with the app") @JsonProperty(JSON_PROPERTY_DOMAINS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -221,12 +214,11 @@ public ApiAppResponse name(String name) { return this; } - /** + /** * The name of the app * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the app") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -247,12 +239,11 @@ public ApiAppResponse isApproved(Boolean isApproved) { return this; } - /** + /** * Boolean to indicate if the app has been approved * @return isApproved - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Boolean to indicate if the app has been approved") @JsonProperty(JSON_PROPERTY_IS_APPROVED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -273,12 +264,11 @@ public ApiAppResponse oauth(ApiAppResponseOAuth oauth) { return this; } - /** + /** * Get oauth * @return oauth - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_OAUTH) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -299,12 +289,11 @@ public ApiAppResponse options(ApiAppResponseOptions options) { return this; } - /** + /** * Get options * @return options - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -325,12 +314,11 @@ public ApiAppResponse ownerAccount(ApiAppResponseOwnerAccount ownerAccount) { return this; } - /** + /** * Get ownerAccount * @return ownerAccount - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_OWNER_ACCOUNT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -351,12 +339,11 @@ public ApiAppResponse whiteLabelingOptions(ApiAppResponseWhiteLabelingOptions wh return this; } - /** + /** * Get whiteLabelingOptions * @return whiteLabelingOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_WHITE_LABELING_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/ApiAppResponseOAuth.java b/src/main/java/com/dropbox/sign/model/ApiAppResponseOAuth.java index 12fdc77..d4fd6b7 100644 --- a/src/main/java/com/dropbox/sign/model/ApiAppResponseOAuth.java +++ b/src/main/java/com/dropbox/sign/model/ApiAppResponseOAuth.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,29 +21,27 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; /** * An object describing the app's OAuth properties, or null if OAuth is not configured for the app. */ -@ApiModel(description = "An object describing the app's OAuth properties, or null if OAuth is not configured for the app.") @JsonPropertyOrder({ - ApiAppResponseOAuth.JSON_PROPERTY_CALLBACK_URL, - ApiAppResponseOAuth.JSON_PROPERTY_SECRET, - ApiAppResponseOAuth.JSON_PROPERTY_SCOPES, - ApiAppResponseOAuth.JSON_PROPERTY_CHARGES_USERS + ApiAppResponseOAuth.JSON_PROPERTY_CALLBACK_URL, + ApiAppResponseOAuth.JSON_PROPERTY_SECRET, + ApiAppResponseOAuth.JSON_PROPERTY_SCOPES, + ApiAppResponseOAuth.JSON_PROPERTY_CHARGES_USERS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ApiAppResponseOAuth { public static final String JSON_PROPERTY_CALLBACK_URL = "callback_url"; private String callbackUrl; @@ -81,12 +78,11 @@ public ApiAppResponseOAuth callbackUrl(String callbackUrl) { return this; } - /** + /** * The app's OAuth callback URL. * @return callbackUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The app's OAuth callback URL.") @JsonProperty(JSON_PROPERTY_CALLBACK_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -107,12 +103,11 @@ public ApiAppResponseOAuth secret(String secret) { return this; } - /** + /** * The app's OAuth secret, or null if the app does not belong to user. * @return secret - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The app's OAuth secret, or null if the app does not belong to user.") @JsonProperty(JSON_PROPERTY_SECRET) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -141,12 +136,11 @@ public ApiAppResponseOAuth addScopesItem(String scopesItem) { return this; } - /** + /** * Array of OAuth scopes used by the app. * @return scopes - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Array of OAuth scopes used by the app.") @JsonProperty(JSON_PROPERTY_SCOPES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -167,12 +161,11 @@ public ApiAppResponseOAuth chargesUsers(Boolean chargesUsers) { return this; } - /** + /** * Boolean indicating whether the app owner or the account granting permission is billed for OAuth requests. * @return chargesUsers - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Boolean indicating whether the app owner or the account granting permission is billed for OAuth requests.") @JsonProperty(JSON_PROPERTY_CHARGES_USERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/ApiAppResponseOptions.java b/src/main/java/com/dropbox/sign/model/ApiAppResponseOptions.java index ff0d62a..33a7c70 100644 --- a/src/main/java/com/dropbox/sign/model/ApiAppResponseOptions.java +++ b/src/main/java/com/dropbox/sign/model/ApiAppResponseOptions.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,24 +21,22 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * An object with options that override account settings. */ -@ApiModel(description = "An object with options that override account settings.") @JsonPropertyOrder({ - ApiAppResponseOptions.JSON_PROPERTY_CAN_INSERT_EVERYWHERE + ApiAppResponseOptions.JSON_PROPERTY_CAN_INSERT_EVERYWHERE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ApiAppResponseOptions { public static final String JSON_PROPERTY_CAN_INSERT_EVERYWHERE = "can_insert_everywhere"; private Boolean canInsertEverywhere; @@ -67,12 +64,11 @@ public ApiAppResponseOptions canInsertEverywhere(Boolean canInsertEverywhere) { return this; } - /** + /** * Boolean denoting if signers can \"Insert Everywhere\" in one click while signing a document * @return canInsertEverywhere - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Boolean denoting if signers can \"Insert Everywhere\" in one click while signing a document") @JsonProperty(JSON_PROPERTY_CAN_INSERT_EVERYWHERE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/ApiAppResponseOwnerAccount.java b/src/main/java/com/dropbox/sign/model/ApiAppResponseOwnerAccount.java index e2fd1a9..a1e52ba 100644 --- a/src/main/java/com/dropbox/sign/model/ApiAppResponseOwnerAccount.java +++ b/src/main/java/com/dropbox/sign/model/ApiAppResponseOwnerAccount.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,25 +21,23 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * An object describing the app's owner */ -@ApiModel(description = "An object describing the app's owner") @JsonPropertyOrder({ - ApiAppResponseOwnerAccount.JSON_PROPERTY_ACCOUNT_ID, - ApiAppResponseOwnerAccount.JSON_PROPERTY_EMAIL_ADDRESS + ApiAppResponseOwnerAccount.JSON_PROPERTY_ACCOUNT_ID, + ApiAppResponseOwnerAccount.JSON_PROPERTY_EMAIL_ADDRESS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ApiAppResponseOwnerAccount { public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; private String accountId; @@ -71,12 +68,11 @@ public ApiAppResponseOwnerAccount accountId(String accountId) { return this; } - /** + /** * The owner account's ID * @return accountId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The owner account's ID") @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -97,12 +93,11 @@ public ApiAppResponseOwnerAccount emailAddress(String emailAddress) { return this; } - /** + /** * The owner account's email address * @return emailAddress - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The owner account's email address") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/ApiAppResponseWhiteLabelingOptions.java b/src/main/java/com/dropbox/sign/model/ApiAppResponseWhiteLabelingOptions.java index 9fca888..f8dabea 100644 --- a/src/main/java/com/dropbox/sign/model/ApiAppResponseWhiteLabelingOptions.java +++ b/src/main/java/com/dropbox/sign/model/ApiAppResponseWhiteLabelingOptions.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,37 +21,35 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * An object with options to customize the app's signer page */ -@ApiModel(description = "An object with options to customize the app's signer page") @JsonPropertyOrder({ - ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_HEADER_BACKGROUND_COLOR, - ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_LEGAL_VERSION, - ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_LINK_COLOR, - ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_PAGE_BACKGROUND_COLOR, - ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_PRIMARY_BUTTON_COLOR, - ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_PRIMARY_BUTTON_COLOR_HOVER, - ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_PRIMARY_BUTTON_TEXT_COLOR, - ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_PRIMARY_BUTTON_TEXT_COLOR_HOVER, - ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_SECONDARY_BUTTON_COLOR, - ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_SECONDARY_BUTTON_COLOR_HOVER, - ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_SECONDARY_BUTTON_TEXT_COLOR, - ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_SECONDARY_BUTTON_TEXT_COLOR_HOVER, - ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_TEXT_COLOR1, - ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_TEXT_COLOR2 + ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_HEADER_BACKGROUND_COLOR, + ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_LEGAL_VERSION, + ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_LINK_COLOR, + ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_PAGE_BACKGROUND_COLOR, + ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_PRIMARY_BUTTON_COLOR, + ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_PRIMARY_BUTTON_COLOR_HOVER, + ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_PRIMARY_BUTTON_TEXT_COLOR, + ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_PRIMARY_BUTTON_TEXT_COLOR_HOVER, + ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_SECONDARY_BUTTON_COLOR, + ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_SECONDARY_BUTTON_COLOR_HOVER, + ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_SECONDARY_BUTTON_TEXT_COLOR, + ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_SECONDARY_BUTTON_TEXT_COLOR_HOVER, + ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_TEXT_COLOR1, + ApiAppResponseWhiteLabelingOptions.JSON_PROPERTY_TEXT_COLOR2 }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ApiAppResponseWhiteLabelingOptions { public static final String JSON_PROPERTY_HEADER_BACKGROUND_COLOR = "header_background_color"; private String headerBackgroundColor; @@ -119,12 +116,11 @@ public ApiAppResponseWhiteLabelingOptions headerBackgroundColor(String headerBac return this; } - /** + /** * Get headerBackgroundColor * @return headerBackgroundColor - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_HEADER_BACKGROUND_COLOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -145,12 +141,11 @@ public ApiAppResponseWhiteLabelingOptions legalVersion(String legalVersion) { return this; } - /** + /** * Get legalVersion * @return legalVersion - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LEGAL_VERSION) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -171,12 +166,11 @@ public ApiAppResponseWhiteLabelingOptions linkColor(String linkColor) { return this; } - /** + /** * Get linkColor * @return linkColor - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LINK_COLOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -197,12 +191,11 @@ public ApiAppResponseWhiteLabelingOptions pageBackgroundColor(String pageBackgro return this; } - /** + /** * Get pageBackgroundColor * @return pageBackgroundColor - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PAGE_BACKGROUND_COLOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -223,12 +216,11 @@ public ApiAppResponseWhiteLabelingOptions primaryButtonColor(String primaryButto return this; } - /** + /** * Get primaryButtonColor * @return primaryButtonColor - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PRIMARY_BUTTON_COLOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -249,12 +241,11 @@ public ApiAppResponseWhiteLabelingOptions primaryButtonColorHover(String primary return this; } - /** + /** * Get primaryButtonColorHover * @return primaryButtonColorHover - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PRIMARY_BUTTON_COLOR_HOVER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -275,12 +266,11 @@ public ApiAppResponseWhiteLabelingOptions primaryButtonTextColor(String primaryB return this; } - /** + /** * Get primaryButtonTextColor * @return primaryButtonTextColor - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PRIMARY_BUTTON_TEXT_COLOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -301,12 +291,11 @@ public ApiAppResponseWhiteLabelingOptions primaryButtonTextColorHover(String pri return this; } - /** + /** * Get primaryButtonTextColorHover * @return primaryButtonTextColorHover - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PRIMARY_BUTTON_TEXT_COLOR_HOVER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -327,12 +316,11 @@ public ApiAppResponseWhiteLabelingOptions secondaryButtonColor(String secondaryB return this; } - /** + /** * Get secondaryButtonColor * @return secondaryButtonColor - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SECONDARY_BUTTON_COLOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -353,12 +341,11 @@ public ApiAppResponseWhiteLabelingOptions secondaryButtonColorHover(String secon return this; } - /** + /** * Get secondaryButtonColorHover * @return secondaryButtonColorHover - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SECONDARY_BUTTON_COLOR_HOVER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -379,12 +366,11 @@ public ApiAppResponseWhiteLabelingOptions secondaryButtonTextColor(String second return this; } - /** + /** * Get secondaryButtonTextColor * @return secondaryButtonTextColor - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SECONDARY_BUTTON_TEXT_COLOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -405,12 +391,11 @@ public ApiAppResponseWhiteLabelingOptions secondaryButtonTextColorHover(String s return this; } - /** + /** * Get secondaryButtonTextColorHover * @return secondaryButtonTextColorHover - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SECONDARY_BUTTON_TEXT_COLOR_HOVER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -431,12 +416,11 @@ public ApiAppResponseWhiteLabelingOptions textColor1(String textColor1) { return this; } - /** + /** * Get textColor1 * @return textColor1 - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TEXT_COLOR1) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -457,12 +441,11 @@ public ApiAppResponseWhiteLabelingOptions textColor2(String textColor2) { return this; } - /** + /** * Get textColor2 * @return textColor2 - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TEXT_COLOR2) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/ApiAppUpdateRequest.java b/src/main/java/com/dropbox/sign/model/ApiAppUpdateRequest.java index 9e725c0..930edc3 100644 --- a/src/main/java/com/dropbox/sign/model/ApiAppUpdateRequest.java +++ b/src/main/java/com/dropbox/sign/model/ApiAppUpdateRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubOAuth; @@ -25,15 +24,14 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.File; 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.JSON; import com.dropbox.sign.ApiException; @@ -41,16 +39,16 @@ * ApiAppUpdateRequest */ @JsonPropertyOrder({ - ApiAppUpdateRequest.JSON_PROPERTY_CALLBACK_URL, - ApiAppUpdateRequest.JSON_PROPERTY_CUSTOM_LOGO_FILE, - ApiAppUpdateRequest.JSON_PROPERTY_DOMAINS, - ApiAppUpdateRequest.JSON_PROPERTY_NAME, - ApiAppUpdateRequest.JSON_PROPERTY_OAUTH, - ApiAppUpdateRequest.JSON_PROPERTY_OPTIONS, - ApiAppUpdateRequest.JSON_PROPERTY_WHITE_LABELING_OPTIONS + ApiAppUpdateRequest.JSON_PROPERTY_CALLBACK_URL, + ApiAppUpdateRequest.JSON_PROPERTY_CUSTOM_LOGO_FILE, + ApiAppUpdateRequest.JSON_PROPERTY_DOMAINS, + ApiAppUpdateRequest.JSON_PROPERTY_NAME, + ApiAppUpdateRequest.JSON_PROPERTY_OAUTH, + ApiAppUpdateRequest.JSON_PROPERTY_OPTIONS, + ApiAppUpdateRequest.JSON_PROPERTY_WHITE_LABELING_OPTIONS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ApiAppUpdateRequest { public static final String JSON_PROPERTY_CALLBACK_URL = "callback_url"; private String callbackUrl; @@ -96,12 +94,11 @@ public ApiAppUpdateRequest callbackUrl(String callbackUrl) { return this; } - /** + /** * The URL at which the API App should receive event callbacks. * @return callbackUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL at which the API App should receive event callbacks.") @JsonProperty(JSON_PROPERTY_CALLBACK_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -122,12 +119,11 @@ public ApiAppUpdateRequest customLogoFile(File customLogoFile) { return this; } - /** + /** * An image file to use as a custom logo in embedded contexts. (Only applies to some API plans) * @return customLogoFile - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An image file to use as a custom logo in embedded contexts. (Only applies to some API plans)") @JsonProperty(JSON_PROPERTY_CUSTOM_LOGO_FILE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -156,12 +152,11 @@ public ApiAppUpdateRequest addDomainsItem(String domainsItem) { return this; } - /** + /** * The domain names the ApiApp will be associated with. * @return domains - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The domain names the ApiApp will be associated with.") @JsonProperty(JSON_PROPERTY_DOMAINS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -182,12 +177,11 @@ public ApiAppUpdateRequest name(String name) { return this; } - /** + /** * The name you want to assign to the ApiApp. * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name you want to assign to the ApiApp.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -208,12 +202,11 @@ public ApiAppUpdateRequest oauth(SubOAuth oauth) { return this; } - /** + /** * Get oauth * @return oauth - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_OAUTH) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -234,12 +227,11 @@ public ApiAppUpdateRequest options(SubOptions options) { return this; } - /** + /** * Get options * @return options - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -260,12 +252,11 @@ public ApiAppUpdateRequest whiteLabelingOptions(SubWhiteLabelingOptions whiteLab return this; } - /** + /** * Get whiteLabelingOptions * @return whiteLabelingOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_WHITE_LABELING_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/BulkSendJobGetResponse.java b/src/main/java/com/dropbox/sign/model/BulkSendJobGetResponse.java index 0b61690..74f1294 100644 --- a/src/main/java/com/dropbox/sign/model/BulkSendJobGetResponse.java +++ b/src/main/java/com/dropbox/sign/model/BulkSendJobGetResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.BulkSendJobGetResponseSignatureRequests; @@ -26,14 +25,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -41,13 +39,13 @@ * BulkSendJobGetResponse */ @JsonPropertyOrder({ - BulkSendJobGetResponse.JSON_PROPERTY_BULK_SEND_JOB, - BulkSendJobGetResponse.JSON_PROPERTY_LIST_INFO, - BulkSendJobGetResponse.JSON_PROPERTY_SIGNATURE_REQUESTS, - BulkSendJobGetResponse.JSON_PROPERTY_WARNINGS + BulkSendJobGetResponse.JSON_PROPERTY_BULK_SEND_JOB, + BulkSendJobGetResponse.JSON_PROPERTY_LIST_INFO, + BulkSendJobGetResponse.JSON_PROPERTY_SIGNATURE_REQUESTS, + BulkSendJobGetResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class BulkSendJobGetResponse { public static final String JSON_PROPERTY_BULK_SEND_JOB = "bulk_send_job"; private BulkSendJobResponse bulkSendJob; @@ -56,7 +54,7 @@ public class BulkSendJobGetResponse { private ListInfoResponse listInfo; public static final String JSON_PROPERTY_SIGNATURE_REQUESTS = "signature_requests"; - private List signatureRequests = null; + private List signatureRequests = new ArrayList<>(); public static final String JSON_PROPERTY_WARNINGS = "warnings"; private List warnings = null; @@ -84,14 +82,13 @@ public BulkSendJobGetResponse bulkSendJob(BulkSendJobResponse bulkSendJob) { return this; } - /** + /** * Get bulkSendJob * @return bulkSendJob - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_BULK_SEND_JOB) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public BulkSendJobResponse getBulkSendJob() { return bulkSendJob; @@ -99,7 +96,7 @@ public BulkSendJobResponse getBulkSendJob() { @JsonProperty(JSON_PROPERTY_BULK_SEND_JOB) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setBulkSendJob(BulkSendJobResponse bulkSendJob) { this.bulkSendJob = bulkSendJob; } @@ -110,14 +107,13 @@ public BulkSendJobGetResponse listInfo(ListInfoResponse listInfo) { return this; } - /** + /** * Get listInfo * @return listInfo - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_LIST_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public ListInfoResponse getListInfo() { return listInfo; @@ -125,7 +121,7 @@ public ListInfoResponse getListInfo() { @JsonProperty(JSON_PROPERTY_LIST_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setListInfo(ListInfoResponse listInfo) { this.listInfo = listInfo; } @@ -144,14 +140,13 @@ public BulkSendJobGetResponse addSignatureRequestsItem(BulkSendJobGetResponseSig return this; } - /** + /** * Contains information about the Signature Requests sent in bulk. * @return signatureRequests - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Contains information about the Signature Requests sent in bulk.") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_SIGNATURE_REQUESTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getSignatureRequests() { return signatureRequests; @@ -159,7 +154,7 @@ public List getSignatureRequests() { @JsonProperty(JSON_PROPERTY_SIGNATURE_REQUESTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setSignatureRequests(List signatureRequests) { this.signatureRequests = signatureRequests; } @@ -178,12 +173,11 @@ public BulkSendJobGetResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/BulkSendJobGetResponseSignatureRequests.java b/src/main/java/com/dropbox/sign/model/BulkSendJobGetResponseSignatureRequests.java index 3fec005..45342c7 100644 --- a/src/main/java/com/dropbox/sign/model/BulkSendJobGetResponseSignatureRequests.java +++ b/src/main/java/com/dropbox/sign/model/BulkSendJobGetResponseSignatureRequests.java @@ -14,10 +14,8 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; -import com.dropbox.sign.model.SignatureRequestResponse; import com.dropbox.sign.model.SignatureRequestResponseAttachment; import com.dropbox.sign.model.SignatureRequestResponseCustomFieldBase; import com.dropbox.sign.model.SignatureRequestResponseDataBase; @@ -27,14 +25,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -42,34 +39,34 @@ * BulkSendJobGetResponseSignatureRequests */ @JsonPropertyOrder({ - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_TEST_MODE, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_SIGNATURE_REQUEST_ID, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_REQUESTER_EMAIL_ADDRESS, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_TITLE, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_ORIGINAL_TITLE, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_SUBJECT, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_MESSAGE, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_METADATA, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_CREATED_AT, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_EXPIRES_AT, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_IS_COMPLETE, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_IS_DECLINED, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_HAS_ERROR, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_FILES_URL, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_SIGNING_URL, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_DETAILS_URL, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_CC_EMAIL_ADDRESSES, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_SIGNING_REDIRECT_URL, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_FINAL_COPY_URI, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_TEMPLATE_IDS, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_CUSTOM_FIELDS, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_ATTACHMENTS, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_RESPONSE_DATA, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_SIGNATURES, - BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_BULK_SEND_JOB_ID + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_TEST_MODE, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_SIGNATURE_REQUEST_ID, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_REQUESTER_EMAIL_ADDRESS, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_TITLE, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_ORIGINAL_TITLE, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_SUBJECT, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_MESSAGE, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_METADATA, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_CREATED_AT, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_EXPIRES_AT, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_IS_COMPLETE, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_IS_DECLINED, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_HAS_ERROR, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_FILES_URL, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_SIGNING_URL, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_DETAILS_URL, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_CC_EMAIL_ADDRESSES, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_SIGNING_REDIRECT_URL, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_FINAL_COPY_URI, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_TEMPLATE_IDS, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_CUSTOM_FIELDS, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_ATTACHMENTS, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_RESPONSE_DATA, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_SIGNATURES, + BulkSendJobGetResponseSignatureRequests.JSON_PROPERTY_BULK_SEND_JOB_ID }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class BulkSendJobGetResponseSignatureRequests { public static final String JSON_PROPERTY_TEST_MODE = "test_mode"; private Boolean testMode = false; @@ -169,12 +166,11 @@ public BulkSendJobGetResponseSignatureRequests testMode(Boolean testMode) { return this; } - /** + /** * Whether this is a test signature request. Test requests have no legal value. Defaults to `false`. * @return testMode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this is a test signature request. Test requests have no legal value. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_TEST_MODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -195,12 +191,11 @@ public BulkSendJobGetResponseSignatureRequests signatureRequestId(String signatu return this; } - /** + /** * The id of the SignatureRequest. * @return signatureRequestId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the SignatureRequest.") @JsonProperty(JSON_PROPERTY_SIGNATURE_REQUEST_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -221,12 +216,11 @@ public BulkSendJobGetResponseSignatureRequests requesterEmailAddress(String requ return this; } - /** + /** * The email address of the initiator of the SignatureRequest. * @return requesterEmailAddress - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The email address of the initiator of the SignatureRequest.") @JsonProperty(JSON_PROPERTY_REQUESTER_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -247,12 +241,11 @@ public BulkSendJobGetResponseSignatureRequests title(String title) { return this; } - /** + /** * The title the specified Account uses for the SignatureRequest. * @return title - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The title the specified Account uses for the SignatureRequest.") @JsonProperty(JSON_PROPERTY_TITLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -273,12 +266,11 @@ public BulkSendJobGetResponseSignatureRequests originalTitle(String originalTitl return this; } - /** + /** * Default Label for account. * @return originalTitle - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Default Label for account.") @JsonProperty(JSON_PROPERTY_ORIGINAL_TITLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -299,12 +291,11 @@ public BulkSendJobGetResponseSignatureRequests subject(String subject) { return this; } - /** + /** * The subject in the email that was initially sent to the signers. * @return subject - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The subject in the email that was initially sent to the signers.") @JsonProperty(JSON_PROPERTY_SUBJECT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -325,12 +316,11 @@ public BulkSendJobGetResponseSignatureRequests message(String message) { return this; } - /** + /** * The custom message in the email that was initially sent to the signers. * @return message - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The custom message in the email that was initially sent to the signers.") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -351,12 +341,11 @@ public BulkSendJobGetResponseSignatureRequests metadata(Object metadata) { return this; } - /** + /** * The metadata attached to the signature request. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The metadata attached to the signature request.") @JsonProperty(JSON_PROPERTY_METADATA) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -377,12 +366,11 @@ public BulkSendJobGetResponseSignatureRequests createdAt(Integer createdAt) { return this; } - /** + /** * Time the signature request was created. * @return createdAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Time the signature request was created.") @JsonProperty(JSON_PROPERTY_CREATED_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -403,12 +391,11 @@ public BulkSendJobGetResponseSignatureRequests expiresAt(Integer expiresAt) { return this; } - /** + /** * The time when the signature request will expire unsigned signatures. See [Signature Request Expiration Date](https://developers.hellosign.com/docs/signature-request/expiration/) for details. * @return expiresAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The time when the signature request will expire unsigned signatures. See [Signature Request Expiration Date](https://developers.hellosign.com/docs/signature-request/expiration/) for details.") @JsonProperty(JSON_PROPERTY_EXPIRES_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -429,12 +416,11 @@ public BulkSendJobGetResponseSignatureRequests isComplete(Boolean isComplete) { return this; } - /** + /** * Whether or not the SignatureRequest has been fully executed by all signers. * @return isComplete - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether or not the SignatureRequest has been fully executed by all signers.") @JsonProperty(JSON_PROPERTY_IS_COMPLETE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -455,12 +441,11 @@ public BulkSendJobGetResponseSignatureRequests isDeclined(Boolean isDeclined) { return this; } - /** + /** * Whether or not the SignatureRequest has been declined by a signer. * @return isDeclined - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether or not the SignatureRequest has been declined by a signer.") @JsonProperty(JSON_PROPERTY_IS_DECLINED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -481,12 +466,11 @@ public BulkSendJobGetResponseSignatureRequests hasError(Boolean hasError) { return this; } - /** + /** * Whether or not an error occurred (either during the creation of the SignatureRequest or during one of the signings). * @return hasError - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether or not an error occurred (either during the creation of the SignatureRequest or during one of the signings).") @JsonProperty(JSON_PROPERTY_HAS_ERROR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -507,12 +491,11 @@ public BulkSendJobGetResponseSignatureRequests filesUrl(String filesUrl) { return this; } - /** + /** * The URL where a copy of the request's documents can be downloaded. * @return filesUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL where a copy of the request's documents can be downloaded.") @JsonProperty(JSON_PROPERTY_FILES_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -533,12 +516,11 @@ public BulkSendJobGetResponseSignatureRequests signingUrl(String signingUrl) { return this; } - /** + /** * The URL where a signer, after authenticating, can sign the documents. This should only be used by users with existing Dropbox Sign accounts as they will be required to log in before signing. * @return signingUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL where a signer, after authenticating, can sign the documents. This should only be used by users with existing Dropbox Sign accounts as they will be required to log in before signing.") @JsonProperty(JSON_PROPERTY_SIGNING_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -559,12 +541,11 @@ public BulkSendJobGetResponseSignatureRequests detailsUrl(String detailsUrl) { return this; } - /** + /** * The URL where the requester and the signers can view the current status of the SignatureRequest. * @return detailsUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL where the requester and the signers can view the current status of the SignatureRequest.") @JsonProperty(JSON_PROPERTY_DETAILS_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -593,12 +574,11 @@ public BulkSendJobGetResponseSignatureRequests addCcEmailAddressesItem(String cc return this; } - /** + /** * A list of email addresses that were CCed on the SignatureRequest. They will receive a copy of the final PDF once all the signers have signed. * @return ccEmailAddresses - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of email addresses that were CCed on the SignatureRequest. They will receive a copy of the final PDF once all the signers have signed.") @JsonProperty(JSON_PROPERTY_CC_EMAIL_ADDRESSES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -619,12 +599,11 @@ public BulkSendJobGetResponseSignatureRequests signingRedirectUrl(String signing return this; } - /** + /** * The URL you want the signer redirected to after they successfully sign. * @return signingRedirectUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL you want the signer redirected to after they successfully sign.") @JsonProperty(JSON_PROPERTY_SIGNING_REDIRECT_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -645,12 +624,11 @@ public BulkSendJobGetResponseSignatureRequests finalCopyUri(String finalCopyUri) return this; } - /** + /** * The path where the completed document can be downloaded * @return finalCopyUri - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The path where the completed document can be downloaded") @JsonProperty(JSON_PROPERTY_FINAL_COPY_URI) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -679,12 +657,11 @@ public BulkSendJobGetResponseSignatureRequests addTemplateIdsItem(String templat return this; } - /** + /** * Templates IDs used in this SignatureRequest (if any). * @return templateIds - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Templates IDs used in this SignatureRequest (if any).") @JsonProperty(JSON_PROPERTY_TEMPLATE_IDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -713,12 +690,11 @@ public BulkSendJobGetResponseSignatureRequests addCustomFieldsItem(SignatureRequ return this; } - /** + /** * An array of Custom Field objects containing the name and type of each custom field. * Text Field uses `SignatureRequestResponseCustomFieldText` * Checkbox Field uses `SignatureRequestResponseCustomFieldCheckbox` * @return customFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array of Custom Field objects containing the name and type of each custom field. * Text Field uses `SignatureRequestResponseCustomFieldText` * Checkbox Field uses `SignatureRequestResponseCustomFieldCheckbox`") @JsonProperty(JSON_PROPERTY_CUSTOM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -747,12 +723,11 @@ public BulkSendJobGetResponseSignatureRequests addAttachmentsItem(SignatureReque return this; } - /** + /** * Signer attachments. * @return attachments - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Signer attachments.") @JsonProperty(JSON_PROPERTY_ATTACHMENTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -781,12 +756,11 @@ public BulkSendJobGetResponseSignatureRequests addResponseDataItem(SignatureRequ return this; } - /** + /** * An array of form field objects containing the name, value, and type of each textbox or checkmark field filled in by the signers. * @return responseData - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array of form field objects containing the name, value, and type of each textbox or checkmark field filled in by the signers.") @JsonProperty(JSON_PROPERTY_RESPONSE_DATA) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -815,12 +789,11 @@ public BulkSendJobGetResponseSignatureRequests addSignaturesItem(SignatureReques return this; } - /** + /** * An array of signature objects, 1 for each signer. * @return signatures - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array of signature objects, 1 for each signer.") @JsonProperty(JSON_PROPERTY_SIGNATURES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -841,12 +814,11 @@ public BulkSendJobGetResponseSignatureRequests bulkSendJobId(String bulkSendJobI return this; } - /** + /** * The id of the BulkSendJob. * @return bulkSendJobId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the BulkSendJob.") @JsonProperty(JSON_PROPERTY_BULK_SEND_JOB_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/BulkSendJobListResponse.java b/src/main/java/com/dropbox/sign/model/BulkSendJobListResponse.java index 2b72645..0e97384 100644 --- a/src/main/java/com/dropbox/sign/model/BulkSendJobListResponse.java +++ b/src/main/java/com/dropbox/sign/model/BulkSendJobListResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.BulkSendJobResponse; @@ -25,14 +24,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -40,15 +38,15 @@ * BulkSendJobListResponse */ @JsonPropertyOrder({ - BulkSendJobListResponse.JSON_PROPERTY_BULK_SEND_JOBS, - BulkSendJobListResponse.JSON_PROPERTY_LIST_INFO, - BulkSendJobListResponse.JSON_PROPERTY_WARNINGS + BulkSendJobListResponse.JSON_PROPERTY_BULK_SEND_JOBS, + BulkSendJobListResponse.JSON_PROPERTY_LIST_INFO, + BulkSendJobListResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class BulkSendJobListResponse { public static final String JSON_PROPERTY_BULK_SEND_JOBS = "bulk_send_jobs"; - private List bulkSendJobs = null; + private List bulkSendJobs = new ArrayList<>(); public static final String JSON_PROPERTY_LIST_INFO = "list_info"; private ListInfoResponse listInfo; @@ -87,14 +85,13 @@ public BulkSendJobListResponse addBulkSendJobsItem(BulkSendJobResponse bulkSendJ return this; } - /** + /** * Contains a list of BulkSendJobs that the API caller has access to. * @return bulkSendJobs - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Contains a list of BulkSendJobs that the API caller has access to.") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_BULK_SEND_JOBS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getBulkSendJobs() { return bulkSendJobs; @@ -102,7 +99,7 @@ public List getBulkSendJobs() { @JsonProperty(JSON_PROPERTY_BULK_SEND_JOBS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setBulkSendJobs(List bulkSendJobs) { this.bulkSendJobs = bulkSendJobs; } @@ -113,14 +110,13 @@ public BulkSendJobListResponse listInfo(ListInfoResponse listInfo) { return this; } - /** + /** * Get listInfo * @return listInfo - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_LIST_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public ListInfoResponse getListInfo() { return listInfo; @@ -128,7 +124,7 @@ public ListInfoResponse getListInfo() { @JsonProperty(JSON_PROPERTY_LIST_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setListInfo(ListInfoResponse listInfo) { this.listInfo = listInfo; } @@ -147,12 +143,11 @@ public BulkSendJobListResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/BulkSendJobResponse.java b/src/main/java/com/dropbox/sign/model/BulkSendJobResponse.java index 903dfd4..613a269 100644 --- a/src/main/java/com/dropbox/sign/model/BulkSendJobResponse.java +++ b/src/main/java/com/dropbox/sign/model/BulkSendJobResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,27 +21,25 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * Contains information about the BulkSendJob such as when it was created and how many signature requests are queued. */ -@ApiModel(description = "Contains information about the BulkSendJob such as when it was created and how many signature requests are queued.") @JsonPropertyOrder({ - BulkSendJobResponse.JSON_PROPERTY_BULK_SEND_JOB_ID, - BulkSendJobResponse.JSON_PROPERTY_TOTAL, - BulkSendJobResponse.JSON_PROPERTY_IS_CREATOR, - BulkSendJobResponse.JSON_PROPERTY_CREATED_AT + BulkSendJobResponse.JSON_PROPERTY_BULK_SEND_JOB_ID, + BulkSendJobResponse.JSON_PROPERTY_TOTAL, + BulkSendJobResponse.JSON_PROPERTY_IS_CREATOR, + BulkSendJobResponse.JSON_PROPERTY_CREATED_AT }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class BulkSendJobResponse { public static final String JSON_PROPERTY_BULK_SEND_JOB_ID = "bulk_send_job_id"; private String bulkSendJobId; @@ -79,12 +76,11 @@ public BulkSendJobResponse bulkSendJobId(String bulkSendJobId) { return this; } - /** + /** * The id of the BulkSendJob. * @return bulkSendJobId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the BulkSendJob.") @JsonProperty(JSON_PROPERTY_BULK_SEND_JOB_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -105,12 +101,11 @@ public BulkSendJobResponse total(Integer total) { return this; } - /** + /** * The total amount of Signature Requests queued for sending. * @return total - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The total amount of Signature Requests queued for sending.") @JsonProperty(JSON_PROPERTY_TOTAL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -131,12 +126,11 @@ public BulkSendJobResponse isCreator(Boolean isCreator) { return this; } - /** + /** * True if you are the owner of this BulkSendJob, false if it's been shared with you by a team member. * @return isCreator - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "True if you are the owner of this BulkSendJob, false if it's been shared with you by a team member.") @JsonProperty(JSON_PROPERTY_IS_CREATOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -157,12 +151,11 @@ public BulkSendJobResponse createdAt(Integer createdAt) { return this; } - /** + /** * Time that the BulkSendJob was created. * @return createdAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Time that the BulkSendJob was created.") @JsonProperty(JSON_PROPERTY_CREATED_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/BulkSendJobSendResponse.java b/src/main/java/com/dropbox/sign/model/BulkSendJobSendResponse.java index 0ba1ab4..400e70c 100644 --- a/src/main/java/com/dropbox/sign/model/BulkSendJobSendResponse.java +++ b/src/main/java/com/dropbox/sign/model/BulkSendJobSendResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.BulkSendJobResponse; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,11 +37,11 @@ * BulkSendJobSendResponse */ @JsonPropertyOrder({ - BulkSendJobSendResponse.JSON_PROPERTY_BULK_SEND_JOB, - BulkSendJobSendResponse.JSON_PROPERTY_WARNINGS + BulkSendJobSendResponse.JSON_PROPERTY_BULK_SEND_JOB, + BulkSendJobSendResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class BulkSendJobSendResponse { public static final String JSON_PROPERTY_BULK_SEND_JOB = "bulk_send_job"; private BulkSendJobResponse bulkSendJob; @@ -74,14 +72,13 @@ public BulkSendJobSendResponse bulkSendJob(BulkSendJobResponse bulkSendJob) { return this; } - /** + /** * Get bulkSendJob * @return bulkSendJob - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_BULK_SEND_JOB) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public BulkSendJobResponse getBulkSendJob() { return bulkSendJob; @@ -89,7 +86,7 @@ public BulkSendJobResponse getBulkSendJob() { @JsonProperty(JSON_PROPERTY_BULK_SEND_JOB) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setBulkSendJob(BulkSendJobResponse bulkSendJob) { this.bulkSendJob = bulkSendJob; } @@ -108,12 +105,11 @@ public BulkSendJobSendResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/EmbeddedEditUrlRequest.java b/src/main/java/com/dropbox/sign/model/EmbeddedEditUrlRequest.java index 3dcc8fb..4ae0413 100644 --- a/src/main/java/com/dropbox/sign/model/EmbeddedEditUrlRequest.java +++ b/src/main/java/com/dropbox/sign/model/EmbeddedEditUrlRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubEditorOptions; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,19 +37,19 @@ * EmbeddedEditUrlRequest */ @JsonPropertyOrder({ - EmbeddedEditUrlRequest.JSON_PROPERTY_ALLOW_EDIT_CCS, - EmbeddedEditUrlRequest.JSON_PROPERTY_CC_ROLES, - EmbeddedEditUrlRequest.JSON_PROPERTY_EDITOR_OPTIONS, - EmbeddedEditUrlRequest.JSON_PROPERTY_FORCE_SIGNER_ROLES, - EmbeddedEditUrlRequest.JSON_PROPERTY_FORCE_SUBJECT_MESSAGE, - EmbeddedEditUrlRequest.JSON_PROPERTY_MERGE_FIELDS, - EmbeddedEditUrlRequest.JSON_PROPERTY_PREVIEW_ONLY, - EmbeddedEditUrlRequest.JSON_PROPERTY_SHOW_PREVIEW, - EmbeddedEditUrlRequest.JSON_PROPERTY_SHOW_PROGRESS_STEPPER, - EmbeddedEditUrlRequest.JSON_PROPERTY_TEST_MODE + EmbeddedEditUrlRequest.JSON_PROPERTY_ALLOW_EDIT_CCS, + EmbeddedEditUrlRequest.JSON_PROPERTY_CC_ROLES, + EmbeddedEditUrlRequest.JSON_PROPERTY_EDITOR_OPTIONS, + EmbeddedEditUrlRequest.JSON_PROPERTY_FORCE_SIGNER_ROLES, + EmbeddedEditUrlRequest.JSON_PROPERTY_FORCE_SUBJECT_MESSAGE, + EmbeddedEditUrlRequest.JSON_PROPERTY_MERGE_FIELDS, + EmbeddedEditUrlRequest.JSON_PROPERTY_PREVIEW_ONLY, + EmbeddedEditUrlRequest.JSON_PROPERTY_SHOW_PREVIEW, + EmbeddedEditUrlRequest.JSON_PROPERTY_SHOW_PROGRESS_STEPPER, + EmbeddedEditUrlRequest.JSON_PROPERTY_TEST_MODE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class EmbeddedEditUrlRequest { public static final String JSON_PROPERTY_ALLOW_EDIT_CCS = "allow_edit_ccs"; private Boolean allowEditCcs = false; @@ -106,12 +104,11 @@ public EmbeddedEditUrlRequest allowEditCcs(Boolean allowEditCcs) { return this; } - /** + /** * This allows the requester to enable/disable to add or change CC roles when editing the template. * @return allowEditCcs - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "This allows the requester to enable/disable to add or change CC roles when editing the template.") @JsonProperty(JSON_PROPERTY_ALLOW_EDIT_CCS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -140,12 +137,11 @@ public EmbeddedEditUrlRequest addCcRolesItem(String ccRolesItem) { return this; } - /** + /** * The CC roles that must be assigned when using the template to send a signature request. To remove all CC roles, pass in a single role with no name. For use in a POST request. * @return ccRoles - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The CC roles that must be assigned when using the template to send a signature request. To remove all CC roles, pass in a single role with no name. For use in a POST request.") @JsonProperty(JSON_PROPERTY_CC_ROLES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -166,12 +162,11 @@ public EmbeddedEditUrlRequest editorOptions(SubEditorOptions editorOptions) { return this; } - /** + /** * Get editorOptions * @return editorOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EDITOR_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -192,12 +187,11 @@ public EmbeddedEditUrlRequest forceSignerRoles(Boolean forceSignerRoles) { return this; } - /** + /** * Provide users the ability to review/edit the template signer roles. * @return forceSignerRoles - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Provide users the ability to review/edit the template signer roles.") @JsonProperty(JSON_PROPERTY_FORCE_SIGNER_ROLES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -218,12 +212,11 @@ public EmbeddedEditUrlRequest forceSubjectMessage(Boolean forceSubjectMessage) { return this; } - /** + /** * Provide users the ability to review/edit the template subject and message. * @return forceSubjectMessage - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Provide users the ability to review/edit the template subject and message.") @JsonProperty(JSON_PROPERTY_FORCE_SUBJECT_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -252,12 +245,11 @@ public EmbeddedEditUrlRequest addMergeFieldsItem(SubMergeField mergeFieldsItem) return this; } - /** + /** * Add additional merge fields to the template, which can be used used to pre-fill data by passing values into signature requests made with that template. Remove all merge fields on the template by passing an empty array `[]`. * @return mergeFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Add additional merge fields to the template, which can be used used to pre-fill data by passing values into signature requests made with that template. Remove all merge fields on the template by passing an empty array `[]`.") @JsonProperty(JSON_PROPERTY_MERGE_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -278,12 +270,11 @@ public EmbeddedEditUrlRequest previewOnly(Boolean previewOnly) { return this; } - /** + /** * This allows the requester to enable the preview experience (i.e. does not allow the requester's end user to add any additional fields via the editor). **NOTE:** This parameter overwrites `show_preview=true` (if set). * @return previewOnly - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "This allows the requester to enable the preview experience (i.e. does not allow the requester's end user to add any additional fields via the editor). **NOTE:** This parameter overwrites `show_preview=true` (if set).") @JsonProperty(JSON_PROPERTY_PREVIEW_ONLY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -304,12 +295,11 @@ public EmbeddedEditUrlRequest showPreview(Boolean showPreview) { return this; } - /** + /** * This allows the requester to enable the editor/preview experience. * @return showPreview - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "This allows the requester to enable the editor/preview experience.") @JsonProperty(JSON_PROPERTY_SHOW_PREVIEW) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -330,12 +320,11 @@ public EmbeddedEditUrlRequest showProgressStepper(Boolean showProgressStepper) { return this; } - /** + /** * When only one step remains in the signature request process and this parameter is set to `false` then the progress stepper will be hidden. * @return showProgressStepper - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When only one step remains in the signature request process and this parameter is set to `false` then the progress stepper will be hidden.") @JsonProperty(JSON_PROPERTY_SHOW_PROGRESS_STEPPER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -356,12 +345,11 @@ public EmbeddedEditUrlRequest testMode(Boolean testMode) { return this; } - /** + /** * Whether this is a test, locked templates will only be available for editing if this is set to `true`. Defaults to `false`. * @return testMode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this is a test, locked templates will only be available for editing if this is set to `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_TEST_MODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/EmbeddedEditUrlResponse.java b/src/main/java/com/dropbox/sign/model/EmbeddedEditUrlResponse.java index 807a3d1..81fb833 100644 --- a/src/main/java/com/dropbox/sign/model/EmbeddedEditUrlResponse.java +++ b/src/main/java/com/dropbox/sign/model/EmbeddedEditUrlResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.EmbeddedEditUrlResponseEmbedded; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,11 +37,11 @@ * EmbeddedEditUrlResponse */ @JsonPropertyOrder({ - EmbeddedEditUrlResponse.JSON_PROPERTY_EMBEDDED, - EmbeddedEditUrlResponse.JSON_PROPERTY_WARNINGS + EmbeddedEditUrlResponse.JSON_PROPERTY_EMBEDDED, + EmbeddedEditUrlResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class EmbeddedEditUrlResponse { public static final String JSON_PROPERTY_EMBEDDED = "embedded"; private EmbeddedEditUrlResponseEmbedded embedded; @@ -74,14 +72,13 @@ public EmbeddedEditUrlResponse embedded(EmbeddedEditUrlResponseEmbedded embedded return this; } - /** + /** * Get embedded * @return embedded - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_EMBEDDED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public EmbeddedEditUrlResponseEmbedded getEmbedded() { return embedded; @@ -89,7 +86,7 @@ public EmbeddedEditUrlResponseEmbedded getEmbedded() { @JsonProperty(JSON_PROPERTY_EMBEDDED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setEmbedded(EmbeddedEditUrlResponseEmbedded embedded) { this.embedded = embedded; } @@ -108,12 +105,11 @@ public EmbeddedEditUrlResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/EmbeddedEditUrlResponseEmbedded.java b/src/main/java/com/dropbox/sign/model/EmbeddedEditUrlResponseEmbedded.java index d586310..a2fe58d 100644 --- a/src/main/java/com/dropbox/sign/model/EmbeddedEditUrlResponseEmbedded.java +++ b/src/main/java/com/dropbox/sign/model/EmbeddedEditUrlResponseEmbedded.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,25 +21,23 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * An embedded template object. */ -@ApiModel(description = "An embedded template object.") @JsonPropertyOrder({ - EmbeddedEditUrlResponseEmbedded.JSON_PROPERTY_EDIT_URL, - EmbeddedEditUrlResponseEmbedded.JSON_PROPERTY_EXPIRES_AT + EmbeddedEditUrlResponseEmbedded.JSON_PROPERTY_EDIT_URL, + EmbeddedEditUrlResponseEmbedded.JSON_PROPERTY_EXPIRES_AT }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class EmbeddedEditUrlResponseEmbedded { public static final String JSON_PROPERTY_EDIT_URL = "edit_url"; private String editUrl; @@ -71,12 +68,11 @@ public EmbeddedEditUrlResponseEmbedded editUrl(String editUrl) { return this; } - /** + /** * A template url that can be opened in an iFrame. * @return editUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A template url that can be opened in an iFrame.") @JsonProperty(JSON_PROPERTY_EDIT_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -97,12 +93,11 @@ public EmbeddedEditUrlResponseEmbedded expiresAt(Integer expiresAt) { return this; } - /** + /** * The specific time that the the `edit_url` link expires, in epoch. * @return expiresAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The specific time that the the `edit_url` link expires, in epoch.") @JsonProperty(JSON_PROPERTY_EXPIRES_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/EmbeddedSignUrlResponse.java b/src/main/java/com/dropbox/sign/model/EmbeddedSignUrlResponse.java index 92ed198..94e2512 100644 --- a/src/main/java/com/dropbox/sign/model/EmbeddedSignUrlResponse.java +++ b/src/main/java/com/dropbox/sign/model/EmbeddedSignUrlResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.EmbeddedSignUrlResponseEmbedded; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,11 +37,11 @@ * EmbeddedSignUrlResponse */ @JsonPropertyOrder({ - EmbeddedSignUrlResponse.JSON_PROPERTY_EMBEDDED, - EmbeddedSignUrlResponse.JSON_PROPERTY_WARNINGS + EmbeddedSignUrlResponse.JSON_PROPERTY_EMBEDDED, + EmbeddedSignUrlResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class EmbeddedSignUrlResponse { public static final String JSON_PROPERTY_EMBEDDED = "embedded"; private EmbeddedSignUrlResponseEmbedded embedded; @@ -74,14 +72,13 @@ public EmbeddedSignUrlResponse embedded(EmbeddedSignUrlResponseEmbedded embedded return this; } - /** + /** * Get embedded * @return embedded - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_EMBEDDED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public EmbeddedSignUrlResponseEmbedded getEmbedded() { return embedded; @@ -89,7 +86,7 @@ public EmbeddedSignUrlResponseEmbedded getEmbedded() { @JsonProperty(JSON_PROPERTY_EMBEDDED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setEmbedded(EmbeddedSignUrlResponseEmbedded embedded) { this.embedded = embedded; } @@ -108,12 +105,11 @@ public EmbeddedSignUrlResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/EmbeddedSignUrlResponseEmbedded.java b/src/main/java/com/dropbox/sign/model/EmbeddedSignUrlResponseEmbedded.java index 6199544..1d2140e 100644 --- a/src/main/java/com/dropbox/sign/model/EmbeddedSignUrlResponseEmbedded.java +++ b/src/main/java/com/dropbox/sign/model/EmbeddedSignUrlResponseEmbedded.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,25 +21,23 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * An object that contains necessary information to set up embedded signing. */ -@ApiModel(description = "An object that contains necessary information to set up embedded signing.") @JsonPropertyOrder({ - EmbeddedSignUrlResponseEmbedded.JSON_PROPERTY_SIGN_URL, - EmbeddedSignUrlResponseEmbedded.JSON_PROPERTY_EXPIRES_AT + EmbeddedSignUrlResponseEmbedded.JSON_PROPERTY_SIGN_URL, + EmbeddedSignUrlResponseEmbedded.JSON_PROPERTY_EXPIRES_AT }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class EmbeddedSignUrlResponseEmbedded { public static final String JSON_PROPERTY_SIGN_URL = "sign_url"; private String signUrl; @@ -71,12 +68,11 @@ public EmbeddedSignUrlResponseEmbedded signUrl(String signUrl) { return this; } - /** + /** * A signature url that can be opened in an iFrame. * @return signUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A signature url that can be opened in an iFrame.") @JsonProperty(JSON_PROPERTY_SIGN_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -97,12 +93,11 @@ public EmbeddedSignUrlResponseEmbedded expiresAt(Integer expiresAt) { return this; } - /** + /** * The specific time that the the `sign_url` link expires, in epoch. * @return expiresAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The specific time that the the `sign_url` link expires, in epoch.") @JsonProperty(JSON_PROPERTY_EXPIRES_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/ErrorResponse.java b/src/main/java/com/dropbox/sign/model/ErrorResponse.java index 6093ed0..ea1255d 100644 --- a/src/main/java/com/dropbox/sign/model/ErrorResponse.java +++ b/src/main/java/com/dropbox/sign/model/ErrorResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.ErrorResponseError; @@ -23,12 +22,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -36,10 +34,10 @@ * ErrorResponse */ @JsonPropertyOrder({ - ErrorResponse.JSON_PROPERTY_ERROR + ErrorResponse.JSON_PROPERTY_ERROR }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ErrorResponse { public static final String JSON_PROPERTY_ERROR = "error"; private ErrorResponseError error; @@ -67,12 +65,11 @@ public ErrorResponse error(ErrorResponseError error) { return this; } - /** + /** * Get error * @return error - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_ERROR) @JsonInclude(value = JsonInclude.Include.ALWAYS) diff --git a/src/main/java/com/dropbox/sign/model/ErrorResponseError.java b/src/main/java/com/dropbox/sign/model/ErrorResponseError.java index c38cda3..d7f9af4 100644 --- a/src/main/java/com/dropbox/sign/model/ErrorResponseError.java +++ b/src/main/java/com/dropbox/sign/model/ErrorResponseError.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,26 +21,24 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * Contains information about an error that occurred. */ -@ApiModel(description = "Contains information about an error that occurred.") @JsonPropertyOrder({ - ErrorResponseError.JSON_PROPERTY_ERROR_MSG, - ErrorResponseError.JSON_PROPERTY_ERROR_NAME, - ErrorResponseError.JSON_PROPERTY_ERROR_PATH + ErrorResponseError.JSON_PROPERTY_ERROR_MSG, + ErrorResponseError.JSON_PROPERTY_ERROR_NAME, + ErrorResponseError.JSON_PROPERTY_ERROR_PATH }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ErrorResponseError { public static final String JSON_PROPERTY_ERROR_MSG = "error_msg"; private String errorMsg; @@ -75,12 +72,11 @@ public ErrorResponseError errorMsg(String errorMsg) { return this; } - /** + /** * Message describing an error. * @return errorMsg - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Message describing an error.") @JsonProperty(JSON_PROPERTY_ERROR_MSG) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -101,12 +97,11 @@ public ErrorResponseError errorName(String errorName) { return this; } - /** + /** * Name of the error. * @return errorName - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Name of the error.") @JsonProperty(JSON_PROPERTY_ERROR_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -127,12 +122,11 @@ public ErrorResponseError errorPath(String errorPath) { return this; } - /** + /** * Path at which an error occurred. * @return errorPath - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Path at which an error occurred.") @JsonProperty(JSON_PROPERTY_ERROR_PATH) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/EventCallbackRequest.java b/src/main/java/com/dropbox/sign/model/EventCallbackRequest.java index c15deef..791194f 100644 --- a/src/main/java/com/dropbox/sign/model/EventCallbackRequest.java +++ b/src/main/java/com/dropbox/sign/model/EventCallbackRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.AccountResponse; @@ -26,12 +25,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -39,13 +37,13 @@ * EventCallbackRequest */ @JsonPropertyOrder({ - EventCallbackRequest.JSON_PROPERTY_EVENT, - EventCallbackRequest.JSON_PROPERTY_ACCOUNT, - EventCallbackRequest.JSON_PROPERTY_SIGNATURE_REQUEST, - EventCallbackRequest.JSON_PROPERTY_TEMPLATE + EventCallbackRequest.JSON_PROPERTY_EVENT, + EventCallbackRequest.JSON_PROPERTY_ACCOUNT, + EventCallbackRequest.JSON_PROPERTY_SIGNATURE_REQUEST, + EventCallbackRequest.JSON_PROPERTY_TEMPLATE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class EventCallbackRequest { public static final String JSON_PROPERTY_EVENT = "event"; private EventCallbackRequestEvent event; @@ -82,12 +80,11 @@ public EventCallbackRequest event(EventCallbackRequestEvent event) { return this; } - /** + /** * Get event * @return event - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_EVENT) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -108,12 +105,11 @@ public EventCallbackRequest account(AccountResponse account) { return this; } - /** + /** * Get account * @return account - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ACCOUNT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -134,12 +130,11 @@ public EventCallbackRequest signatureRequest(SignatureRequestResponse signatureR return this; } - /** + /** * Get signatureRequest * @return signatureRequest - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SIGNATURE_REQUEST) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -160,12 +155,11 @@ public EventCallbackRequest template(TemplateResponse template) { return this; } - /** + /** * Get template * @return template - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TEMPLATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/EventCallbackRequestEvent.java b/src/main/java/com/dropbox/sign/model/EventCallbackRequestEvent.java index 9b1cc25..38e621d 100644 --- a/src/main/java/com/dropbox/sign/model/EventCallbackRequestEvent.java +++ b/src/main/java/com/dropbox/sign/model/EventCallbackRequestEvent.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.EventCallbackRequestEventMetadata; @@ -23,27 +22,25 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * Basic information about the event that occurred. */ -@ApiModel(description = "Basic information about the event that occurred.") @JsonPropertyOrder({ - EventCallbackRequestEvent.JSON_PROPERTY_EVENT_TIME, - EventCallbackRequestEvent.JSON_PROPERTY_EVENT_TYPE, - EventCallbackRequestEvent.JSON_PROPERTY_EVENT_HASH, - EventCallbackRequestEvent.JSON_PROPERTY_EVENT_METADATA + EventCallbackRequestEvent.JSON_PROPERTY_EVENT_TIME, + EventCallbackRequestEvent.JSON_PROPERTY_EVENT_TYPE, + EventCallbackRequestEvent.JSON_PROPERTY_EVENT_HASH, + EventCallbackRequestEvent.JSON_PROPERTY_EVENT_METADATA }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class EventCallbackRequestEvent { public static final String JSON_PROPERTY_EVENT_TIME = "event_time"; private String eventTime; @@ -157,12 +154,11 @@ public EventCallbackRequestEvent eventTime(String eventTime) { return this; } - /** + /** * Time the event was created (using Unix time). * @return eventTime - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Time the event was created (using Unix time).") @JsonProperty(JSON_PROPERTY_EVENT_TIME) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -183,12 +179,11 @@ public EventCallbackRequestEvent eventType(EventTypeEnum eventType) { return this; } - /** + /** * Type of callback event that was triggered. * @return eventType - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Type of callback event that was triggered.") @JsonProperty(JSON_PROPERTY_EVENT_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -209,12 +204,11 @@ public EventCallbackRequestEvent eventHash(String eventHash) { return this; } - /** + /** * Generated hash used to verify source of event data. * @return eventHash - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Generated hash used to verify source of event data.") @JsonProperty(JSON_PROPERTY_EVENT_HASH) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -235,12 +229,11 @@ public EventCallbackRequestEvent eventMetadata(EventCallbackRequestEventMetadata return this; } - /** + /** * Get eventMetadata * @return eventMetadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EVENT_METADATA) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/EventCallbackRequestEventMetadata.java b/src/main/java/com/dropbox/sign/model/EventCallbackRequestEventMetadata.java index 947b495..d6a0d30 100644 --- a/src/main/java/com/dropbox/sign/model/EventCallbackRequestEventMetadata.java +++ b/src/main/java/com/dropbox/sign/model/EventCallbackRequestEventMetadata.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,27 +21,25 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * Specific metadata about the event. */ -@ApiModel(description = "Specific metadata about the event.") @JsonPropertyOrder({ - EventCallbackRequestEventMetadata.JSON_PROPERTY_RELATED_SIGNATURE_ID, - EventCallbackRequestEventMetadata.JSON_PROPERTY_REPORTED_FOR_ACCOUNT_ID, - EventCallbackRequestEventMetadata.JSON_PROPERTY_REPORTED_FOR_APP_ID, - EventCallbackRequestEventMetadata.JSON_PROPERTY_EVENT_MESSAGE + EventCallbackRequestEventMetadata.JSON_PROPERTY_RELATED_SIGNATURE_ID, + EventCallbackRequestEventMetadata.JSON_PROPERTY_REPORTED_FOR_ACCOUNT_ID, + EventCallbackRequestEventMetadata.JSON_PROPERTY_REPORTED_FOR_APP_ID, + EventCallbackRequestEventMetadata.JSON_PROPERTY_EVENT_MESSAGE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class EventCallbackRequestEventMetadata { public static final String JSON_PROPERTY_RELATED_SIGNATURE_ID = "related_signature_id"; private String relatedSignatureId; @@ -79,12 +76,11 @@ public EventCallbackRequestEventMetadata relatedSignatureId(String relatedSignat return this; } - /** + /** * Signature ID for a specific signer. Applicable to `signature_request_signed` and `signature_request_viewed` events. * @return relatedSignatureId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Signature ID for a specific signer. Applicable to `signature_request_signed` and `signature_request_viewed` events.") @JsonProperty(JSON_PROPERTY_RELATED_SIGNATURE_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -105,12 +101,11 @@ public EventCallbackRequestEventMetadata reportedForAccountId(String reportedFor return this; } - /** + /** * Account ID the event was reported for. * @return reportedForAccountId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Account ID the event was reported for.") @JsonProperty(JSON_PROPERTY_REPORTED_FOR_ACCOUNT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -131,12 +126,11 @@ public EventCallbackRequestEventMetadata reportedForAppId(String reportedForAppI return this; } - /** + /** * App ID the event was reported for. * @return reportedForAppId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "App ID the event was reported for.") @JsonProperty(JSON_PROPERTY_REPORTED_FOR_APP_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -157,12 +151,11 @@ public EventCallbackRequestEventMetadata eventMessage(String eventMessage) { return this; } - /** + /** * Message about a declined or failed (due to error) signature flow. * @return eventMessage - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Message about a declined or failed (due to error) signature flow.") @JsonProperty(JSON_PROPERTY_EVENT_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/FaxLineAddUserRequest.java b/src/main/java/com/dropbox/sign/model/FaxLineAddUserRequest.java new file mode 100644 index 0000000..d81de23 --- /dev/null +++ b/src/main/java/com/dropbox/sign/model/FaxLineAddUserRequest.java @@ -0,0 +1,278 @@ +/* + * 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; +/** + * FaxLineAddUserRequest + */ +@JsonPropertyOrder({ + FaxLineAddUserRequest.JSON_PROPERTY_NUMBER, + FaxLineAddUserRequest.JSON_PROPERTY_ACCOUNT_ID, + FaxLineAddUserRequest.JSON_PROPERTY_EMAIL_ADDRESS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties(ignoreUnknown=true) +public class FaxLineAddUserRequest { + public static final String JSON_PROPERTY_NUMBER = "number"; + private String number; + + public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; + private String accountId; + + public static final String JSON_PROPERTY_EMAIL_ADDRESS = "email_address"; + private String emailAddress; + + public FaxLineAddUserRequest() { + } + + /** + * Attempt to instantiate and hydrate a new instance of this class + * @param jsonData String of JSON data representing target object + */ + static public FaxLineAddUserRequest init(String jsonData) throws Exception { + return new ObjectMapper().readValue(jsonData, FaxLineAddUserRequest.class); + } + + static public FaxLineAddUserRequest init(HashMap data) throws Exception { + return new ObjectMapper().readValue( + new ObjectMapper().writeValueAsString(data), + FaxLineAddUserRequest.class + ); + } + + public FaxLineAddUserRequest number(String number) { + this.number = number; + return this; + } + + /** + * The Fax Line number. + * @return number + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getNumber() { + return number; + } + + + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setNumber(String number) { + this.number = number; + } + + + public FaxLineAddUserRequest accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Account ID + * @return accountId + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAccountId() { + return accountId; + } + + + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public FaxLineAddUserRequest emailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Email address + * @return emailAddress + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getEmailAddress() { + return emailAddress; + } + + + @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + + /** + * Return true if this FaxLineAddUserRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FaxLineAddUserRequest faxLineAddUserRequest = (FaxLineAddUserRequest) o; + return Objects.equals(this.number, faxLineAddUserRequest.number) && + Objects.equals(this.accountId, faxLineAddUserRequest.accountId) && + Objects.equals(this.emailAddress, faxLineAddUserRequest.emailAddress); + } + + @Override + public int hashCode() { + return Objects.hash(number, accountId, emailAddress); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FaxLineAddUserRequest {\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" emailAddress: ").append(toIndentedString(emailAddress)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public Map createFormData() throws ApiException { + Map map = new HashMap<>(); + boolean fileTypeFound = false; + try { + if (number != null) { + if (isFileTypeOrListOfFiles(number)) { + fileTypeFound = true; + } + + if (number.getClass().equals(java.io.File.class) || + number.getClass().equals(Integer.class) || + number.getClass().equals(String.class) || + number.getClass().isEnum()) { + map.put("number", number); + } else if (isListOfFile(number)) { + for(int i = 0; i< getListSize(number); i++) { + map.put("number[" + i + "]", getFromList(number, i)); + } + } + else { + map.put("number", JSON.getDefault().getMapper().writeValueAsString(number)); + } + } + if (accountId != null) { + if (isFileTypeOrListOfFiles(accountId)) { + fileTypeFound = true; + } + + if (accountId.getClass().equals(java.io.File.class) || + accountId.getClass().equals(Integer.class) || + accountId.getClass().equals(String.class) || + accountId.getClass().isEnum()) { + map.put("account_id", accountId); + } else if (isListOfFile(accountId)) { + for(int i = 0; i< getListSize(accountId); i++) { + map.put("account_id[" + i + "]", getFromList(accountId, i)); + } + } + else { + map.put("account_id", JSON.getDefault().getMapper().writeValueAsString(accountId)); + } + } + if (emailAddress != null) { + if (isFileTypeOrListOfFiles(emailAddress)) { + fileTypeFound = true; + } + + if (emailAddress.getClass().equals(java.io.File.class) || + emailAddress.getClass().equals(Integer.class) || + emailAddress.getClass().equals(String.class) || + emailAddress.getClass().isEnum()) { + map.put("email_address", emailAddress); + } else if (isListOfFile(emailAddress)) { + for(int i = 0; i< getListSize(emailAddress); i++) { + map.put("email_address[" + i + "]", getFromList(emailAddress, i)); + } + } + else { + map.put("email_address", JSON.getDefault().getMapper().writeValueAsString(emailAddress)); + } + } + } 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/src/main/java/com/dropbox/sign/model/FaxLineAreaCodeGetCountryEnum.java b/src/main/java/com/dropbox/sign/model/FaxLineAreaCodeGetCountryEnum.java new file mode 100644 index 0000000..d6ef808 --- /dev/null +++ b/src/main/java/com/dropbox/sign/model/FaxLineAreaCodeGetCountryEnum.java @@ -0,0 +1,65 @@ +/* + * 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.JsonPropertyOrder; +import com.dropbox.sign.JSON; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.ObjectMapper; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets FaxLineAreaCodeGetCountryEnum + */ +public enum FaxLineAreaCodeGetCountryEnum { + + CA("CA"), + + US("US"), + + UK("UK"); + + private String value; + + FaxLineAreaCodeGetCountryEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static FaxLineAreaCodeGetCountryEnum fromValue(String value) { + for (FaxLineAreaCodeGetCountryEnum b : FaxLineAreaCodeGetCountryEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/dropbox/sign/model/FaxLineAreaCodeGetProvinceEnum.java b/src/main/java/com/dropbox/sign/model/FaxLineAreaCodeGetProvinceEnum.java new file mode 100644 index 0000000..3c0b913 --- /dev/null +++ b/src/main/java/com/dropbox/sign/model/FaxLineAreaCodeGetProvinceEnum.java @@ -0,0 +1,85 @@ +/* + * 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.JsonPropertyOrder; +import com.dropbox.sign.JSON; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.ObjectMapper; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets FaxLineAreaCodeGetProvinceEnum + */ +public enum FaxLineAreaCodeGetProvinceEnum { + + AB("AB"), + + BC("BC"), + + MB("MB"), + + NB("NB"), + + NL("NL"), + + NT("NT"), + + NS("NS"), + + NU("NU"), + + ON("ON"), + + PE("PE"), + + QC("QC"), + + SK("SK"), + + YT("YT"); + + private String value; + + FaxLineAreaCodeGetProvinceEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static FaxLineAreaCodeGetProvinceEnum fromValue(String value) { + for (FaxLineAreaCodeGetProvinceEnum b : FaxLineAreaCodeGetProvinceEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/dropbox/sign/model/FaxLineAreaCodeGetResponse.java b/src/main/java/com/dropbox/sign/model/FaxLineAreaCodeGetResponse.java new file mode 100644 index 0000000..08c418a --- /dev/null +++ b/src/main/java/com/dropbox/sign/model/FaxLineAreaCodeGetResponse.java @@ -0,0 +1,188 @@ +/* + * 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; +/** + * FaxLineAreaCodeGetResponse + */ +@JsonPropertyOrder({ + FaxLineAreaCodeGetResponse.JSON_PROPERTY_AREA_CODES +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties(ignoreUnknown=true) +public class FaxLineAreaCodeGetResponse { + public static final String JSON_PROPERTY_AREA_CODES = "area_codes"; + private List areaCodes = new ArrayList<>(); + + public FaxLineAreaCodeGetResponse() { + } + + /** + * Attempt to instantiate and hydrate a new instance of this class + * @param jsonData String of JSON data representing target object + */ + static public FaxLineAreaCodeGetResponse init(String jsonData) throws Exception { + return new ObjectMapper().readValue(jsonData, FaxLineAreaCodeGetResponse.class); + } + + static public FaxLineAreaCodeGetResponse init(HashMap data) throws Exception { + return new ObjectMapper().readValue( + new ObjectMapper().writeValueAsString(data), + FaxLineAreaCodeGetResponse.class + ); + } + + public FaxLineAreaCodeGetResponse areaCodes(List areaCodes) { + this.areaCodes = areaCodes; + return this; + } + + public FaxLineAreaCodeGetResponse addAreaCodesItem(Integer areaCodesItem) { + if (this.areaCodes == null) { + this.areaCodes = new ArrayList<>(); + } + this.areaCodes.add(areaCodesItem); + return this; + } + + /** + * Get areaCodes + * @return areaCodes + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_AREA_CODES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getAreaCodes() { + return areaCodes; + } + + + @JsonProperty(JSON_PROPERTY_AREA_CODES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAreaCodes(List areaCodes) { + this.areaCodes = areaCodes; + } + + + /** + * Return true if this FaxLineAreaCodeGetResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FaxLineAreaCodeGetResponse faxLineAreaCodeGetResponse = (FaxLineAreaCodeGetResponse) o; + return Objects.equals(this.areaCodes, faxLineAreaCodeGetResponse.areaCodes); + } + + @Override + public int hashCode() { + return Objects.hash(areaCodes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FaxLineAreaCodeGetResponse {\n"); + sb.append(" areaCodes: ").append(toIndentedString(areaCodes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public Map createFormData() throws ApiException { + Map map = new HashMap<>(); + boolean fileTypeFound = false; + try { + if (areaCodes != null) { + if (isFileTypeOrListOfFiles(areaCodes)) { + fileTypeFound = true; + } + + if (areaCodes.getClass().equals(java.io.File.class) || + areaCodes.getClass().equals(Integer.class) || + areaCodes.getClass().equals(String.class) || + areaCodes.getClass().isEnum()) { + map.put("area_codes", areaCodes); + } else if (isListOfFile(areaCodes)) { + for(int i = 0; i< getListSize(areaCodes); i++) { + map.put("area_codes[" + i + "]", getFromList(areaCodes, i)); + } + } + else { + map.put("area_codes", JSON.getDefault().getMapper().writeValueAsString(areaCodes)); + } + } + } 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/src/main/java/com/dropbox/sign/model/FaxLineAreaCodeGetStateEnum.java b/src/main/java/com/dropbox/sign/model/FaxLineAreaCodeGetStateEnum.java new file mode 100644 index 0000000..c0e5ae4 --- /dev/null +++ b/src/main/java/com/dropbox/sign/model/FaxLineAreaCodeGetStateEnum.java @@ -0,0 +1,161 @@ +/* + * 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.JsonPropertyOrder; +import com.dropbox.sign.JSON; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.ObjectMapper; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets FaxLineAreaCodeGetStateEnum + */ +public enum FaxLineAreaCodeGetStateEnum { + + AK("AK"), + + AL("AL"), + + AR("AR"), + + AZ("AZ"), + + CA("CA"), + + CO("CO"), + + CT("CT"), + + DC("DC"), + + DE("DE"), + + FL("FL"), + + GA("GA"), + + HI("HI"), + + IA("IA"), + + ID("ID"), + + IL("IL"), + + IN("IN"), + + KS("KS"), + + KY("KY"), + + LA("LA"), + + MA("MA"), + + MD("MD"), + + ME("ME"), + + MI("MI"), + + MN("MN"), + + MO("MO"), + + MS("MS"), + + MT("MT"), + + NC("NC"), + + ND("ND"), + + NE("NE"), + + NH("NH"), + + NJ("NJ"), + + NM("NM"), + + NV("NV"), + + NY("NY"), + + OH("OH"), + + OK("OK"), + + OR("OR"), + + PA("PA"), + + RI("RI"), + + SC("SC"), + + SD("SD"), + + TN("TN"), + + TX("TX"), + + UT("UT"), + + VA("VA"), + + VT("VT"), + + WA("WA"), + + WI("WI"), + + WV("WV"), + + WY("WY"); + + private String value; + + FaxLineAreaCodeGetStateEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static FaxLineAreaCodeGetStateEnum fromValue(String value) { + for (FaxLineAreaCodeGetStateEnum b : FaxLineAreaCodeGetStateEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/dropbox/sign/model/FaxLineCreateRequest.java b/src/main/java/com/dropbox/sign/model/FaxLineCreateRequest.java new file mode 100644 index 0000000..fc864b0 --- /dev/null +++ b/src/main/java/com/dropbox/sign/model/FaxLineCreateRequest.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 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; +/** + * FaxLineCreateRequest + */ +@JsonPropertyOrder({ + FaxLineCreateRequest.JSON_PROPERTY_AREA_CODE, + FaxLineCreateRequest.JSON_PROPERTY_COUNTRY, + FaxLineCreateRequest.JSON_PROPERTY_CITY, + FaxLineCreateRequest.JSON_PROPERTY_ACCOUNT_ID +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties(ignoreUnknown=true) +public class FaxLineCreateRequest { + public static final String JSON_PROPERTY_AREA_CODE = "area_code"; + private Integer areaCode; + + /** + * Country + */ + public enum CountryEnum { + CA("CA"), + + US("US"), + + UK("UK"); + + private String value; + + CountryEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static CountryEnum fromValue(String value) { + for (CountryEnum b : CountryEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_COUNTRY = "country"; + private CountryEnum country; + + public static final String JSON_PROPERTY_CITY = "city"; + private String city; + + public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; + private String accountId; + + public FaxLineCreateRequest() { + } + + /** + * Attempt to instantiate and hydrate a new instance of this class + * @param jsonData String of JSON data representing target object + */ + static public FaxLineCreateRequest init(String jsonData) throws Exception { + return new ObjectMapper().readValue(jsonData, FaxLineCreateRequest.class); + } + + static public FaxLineCreateRequest init(HashMap data) throws Exception { + return new ObjectMapper().readValue( + new ObjectMapper().writeValueAsString(data), + FaxLineCreateRequest.class + ); + } + + public FaxLineCreateRequest areaCode(Integer areaCode) { + this.areaCode = areaCode; + return this; + } + + /** + * Area code + * @return areaCode + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_AREA_CODE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Integer getAreaCode() { + return areaCode; + } + + + @JsonProperty(JSON_PROPERTY_AREA_CODE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAreaCode(Integer areaCode) { + this.areaCode = areaCode; + } + + + public FaxLineCreateRequest country(CountryEnum country) { + this.country = country; + return this; + } + + /** + * Country + * @return country + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_COUNTRY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public CountryEnum getCountry() { + return country; + } + + + @JsonProperty(JSON_PROPERTY_COUNTRY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCountry(CountryEnum country) { + this.country = country; + } + + + public FaxLineCreateRequest city(String city) { + this.city = city; + return this; + } + + /** + * City + * @return city + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCity() { + return city; + } + + + @JsonProperty(JSON_PROPERTY_CITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCity(String city) { + this.city = city; + } + + + public FaxLineCreateRequest accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Account ID + * @return accountId + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAccountId() { + return accountId; + } + + + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + /** + * Return true if this FaxLineCreateRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FaxLineCreateRequest faxLineCreateRequest = (FaxLineCreateRequest) o; + return Objects.equals(this.areaCode, faxLineCreateRequest.areaCode) && + Objects.equals(this.country, faxLineCreateRequest.country) && + Objects.equals(this.city, faxLineCreateRequest.city) && + Objects.equals(this.accountId, faxLineCreateRequest.accountId); + } + + @Override + public int hashCode() { + return Objects.hash(areaCode, country, city, accountId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FaxLineCreateRequest {\n"); + sb.append(" areaCode: ").append(toIndentedString(areaCode)).append("\n"); + sb.append(" country: ").append(toIndentedString(country)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public Map createFormData() throws ApiException { + Map map = new HashMap<>(); + boolean fileTypeFound = false; + try { + if (areaCode != null) { + if (isFileTypeOrListOfFiles(areaCode)) { + fileTypeFound = true; + } + + if (areaCode.getClass().equals(java.io.File.class) || + areaCode.getClass().equals(Integer.class) || + areaCode.getClass().equals(String.class) || + areaCode.getClass().isEnum()) { + map.put("area_code", areaCode); + } else if (isListOfFile(areaCode)) { + for(int i = 0; i< getListSize(areaCode); i++) { + map.put("area_code[" + i + "]", getFromList(areaCode, i)); + } + } + else { + map.put("area_code", JSON.getDefault().getMapper().writeValueAsString(areaCode)); + } + } + if (country != null) { + if (isFileTypeOrListOfFiles(country)) { + fileTypeFound = true; + } + + if (country.getClass().equals(java.io.File.class) || + country.getClass().equals(Integer.class) || + country.getClass().equals(String.class) || + country.getClass().isEnum()) { + map.put("country", country); + } else if (isListOfFile(country)) { + for(int i = 0; i< getListSize(country); i++) { + map.put("country[" + i + "]", getFromList(country, i)); + } + } + else { + map.put("country", JSON.getDefault().getMapper().writeValueAsString(country)); + } + } + if (city != null) { + if (isFileTypeOrListOfFiles(city)) { + fileTypeFound = true; + } + + if (city.getClass().equals(java.io.File.class) || + city.getClass().equals(Integer.class) || + city.getClass().equals(String.class) || + city.getClass().isEnum()) { + map.put("city", city); + } else if (isListOfFile(city)) { + for(int i = 0; i< getListSize(city); i++) { + map.put("city[" + i + "]", getFromList(city, i)); + } + } + else { + map.put("city", JSON.getDefault().getMapper().writeValueAsString(city)); + } + } + if (accountId != null) { + if (isFileTypeOrListOfFiles(accountId)) { + fileTypeFound = true; + } + + if (accountId.getClass().equals(java.io.File.class) || + accountId.getClass().equals(Integer.class) || + accountId.getClass().equals(String.class) || + accountId.getClass().isEnum()) { + map.put("account_id", accountId); + } else if (isListOfFile(accountId)) { + for(int i = 0; i< getListSize(accountId); i++) { + map.put("account_id[" + i + "]", getFromList(accountId, i)); + } + } + else { + map.put("account_id", JSON.getDefault().getMapper().writeValueAsString(accountId)); + } + } + } 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/src/main/java/com/dropbox/sign/model/FaxLineDeleteRequest.java b/src/main/java/com/dropbox/sign/model/FaxLineDeleteRequest.java new file mode 100644 index 0000000..46946fd --- /dev/null +++ b/src/main/java/com/dropbox/sign/model/FaxLineDeleteRequest.java @@ -0,0 +1,178 @@ +/* + * 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; +/** + * FaxLineDeleteRequest + */ +@JsonPropertyOrder({ + FaxLineDeleteRequest.JSON_PROPERTY_NUMBER +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties(ignoreUnknown=true) +public class FaxLineDeleteRequest { + public static final String JSON_PROPERTY_NUMBER = "number"; + private String number; + + public FaxLineDeleteRequest() { + } + + /** + * Attempt to instantiate and hydrate a new instance of this class + * @param jsonData String of JSON data representing target object + */ + static public FaxLineDeleteRequest init(String jsonData) throws Exception { + return new ObjectMapper().readValue(jsonData, FaxLineDeleteRequest.class); + } + + static public FaxLineDeleteRequest init(HashMap data) throws Exception { + return new ObjectMapper().readValue( + new ObjectMapper().writeValueAsString(data), + FaxLineDeleteRequest.class + ); + } + + public FaxLineDeleteRequest number(String number) { + this.number = number; + return this; + } + + /** + * The Fax Line number. + * @return number + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getNumber() { + return number; + } + + + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setNumber(String number) { + this.number = number; + } + + + /** + * Return true if this FaxLineDeleteRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FaxLineDeleteRequest faxLineDeleteRequest = (FaxLineDeleteRequest) o; + return Objects.equals(this.number, faxLineDeleteRequest.number); + } + + @Override + public int hashCode() { + return Objects.hash(number); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FaxLineDeleteRequest {\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public Map createFormData() throws ApiException { + Map map = new HashMap<>(); + boolean fileTypeFound = false; + try { + if (number != null) { + if (isFileTypeOrListOfFiles(number)) { + fileTypeFound = true; + } + + if (number.getClass().equals(java.io.File.class) || + number.getClass().equals(Integer.class) || + number.getClass().equals(String.class) || + number.getClass().isEnum()) { + map.put("number", number); + } else if (isListOfFile(number)) { + for(int i = 0; i< getListSize(number); i++) { + map.put("number[" + i + "]", getFromList(number, i)); + } + } + else { + map.put("number", JSON.getDefault().getMapper().writeValueAsString(number)); + } + } + } 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/src/main/java/com/dropbox/sign/model/FaxLineListResponse.java b/src/main/java/com/dropbox/sign/model/FaxLineListResponse.java new file mode 100644 index 0000000..a6dddb7 --- /dev/null +++ b/src/main/java/com/dropbox/sign/model/FaxLineListResponse.java @@ -0,0 +1,291 @@ +/* + * 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.dropbox.sign.model.FaxLineResponseFaxLine; +import com.dropbox.sign.model.ListInfoResponse; +import com.dropbox.sign.model.WarningResponse; +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; +/** + * FaxLineListResponse + */ +@JsonPropertyOrder({ + FaxLineListResponse.JSON_PROPERTY_LIST_INFO, + FaxLineListResponse.JSON_PROPERTY_FAX_LINES, + FaxLineListResponse.JSON_PROPERTY_WARNINGS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties(ignoreUnknown=true) +public class FaxLineListResponse { + public static final String JSON_PROPERTY_LIST_INFO = "list_info"; + private ListInfoResponse listInfo; + + public static final String JSON_PROPERTY_FAX_LINES = "fax_lines"; + private List faxLines = new ArrayList<>(); + + public static final String JSON_PROPERTY_WARNINGS = "warnings"; + private WarningResponse warnings; + + public FaxLineListResponse() { + } + + /** + * Attempt to instantiate and hydrate a new instance of this class + * @param jsonData String of JSON data representing target object + */ + static public FaxLineListResponse init(String jsonData) throws Exception { + return new ObjectMapper().readValue(jsonData, FaxLineListResponse.class); + } + + static public FaxLineListResponse init(HashMap data) throws Exception { + return new ObjectMapper().readValue( + new ObjectMapper().writeValueAsString(data), + FaxLineListResponse.class + ); + } + + public FaxLineListResponse listInfo(ListInfoResponse listInfo) { + this.listInfo = listInfo; + return this; + } + + /** + * Get listInfo + * @return listInfo + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_LIST_INFO) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public ListInfoResponse getListInfo() { + return listInfo; + } + + + @JsonProperty(JSON_PROPERTY_LIST_INFO) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setListInfo(ListInfoResponse listInfo) { + this.listInfo = listInfo; + } + + + public FaxLineListResponse faxLines(List faxLines) { + this.faxLines = faxLines; + return this; + } + + public FaxLineListResponse addFaxLinesItem(FaxLineResponseFaxLine faxLinesItem) { + if (this.faxLines == null) { + this.faxLines = new ArrayList<>(); + } + this.faxLines.add(faxLinesItem); + return this; + } + + /** + * Get faxLines + * @return faxLines + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_FAX_LINES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getFaxLines() { + return faxLines; + } + + + @JsonProperty(JSON_PROPERTY_FAX_LINES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setFaxLines(List faxLines) { + this.faxLines = faxLines; + } + + + public FaxLineListResponse warnings(WarningResponse warnings) { + this.warnings = warnings; + return this; + } + + /** + * Get warnings + * @return warnings + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_WARNINGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public WarningResponse getWarnings() { + return warnings; + } + + + @JsonProperty(JSON_PROPERTY_WARNINGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setWarnings(WarningResponse warnings) { + this.warnings = warnings; + } + + + /** + * Return true if this FaxLineListResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FaxLineListResponse faxLineListResponse = (FaxLineListResponse) o; + return Objects.equals(this.listInfo, faxLineListResponse.listInfo) && + Objects.equals(this.faxLines, faxLineListResponse.faxLines) && + Objects.equals(this.warnings, faxLineListResponse.warnings); + } + + @Override + public int hashCode() { + return Objects.hash(listInfo, faxLines, warnings); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FaxLineListResponse {\n"); + sb.append(" listInfo: ").append(toIndentedString(listInfo)).append("\n"); + sb.append(" faxLines: ").append(toIndentedString(faxLines)).append("\n"); + sb.append(" warnings: ").append(toIndentedString(warnings)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public Map createFormData() throws ApiException { + Map map = new HashMap<>(); + boolean fileTypeFound = false; + try { + if (listInfo != null) { + if (isFileTypeOrListOfFiles(listInfo)) { + fileTypeFound = true; + } + + if (listInfo.getClass().equals(java.io.File.class) || + listInfo.getClass().equals(Integer.class) || + listInfo.getClass().equals(String.class) || + listInfo.getClass().isEnum()) { + map.put("list_info", listInfo); + } else if (isListOfFile(listInfo)) { + for(int i = 0; i< getListSize(listInfo); i++) { + map.put("list_info[" + i + "]", getFromList(listInfo, i)); + } + } + else { + map.put("list_info", JSON.getDefault().getMapper().writeValueAsString(listInfo)); + } + } + if (faxLines != null) { + if (isFileTypeOrListOfFiles(faxLines)) { + fileTypeFound = true; + } + + if (faxLines.getClass().equals(java.io.File.class) || + faxLines.getClass().equals(Integer.class) || + faxLines.getClass().equals(String.class) || + faxLines.getClass().isEnum()) { + map.put("fax_lines", faxLines); + } else if (isListOfFile(faxLines)) { + for(int i = 0; i< getListSize(faxLines); i++) { + map.put("fax_lines[" + i + "]", getFromList(faxLines, i)); + } + } + else { + map.put("fax_lines", JSON.getDefault().getMapper().writeValueAsString(faxLines)); + } + } + if (warnings != null) { + if (isFileTypeOrListOfFiles(warnings)) { + fileTypeFound = true; + } + + if (warnings.getClass().equals(java.io.File.class) || + warnings.getClass().equals(Integer.class) || + warnings.getClass().equals(String.class) || + warnings.getClass().isEnum()) { + map.put("warnings", warnings); + } else if (isListOfFile(warnings)) { + for(int i = 0; i< getListSize(warnings); i++) { + map.put("warnings[" + i + "]", getFromList(warnings, i)); + } + } + else { + map.put("warnings", JSON.getDefault().getMapper().writeValueAsString(warnings)); + } + } + } 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/src/main/java/com/dropbox/sign/model/FaxLineRemoveUserRequest.java b/src/main/java/com/dropbox/sign/model/FaxLineRemoveUserRequest.java new file mode 100644 index 0000000..426d991 --- /dev/null +++ b/src/main/java/com/dropbox/sign/model/FaxLineRemoveUserRequest.java @@ -0,0 +1,278 @@ +/* + * 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; +/** + * FaxLineRemoveUserRequest + */ +@JsonPropertyOrder({ + FaxLineRemoveUserRequest.JSON_PROPERTY_NUMBER, + FaxLineRemoveUserRequest.JSON_PROPERTY_ACCOUNT_ID, + FaxLineRemoveUserRequest.JSON_PROPERTY_EMAIL_ADDRESS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties(ignoreUnknown=true) +public class FaxLineRemoveUserRequest { + public static final String JSON_PROPERTY_NUMBER = "number"; + private String number; + + public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; + private String accountId; + + public static final String JSON_PROPERTY_EMAIL_ADDRESS = "email_address"; + private String emailAddress; + + public FaxLineRemoveUserRequest() { + } + + /** + * Attempt to instantiate and hydrate a new instance of this class + * @param jsonData String of JSON data representing target object + */ + static public FaxLineRemoveUserRequest init(String jsonData) throws Exception { + return new ObjectMapper().readValue(jsonData, FaxLineRemoveUserRequest.class); + } + + static public FaxLineRemoveUserRequest init(HashMap data) throws Exception { + return new ObjectMapper().readValue( + new ObjectMapper().writeValueAsString(data), + FaxLineRemoveUserRequest.class + ); + } + + public FaxLineRemoveUserRequest number(String number) { + this.number = number; + return this; + } + + /** + * The Fax Line number. + * @return number + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getNumber() { + return number; + } + + + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setNumber(String number) { + this.number = number; + } + + + public FaxLineRemoveUserRequest accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Account ID + * @return accountId + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAccountId() { + return accountId; + } + + + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public FaxLineRemoveUserRequest emailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Email address + * @return emailAddress + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getEmailAddress() { + return emailAddress; + } + + + @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + + /** + * Return true if this FaxLineRemoveUserRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FaxLineRemoveUserRequest faxLineRemoveUserRequest = (FaxLineRemoveUserRequest) o; + return Objects.equals(this.number, faxLineRemoveUserRequest.number) && + Objects.equals(this.accountId, faxLineRemoveUserRequest.accountId) && + Objects.equals(this.emailAddress, faxLineRemoveUserRequest.emailAddress); + } + + @Override + public int hashCode() { + return Objects.hash(number, accountId, emailAddress); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FaxLineRemoveUserRequest {\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" emailAddress: ").append(toIndentedString(emailAddress)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public Map createFormData() throws ApiException { + Map map = new HashMap<>(); + boolean fileTypeFound = false; + try { + if (number != null) { + if (isFileTypeOrListOfFiles(number)) { + fileTypeFound = true; + } + + if (number.getClass().equals(java.io.File.class) || + number.getClass().equals(Integer.class) || + number.getClass().equals(String.class) || + number.getClass().isEnum()) { + map.put("number", number); + } else if (isListOfFile(number)) { + for(int i = 0; i< getListSize(number); i++) { + map.put("number[" + i + "]", getFromList(number, i)); + } + } + else { + map.put("number", JSON.getDefault().getMapper().writeValueAsString(number)); + } + } + if (accountId != null) { + if (isFileTypeOrListOfFiles(accountId)) { + fileTypeFound = true; + } + + if (accountId.getClass().equals(java.io.File.class) || + accountId.getClass().equals(Integer.class) || + accountId.getClass().equals(String.class) || + accountId.getClass().isEnum()) { + map.put("account_id", accountId); + } else if (isListOfFile(accountId)) { + for(int i = 0; i< getListSize(accountId); i++) { + map.put("account_id[" + i + "]", getFromList(accountId, i)); + } + } + else { + map.put("account_id", JSON.getDefault().getMapper().writeValueAsString(accountId)); + } + } + if (emailAddress != null) { + if (isFileTypeOrListOfFiles(emailAddress)) { + fileTypeFound = true; + } + + if (emailAddress.getClass().equals(java.io.File.class) || + emailAddress.getClass().equals(Integer.class) || + emailAddress.getClass().equals(String.class) || + emailAddress.getClass().isEnum()) { + map.put("email_address", emailAddress); + } else if (isListOfFile(emailAddress)) { + for(int i = 0; i< getListSize(emailAddress); i++) { + map.put("email_address[" + i + "]", getFromList(emailAddress, i)); + } + } + else { + map.put("email_address", JSON.getDefault().getMapper().writeValueAsString(emailAddress)); + } + } + } 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/src/main/java/com/dropbox/sign/model/FaxLineResponse.java b/src/main/java/com/dropbox/sign/model/FaxLineResponse.java new file mode 100644 index 0000000..8e9f3d9 --- /dev/null +++ b/src/main/java/com/dropbox/sign/model/FaxLineResponse.java @@ -0,0 +1,230 @@ +/* + * 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.dropbox.sign.model.FaxLineResponseFaxLine; +import com.dropbox.sign.model.WarningResponse; +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; +/** + * FaxLineResponse + */ +@JsonPropertyOrder({ + FaxLineResponse.JSON_PROPERTY_FAX_LINE, + FaxLineResponse.JSON_PROPERTY_WARNINGS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties(ignoreUnknown=true) +public class FaxLineResponse { + public static final String JSON_PROPERTY_FAX_LINE = "fax_line"; + private FaxLineResponseFaxLine faxLine; + + public static final String JSON_PROPERTY_WARNINGS = "warnings"; + private WarningResponse warnings; + + public FaxLineResponse() { + } + + /** + * Attempt to instantiate and hydrate a new instance of this class + * @param jsonData String of JSON data representing target object + */ + static public FaxLineResponse init(String jsonData) throws Exception { + return new ObjectMapper().readValue(jsonData, FaxLineResponse.class); + } + + static public FaxLineResponse init(HashMap data) throws Exception { + return new ObjectMapper().readValue( + new ObjectMapper().writeValueAsString(data), + FaxLineResponse.class + ); + } + + public FaxLineResponse faxLine(FaxLineResponseFaxLine faxLine) { + this.faxLine = faxLine; + return this; + } + + /** + * Get faxLine + * @return faxLine + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_FAX_LINE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public FaxLineResponseFaxLine getFaxLine() { + return faxLine; + } + + + @JsonProperty(JSON_PROPERTY_FAX_LINE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setFaxLine(FaxLineResponseFaxLine faxLine) { + this.faxLine = faxLine; + } + + + public FaxLineResponse warnings(WarningResponse warnings) { + this.warnings = warnings; + return this; + } + + /** + * Get warnings + * @return warnings + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_WARNINGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public WarningResponse getWarnings() { + return warnings; + } + + + @JsonProperty(JSON_PROPERTY_WARNINGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setWarnings(WarningResponse warnings) { + this.warnings = warnings; + } + + + /** + * Return true if this FaxLineResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FaxLineResponse faxLineResponse = (FaxLineResponse) o; + return Objects.equals(this.faxLine, faxLineResponse.faxLine) && + Objects.equals(this.warnings, faxLineResponse.warnings); + } + + @Override + public int hashCode() { + return Objects.hash(faxLine, warnings); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FaxLineResponse {\n"); + sb.append(" faxLine: ").append(toIndentedString(faxLine)).append("\n"); + sb.append(" warnings: ").append(toIndentedString(warnings)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public Map createFormData() throws ApiException { + Map map = new HashMap<>(); + boolean fileTypeFound = false; + try { + if (faxLine != null) { + if (isFileTypeOrListOfFiles(faxLine)) { + fileTypeFound = true; + } + + if (faxLine.getClass().equals(java.io.File.class) || + faxLine.getClass().equals(Integer.class) || + faxLine.getClass().equals(String.class) || + faxLine.getClass().isEnum()) { + map.put("fax_line", faxLine); + } else if (isListOfFile(faxLine)) { + for(int i = 0; i< getListSize(faxLine); i++) { + map.put("fax_line[" + i + "]", getFromList(faxLine, i)); + } + } + else { + map.put("fax_line", JSON.getDefault().getMapper().writeValueAsString(faxLine)); + } + } + if (warnings != null) { + if (isFileTypeOrListOfFiles(warnings)) { + fileTypeFound = true; + } + + if (warnings.getClass().equals(java.io.File.class) || + warnings.getClass().equals(Integer.class) || + warnings.getClass().equals(String.class) || + warnings.getClass().isEnum()) { + map.put("warnings", warnings); + } else if (isListOfFile(warnings)) { + for(int i = 0; i< getListSize(warnings); i++) { + map.put("warnings[" + i + "]", getFromList(warnings, i)); + } + } + else { + map.put("warnings", JSON.getDefault().getMapper().writeValueAsString(warnings)); + } + } + } 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/src/main/java/com/dropbox/sign/model/FaxLineResponseFaxLine.java b/src/main/java/com/dropbox/sign/model/FaxLineResponseFaxLine.java new file mode 100644 index 0000000..f721698 --- /dev/null +++ b/src/main/java/com/dropbox/sign/model/FaxLineResponseFaxLine.java @@ -0,0 +1,339 @@ +/* + * 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.dropbox.sign.model.AccountResponse; +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; +/** + * FaxLineResponseFaxLine + */ +@JsonPropertyOrder({ + FaxLineResponseFaxLine.JSON_PROPERTY_NUMBER, + FaxLineResponseFaxLine.JSON_PROPERTY_CREATED_AT, + FaxLineResponseFaxLine.JSON_PROPERTY_UPDATED_AT, + FaxLineResponseFaxLine.JSON_PROPERTY_ACCOUNTS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties(ignoreUnknown=true) +public class FaxLineResponseFaxLine { + public static final String JSON_PROPERTY_NUMBER = "number"; + private String number; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private Integer createdAt; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private Integer updatedAt; + + public static final String JSON_PROPERTY_ACCOUNTS = "accounts"; + private List accounts = null; + + public FaxLineResponseFaxLine() { + } + + /** + * Attempt to instantiate and hydrate a new instance of this class + * @param jsonData String of JSON data representing target object + */ + static public FaxLineResponseFaxLine init(String jsonData) throws Exception { + return new ObjectMapper().readValue(jsonData, FaxLineResponseFaxLine.class); + } + + static public FaxLineResponseFaxLine init(HashMap data) throws Exception { + return new ObjectMapper().readValue( + new ObjectMapper().writeValueAsString(data), + FaxLineResponseFaxLine.class + ); + } + + public FaxLineResponseFaxLine number(String number) { + this.number = number; + return this; + } + + /** + * Number + * @return number + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getNumber() { + return number; + } + + + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNumber(String number) { + this.number = number; + } + + + public FaxLineResponseFaxLine createdAt(Integer createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Created at + * @return createdAt + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getCreatedAt() { + return createdAt; + } + + + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCreatedAt(Integer createdAt) { + this.createdAt = createdAt; + } + + + public FaxLineResponseFaxLine updatedAt(Integer updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Updated at + * @return updatedAt + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getUpdatedAt() { + return updatedAt; + } + + + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUpdatedAt(Integer updatedAt) { + this.updatedAt = updatedAt; + } + + + public FaxLineResponseFaxLine accounts(List accounts) { + this.accounts = accounts; + return this; + } + + public FaxLineResponseFaxLine addAccountsItem(AccountResponse accountsItem) { + if (this.accounts == null) { + this.accounts = new ArrayList<>(); + } + this.accounts.add(accountsItem); + return this; + } + + /** + * Get accounts + * @return accounts + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ACCOUNTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getAccounts() { + return accounts; + } + + + @JsonProperty(JSON_PROPERTY_ACCOUNTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAccounts(List accounts) { + this.accounts = accounts; + } + + + /** + * Return true if this FaxLineResponseFaxLine object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FaxLineResponseFaxLine faxLineResponseFaxLine = (FaxLineResponseFaxLine) o; + return Objects.equals(this.number, faxLineResponseFaxLine.number) && + Objects.equals(this.createdAt, faxLineResponseFaxLine.createdAt) && + Objects.equals(this.updatedAt, faxLineResponseFaxLine.updatedAt) && + Objects.equals(this.accounts, faxLineResponseFaxLine.accounts); + } + + @Override + public int hashCode() { + return Objects.hash(number, createdAt, updatedAt, accounts); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FaxLineResponseFaxLine {\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" accounts: ").append(toIndentedString(accounts)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + public Map createFormData() throws ApiException { + Map map = new HashMap<>(); + boolean fileTypeFound = false; + try { + if (number != null) { + if (isFileTypeOrListOfFiles(number)) { + fileTypeFound = true; + } + + if (number.getClass().equals(java.io.File.class) || + number.getClass().equals(Integer.class) || + number.getClass().equals(String.class) || + number.getClass().isEnum()) { + map.put("number", number); + } else if (isListOfFile(number)) { + for(int i = 0; i< getListSize(number); i++) { + map.put("number[" + i + "]", getFromList(number, i)); + } + } + else { + map.put("number", JSON.getDefault().getMapper().writeValueAsString(number)); + } + } + if (createdAt != null) { + if (isFileTypeOrListOfFiles(createdAt)) { + fileTypeFound = true; + } + + if (createdAt.getClass().equals(java.io.File.class) || + createdAt.getClass().equals(Integer.class) || + createdAt.getClass().equals(String.class) || + createdAt.getClass().isEnum()) { + map.put("created_at", createdAt); + } else if (isListOfFile(createdAt)) { + for(int i = 0; i< getListSize(createdAt); i++) { + map.put("created_at[" + i + "]", getFromList(createdAt, i)); + } + } + else { + map.put("created_at", JSON.getDefault().getMapper().writeValueAsString(createdAt)); + } + } + if (updatedAt != null) { + if (isFileTypeOrListOfFiles(updatedAt)) { + fileTypeFound = true; + } + + if (updatedAt.getClass().equals(java.io.File.class) || + updatedAt.getClass().equals(Integer.class) || + updatedAt.getClass().equals(String.class) || + updatedAt.getClass().isEnum()) { + map.put("updated_at", updatedAt); + } else if (isListOfFile(updatedAt)) { + for(int i = 0; i< getListSize(updatedAt); i++) { + map.put("updated_at[" + i + "]", getFromList(updatedAt, i)); + } + } + else { + map.put("updated_at", JSON.getDefault().getMapper().writeValueAsString(updatedAt)); + } + } + if (accounts != null) { + if (isFileTypeOrListOfFiles(accounts)) { + fileTypeFound = true; + } + + if (accounts.getClass().equals(java.io.File.class) || + accounts.getClass().equals(Integer.class) || + accounts.getClass().equals(String.class) || + accounts.getClass().isEnum()) { + map.put("accounts", accounts); + } else if (isListOfFile(accounts)) { + for(int i = 0; i< getListSize(accounts); i++) { + map.put("accounts[" + i + "]", getFromList(accounts, i)); + } + } + else { + map.put("accounts", JSON.getDefault().getMapper().writeValueAsString(accounts)); + } + } + } 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/src/main/java/com/dropbox/sign/model/FileResponse.java b/src/main/java/com/dropbox/sign/model/FileResponse.java index e80e345..fb26048 100644 --- a/src/main/java/com/dropbox/sign/model/FileResponse.java +++ b/src/main/java/com/dropbox/sign/model/FileResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,11 +33,11 @@ * FileResponse */ @JsonPropertyOrder({ - FileResponse.JSON_PROPERTY_FILE_URL, - FileResponse.JSON_PROPERTY_EXPIRES_AT + FileResponse.JSON_PROPERTY_FILE_URL, + FileResponse.JSON_PROPERTY_EXPIRES_AT }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class FileResponse { public static final String JSON_PROPERTY_FILE_URL = "file_url"; private String fileUrl; @@ -70,14 +68,13 @@ public FileResponse fileUrl(String fileUrl) { return this; } - /** + /** * URL to the file. * @return fileUrl - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "URL to the file.") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_FILE_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getFileUrl() { return fileUrl; @@ -85,7 +82,7 @@ public String getFileUrl() { @JsonProperty(JSON_PROPERTY_FILE_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setFileUrl(String fileUrl) { this.fileUrl = fileUrl; } @@ -96,14 +93,13 @@ public FileResponse expiresAt(Integer expiresAt) { return this; } - /** + /** * When the link expires. * @return expiresAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "When the link expires.") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_EXPIRES_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getExpiresAt() { return expiresAt; @@ -111,7 +107,7 @@ public Integer getExpiresAt() { @JsonProperty(JSON_PROPERTY_EXPIRES_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setExpiresAt(Integer expiresAt) { this.expiresAt = expiresAt; } diff --git a/src/main/java/com/dropbox/sign/model/FileResponseDataUri.java b/src/main/java/com/dropbox/sign/model/FileResponseDataUri.java index 90688a1..0a82c3f 100644 --- a/src/main/java/com/dropbox/sign/model/FileResponseDataUri.java +++ b/src/main/java/com/dropbox/sign/model/FileResponseDataUri.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,10 +33,10 @@ * FileResponseDataUri */ @JsonPropertyOrder({ - FileResponseDataUri.JSON_PROPERTY_DATA_URI + FileResponseDataUri.JSON_PROPERTY_DATA_URI }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class FileResponseDataUri { public static final String JSON_PROPERTY_DATA_URI = "data_uri"; private String dataUri; @@ -66,14 +64,13 @@ public FileResponseDataUri dataUri(String dataUri) { return this; } - /** + /** * File as base64 encoded string. * @return dataUri - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "File as base64 encoded string.") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_DATA_URI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getDataUri() { return dataUri; @@ -81,7 +78,7 @@ public String getDataUri() { @JsonProperty(JSON_PROPERTY_DATA_URI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setDataUri(String dataUri) { this.dataUri = dataUri; } diff --git a/src/main/java/com/dropbox/sign/model/ListInfoResponse.java b/src/main/java/com/dropbox/sign/model/ListInfoResponse.java index 45f99ca..05a6ad0 100644 --- a/src/main/java/com/dropbox/sign/model/ListInfoResponse.java +++ b/src/main/java/com/dropbox/sign/model/ListInfoResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,27 +21,25 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * Contains pagination information about the data returned. */ -@ApiModel(description = "Contains pagination information about the data returned.") @JsonPropertyOrder({ - ListInfoResponse.JSON_PROPERTY_NUM_PAGES, - ListInfoResponse.JSON_PROPERTY_NUM_RESULTS, - ListInfoResponse.JSON_PROPERTY_PAGE, - ListInfoResponse.JSON_PROPERTY_PAGE_SIZE + ListInfoResponse.JSON_PROPERTY_NUM_PAGES, + ListInfoResponse.JSON_PROPERTY_NUM_RESULTS, + ListInfoResponse.JSON_PROPERTY_PAGE, + ListInfoResponse.JSON_PROPERTY_PAGE_SIZE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ListInfoResponse { public static final String JSON_PROPERTY_NUM_PAGES = "num_pages"; private Integer numPages; @@ -79,12 +76,11 @@ public ListInfoResponse numPages(Integer numPages) { return this; } - /** + /** * Total number of pages available. * @return numPages - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Total number of pages available.") @JsonProperty(JSON_PROPERTY_NUM_PAGES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -105,12 +101,11 @@ public ListInfoResponse numResults(Integer numResults) { return this; } - /** + /** * Total number of objects available. * @return numResults - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Total number of objects available.") @JsonProperty(JSON_PROPERTY_NUM_RESULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -131,12 +126,11 @@ public ListInfoResponse page(Integer page) { return this; } - /** + /** * Number of the page being returned. * @return page - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Number of the page being returned.") @JsonProperty(JSON_PROPERTY_PAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -157,12 +151,11 @@ public ListInfoResponse pageSize(Integer pageSize) { return this; } - /** + /** * Objects returned per page. * @return pageSize - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Objects returned per page.") @JsonProperty(JSON_PROPERTY_PAGE_SIZE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/OAuthTokenGenerateRequest.java b/src/main/java/com/dropbox/sign/model/OAuthTokenGenerateRequest.java index faa0f45..abb0f74 100644 --- a/src/main/java/com/dropbox/sign/model/OAuthTokenGenerateRequest.java +++ b/src/main/java/com/dropbox/sign/model/OAuthTokenGenerateRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,14 +33,14 @@ * OAuthTokenGenerateRequest */ @JsonPropertyOrder({ - OAuthTokenGenerateRequest.JSON_PROPERTY_CLIENT_ID, - OAuthTokenGenerateRequest.JSON_PROPERTY_CLIENT_SECRET, - OAuthTokenGenerateRequest.JSON_PROPERTY_CODE, - OAuthTokenGenerateRequest.JSON_PROPERTY_GRANT_TYPE, - OAuthTokenGenerateRequest.JSON_PROPERTY_STATE + OAuthTokenGenerateRequest.JSON_PROPERTY_CLIENT_ID, + OAuthTokenGenerateRequest.JSON_PROPERTY_CLIENT_SECRET, + OAuthTokenGenerateRequest.JSON_PROPERTY_CODE, + OAuthTokenGenerateRequest.JSON_PROPERTY_GRANT_TYPE, + OAuthTokenGenerateRequest.JSON_PROPERTY_STATE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class OAuthTokenGenerateRequest { public static final String JSON_PROPERTY_CLIENT_ID = "client_id"; private String clientId; @@ -82,12 +80,11 @@ public OAuthTokenGenerateRequest clientId(String clientId) { return this; } - /** + /** * The client id of the app requesting authorization. * @return clientId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The client id of the app requesting authorization.") @JsonProperty(JSON_PROPERTY_CLIENT_ID) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -108,12 +105,11 @@ public OAuthTokenGenerateRequest clientSecret(String clientSecret) { return this; } - /** + /** * The secret token of your app. * @return clientSecret - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The secret token of your app.") @JsonProperty(JSON_PROPERTY_CLIENT_SECRET) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -134,12 +130,11 @@ public OAuthTokenGenerateRequest code(String code) { return this; } - /** + /** * The code passed to your callback when the user granted access. * @return code - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The code passed to your callback when the user granted access.") @JsonProperty(JSON_PROPERTY_CODE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -160,12 +155,11 @@ public OAuthTokenGenerateRequest grantType(String grantType) { return this; } - /** + /** * When generating a new token use `authorization_code`. * @return grantType - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "When generating a new token use `authorization_code`.") @JsonProperty(JSON_PROPERTY_GRANT_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -186,12 +180,11 @@ public OAuthTokenGenerateRequest state(String state) { return this; } - /** + /** * Same as the state you specified earlier. * @return state - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Same as the state you specified earlier.") @JsonProperty(JSON_PROPERTY_STATE) @JsonInclude(value = JsonInclude.Include.ALWAYS) diff --git a/src/main/java/com/dropbox/sign/model/OAuthTokenRefreshRequest.java b/src/main/java/com/dropbox/sign/model/OAuthTokenRefreshRequest.java index c1fbe8a..4e9e198 100644 --- a/src/main/java/com/dropbox/sign/model/OAuthTokenRefreshRequest.java +++ b/src/main/java/com/dropbox/sign/model/OAuthTokenRefreshRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,11 +33,11 @@ * OAuthTokenRefreshRequest */ @JsonPropertyOrder({ - OAuthTokenRefreshRequest.JSON_PROPERTY_GRANT_TYPE, - OAuthTokenRefreshRequest.JSON_PROPERTY_REFRESH_TOKEN + OAuthTokenRefreshRequest.JSON_PROPERTY_GRANT_TYPE, + OAuthTokenRefreshRequest.JSON_PROPERTY_REFRESH_TOKEN }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class OAuthTokenRefreshRequest { public static final String JSON_PROPERTY_GRANT_TYPE = "grant_type"; private String grantType = "refresh_token"; @@ -70,12 +68,11 @@ public OAuthTokenRefreshRequest grantType(String grantType) { return this; } - /** + /** * When refreshing an existing token use `refresh_token`. * @return grantType - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "When refreshing an existing token use `refresh_token`.") @JsonProperty(JSON_PROPERTY_GRANT_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -96,12 +93,11 @@ public OAuthTokenRefreshRequest refreshToken(String refreshToken) { return this; } - /** + /** * The token provided when you got the expired access token. * @return refreshToken - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The token provided when you got the expired access token.") @JsonProperty(JSON_PROPERTY_REFRESH_TOKEN) @JsonInclude(value = JsonInclude.Include.ALWAYS) diff --git a/src/main/java/com/dropbox/sign/model/OAuthTokenResponse.java b/src/main/java/com/dropbox/sign/model/OAuthTokenResponse.java index b953df9..7ec43ce 100644 --- a/src/main/java/com/dropbox/sign/model/OAuthTokenResponse.java +++ b/src/main/java/com/dropbox/sign/model/OAuthTokenResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,14 +33,14 @@ * OAuthTokenResponse */ @JsonPropertyOrder({ - OAuthTokenResponse.JSON_PROPERTY_ACCESS_TOKEN, - OAuthTokenResponse.JSON_PROPERTY_TOKEN_TYPE, - OAuthTokenResponse.JSON_PROPERTY_REFRESH_TOKEN, - OAuthTokenResponse.JSON_PROPERTY_EXPIRES_IN, - OAuthTokenResponse.JSON_PROPERTY_STATE + OAuthTokenResponse.JSON_PROPERTY_ACCESS_TOKEN, + OAuthTokenResponse.JSON_PROPERTY_TOKEN_TYPE, + OAuthTokenResponse.JSON_PROPERTY_REFRESH_TOKEN, + OAuthTokenResponse.JSON_PROPERTY_EXPIRES_IN, + OAuthTokenResponse.JSON_PROPERTY_STATE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class OAuthTokenResponse { public static final String JSON_PROPERTY_ACCESS_TOKEN = "access_token"; private String accessToken; @@ -82,12 +80,11 @@ public OAuthTokenResponse accessToken(String accessToken) { return this; } - /** + /** * Get accessToken * @return accessToken - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ACCESS_TOKEN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -108,12 +105,11 @@ public OAuthTokenResponse tokenType(String tokenType) { return this; } - /** + /** * Get tokenType * @return tokenType - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TOKEN_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -134,12 +130,11 @@ public OAuthTokenResponse refreshToken(String refreshToken) { return this; } - /** + /** * Get refreshToken * @return refreshToken - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_REFRESH_TOKEN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -160,12 +155,11 @@ public OAuthTokenResponse expiresIn(Integer expiresIn) { return this; } - /** + /** * Number of seconds until the `access_token` expires. Uses epoch time. * @return expiresIn - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Number of seconds until the `access_token` expires. Uses epoch time.") @JsonProperty(JSON_PROPERTY_EXPIRES_IN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -186,12 +180,11 @@ public OAuthTokenResponse state(String state) { return this; } - /** + /** * Get state * @return state - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_STATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/ReportCreateRequest.java b/src/main/java/com/dropbox/sign/model/ReportCreateRequest.java index eea03a0..f156dfb 100644 --- a/src/main/java/com/dropbox/sign/model/ReportCreateRequest.java +++ b/src/main/java/com/dropbox/sign/model/ReportCreateRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,14 +21,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -37,12 +35,12 @@ * ReportCreateRequest */ @JsonPropertyOrder({ - ReportCreateRequest.JSON_PROPERTY_END_DATE, - ReportCreateRequest.JSON_PROPERTY_REPORT_TYPE, - ReportCreateRequest.JSON_PROPERTY_START_DATE + ReportCreateRequest.JSON_PROPERTY_END_DATE, + ReportCreateRequest.JSON_PROPERTY_REPORT_TYPE, + ReportCreateRequest.JSON_PROPERTY_START_DATE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ReportCreateRequest { public static final String JSON_PROPERTY_END_DATE = "end_date"; private String endDate; @@ -111,12 +109,11 @@ public ReportCreateRequest endDate(String endDate) { return this; } - /** + /** * The (inclusive) end date for the report data in `MM/DD/YYYY` format. * @return endDate - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The (inclusive) end date for the report data in `MM/DD/YYYY` format.") @JsonProperty(JSON_PROPERTY_END_DATE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -138,16 +135,18 @@ public ReportCreateRequest reportType(List reportType) { } public ReportCreateRequest addReportTypeItem(ReportTypeEnum reportTypeItem) { + if (this.reportType == null) { + this.reportType = new ArrayList<>(); + } this.reportType.add(reportTypeItem); return this; } - /** + /** * The type(s) of the report you are requesting. Allowed values are `user_activity` and `document_status`. User activity reports contain list of all users and their activity during the specified date range. Document status report contain a list of signature requests created in the specified time range (and their status). * @return reportType - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type(s) of the report you are requesting. Allowed values are `user_activity` and `document_status`. User activity reports contain list of all users and their activity during the specified date range. Document status report contain a list of signature requests created in the specified time range (and their status).") @JsonProperty(JSON_PROPERTY_REPORT_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -168,12 +167,11 @@ public ReportCreateRequest startDate(String startDate) { return this; } - /** + /** * The (inclusive) start date for the report data in `MM/DD/YYYY` format. * @return startDate - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The (inclusive) start date for the report data in `MM/DD/YYYY` format.") @JsonProperty(JSON_PROPERTY_START_DATE) @JsonInclude(value = JsonInclude.Include.ALWAYS) diff --git a/src/main/java/com/dropbox/sign/model/ReportCreateResponse.java b/src/main/java/com/dropbox/sign/model/ReportCreateResponse.java index 75b1030..21c5aa4 100644 --- a/src/main/java/com/dropbox/sign/model/ReportCreateResponse.java +++ b/src/main/java/com/dropbox/sign/model/ReportCreateResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.ReportResponse; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,11 +37,11 @@ * ReportCreateResponse */ @JsonPropertyOrder({ - ReportCreateResponse.JSON_PROPERTY_REPORT, - ReportCreateResponse.JSON_PROPERTY_WARNINGS + ReportCreateResponse.JSON_PROPERTY_REPORT, + ReportCreateResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ReportCreateResponse { public static final String JSON_PROPERTY_REPORT = "report"; private ReportResponse report; @@ -74,14 +72,13 @@ public ReportCreateResponse report(ReportResponse report) { return this; } - /** + /** * Get report * @return report - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public ReportResponse getReport() { return report; @@ -89,7 +86,7 @@ public ReportResponse getReport() { @JsonProperty(JSON_PROPERTY_REPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setReport(ReportResponse report) { this.report = report; } @@ -108,12 +105,11 @@ public ReportCreateResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/ReportResponse.java b/src/main/java/com/dropbox/sign/model/ReportResponse.java index a8195c3..7952227 100644 --- a/src/main/java/com/dropbox/sign/model/ReportResponse.java +++ b/src/main/java/com/dropbox/sign/model/ReportResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,29 +21,27 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; /** * Contains information about the report request. */ -@ApiModel(description = "Contains information about the report request.") @JsonPropertyOrder({ - ReportResponse.JSON_PROPERTY_SUCCESS, - ReportResponse.JSON_PROPERTY_START_DATE, - ReportResponse.JSON_PROPERTY_END_DATE, - ReportResponse.JSON_PROPERTY_REPORT_TYPE + ReportResponse.JSON_PROPERTY_SUCCESS, + ReportResponse.JSON_PROPERTY_START_DATE, + ReportResponse.JSON_PROPERTY_END_DATE, + ReportResponse.JSON_PROPERTY_REPORT_TYPE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ReportResponse { public static final String JSON_PROPERTY_SUCCESS = "success"; private String success; @@ -116,12 +113,11 @@ public ReportResponse success(String success) { return this; } - /** + /** * A message indicating the requested operation's success * @return success - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A message indicating the requested operation's success") @JsonProperty(JSON_PROPERTY_SUCCESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -142,12 +138,11 @@ public ReportResponse startDate(String startDate) { return this; } - /** + /** * The (inclusive) start date for the report data in MM/DD/YYYY format. * @return startDate - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The (inclusive) start date for the report data in MM/DD/YYYY format.") @JsonProperty(JSON_PROPERTY_START_DATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -168,12 +163,11 @@ public ReportResponse endDate(String endDate) { return this; } - /** + /** * The (inclusive) end date for the report data in MM/DD/YYYY format. * @return endDate - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The (inclusive) end date for the report data in MM/DD/YYYY format.") @JsonProperty(JSON_PROPERTY_END_DATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -202,12 +196,11 @@ public ReportResponse addReportTypeItem(ReportTypeEnum reportTypeItem) { return this; } - /** + /** * The type(s) of the report you are requesting. Allowed values are \"user_activity\" and \"document_status\". User activity reports contain list of all users and their activity during the specified date range. Document status report contain a list of signature requests created in the specified time range (and their status). * @return reportType - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The type(s) of the report you are requesting. Allowed values are \"user_activity\" and \"document_status\". User activity reports contain list of all users and their activity during the specified date range. Document status report contain a list of signature requests created in the specified time range (and their status).") @JsonProperty(JSON_PROPERTY_REPORT_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.java b/src/main/java/com/dropbox/sign/model/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.java index 3afb305..5a27c1f 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubBulkSignerList; @@ -25,17 +24,16 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; 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.JSON; import com.dropbox.sign.ApiException; @@ -43,22 +41,22 @@ * SignatureRequestBulkCreateEmbeddedWithTemplateRequest */ @JsonPropertyOrder({ - SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TEMPLATE_IDS, - SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CLIENT_ID, - SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SIGNER_FILE, - SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SIGNER_LIST, - SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_ALLOW_DECLINE, - SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CCS, - SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CUSTOM_FIELDS, - SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_MESSAGE, - SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_METADATA, - SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SIGNING_REDIRECT_URL, - SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SUBJECT, - SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TEST_MODE, - SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TITLE + SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TEMPLATE_IDS, + SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CLIENT_ID, + SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SIGNER_FILE, + SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SIGNER_LIST, + SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_ALLOW_DECLINE, + SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CCS, + SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CUSTOM_FIELDS, + SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_MESSAGE, + SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_METADATA, + SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SIGNING_REDIRECT_URL, + SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SUBJECT, + SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TEST_MODE, + SignatureRequestBulkCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TITLE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SignatureRequestBulkCreateEmbeddedWithTemplateRequest { public static final String JSON_PROPERTY_TEMPLATE_IDS = "template_ids"; private List templateIds = new ArrayList<>(); @@ -123,16 +121,18 @@ public SignatureRequestBulkCreateEmbeddedWithTemplateRequest templateIds(List(); + } this.templateIds.add(templateIdsItem); return this; } - /** + /** * Use `template_ids` to create a SignatureRequest from one or more templates, in the order in which the template will be used. * @return templateIds - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Use `template_ids` to create a SignatureRequest from one or more templates, in the order in which the template will be used.") @JsonProperty(JSON_PROPERTY_TEMPLATE_IDS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -153,12 +153,11 @@ public SignatureRequestBulkCreateEmbeddedWithTemplateRequest clientId(String cli return this; } - /** + /** * Client id of the app you're using to create this embedded signature request. Used for security purposes. * @return clientId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Client id of the app you're using to create this embedded signature request. Used for security purposes.") @JsonProperty(JSON_PROPERTY_CLIENT_ID) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -179,12 +178,11 @@ public SignatureRequestBulkCreateEmbeddedWithTemplateRequest signerFile(File sig return this; } - /** + /** * `signer_file` is a CSV file defining values and options for signer fields. Required unless a `signer_list` is used, you may not use both. The CSV can have the following columns: - `name`: the name of the signer filling the role of RoleName - `email_address`: email address of the signer filling the role of RoleName - `pin`: the 4- to 12-character access code that will secure this signer's signature page (optional) - `sms_phone_number`: An E.164 formatted phone number that will receive a code via SMS to access this signer's signature page. (optional) By using the feature, you agree you are responsible for obtaining a signer's consent to receive text messages from Dropbox Sign related to this signature request and confirm you have obtained such consent from all signers prior to enabling SMS delivery for this signature request. [Learn more](https://faq.hellosign.com/hc/en-us/articles/15815316468877-Dropbox-Sign-SMS-tools-add-on). **NOTE:** Not available in test mode and requires a Standard plan or higher. - `*_field`: any column with a _field\" suffix will be treated as a custom field (optional) You may only specify field values here, any other options should be set in the custom_fields request parameter. Example CSV: ``` name, email_address, pin, company_field George, george@example.com, d79a3td, ABC Corp Mary, mary@example.com, gd9as5b, 123 LLC ``` * @return signerFile - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "`signer_file` is a CSV file defining values and options for signer fields. Required unless a `signer_list` is used, you may not use both. The CSV can have the following columns: - `name`: the name of the signer filling the role of RoleName - `email_address`: email address of the signer filling the role of RoleName - `pin`: the 4- to 12-character access code that will secure this signer's signature page (optional) - `sms_phone_number`: An E.164 formatted phone number that will receive a code via SMS to access this signer's signature page. (optional) By using the feature, you agree you are responsible for obtaining a signer's consent to receive text messages from Dropbox Sign related to this signature request and confirm you have obtained such consent from all signers prior to enabling SMS delivery for this signature request. [Learn more](https://faq.hellosign.com/hc/en-us/articles/15815316468877-Dropbox-Sign-SMS-tools-add-on). **NOTE:** Not available in test mode and requires a Standard plan or higher. - `*_field`: any column with a _field\" suffix will be treated as a custom field (optional) You may only specify field values here, any other options should be set in the custom_fields request parameter. Example CSV: ``` name, email_address, pin, company_field George, george@example.com, d79a3td, ABC Corp Mary, mary@example.com, gd9as5b, 123 LLC ```") @JsonProperty(JSON_PROPERTY_SIGNER_FILE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -213,12 +211,11 @@ public SignatureRequestBulkCreateEmbeddedWithTemplateRequest addSignerListItem(S return this; } - /** + /** * `signer_list` is an array defining values and options for signer fields. Required unless a `signer_file` is used, you may not use both. * @return signerList - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "`signer_list` is an array defining values and options for signer fields. Required unless a `signer_file` is used, you may not use both.") @JsonProperty(JSON_PROPERTY_SIGNER_LIST) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -239,12 +236,11 @@ public SignatureRequestBulkCreateEmbeddedWithTemplateRequest allowDecline(Boolea return this; } - /** + /** * Allows signers to decline to sign a document if `true`. Defaults to `false`. * @return allowDecline - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows signers to decline to sign a document if `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_ALLOW_DECLINE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -273,12 +269,11 @@ public SignatureRequestBulkCreateEmbeddedWithTemplateRequest addCcsItem(SubCC cc return this; } - /** + /** * Add CC email recipients. Required when a CC role exists for the Template. * @return ccs - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Add CC email recipients. Required when a CC role exists for the Template.") @JsonProperty(JSON_PROPERTY_CCS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -307,12 +302,11 @@ public SignatureRequestBulkCreateEmbeddedWithTemplateRequest addCustomFieldsItem return this; } - /** + /** * When used together with merge fields, `custom_fields` allows users to add pre-filled data to their signature requests. Pre-filled data can be used with \"send-once\" signature requests by adding merge fields with `form_fields_per_document` or [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) while passing values back with `custom_fields` together in one API call. For using pre-filled on repeatable signature requests, merge fields are added to templates in the Dropbox Sign UI or by calling [/template/create_embedded_draft](/api/reference/operation/templateCreateEmbeddedDraft) and then passing `custom_fields` on subsequent signature requests referencing that template. * @return customFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When used together with merge fields, `custom_fields` allows users to add pre-filled data to their signature requests. Pre-filled data can be used with \"send-once\" signature requests by adding merge fields with `form_fields_per_document` or [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) while passing values back with `custom_fields` together in one API call. For using pre-filled on repeatable signature requests, merge fields are added to templates in the Dropbox Sign UI or by calling [/template/create_embedded_draft](/api/reference/operation/templateCreateEmbeddedDraft) and then passing `custom_fields` on subsequent signature requests referencing that template.") @JsonProperty(JSON_PROPERTY_CUSTOM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -333,12 +327,11 @@ public SignatureRequestBulkCreateEmbeddedWithTemplateRequest message(String mess return this; } - /** + /** * The custom message in the email that will be sent to the signers. * @return message - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The custom message in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -367,12 +360,11 @@ public SignatureRequestBulkCreateEmbeddedWithTemplateRequest putMetadataItem(Str return this; } - /** + /** * Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long.") @JsonProperty(JSON_PROPERTY_METADATA) @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) @@ -393,12 +385,11 @@ public SignatureRequestBulkCreateEmbeddedWithTemplateRequest signingRedirectUrl( return this; } - /** + /** * The URL you want signers redirected to after they successfully sign. * @return signingRedirectUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL you want signers redirected to after they successfully sign.") @JsonProperty(JSON_PROPERTY_SIGNING_REDIRECT_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -419,12 +410,11 @@ public SignatureRequestBulkCreateEmbeddedWithTemplateRequest subject(String subj return this; } - /** + /** * The subject in the email that will be sent to the signers. * @return subject - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The subject in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_SUBJECT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -445,12 +435,11 @@ public SignatureRequestBulkCreateEmbeddedWithTemplateRequest testMode(Boolean te return this; } - /** + /** * Whether this is a test, the signature request will not be legally binding if set to `true`. Defaults to `false`. * @return testMode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this is a test, the signature request will not be legally binding if set to `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_TEST_MODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -471,12 +460,11 @@ public SignatureRequestBulkCreateEmbeddedWithTemplateRequest title(String title) return this; } - /** + /** * The title you want to assign to the SignatureRequest. * @return title - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The title you want to assign to the SignatureRequest.") @JsonProperty(JSON_PROPERTY_TITLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestBulkSendWithTemplateRequest.java b/src/main/java/com/dropbox/sign/model/SignatureRequestBulkSendWithTemplateRequest.java index 35530d5..73ed989 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestBulkSendWithTemplateRequest.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestBulkSendWithTemplateRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubBulkSignerList; @@ -25,17 +24,16 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; 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.JSON; import com.dropbox.sign.ApiException; @@ -43,22 +41,22 @@ * SignatureRequestBulkSendWithTemplateRequest */ @JsonPropertyOrder({ - SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_TEMPLATE_IDS, - SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_SIGNER_FILE, - SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_SIGNER_LIST, - SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_ALLOW_DECLINE, - SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_CCS, - SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_CLIENT_ID, - SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_CUSTOM_FIELDS, - SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_MESSAGE, - SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_METADATA, - SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_SIGNING_REDIRECT_URL, - SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_SUBJECT, - SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_TEST_MODE, - SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_TITLE + SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_TEMPLATE_IDS, + SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_SIGNER_FILE, + SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_SIGNER_LIST, + SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_ALLOW_DECLINE, + SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_CCS, + SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_CLIENT_ID, + SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_CUSTOM_FIELDS, + SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_MESSAGE, + SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_METADATA, + SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_SIGNING_REDIRECT_URL, + SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_SUBJECT, + SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_TEST_MODE, + SignatureRequestBulkSendWithTemplateRequest.JSON_PROPERTY_TITLE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SignatureRequestBulkSendWithTemplateRequest { public static final String JSON_PROPERTY_TEMPLATE_IDS = "template_ids"; private List templateIds = new ArrayList<>(); @@ -123,16 +121,18 @@ public SignatureRequestBulkSendWithTemplateRequest templateIds(List temp } public SignatureRequestBulkSendWithTemplateRequest addTemplateIdsItem(String templateIdsItem) { + if (this.templateIds == null) { + this.templateIds = new ArrayList<>(); + } this.templateIds.add(templateIdsItem); return this; } - /** + /** * Use `template_ids` to create a SignatureRequest from one or more templates, in the order in which the template will be used. * @return templateIds - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Use `template_ids` to create a SignatureRequest from one or more templates, in the order in which the template will be used.") @JsonProperty(JSON_PROPERTY_TEMPLATE_IDS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -153,12 +153,11 @@ public SignatureRequestBulkSendWithTemplateRequest signerFile(File signerFile) { return this; } - /** + /** * `signer_file` is a CSV file defining values and options for signer fields. Required unless a `signer_list` is used, you may not use both. The CSV can have the following columns: - `name`: the name of the signer filling the role of RoleName - `email_address`: email address of the signer filling the role of RoleName - `pin`: the 4- to 12-character access code that will secure this signer's signature page (optional) - `sms_phone_number`: An E.164 formatted phone number that will receive a code via SMS to access this signer's signature page. (optional) By using the feature, you agree you are responsible for obtaining a signer's consent to receive text messages from Dropbox Sign related to this signature request and confirm you have obtained such consent from all signers prior to enabling SMS delivery for this signature request. [Learn more](https://faq.hellosign.com/hc/en-us/articles/15815316468877-Dropbox-Sign-SMS-tools-add-on). **NOTE:** Not available in test mode and requires a Standard plan or higher. - `*_field`: any column with a _field\" suffix will be treated as a custom field (optional) You may only specify field values here, any other options should be set in the custom_fields request parameter. Example CSV: ``` name, email_address, pin, company_field George, george@example.com, d79a3td, ABC Corp Mary, mary@example.com, gd9as5b, 123 LLC ``` * @return signerFile - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "`signer_file` is a CSV file defining values and options for signer fields. Required unless a `signer_list` is used, you may not use both. The CSV can have the following columns: - `name`: the name of the signer filling the role of RoleName - `email_address`: email address of the signer filling the role of RoleName - `pin`: the 4- to 12-character access code that will secure this signer's signature page (optional) - `sms_phone_number`: An E.164 formatted phone number that will receive a code via SMS to access this signer's signature page. (optional) By using the feature, you agree you are responsible for obtaining a signer's consent to receive text messages from Dropbox Sign related to this signature request and confirm you have obtained such consent from all signers prior to enabling SMS delivery for this signature request. [Learn more](https://faq.hellosign.com/hc/en-us/articles/15815316468877-Dropbox-Sign-SMS-tools-add-on). **NOTE:** Not available in test mode and requires a Standard plan or higher. - `*_field`: any column with a _field\" suffix will be treated as a custom field (optional) You may only specify field values here, any other options should be set in the custom_fields request parameter. Example CSV: ``` name, email_address, pin, company_field George, george@example.com, d79a3td, ABC Corp Mary, mary@example.com, gd9as5b, 123 LLC ```") @JsonProperty(JSON_PROPERTY_SIGNER_FILE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -187,12 +186,11 @@ public SignatureRequestBulkSendWithTemplateRequest addSignerListItem(SubBulkSign return this; } - /** + /** * `signer_list` is an array defining values and options for signer fields. Required unless a `signer_file` is used, you may not use both. * @return signerList - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "`signer_list` is an array defining values and options for signer fields. Required unless a `signer_file` is used, you may not use both.") @JsonProperty(JSON_PROPERTY_SIGNER_LIST) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -213,12 +211,11 @@ public SignatureRequestBulkSendWithTemplateRequest allowDecline(Boolean allowDec return this; } - /** + /** * Allows signers to decline to sign a document if `true`. Defaults to `false`. * @return allowDecline - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows signers to decline to sign a document if `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_ALLOW_DECLINE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -247,12 +244,11 @@ public SignatureRequestBulkSendWithTemplateRequest addCcsItem(SubCC ccsItem) { return this; } - /** + /** * Add CC email recipients. Required when a CC role exists for the Template. * @return ccs - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Add CC email recipients. Required when a CC role exists for the Template.") @JsonProperty(JSON_PROPERTY_CCS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -273,12 +269,11 @@ public SignatureRequestBulkSendWithTemplateRequest clientId(String clientId) { return this; } - /** + /** * The client id of the API App you want to associate with this request. Used to apply the branding and callback url defined for the app. * @return clientId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The client id of the API App you want to associate with this request. Used to apply the branding and callback url defined for the app.") @JsonProperty(JSON_PROPERTY_CLIENT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -307,12 +302,11 @@ public SignatureRequestBulkSendWithTemplateRequest addCustomFieldsItem(SubCustom return this; } - /** + /** * When used together with merge fields, `custom_fields` allows users to add pre-filled data to their signature requests. Pre-filled data can be used with \"send-once\" signature requests by adding merge fields with `form_fields_per_document` or [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) while passing values back with `custom_fields` together in one API call. For using pre-filled on repeatable signature requests, merge fields are added to templates in the Dropbox Sign UI or by calling [/template/create_embedded_draft](/api/reference/operation/templateCreateEmbeddedDraft) and then passing `custom_fields` on subsequent signature requests referencing that template. * @return customFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When used together with merge fields, `custom_fields` allows users to add pre-filled data to their signature requests. Pre-filled data can be used with \"send-once\" signature requests by adding merge fields with `form_fields_per_document` or [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) while passing values back with `custom_fields` together in one API call. For using pre-filled on repeatable signature requests, merge fields are added to templates in the Dropbox Sign UI or by calling [/template/create_embedded_draft](/api/reference/operation/templateCreateEmbeddedDraft) and then passing `custom_fields` on subsequent signature requests referencing that template.") @JsonProperty(JSON_PROPERTY_CUSTOM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -333,12 +327,11 @@ public SignatureRequestBulkSendWithTemplateRequest message(String message) { return this; } - /** + /** * The custom message in the email that will be sent to the signers. * @return message - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The custom message in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -367,12 +360,11 @@ public SignatureRequestBulkSendWithTemplateRequest putMetadataItem(String key, O return this; } - /** + /** * Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long.") @JsonProperty(JSON_PROPERTY_METADATA) @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) @@ -393,12 +385,11 @@ public SignatureRequestBulkSendWithTemplateRequest signingRedirectUrl(String sig return this; } - /** + /** * The URL you want signers redirected to after they successfully sign. * @return signingRedirectUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL you want signers redirected to after they successfully sign.") @JsonProperty(JSON_PROPERTY_SIGNING_REDIRECT_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -419,12 +410,11 @@ public SignatureRequestBulkSendWithTemplateRequest subject(String subject) { return this; } - /** + /** * The subject in the email that will be sent to the signers. * @return subject - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The subject in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_SUBJECT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -445,12 +435,11 @@ public SignatureRequestBulkSendWithTemplateRequest testMode(Boolean testMode) { return this; } - /** + /** * Whether this is a test, the signature request will not be legally binding if set to `true`. Defaults to `false`. * @return testMode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this is a test, the signature request will not be legally binding if set to `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_TEST_MODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -471,12 +460,11 @@ public SignatureRequestBulkSendWithTemplateRequest title(String title) { return this; } - /** + /** * The title you want to assign to the SignatureRequest. * @return title - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The title you want to assign to the SignatureRequest.") @JsonProperty(JSON_PROPERTY_TITLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestCreateEmbeddedRequest.java b/src/main/java/com/dropbox/sign/model/SignatureRequestCreateEmbeddedRequest.java index 99cf20d..db7b7d5 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestCreateEmbeddedRequest.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestCreateEmbeddedRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubAttachment; @@ -31,17 +30,16 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; 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.JSON; import com.dropbox.sign.ApiException; @@ -49,33 +47,33 @@ * SignatureRequestCreateEmbeddedRequest */ @JsonPropertyOrder({ - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_CLIENT_ID, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_FILES, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_FILE_URLS, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_SIGNERS, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_GROUPED_SIGNERS, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_ALLOW_DECLINE, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_ALLOW_REASSIGN, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_ATTACHMENTS, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_CC_EMAIL_ADDRESSES, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_CUSTOM_FIELDS, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_FIELD_OPTIONS, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_FORM_FIELD_GROUPS, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_FORM_FIELD_RULES, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_HIDE_TEXT_TAGS, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_MESSAGE, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_METADATA, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_SIGNING_OPTIONS, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_SUBJECT, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_TEST_MODE, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_TITLE, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_USE_TEXT_TAGS, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_POPULATE_AUTO_FILL_FIELDS, - SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_EXPIRES_AT + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_CLIENT_ID, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_FILES, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_FILE_URLS, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_SIGNERS, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_GROUPED_SIGNERS, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_ALLOW_DECLINE, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_ALLOW_REASSIGN, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_ATTACHMENTS, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_CC_EMAIL_ADDRESSES, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_CUSTOM_FIELDS, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_FIELD_OPTIONS, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_FORM_FIELD_GROUPS, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_FORM_FIELD_RULES, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_HIDE_TEXT_TAGS, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_MESSAGE, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_METADATA, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_SIGNING_OPTIONS, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_SUBJECT, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_TEST_MODE, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_TITLE, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_USE_TEXT_TAGS, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_POPULATE_AUTO_FILL_FIELDS, + SignatureRequestCreateEmbeddedRequest.JSON_PROPERTY_EXPIRES_AT }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SignatureRequestCreateEmbeddedRequest { public static final String JSON_PROPERTY_CLIENT_ID = "client_id"; private String clientId; @@ -172,12 +170,11 @@ public SignatureRequestCreateEmbeddedRequest clientId(String clientId) { return this; } - /** + /** * Client id of the app you're using to create this embedded signature request. Used for security purposes. * @return clientId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Client id of the app you're using to create this embedded signature request. Used for security purposes.") @JsonProperty(JSON_PROPERTY_CLIENT_ID) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -206,12 +203,11 @@ public SignatureRequestCreateEmbeddedRequest addFilesItem(File filesItem) { return this; } - /** + /** * Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both. * @return files - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -240,12 +236,11 @@ public SignatureRequestCreateEmbeddedRequest addFileUrlsItem(String fileUrlsItem return this; } - /** + /** * Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both. * @return fileUrls - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILE_URLS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -274,12 +269,11 @@ public SignatureRequestCreateEmbeddedRequest addSignersItem(SubSignatureRequestS return this; } - /** + /** * Add Signers to your Signature Request. This endpoint requires either **signers** or **grouped_signers**, but not both. * @return signers - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Add Signers to your Signature Request. This endpoint requires either **signers** or **grouped_signers**, but not both.") @JsonProperty(JSON_PROPERTY_SIGNERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -308,12 +302,11 @@ public SignatureRequestCreateEmbeddedRequest addGroupedSignersItem(SubSignatureR return this; } - /** + /** * Add Grouped Signers to your Signature Request. This endpoint requires either **signers** or **grouped_signers**, but not both. * @return groupedSigners - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Add Grouped Signers to your Signature Request. This endpoint requires either **signers** or **grouped_signers**, but not both.") @JsonProperty(JSON_PROPERTY_GROUPED_SIGNERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -334,12 +327,11 @@ public SignatureRequestCreateEmbeddedRequest allowDecline(Boolean allowDecline) return this; } - /** + /** * Allows signers to decline to sign a document if `true`. Defaults to `false`. * @return allowDecline - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows signers to decline to sign a document if `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_ALLOW_DECLINE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -360,12 +352,11 @@ public SignatureRequestCreateEmbeddedRequest allowReassign(Boolean allowReassign return this; } - /** + /** * Allows signers to reassign their signature requests to other signers if set to `true`. Defaults to `false`. **NOTE:** Only available for Premium plan. * @return allowReassign - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows signers to reassign their signature requests to other signers if set to `true`. Defaults to `false`. **NOTE:** Only available for Premium plan.") @JsonProperty(JSON_PROPERTY_ALLOW_REASSIGN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -394,12 +385,11 @@ public SignatureRequestCreateEmbeddedRequest addAttachmentsItem(SubAttachment at return this; } - /** + /** * A list describing the attachments * @return attachments - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list describing the attachments") @JsonProperty(JSON_PROPERTY_ATTACHMENTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -428,12 +418,11 @@ public SignatureRequestCreateEmbeddedRequest addCcEmailAddressesItem(String ccEm return this; } - /** + /** * The email addresses that should be CCed. * @return ccEmailAddresses - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The email addresses that should be CCed.") @JsonProperty(JSON_PROPERTY_CC_EMAIL_ADDRESSES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -462,12 +451,11 @@ public SignatureRequestCreateEmbeddedRequest addCustomFieldsItem(SubCustomField return this; } - /** + /** * When used together with merge fields, `custom_fields` allows users to add pre-filled data to their signature requests. Pre-filled data can be used with \"send-once\" signature requests by adding merge fields with `form_fields_per_document` or [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) while passing values back with `custom_fields` together in one API call. For using pre-filled on repeatable signature requests, merge fields are added to templates in the Dropbox Sign UI or by calling [/template/create_embedded_draft](/api/reference/operation/templateCreateEmbeddedDraft) and then passing `custom_fields` on subsequent signature requests referencing that template. * @return customFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When used together with merge fields, `custom_fields` allows users to add pre-filled data to their signature requests. Pre-filled data can be used with \"send-once\" signature requests by adding merge fields with `form_fields_per_document` or [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) while passing values back with `custom_fields` together in one API call. For using pre-filled on repeatable signature requests, merge fields are added to templates in the Dropbox Sign UI or by calling [/template/create_embedded_draft](/api/reference/operation/templateCreateEmbeddedDraft) and then passing `custom_fields` on subsequent signature requests referencing that template.") @JsonProperty(JSON_PROPERTY_CUSTOM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -488,12 +476,11 @@ public SignatureRequestCreateEmbeddedRequest fieldOptions(SubFieldOptions fieldO return this; } - /** + /** * Get fieldOptions * @return fieldOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIELD_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -522,12 +509,11 @@ public SignatureRequestCreateEmbeddedRequest addFormFieldGroupsItem(SubFormField return this; } - /** + /** * Group information for fields defined in `form_fields_per_document`. String-indexed JSON array with `group_label` and `requirement` keys. `form_fields_per_document` must contain fields referencing a group defined in `form_field_groups`. * @return formFieldGroups - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Group information for fields defined in `form_fields_per_document`. String-indexed JSON array with `group_label` and `requirement` keys. `form_fields_per_document` must contain fields referencing a group defined in `form_field_groups`.") @JsonProperty(JSON_PROPERTY_FORM_FIELD_GROUPS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -556,12 +542,11 @@ public SignatureRequestCreateEmbeddedRequest addFormFieldRulesItem(SubFormFieldR return this; } - /** + /** * Conditional Logic rules for fields defined in `form_fields_per_document`. * @return formFieldRules - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Conditional Logic rules for fields defined in `form_fields_per_document`.") @JsonProperty(JSON_PROPERTY_FORM_FIELD_RULES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -590,12 +575,11 @@ public SignatureRequestCreateEmbeddedRequest addFormFieldsPerDocumentItem(SubFor return this; } - /** + /** * The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).) **NOTE:** Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types. * Text Field use `SubFormFieldsPerDocumentText` * Dropdown Field use `SubFormFieldsPerDocumentDropdown` * Hyperlink Field use `SubFormFieldsPerDocumentHyperlink` * Checkbox Field use `SubFormFieldsPerDocumentCheckbox` * Radio Field use `SubFormFieldsPerDocumentRadio` * Signature Field use `SubFormFieldsPerDocumentSignature` * Date Signed Field use `SubFormFieldsPerDocumentDateSigned` * Initials Field use `SubFormFieldsPerDocumentInitials` * Text Merge Field use `SubFormFieldsPerDocumentTextMerge` * Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge` * @return formFieldsPerDocument - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).) **NOTE:** Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types. * Text Field use `SubFormFieldsPerDocumentText` * Dropdown Field use `SubFormFieldsPerDocumentDropdown` * Hyperlink Field use `SubFormFieldsPerDocumentHyperlink` * Checkbox Field use `SubFormFieldsPerDocumentCheckbox` * Radio Field use `SubFormFieldsPerDocumentRadio` * Signature Field use `SubFormFieldsPerDocumentSignature` * Date Signed Field use `SubFormFieldsPerDocumentDateSigned` * Initials Field use `SubFormFieldsPerDocumentInitials` * Text Merge Field use `SubFormFieldsPerDocumentTextMerge` * Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge`") @JsonProperty(JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -616,12 +600,11 @@ public SignatureRequestCreateEmbeddedRequest hideTextTags(Boolean hideTextTags) return this; } - /** + /** * Enables automatic Text Tag removal when set to true. **NOTE:** Removing text tags this way can cause unwanted clipping. We recommend leaving this setting on `false` and instead hiding your text tags using white text or a similar approach. See the [Text Tags Walkthrough](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) for more information. * @return hideTextTags - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Enables automatic Text Tag removal when set to true. **NOTE:** Removing text tags this way can cause unwanted clipping. We recommend leaving this setting on `false` and instead hiding your text tags using white text or a similar approach. See the [Text Tags Walkthrough](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) for more information.") @JsonProperty(JSON_PROPERTY_HIDE_TEXT_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -642,12 +625,11 @@ public SignatureRequestCreateEmbeddedRequest message(String message) { return this; } - /** + /** * The custom message in the email that will be sent to the signers. * @return message - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The custom message in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -676,12 +658,11 @@ public SignatureRequestCreateEmbeddedRequest putMetadataItem(String key, Object return this; } - /** + /** * Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long.") @JsonProperty(JSON_PROPERTY_METADATA) @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) @@ -702,12 +683,11 @@ public SignatureRequestCreateEmbeddedRequest signingOptions(SubSigningOptions si return this; } - /** + /** * Get signingOptions * @return signingOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SIGNING_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -728,12 +708,11 @@ public SignatureRequestCreateEmbeddedRequest subject(String subject) { return this; } - /** + /** * The subject in the email that will be sent to the signers. * @return subject - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The subject in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_SUBJECT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -754,12 +733,11 @@ public SignatureRequestCreateEmbeddedRequest testMode(Boolean testMode) { return this; } - /** + /** * Whether this is a test, the signature request will not be legally binding if set to `true`. Defaults to `false`. * @return testMode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this is a test, the signature request will not be legally binding if set to `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_TEST_MODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -780,12 +758,11 @@ public SignatureRequestCreateEmbeddedRequest title(String title) { return this; } - /** + /** * The title you want to assign to the SignatureRequest. * @return title - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The title you want to assign to the SignatureRequest.") @JsonProperty(JSON_PROPERTY_TITLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -806,12 +783,11 @@ public SignatureRequestCreateEmbeddedRequest useTextTags(Boolean useTextTags) { return this; } - /** + /** * Send with a value of `true` if you wish to enable [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) parsing in your document. Defaults to disabled, or `false`. * @return useTextTags - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Send with a value of `true` if you wish to enable [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) parsing in your document. Defaults to disabled, or `false`.") @JsonProperty(JSON_PROPERTY_USE_TEXT_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -832,12 +808,11 @@ public SignatureRequestCreateEmbeddedRequest populateAutoFillFields(Boolean popu return this; } - /** + /** * Controls whether [auto fill fields](https://faq.hellosign.com/hc/en-us/articles/360051467511-Auto-Fill-Fields) can automatically populate a signer's information during signing. **NOTE:** Keep your signer's information safe by ensuring that the _signer on your signature request is the intended party_ before using this feature. * @return populateAutoFillFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Controls whether [auto fill fields](https://faq.hellosign.com/hc/en-us/articles/360051467511-Auto-Fill-Fields) can automatically populate a signer's information during signing. **NOTE:** Keep your signer's information safe by ensuring that the _signer on your signature request is the intended party_ before using this feature.") @JsonProperty(JSON_PROPERTY_POPULATE_AUTO_FILL_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -858,12 +833,11 @@ public SignatureRequestCreateEmbeddedRequest expiresAt(Integer expiresAt) { return this; } - /** + /** * When the signature request will expire. Unsigned signatures will be moved to the expired status, and no longer signable. See [Signature Request Expiration Date](https://developers.hellosign.com/docs/signature-request/expiration/) for details. * @return expiresAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When the signature request will expire. Unsigned signatures will be moved to the expired status, and no longer signable. See [Signature Request Expiration Date](https://developers.hellosign.com/docs/signature-request/expiration/) for details.") @JsonProperty(JSON_PROPERTY_EXPIRES_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestCreateEmbeddedWithTemplateRequest.java b/src/main/java/com/dropbox/sign/model/SignatureRequestCreateEmbeddedWithTemplateRequest.java index 7c90fd8..f43cbef 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestCreateEmbeddedWithTemplateRequest.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestCreateEmbeddedWithTemplateRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubCC; @@ -26,17 +25,16 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; 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.JSON; import com.dropbox.sign.ApiException; @@ -44,24 +42,24 @@ * SignatureRequestCreateEmbeddedWithTemplateRequest */ @JsonPropertyOrder({ - SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TEMPLATE_IDS, - SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CLIENT_ID, - SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SIGNERS, - SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_ALLOW_DECLINE, - SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CCS, - SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CUSTOM_FIELDS, - SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_FILES, - SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_FILE_URLS, - SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_MESSAGE, - SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_METADATA, - SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SIGNING_OPTIONS, - SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SUBJECT, - SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TEST_MODE, - SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TITLE, - SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_POPULATE_AUTO_FILL_FIELDS + SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TEMPLATE_IDS, + SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CLIENT_ID, + SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SIGNERS, + SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_ALLOW_DECLINE, + SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CCS, + SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CUSTOM_FIELDS, + SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_FILES, + SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_FILE_URLS, + SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_MESSAGE, + SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_METADATA, + SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SIGNING_OPTIONS, + SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SUBJECT, + SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TEST_MODE, + SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TITLE, + SignatureRequestCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_POPULATE_AUTO_FILL_FIELDS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SignatureRequestCreateEmbeddedWithTemplateRequest { public static final String JSON_PROPERTY_TEMPLATE_IDS = "template_ids"; private List templateIds = new ArrayList<>(); @@ -132,16 +130,18 @@ public SignatureRequestCreateEmbeddedWithTemplateRequest templateIds(List(); + } this.templateIds.add(templateIdsItem); return this; } - /** + /** * Use `template_ids` to create a SignatureRequest from one or more templates, in the order in which the template will be used. * @return templateIds - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Use `template_ids` to create a SignatureRequest from one or more templates, in the order in which the template will be used.") @JsonProperty(JSON_PROPERTY_TEMPLATE_IDS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -162,12 +162,11 @@ public SignatureRequestCreateEmbeddedWithTemplateRequest clientId(String clientI return this; } - /** + /** * Client id of the app you're using to create this embedded signature request. Used for security purposes. * @return clientId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Client id of the app you're using to create this embedded signature request. Used for security purposes.") @JsonProperty(JSON_PROPERTY_CLIENT_ID) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -189,16 +188,18 @@ public SignatureRequestCreateEmbeddedWithTemplateRequest signers(List(); + } this.signers.add(signersItem); return this; } - /** + /** * Add Signers to your Templated-based Signature Request. * @return signers - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Add Signers to your Templated-based Signature Request.") @JsonProperty(JSON_PROPERTY_SIGNERS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -219,12 +220,11 @@ public SignatureRequestCreateEmbeddedWithTemplateRequest allowDecline(Boolean al return this; } - /** + /** * Allows signers to decline to sign a document if `true`. Defaults to `false`. * @return allowDecline - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows signers to decline to sign a document if `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_ALLOW_DECLINE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -253,12 +253,11 @@ public SignatureRequestCreateEmbeddedWithTemplateRequest addCcsItem(SubCC ccsIte return this; } - /** + /** * Add CC email recipients. Required when a CC role exists for the Template. * @return ccs - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Add CC email recipients. Required when a CC role exists for the Template.") @JsonProperty(JSON_PROPERTY_CCS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -287,12 +286,11 @@ public SignatureRequestCreateEmbeddedWithTemplateRequest addCustomFieldsItem(Sub return this; } - /** + /** * An array defining values and options for custom fields. Required when a custom field exists in the Template. * @return customFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array defining values and options for custom fields. Required when a custom field exists in the Template.") @JsonProperty(JSON_PROPERTY_CUSTOM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -321,12 +319,11 @@ public SignatureRequestCreateEmbeddedWithTemplateRequest addFilesItem(File files return this; } - /** + /** * Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both. * @return files - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -355,12 +352,11 @@ public SignatureRequestCreateEmbeddedWithTemplateRequest addFileUrlsItem(String return this; } - /** + /** * Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both. * @return fileUrls - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILE_URLS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -381,12 +377,11 @@ public SignatureRequestCreateEmbeddedWithTemplateRequest message(String message) return this; } - /** + /** * The custom message in the email that will be sent to the signers. * @return message - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The custom message in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -415,12 +410,11 @@ public SignatureRequestCreateEmbeddedWithTemplateRequest putMetadataItem(String return this; } - /** + /** * Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long.") @JsonProperty(JSON_PROPERTY_METADATA) @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) @@ -441,12 +435,11 @@ public SignatureRequestCreateEmbeddedWithTemplateRequest signingOptions(SubSigni return this; } - /** + /** * Get signingOptions * @return signingOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SIGNING_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -467,12 +460,11 @@ public SignatureRequestCreateEmbeddedWithTemplateRequest subject(String subject) return this; } - /** + /** * The subject in the email that will be sent to the signers. * @return subject - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The subject in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_SUBJECT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -493,12 +485,11 @@ public SignatureRequestCreateEmbeddedWithTemplateRequest testMode(Boolean testMo return this; } - /** + /** * Whether this is a test, the signature request will not be legally binding if set to `true`. Defaults to `false`. * @return testMode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this is a test, the signature request will not be legally binding if set to `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_TEST_MODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -519,12 +510,11 @@ public SignatureRequestCreateEmbeddedWithTemplateRequest title(String title) { return this; } - /** + /** * The title you want to assign to the SignatureRequest. * @return title - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The title you want to assign to the SignatureRequest.") @JsonProperty(JSON_PROPERTY_TITLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -545,12 +535,11 @@ public SignatureRequestCreateEmbeddedWithTemplateRequest populateAutoFillFields( return this; } - /** + /** * Controls whether [auto fill fields](https://faq.hellosign.com/hc/en-us/articles/360051467511-Auto-Fill-Fields) can automatically populate a signer's information during signing. **NOTE:** Keep your signer's information safe by ensuring that the _signer on your signature request is the intended party_ before using this feature. * @return populateAutoFillFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Controls whether [auto fill fields](https://faq.hellosign.com/hc/en-us/articles/360051467511-Auto-Fill-Fields) can automatically populate a signer's information during signing. **NOTE:** Keep your signer's information safe by ensuring that the _signer on your signature request is the intended party_ before using this feature.") @JsonProperty(JSON_PROPERTY_POPULATE_AUTO_FILL_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestGetResponse.java b/src/main/java/com/dropbox/sign/model/SignatureRequestGetResponse.java index b1bd94f..1813af9 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestGetResponse.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestGetResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SignatureRequestResponse; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,11 +37,11 @@ * SignatureRequestGetResponse */ @JsonPropertyOrder({ - SignatureRequestGetResponse.JSON_PROPERTY_SIGNATURE_REQUEST, - SignatureRequestGetResponse.JSON_PROPERTY_WARNINGS + SignatureRequestGetResponse.JSON_PROPERTY_SIGNATURE_REQUEST, + SignatureRequestGetResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SignatureRequestGetResponse { public static final String JSON_PROPERTY_SIGNATURE_REQUEST = "signature_request"; private SignatureRequestResponse signatureRequest; @@ -74,14 +72,13 @@ public SignatureRequestGetResponse signatureRequest(SignatureRequestResponse sig return this; } - /** + /** * Get signatureRequest * @return signatureRequest - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_SIGNATURE_REQUEST) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public SignatureRequestResponse getSignatureRequest() { return signatureRequest; @@ -89,7 +86,7 @@ public SignatureRequestResponse getSignatureRequest() { @JsonProperty(JSON_PROPERTY_SIGNATURE_REQUEST) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setSignatureRequest(SignatureRequestResponse signatureRequest) { this.signatureRequest = signatureRequest; } @@ -108,12 +105,11 @@ public SignatureRequestGetResponse addWarningsItem(WarningResponse warningsItem) return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestListResponse.java b/src/main/java/com/dropbox/sign/model/SignatureRequestListResponse.java index fc43bf1..de380ad 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestListResponse.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestListResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.ListInfoResponse; @@ -25,14 +24,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -40,15 +38,15 @@ * SignatureRequestListResponse */ @JsonPropertyOrder({ - SignatureRequestListResponse.JSON_PROPERTY_SIGNATURE_REQUESTS, - SignatureRequestListResponse.JSON_PROPERTY_LIST_INFO, - SignatureRequestListResponse.JSON_PROPERTY_WARNINGS + SignatureRequestListResponse.JSON_PROPERTY_SIGNATURE_REQUESTS, + SignatureRequestListResponse.JSON_PROPERTY_LIST_INFO, + SignatureRequestListResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SignatureRequestListResponse { public static final String JSON_PROPERTY_SIGNATURE_REQUESTS = "signature_requests"; - private List signatureRequests = null; + private List signatureRequests = new ArrayList<>(); public static final String JSON_PROPERTY_LIST_INFO = "list_info"; private ListInfoResponse listInfo; @@ -87,14 +85,13 @@ public SignatureRequestListResponse addSignatureRequestsItem(SignatureRequestRes return this; } - /** + /** * Contains information about signature requests. * @return signatureRequests - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Contains information about signature requests.") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_SIGNATURE_REQUESTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getSignatureRequests() { return signatureRequests; @@ -102,7 +99,7 @@ public List getSignatureRequests() { @JsonProperty(JSON_PROPERTY_SIGNATURE_REQUESTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setSignatureRequests(List signatureRequests) { this.signatureRequests = signatureRequests; } @@ -113,14 +110,13 @@ public SignatureRequestListResponse listInfo(ListInfoResponse listInfo) { return this; } - /** + /** * Get listInfo * @return listInfo - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_LIST_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public ListInfoResponse getListInfo() { return listInfo; @@ -128,7 +124,7 @@ public ListInfoResponse getListInfo() { @JsonProperty(JSON_PROPERTY_LIST_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setListInfo(ListInfoResponse listInfo) { this.listInfo = listInfo; } @@ -147,12 +143,11 @@ public SignatureRequestListResponse addWarningsItem(WarningResponse warningsItem return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestRemindRequest.java b/src/main/java/com/dropbox/sign/model/SignatureRequestRemindRequest.java index f7a730f..b300412 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestRemindRequest.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestRemindRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,11 +33,11 @@ * SignatureRequestRemindRequest */ @JsonPropertyOrder({ - SignatureRequestRemindRequest.JSON_PROPERTY_EMAIL_ADDRESS, - SignatureRequestRemindRequest.JSON_PROPERTY_NAME + SignatureRequestRemindRequest.JSON_PROPERTY_EMAIL_ADDRESS, + SignatureRequestRemindRequest.JSON_PROPERTY_NAME }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SignatureRequestRemindRequest { public static final String JSON_PROPERTY_EMAIL_ADDRESS = "email_address"; private String emailAddress; @@ -70,12 +68,11 @@ public SignatureRequestRemindRequest emailAddress(String emailAddress) { return this; } - /** + /** * The email address of the signer to send a reminder to. * @return emailAddress - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The email address of the signer to send a reminder to.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -96,12 +93,11 @@ public SignatureRequestRemindRequest name(String name) { return this; } - /** + /** * The name of the signer to send a reminder to. Include if two or more signers share an email address. * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the signer to send a reminder to. Include if two or more signers share an email address.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponse.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponse.java index fd7de67..da6e723 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponse.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SignatureRequestResponseAttachment; @@ -26,50 +25,48 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; /** * Contains information about a signature request. */ -@ApiModel(description = "Contains information about a signature request.") @JsonPropertyOrder({ - SignatureRequestResponse.JSON_PROPERTY_TEST_MODE, - SignatureRequestResponse.JSON_PROPERTY_SIGNATURE_REQUEST_ID, - SignatureRequestResponse.JSON_PROPERTY_REQUESTER_EMAIL_ADDRESS, - SignatureRequestResponse.JSON_PROPERTY_TITLE, - SignatureRequestResponse.JSON_PROPERTY_ORIGINAL_TITLE, - SignatureRequestResponse.JSON_PROPERTY_SUBJECT, - SignatureRequestResponse.JSON_PROPERTY_MESSAGE, - SignatureRequestResponse.JSON_PROPERTY_METADATA, - SignatureRequestResponse.JSON_PROPERTY_CREATED_AT, - SignatureRequestResponse.JSON_PROPERTY_EXPIRES_AT, - SignatureRequestResponse.JSON_PROPERTY_IS_COMPLETE, - SignatureRequestResponse.JSON_PROPERTY_IS_DECLINED, - SignatureRequestResponse.JSON_PROPERTY_HAS_ERROR, - SignatureRequestResponse.JSON_PROPERTY_FILES_URL, - SignatureRequestResponse.JSON_PROPERTY_SIGNING_URL, - SignatureRequestResponse.JSON_PROPERTY_DETAILS_URL, - SignatureRequestResponse.JSON_PROPERTY_CC_EMAIL_ADDRESSES, - SignatureRequestResponse.JSON_PROPERTY_SIGNING_REDIRECT_URL, - SignatureRequestResponse.JSON_PROPERTY_FINAL_COPY_URI, - SignatureRequestResponse.JSON_PROPERTY_TEMPLATE_IDS, - SignatureRequestResponse.JSON_PROPERTY_CUSTOM_FIELDS, - SignatureRequestResponse.JSON_PROPERTY_ATTACHMENTS, - SignatureRequestResponse.JSON_PROPERTY_RESPONSE_DATA, - SignatureRequestResponse.JSON_PROPERTY_SIGNATURES, - SignatureRequestResponse.JSON_PROPERTY_BULK_SEND_JOB_ID + SignatureRequestResponse.JSON_PROPERTY_TEST_MODE, + SignatureRequestResponse.JSON_PROPERTY_SIGNATURE_REQUEST_ID, + SignatureRequestResponse.JSON_PROPERTY_REQUESTER_EMAIL_ADDRESS, + SignatureRequestResponse.JSON_PROPERTY_TITLE, + SignatureRequestResponse.JSON_PROPERTY_ORIGINAL_TITLE, + SignatureRequestResponse.JSON_PROPERTY_SUBJECT, + SignatureRequestResponse.JSON_PROPERTY_MESSAGE, + SignatureRequestResponse.JSON_PROPERTY_METADATA, + SignatureRequestResponse.JSON_PROPERTY_CREATED_AT, + SignatureRequestResponse.JSON_PROPERTY_EXPIRES_AT, + SignatureRequestResponse.JSON_PROPERTY_IS_COMPLETE, + SignatureRequestResponse.JSON_PROPERTY_IS_DECLINED, + SignatureRequestResponse.JSON_PROPERTY_HAS_ERROR, + SignatureRequestResponse.JSON_PROPERTY_FILES_URL, + SignatureRequestResponse.JSON_PROPERTY_SIGNING_URL, + SignatureRequestResponse.JSON_PROPERTY_DETAILS_URL, + SignatureRequestResponse.JSON_PROPERTY_CC_EMAIL_ADDRESSES, + SignatureRequestResponse.JSON_PROPERTY_SIGNING_REDIRECT_URL, + SignatureRequestResponse.JSON_PROPERTY_FINAL_COPY_URI, + SignatureRequestResponse.JSON_PROPERTY_TEMPLATE_IDS, + SignatureRequestResponse.JSON_PROPERTY_CUSTOM_FIELDS, + SignatureRequestResponse.JSON_PROPERTY_ATTACHMENTS, + SignatureRequestResponse.JSON_PROPERTY_RESPONSE_DATA, + SignatureRequestResponse.JSON_PROPERTY_SIGNATURES, + SignatureRequestResponse.JSON_PROPERTY_BULK_SEND_JOB_ID }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SignatureRequestResponse { public static final String JSON_PROPERTY_TEST_MODE = "test_mode"; private Boolean testMode = false; @@ -169,12 +166,11 @@ public SignatureRequestResponse testMode(Boolean testMode) { return this; } - /** + /** * Whether this is a test signature request. Test requests have no legal value. Defaults to `false`. * @return testMode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this is a test signature request. Test requests have no legal value. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_TEST_MODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -195,12 +191,11 @@ public SignatureRequestResponse signatureRequestId(String signatureRequestId) { return this; } - /** + /** * The id of the SignatureRequest. * @return signatureRequestId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the SignatureRequest.") @JsonProperty(JSON_PROPERTY_SIGNATURE_REQUEST_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -221,12 +216,11 @@ public SignatureRequestResponse requesterEmailAddress(String requesterEmailAddre return this; } - /** + /** * The email address of the initiator of the SignatureRequest. * @return requesterEmailAddress - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The email address of the initiator of the SignatureRequest.") @JsonProperty(JSON_PROPERTY_REQUESTER_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -247,12 +241,11 @@ public SignatureRequestResponse title(String title) { return this; } - /** + /** * The title the specified Account uses for the SignatureRequest. * @return title - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The title the specified Account uses for the SignatureRequest.") @JsonProperty(JSON_PROPERTY_TITLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -273,12 +266,11 @@ public SignatureRequestResponse originalTitle(String originalTitle) { return this; } - /** + /** * Default Label for account. * @return originalTitle - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Default Label for account.") @JsonProperty(JSON_PROPERTY_ORIGINAL_TITLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -299,12 +291,11 @@ public SignatureRequestResponse subject(String subject) { return this; } - /** + /** * The subject in the email that was initially sent to the signers. * @return subject - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The subject in the email that was initially sent to the signers.") @JsonProperty(JSON_PROPERTY_SUBJECT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -325,12 +316,11 @@ public SignatureRequestResponse message(String message) { return this; } - /** + /** * The custom message in the email that was initially sent to the signers. * @return message - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The custom message in the email that was initially sent to the signers.") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -351,12 +341,11 @@ public SignatureRequestResponse metadata(Object metadata) { return this; } - /** + /** * The metadata attached to the signature request. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The metadata attached to the signature request.") @JsonProperty(JSON_PROPERTY_METADATA) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -377,12 +366,11 @@ public SignatureRequestResponse createdAt(Integer createdAt) { return this; } - /** + /** * Time the signature request was created. * @return createdAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Time the signature request was created.") @JsonProperty(JSON_PROPERTY_CREATED_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -403,12 +391,11 @@ public SignatureRequestResponse expiresAt(Integer expiresAt) { return this; } - /** + /** * The time when the signature request will expire unsigned signatures. See [Signature Request Expiration Date](https://developers.hellosign.com/docs/signature-request/expiration/) for details. * @return expiresAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The time when the signature request will expire unsigned signatures. See [Signature Request Expiration Date](https://developers.hellosign.com/docs/signature-request/expiration/) for details.") @JsonProperty(JSON_PROPERTY_EXPIRES_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -429,12 +416,11 @@ public SignatureRequestResponse isComplete(Boolean isComplete) { return this; } - /** + /** * Whether or not the SignatureRequest has been fully executed by all signers. * @return isComplete - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether or not the SignatureRequest has been fully executed by all signers.") @JsonProperty(JSON_PROPERTY_IS_COMPLETE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -455,12 +441,11 @@ public SignatureRequestResponse isDeclined(Boolean isDeclined) { return this; } - /** + /** * Whether or not the SignatureRequest has been declined by a signer. * @return isDeclined - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether or not the SignatureRequest has been declined by a signer.") @JsonProperty(JSON_PROPERTY_IS_DECLINED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -481,12 +466,11 @@ public SignatureRequestResponse hasError(Boolean hasError) { return this; } - /** + /** * Whether or not an error occurred (either during the creation of the SignatureRequest or during one of the signings). * @return hasError - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether or not an error occurred (either during the creation of the SignatureRequest or during one of the signings).") @JsonProperty(JSON_PROPERTY_HAS_ERROR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -507,12 +491,11 @@ public SignatureRequestResponse filesUrl(String filesUrl) { return this; } - /** + /** * The URL where a copy of the request's documents can be downloaded. * @return filesUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL where a copy of the request's documents can be downloaded.") @JsonProperty(JSON_PROPERTY_FILES_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -533,12 +516,11 @@ public SignatureRequestResponse signingUrl(String signingUrl) { return this; } - /** + /** * The URL where a signer, after authenticating, can sign the documents. This should only be used by users with existing Dropbox Sign accounts as they will be required to log in before signing. * @return signingUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL where a signer, after authenticating, can sign the documents. This should only be used by users with existing Dropbox Sign accounts as they will be required to log in before signing.") @JsonProperty(JSON_PROPERTY_SIGNING_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -559,12 +541,11 @@ public SignatureRequestResponse detailsUrl(String detailsUrl) { return this; } - /** + /** * The URL where the requester and the signers can view the current status of the SignatureRequest. * @return detailsUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL where the requester and the signers can view the current status of the SignatureRequest.") @JsonProperty(JSON_PROPERTY_DETAILS_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -593,12 +574,11 @@ public SignatureRequestResponse addCcEmailAddressesItem(String ccEmailAddressesI return this; } - /** + /** * A list of email addresses that were CCed on the SignatureRequest. They will receive a copy of the final PDF once all the signers have signed. * @return ccEmailAddresses - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of email addresses that were CCed on the SignatureRequest. They will receive a copy of the final PDF once all the signers have signed.") @JsonProperty(JSON_PROPERTY_CC_EMAIL_ADDRESSES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -619,12 +599,11 @@ public SignatureRequestResponse signingRedirectUrl(String signingRedirectUrl) { return this; } - /** + /** * The URL you want the signer redirected to after they successfully sign. * @return signingRedirectUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL you want the signer redirected to after they successfully sign.") @JsonProperty(JSON_PROPERTY_SIGNING_REDIRECT_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -645,12 +624,11 @@ public SignatureRequestResponse finalCopyUri(String finalCopyUri) { return this; } - /** + /** * The path where the completed document can be downloaded * @return finalCopyUri - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The path where the completed document can be downloaded") @JsonProperty(JSON_PROPERTY_FINAL_COPY_URI) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -679,12 +657,11 @@ public SignatureRequestResponse addTemplateIdsItem(String templateIdsItem) { return this; } - /** + /** * Templates IDs used in this SignatureRequest (if any). * @return templateIds - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Templates IDs used in this SignatureRequest (if any).") @JsonProperty(JSON_PROPERTY_TEMPLATE_IDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -713,12 +690,11 @@ public SignatureRequestResponse addCustomFieldsItem(SignatureRequestResponseCust return this; } - /** + /** * An array of Custom Field objects containing the name and type of each custom field. * Text Field uses `SignatureRequestResponseCustomFieldText` * Checkbox Field uses `SignatureRequestResponseCustomFieldCheckbox` * @return customFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array of Custom Field objects containing the name and type of each custom field. * Text Field uses `SignatureRequestResponseCustomFieldText` * Checkbox Field uses `SignatureRequestResponseCustomFieldCheckbox`") @JsonProperty(JSON_PROPERTY_CUSTOM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -747,12 +723,11 @@ public SignatureRequestResponse addAttachmentsItem(SignatureRequestResponseAttac return this; } - /** + /** * Signer attachments. * @return attachments - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Signer attachments.") @JsonProperty(JSON_PROPERTY_ATTACHMENTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -781,12 +756,11 @@ public SignatureRequestResponse addResponseDataItem(SignatureRequestResponseData return this; } - /** + /** * An array of form field objects containing the name, value, and type of each textbox or checkmark field filled in by the signers. * @return responseData - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array of form field objects containing the name, value, and type of each textbox or checkmark field filled in by the signers.") @JsonProperty(JSON_PROPERTY_RESPONSE_DATA) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -815,12 +789,11 @@ public SignatureRequestResponse addSignaturesItem(SignatureRequestResponseSignat return this; } - /** + /** * An array of signature objects, 1 for each signer. * @return signatures - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array of signature objects, 1 for each signer.") @JsonProperty(JSON_PROPERTY_SIGNATURES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -841,12 +814,11 @@ public SignatureRequestResponse bulkSendJobId(String bulkSendJobId) { return this; } - /** + /** * The ID of the Bulk Send job which sent the signature request, if applicable. * @return bulkSendJobId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The ID of the Bulk Send job which sent the signature request, if applicable.") @JsonProperty(JSON_PROPERTY_BULK_SEND_JOB_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseAttachment.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseAttachment.java index e90f503..3230732 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseAttachment.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseAttachment.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,29 +21,27 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * Signer attachments. */ -@ApiModel(description = "Signer attachments.") @JsonPropertyOrder({ - SignatureRequestResponseAttachment.JSON_PROPERTY_ID, - SignatureRequestResponseAttachment.JSON_PROPERTY_SIGNER, - SignatureRequestResponseAttachment.JSON_PROPERTY_NAME, - SignatureRequestResponseAttachment.JSON_PROPERTY_REQUIRED, - SignatureRequestResponseAttachment.JSON_PROPERTY_INSTRUCTIONS, - SignatureRequestResponseAttachment.JSON_PROPERTY_UPLOADED_AT + SignatureRequestResponseAttachment.JSON_PROPERTY_ID, + SignatureRequestResponseAttachment.JSON_PROPERTY_SIGNER, + SignatureRequestResponseAttachment.JSON_PROPERTY_NAME, + SignatureRequestResponseAttachment.JSON_PROPERTY_REQUIRED, + SignatureRequestResponseAttachment.JSON_PROPERTY_INSTRUCTIONS, + SignatureRequestResponseAttachment.JSON_PROPERTY_UPLOADED_AT }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SignatureRequestResponseAttachment { public static final String JSON_PROPERTY_ID = "id"; private String id; @@ -87,12 +84,11 @@ public SignatureRequestResponseAttachment id(String id) { return this; } - /** + /** * The unique ID for this attachment. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique ID for this attachment.") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -112,13 +108,16 @@ public SignatureRequestResponseAttachment signer(String signer) { this.signer = signer; return this; } + public SignatureRequestResponseAttachment signer(Integer signer) { + this.signer = String.valueOf(signer); + return this; + } - /** + /** * The Signer this attachment is assigned to. * @return signer - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Signer this attachment is assigned to.") @JsonProperty(JSON_PROPERTY_SIGNER) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -133,18 +132,21 @@ public void setSigner(String signer) { this.signer = signer; } + public void setSigner(Integer signer) { + this.signer = String.valueOf(signer); + } + public SignatureRequestResponseAttachment name(String name) { this.name = name; return this; } - /** + /** * The name of this attachment. * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of this attachment.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -165,12 +167,11 @@ public SignatureRequestResponseAttachment required(Boolean required) { return this; } - /** + /** * A boolean value denoting if this attachment is required. * @return required - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A boolean value denoting if this attachment is required.") @JsonProperty(JSON_PROPERTY_REQUIRED) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -191,12 +192,11 @@ public SignatureRequestResponseAttachment instructions(String instructions) { return this; } - /** + /** * Instructions for Signer. * @return instructions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Instructions for Signer.") @JsonProperty(JSON_PROPERTY_INSTRUCTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -217,12 +217,11 @@ public SignatureRequestResponseAttachment uploadedAt(Integer uploadedAt) { return this; } - /** + /** * Timestamp when attachment was uploaded by Signer. * @return uploadedAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Timestamp when attachment was uploaded by Signer.") @JsonProperty(JSON_PROPERTY_UPLOADED_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldBase.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldBase.java index 1d8f7d1..fcde00f 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldBase.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldBase.java @@ -14,11 +14,9 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; -import com.dropbox.sign.model.SignatureRequestResponseCustomFieldCheckbox; -import com.dropbox.sign.model.SignatureRequestResponseCustomFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -26,32 +24,31 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * An array of Custom Field objects containing the name and type of each custom field. * Text Field uses `SignatureRequestResponseCustomFieldText` * Checkbox Field uses `SignatureRequestResponseCustomFieldCheckbox` */ -@ApiModel(description = "An array of Custom Field objects containing the name and type of each custom field. * Text Field uses `SignatureRequestResponseCustomFieldText` * Checkbox Field uses `SignatureRequestResponseCustomFieldCheckbox`") @JsonPropertyOrder({ - SignatureRequestResponseCustomFieldBase.JSON_PROPERTY_TYPE, - SignatureRequestResponseCustomFieldBase.JSON_PROPERTY_NAME, - SignatureRequestResponseCustomFieldBase.JSON_PROPERTY_REQUIRED, - SignatureRequestResponseCustomFieldBase.JSON_PROPERTY_API_ID, - SignatureRequestResponseCustomFieldBase.JSON_PROPERTY_EDITOR + SignatureRequestResponseCustomFieldBase.JSON_PROPERTY_TYPE, + SignatureRequestResponseCustomFieldBase.JSON_PROPERTY_NAME, + SignatureRequestResponseCustomFieldBase.JSON_PROPERTY_REQUIRED, + SignatureRequestResponseCustomFieldBase.JSON_PROPERTY_API_ID, + SignatureRequestResponseCustomFieldBase.JSON_PROPERTY_EDITOR }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) @JsonSubTypes({ - @JsonSubTypes.Type(value = SignatureRequestResponseCustomFieldCheckbox.class, name = "SignatureRequestResponseCustomFieldCheckbox"), - @JsonSubTypes.Type(value = SignatureRequestResponseCustomFieldText.class, name = "SignatureRequestResponseCustomFieldText"), @JsonSubTypes.Type(value = SignatureRequestResponseCustomFieldCheckbox.class, name = "checkbox"), @JsonSubTypes.Type(value = SignatureRequestResponseCustomFieldText.class, name = "text"), }) @@ -95,12 +92,11 @@ public SignatureRequestResponseCustomFieldBase type(String type) { return this; } - /** + /** * The type of this Custom Field. Only 'text' and 'checkbox' are currently supported. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this Custom Field. Only 'text' and 'checkbox' are currently supported.") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -121,12 +117,11 @@ public SignatureRequestResponseCustomFieldBase name(String name) { return this; } - /** + /** * The name of the Custom Field. * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the Custom Field.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -147,12 +142,11 @@ public SignatureRequestResponseCustomFieldBase required(Boolean required) { return this; } - /** + /** * A boolean value denoting if this field is required. * @return required - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A boolean value denoting if this field is required.") @JsonProperty(JSON_PROPERTY_REQUIRED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -173,12 +167,11 @@ public SignatureRequestResponseCustomFieldBase apiId(String apiId) { return this; } - /** + /** * The unique ID for this field. * @return apiId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The unique ID for this field.") @JsonProperty(JSON_PROPERTY_API_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -199,12 +192,11 @@ public SignatureRequestResponseCustomFieldBase editor(String editor) { return this; } - /** + /** * The name of the Role that is able to edit this field. * @return editor - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the Role that is able to edit this field.") @JsonProperty(JSON_PROPERTY_EDITOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -394,15 +386,13 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("SignatureRequestResponseCustomFieldCheckbox", SignatureRequestResponseCustomFieldCheckbox.class); - mappings.put("SignatureRequestResponseCustomFieldText", SignatureRequestResponseCustomFieldText.class); - mappings.put("checkbox", SignatureRequestResponseCustomFieldCheckbox.class); - mappings.put("text", SignatureRequestResponseCustomFieldText.class); - mappings.put("SignatureRequestResponseCustomFieldBase", SignatureRequestResponseCustomFieldBase.class); - JSON.registerDiscriminator(SignatureRequestResponseCustomFieldBase.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("checkbox", SignatureRequestResponseCustomFieldCheckbox.class); + mappings.put("text", SignatureRequestResponseCustomFieldText.class); + mappings.put("SignatureRequestResponseCustomFieldBase", SignatureRequestResponseCustomFieldBase.class); + JSON.registerDiscriminator(SignatureRequestResponseCustomFieldBase.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldCheckbox.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldCheckbox.java index 0fcc3a1..e4eb1e3 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldCheckbox.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldCheckbox.java @@ -14,12 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SignatureRequestResponseCustomFieldBase; -import com.dropbox.sign.model.SignatureRequestResponseCustomFieldCheckbox; -import com.dropbox.sign.model.SignatureRequestResponseCustomFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -27,30 +25,27 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `SignatureRequestResponseCustomFieldBase`. */ -@ApiModel(description = "This class extends `SignatureRequestResponseCustomFieldBase`.") @JsonPropertyOrder({ - SignatureRequestResponseCustomFieldCheckbox.JSON_PROPERTY_TYPE, - SignatureRequestResponseCustomFieldCheckbox.JSON_PROPERTY_VALUE + SignatureRequestResponseCustomFieldCheckbox.JSON_PROPERTY_TYPE, + SignatureRequestResponseCustomFieldCheckbox.JSON_PROPERTY_VALUE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SignatureRequestResponseCustomFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SignatureRequestResponseCustomFieldText.class, name = "text"), -}) public class SignatureRequestResponseCustomFieldCheckbox extends SignatureRequestResponseCustomFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -82,12 +77,11 @@ public SignatureRequestResponseCustomFieldCheckbox type(String type) { return this; } - /** + /** * The type of this Custom Field. Only 'text' and 'checkbox' are currently supported. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this Custom Field. Only 'text' and 'checkbox' are currently supported.") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -108,12 +102,11 @@ public SignatureRequestResponseCustomFieldCheckbox value(Boolean value) { return this; } - /** + /** * A true/false for checkbox fields * @return value - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A true/false for checkbox fields") @JsonProperty(JSON_PROPERTY_VALUE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -243,13 +236,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SignatureRequestResponseCustomFieldCheckbox.class); - mappings.put("text", SignatureRequestResponseCustomFieldText.class); - mappings.put("SignatureRequestResponseCustomFieldCheckbox", SignatureRequestResponseCustomFieldCheckbox.class); - JSON.registerDiscriminator(SignatureRequestResponseCustomFieldCheckbox.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SignatureRequestResponseCustomFieldCheckbox", SignatureRequestResponseCustomFieldCheckbox.class); + JSON.registerDiscriminator(SignatureRequestResponseCustomFieldCheckbox.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldText.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldText.java index 21a0f23..f4284d6 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldText.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldText.java @@ -14,12 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SignatureRequestResponseCustomFieldBase; -import com.dropbox.sign.model.SignatureRequestResponseCustomFieldCheckbox; -import com.dropbox.sign.model.SignatureRequestResponseCustomFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -27,30 +25,27 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `SignatureRequestResponseCustomFieldBase`. */ -@ApiModel(description = "This class extends `SignatureRequestResponseCustomFieldBase`.") @JsonPropertyOrder({ - SignatureRequestResponseCustomFieldText.JSON_PROPERTY_TYPE, - SignatureRequestResponseCustomFieldText.JSON_PROPERTY_VALUE + SignatureRequestResponseCustomFieldText.JSON_PROPERTY_TYPE, + SignatureRequestResponseCustomFieldText.JSON_PROPERTY_VALUE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SignatureRequestResponseCustomFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SignatureRequestResponseCustomFieldText.class, name = "text"), -}) public class SignatureRequestResponseCustomFieldText extends SignatureRequestResponseCustomFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -82,12 +77,11 @@ public SignatureRequestResponseCustomFieldText type(String type) { return this; } - /** + /** * The type of this Custom Field. Only 'text' and 'checkbox' are currently supported. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this Custom Field. Only 'text' and 'checkbox' are currently supported.") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -108,12 +102,11 @@ public SignatureRequestResponseCustomFieldText value(String value) { return this; } - /** + /** * A text string for text fields * @return value - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A text string for text fields") @JsonProperty(JSON_PROPERTY_VALUE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -243,13 +236,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SignatureRequestResponseCustomFieldCheckbox.class); - mappings.put("text", SignatureRequestResponseCustomFieldText.class); - mappings.put("SignatureRequestResponseCustomFieldText", SignatureRequestResponseCustomFieldText.class); - JSON.registerDiscriminator(SignatureRequestResponseCustomFieldText.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SignatureRequestResponseCustomFieldText", SignatureRequestResponseCustomFieldText.class); + JSON.registerDiscriminator(SignatureRequestResponseCustomFieldText.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldTypeEnum.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldTypeEnum.java index bb24156..c4ae5b3 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldTypeEnum.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseCustomFieldTypeEnum.java @@ -14,13 +14,12 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; 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.JSON; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataBase.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataBase.java index a2f354f..c1a23eb 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataBase.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataBase.java @@ -14,18 +14,9 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckbox; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckboxMerge; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDateSigned; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDropdown; -import com.dropbox.sign.model.SignatureRequestResponseDataValueInitials; -import com.dropbox.sign.model.SignatureRequestResponseDataValueRadio; -import com.dropbox.sign.model.SignatureRequestResponseDataValueSignature; -import com.dropbox.sign.model.SignatureRequestResponseDataValueText; -import com.dropbox.sign.model.SignatureRequestResponseDataValueTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -33,39 +24,31 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * An array of form field objects containing the name, value, and type of each textbox or checkmark field filled in by the signers. */ -@ApiModel(description = "An array of form field objects containing the name, value, and type of each textbox or checkmark field filled in by the signers.") @JsonPropertyOrder({ - SignatureRequestResponseDataBase.JSON_PROPERTY_API_ID, - SignatureRequestResponseDataBase.JSON_PROPERTY_SIGNATURE_ID, - SignatureRequestResponseDataBase.JSON_PROPERTY_NAME, - SignatureRequestResponseDataBase.JSON_PROPERTY_REQUIRED, - SignatureRequestResponseDataBase.JSON_PROPERTY_TYPE + SignatureRequestResponseDataBase.JSON_PROPERTY_API_ID, + SignatureRequestResponseDataBase.JSON_PROPERTY_SIGNATURE_ID, + SignatureRequestResponseDataBase.JSON_PROPERTY_NAME, + SignatureRequestResponseDataBase.JSON_PROPERTY_REQUIRED, + SignatureRequestResponseDataBase.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) @JsonSubTypes({ - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckbox.class, name = "SignatureRequestResponseDataValueCheckbox"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckboxMerge.class, name = "SignatureRequestResponseDataValueCheckboxMerge"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDateSigned.class, name = "SignatureRequestResponseDataValueDateSigned"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDropdown.class, name = "SignatureRequestResponseDataValueDropdown"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueInitials.class, name = "SignatureRequestResponseDataValueInitials"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueRadio.class, name = "SignatureRequestResponseDataValueRadio"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueSignature.class, name = "SignatureRequestResponseDataValueSignature"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueText.class, name = "SignatureRequestResponseDataValueText"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueTextMerge.class, name = "SignatureRequestResponseDataValueTextMerge"), @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckbox.class, name = "checkbox"), @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckboxMerge.class, name = "checkbox-merge"), @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDateSigned.class, name = "date_signed"), @@ -116,12 +99,11 @@ public SignatureRequestResponseDataBase apiId(String apiId) { return this; } - /** + /** * The unique ID for this field. * @return apiId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The unique ID for this field.") @JsonProperty(JSON_PROPERTY_API_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -142,12 +124,11 @@ public SignatureRequestResponseDataBase signatureId(String signatureId) { return this; } - /** + /** * The ID of the signature to which this response is linked. * @return signatureId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The ID of the signature to which this response is linked.") @JsonProperty(JSON_PROPERTY_SIGNATURE_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -168,12 +149,11 @@ public SignatureRequestResponseDataBase name(String name) { return this; } - /** + /** * The name of the form field. * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the form field.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -194,12 +174,11 @@ public SignatureRequestResponseDataBase required(Boolean required) { return this; } - /** + /** * A boolean value denoting if this field is required. * @return required - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A boolean value denoting if this field is required.") @JsonProperty(JSON_PROPERTY_REQUIRED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -220,12 +199,11 @@ public SignatureRequestResponseDataBase type(String type) { return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -415,29 +393,20 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("SignatureRequestResponseDataValueCheckbox", SignatureRequestResponseDataValueCheckbox.class); - mappings.put("SignatureRequestResponseDataValueCheckboxMerge", SignatureRequestResponseDataValueCheckboxMerge.class); - mappings.put("SignatureRequestResponseDataValueDateSigned", SignatureRequestResponseDataValueDateSigned.class); - mappings.put("SignatureRequestResponseDataValueDropdown", SignatureRequestResponseDataValueDropdown.class); - mappings.put("SignatureRequestResponseDataValueInitials", SignatureRequestResponseDataValueInitials.class); - mappings.put("SignatureRequestResponseDataValueRadio", SignatureRequestResponseDataValueRadio.class); - mappings.put("SignatureRequestResponseDataValueSignature", SignatureRequestResponseDataValueSignature.class); - mappings.put("SignatureRequestResponseDataValueText", SignatureRequestResponseDataValueText.class); - mappings.put("SignatureRequestResponseDataValueTextMerge", SignatureRequestResponseDataValueTextMerge.class); - mappings.put("checkbox", SignatureRequestResponseDataValueCheckbox.class); - mappings.put("checkbox-merge", SignatureRequestResponseDataValueCheckboxMerge.class); - mappings.put("date_signed", SignatureRequestResponseDataValueDateSigned.class); - mappings.put("dropdown", SignatureRequestResponseDataValueDropdown.class); - mappings.put("initials", SignatureRequestResponseDataValueInitials.class); - mappings.put("radio", SignatureRequestResponseDataValueRadio.class); - mappings.put("signature", SignatureRequestResponseDataValueSignature.class); - mappings.put("text", SignatureRequestResponseDataValueText.class); - mappings.put("text-merge", SignatureRequestResponseDataValueTextMerge.class); - mappings.put("SignatureRequestResponseDataBase", SignatureRequestResponseDataBase.class); - JSON.registerDiscriminator(SignatureRequestResponseDataBase.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("checkbox", SignatureRequestResponseDataValueCheckbox.class); + mappings.put("checkbox-merge", SignatureRequestResponseDataValueCheckboxMerge.class); + mappings.put("date_signed", SignatureRequestResponseDataValueDateSigned.class); + mappings.put("dropdown", SignatureRequestResponseDataValueDropdown.class); + mappings.put("initials", SignatureRequestResponseDataValueInitials.class); + mappings.put("radio", SignatureRequestResponseDataValueRadio.class); + mappings.put("signature", SignatureRequestResponseDataValueSignature.class); + mappings.put("text", SignatureRequestResponseDataValueText.class); + mappings.put("text-merge", SignatureRequestResponseDataValueTextMerge.class); + mappings.put("SignatureRequestResponseDataBase", SignatureRequestResponseDataBase.class); + JSON.registerDiscriminator(SignatureRequestResponseDataBase.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataTypeEnum.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataTypeEnum.java index e7c32b9..b2e6295 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataTypeEnum.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataTypeEnum.java @@ -14,13 +14,12 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; 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.JSON; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueCheckbox.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueCheckbox.java index f524a6b..ef3a930 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueCheckbox.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueCheckbox.java @@ -14,19 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SignatureRequestResponseDataBase; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckbox; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckboxMerge; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDateSigned; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDropdown; -import com.dropbox.sign.model.SignatureRequestResponseDataValueInitials; -import com.dropbox.sign.model.SignatureRequestResponseDataValueRadio; -import com.dropbox.sign.model.SignatureRequestResponseDataValueSignature; -import com.dropbox.sign.model.SignatureRequestResponseDataValueText; -import com.dropbox.sign.model.SignatureRequestResponseDataValueTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -34,12 +25,11 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -47,23 +37,15 @@ * SignatureRequestResponseDataValueCheckbox */ @JsonPropertyOrder({ - SignatureRequestResponseDataValueCheckbox.JSON_PROPERTY_TYPE, - SignatureRequestResponseDataValueCheckbox.JSON_PROPERTY_VALUE + SignatureRequestResponseDataValueCheckbox.JSON_PROPERTY_TYPE, + SignatureRequestResponseDataValueCheckbox.JSON_PROPERTY_VALUE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueText.class, name = "text"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueTextMerge.class, name = "text-merge"), -}) public class SignatureRequestResponseDataValueCheckbox extends SignatureRequestResponseDataBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -95,12 +77,11 @@ public SignatureRequestResponseDataValueCheckbox type(String type) { return this; } - /** + /** * A yes/no checkbox * @return type - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A yes/no checkbox") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -121,12 +102,11 @@ public SignatureRequestResponseDataValueCheckbox value(Boolean value) { return this; } - /** + /** * The value of the form field. * @return value - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The value of the form field.") @JsonProperty(JSON_PROPERTY_VALUE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -256,20 +236,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SignatureRequestResponseDataValueCheckbox.class); - mappings.put("checkbox-merge", SignatureRequestResponseDataValueCheckboxMerge.class); - mappings.put("date_signed", SignatureRequestResponseDataValueDateSigned.class); - mappings.put("dropdown", SignatureRequestResponseDataValueDropdown.class); - mappings.put("initials", SignatureRequestResponseDataValueInitials.class); - mappings.put("radio", SignatureRequestResponseDataValueRadio.class); - mappings.put("signature", SignatureRequestResponseDataValueSignature.class); - mappings.put("text", SignatureRequestResponseDataValueText.class); - mappings.put("text-merge", SignatureRequestResponseDataValueTextMerge.class); - mappings.put("SignatureRequestResponseDataValueCheckbox", SignatureRequestResponseDataValueCheckbox.class); - JSON.registerDiscriminator(SignatureRequestResponseDataValueCheckbox.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SignatureRequestResponseDataValueCheckbox", SignatureRequestResponseDataValueCheckbox.class); + JSON.registerDiscriminator(SignatureRequestResponseDataValueCheckbox.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueCheckboxMerge.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueCheckboxMerge.java index 18ba380..7fafbf2 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueCheckboxMerge.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueCheckboxMerge.java @@ -14,19 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SignatureRequestResponseDataBase; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckbox; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckboxMerge; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDateSigned; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDropdown; -import com.dropbox.sign.model.SignatureRequestResponseDataValueInitials; -import com.dropbox.sign.model.SignatureRequestResponseDataValueRadio; -import com.dropbox.sign.model.SignatureRequestResponseDataValueSignature; -import com.dropbox.sign.model.SignatureRequestResponseDataValueText; -import com.dropbox.sign.model.SignatureRequestResponseDataValueTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -34,12 +25,11 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -47,23 +37,15 @@ * SignatureRequestResponseDataValueCheckboxMerge */ @JsonPropertyOrder({ - SignatureRequestResponseDataValueCheckboxMerge.JSON_PROPERTY_TYPE, - SignatureRequestResponseDataValueCheckboxMerge.JSON_PROPERTY_VALUE + SignatureRequestResponseDataValueCheckboxMerge.JSON_PROPERTY_TYPE, + SignatureRequestResponseDataValueCheckboxMerge.JSON_PROPERTY_VALUE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueText.class, name = "text"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueTextMerge.class, name = "text-merge"), -}) public class SignatureRequestResponseDataValueCheckboxMerge extends SignatureRequestResponseDataBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -95,12 +77,11 @@ public SignatureRequestResponseDataValueCheckboxMerge type(String type) { return this; } - /** + /** * A checkbox field that has default value set by the api * @return type - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A checkbox field that has default value set by the api") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -121,12 +102,11 @@ public SignatureRequestResponseDataValueCheckboxMerge value(String value) { return this; } - /** + /** * The value of the form field. * @return value - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The value of the form field.") @JsonProperty(JSON_PROPERTY_VALUE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -256,20 +236,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SignatureRequestResponseDataValueCheckbox.class); - mappings.put("checkbox-merge", SignatureRequestResponseDataValueCheckboxMerge.class); - mappings.put("date_signed", SignatureRequestResponseDataValueDateSigned.class); - mappings.put("dropdown", SignatureRequestResponseDataValueDropdown.class); - mappings.put("initials", SignatureRequestResponseDataValueInitials.class); - mappings.put("radio", SignatureRequestResponseDataValueRadio.class); - mappings.put("signature", SignatureRequestResponseDataValueSignature.class); - mappings.put("text", SignatureRequestResponseDataValueText.class); - mappings.put("text-merge", SignatureRequestResponseDataValueTextMerge.class); - mappings.put("SignatureRequestResponseDataValueCheckboxMerge", SignatureRequestResponseDataValueCheckboxMerge.class); - JSON.registerDiscriminator(SignatureRequestResponseDataValueCheckboxMerge.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SignatureRequestResponseDataValueCheckboxMerge", SignatureRequestResponseDataValueCheckboxMerge.class); + JSON.registerDiscriminator(SignatureRequestResponseDataValueCheckboxMerge.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueDateSigned.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueDateSigned.java index 466f0fe..bbd474a 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueDateSigned.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueDateSigned.java @@ -14,19 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SignatureRequestResponseDataBase; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckbox; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckboxMerge; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDateSigned; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDropdown; -import com.dropbox.sign.model.SignatureRequestResponseDataValueInitials; -import com.dropbox.sign.model.SignatureRequestResponseDataValueRadio; -import com.dropbox.sign.model.SignatureRequestResponseDataValueSignature; -import com.dropbox.sign.model.SignatureRequestResponseDataValueText; -import com.dropbox.sign.model.SignatureRequestResponseDataValueTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -34,12 +25,11 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -47,23 +37,15 @@ * SignatureRequestResponseDataValueDateSigned */ @JsonPropertyOrder({ - SignatureRequestResponseDataValueDateSigned.JSON_PROPERTY_TYPE, - SignatureRequestResponseDataValueDateSigned.JSON_PROPERTY_VALUE + SignatureRequestResponseDataValueDateSigned.JSON_PROPERTY_TYPE, + SignatureRequestResponseDataValueDateSigned.JSON_PROPERTY_VALUE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueText.class, name = "text"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueTextMerge.class, name = "text-merge"), -}) public class SignatureRequestResponseDataValueDateSigned extends SignatureRequestResponseDataBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -95,12 +77,11 @@ public SignatureRequestResponseDataValueDateSigned type(String type) { return this; } - /** + /** * A date * @return type - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A date") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -121,12 +102,11 @@ public SignatureRequestResponseDataValueDateSigned value(String value) { return this; } - /** + /** * The value of the form field. * @return value - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The value of the form field.") @JsonProperty(JSON_PROPERTY_VALUE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -256,20 +236,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SignatureRequestResponseDataValueCheckbox.class); - mappings.put("checkbox-merge", SignatureRequestResponseDataValueCheckboxMerge.class); - mappings.put("date_signed", SignatureRequestResponseDataValueDateSigned.class); - mappings.put("dropdown", SignatureRequestResponseDataValueDropdown.class); - mappings.put("initials", SignatureRequestResponseDataValueInitials.class); - mappings.put("radio", SignatureRequestResponseDataValueRadio.class); - mappings.put("signature", SignatureRequestResponseDataValueSignature.class); - mappings.put("text", SignatureRequestResponseDataValueText.class); - mappings.put("text-merge", SignatureRequestResponseDataValueTextMerge.class); - mappings.put("SignatureRequestResponseDataValueDateSigned", SignatureRequestResponseDataValueDateSigned.class); - JSON.registerDiscriminator(SignatureRequestResponseDataValueDateSigned.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SignatureRequestResponseDataValueDateSigned", SignatureRequestResponseDataValueDateSigned.class); + JSON.registerDiscriminator(SignatureRequestResponseDataValueDateSigned.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueDropdown.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueDropdown.java index 4f26d9b..f8cf79d 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueDropdown.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueDropdown.java @@ -14,19 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SignatureRequestResponseDataBase; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckbox; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckboxMerge; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDateSigned; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDropdown; -import com.dropbox.sign.model.SignatureRequestResponseDataValueInitials; -import com.dropbox.sign.model.SignatureRequestResponseDataValueRadio; -import com.dropbox.sign.model.SignatureRequestResponseDataValueSignature; -import com.dropbox.sign.model.SignatureRequestResponseDataValueText; -import com.dropbox.sign.model.SignatureRequestResponseDataValueTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -34,12 +25,11 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -47,23 +37,15 @@ * SignatureRequestResponseDataValueDropdown */ @JsonPropertyOrder({ - SignatureRequestResponseDataValueDropdown.JSON_PROPERTY_TYPE, - SignatureRequestResponseDataValueDropdown.JSON_PROPERTY_VALUE + SignatureRequestResponseDataValueDropdown.JSON_PROPERTY_TYPE, + SignatureRequestResponseDataValueDropdown.JSON_PROPERTY_VALUE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueText.class, name = "text"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueTextMerge.class, name = "text-merge"), -}) public class SignatureRequestResponseDataValueDropdown extends SignatureRequestResponseDataBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -95,12 +77,11 @@ public SignatureRequestResponseDataValueDropdown type(String type) { return this; } - /** + /** * An input field for dropdowns * @return type - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An input field for dropdowns") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -121,12 +102,11 @@ public SignatureRequestResponseDataValueDropdown value(String value) { return this; } - /** + /** * The value of the form field. * @return value - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The value of the form field.") @JsonProperty(JSON_PROPERTY_VALUE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -256,20 +236,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SignatureRequestResponseDataValueCheckbox.class); - mappings.put("checkbox-merge", SignatureRequestResponseDataValueCheckboxMerge.class); - mappings.put("date_signed", SignatureRequestResponseDataValueDateSigned.class); - mappings.put("dropdown", SignatureRequestResponseDataValueDropdown.class); - mappings.put("initials", SignatureRequestResponseDataValueInitials.class); - mappings.put("radio", SignatureRequestResponseDataValueRadio.class); - mappings.put("signature", SignatureRequestResponseDataValueSignature.class); - mappings.put("text", SignatureRequestResponseDataValueText.class); - mappings.put("text-merge", SignatureRequestResponseDataValueTextMerge.class); - mappings.put("SignatureRequestResponseDataValueDropdown", SignatureRequestResponseDataValueDropdown.class); - JSON.registerDiscriminator(SignatureRequestResponseDataValueDropdown.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SignatureRequestResponseDataValueDropdown", SignatureRequestResponseDataValueDropdown.class); + JSON.registerDiscriminator(SignatureRequestResponseDataValueDropdown.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueInitials.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueInitials.java index be73734..9fca409 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueInitials.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueInitials.java @@ -14,19 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SignatureRequestResponseDataBase; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckbox; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckboxMerge; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDateSigned; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDropdown; -import com.dropbox.sign.model.SignatureRequestResponseDataValueInitials; -import com.dropbox.sign.model.SignatureRequestResponseDataValueRadio; -import com.dropbox.sign.model.SignatureRequestResponseDataValueSignature; -import com.dropbox.sign.model.SignatureRequestResponseDataValueText; -import com.dropbox.sign.model.SignatureRequestResponseDataValueTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -34,12 +25,11 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -47,23 +37,15 @@ * SignatureRequestResponseDataValueInitials */ @JsonPropertyOrder({ - SignatureRequestResponseDataValueInitials.JSON_PROPERTY_TYPE, - SignatureRequestResponseDataValueInitials.JSON_PROPERTY_VALUE + SignatureRequestResponseDataValueInitials.JSON_PROPERTY_TYPE, + SignatureRequestResponseDataValueInitials.JSON_PROPERTY_VALUE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueText.class, name = "text"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueTextMerge.class, name = "text-merge"), -}) public class SignatureRequestResponseDataValueInitials extends SignatureRequestResponseDataBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -95,12 +77,11 @@ public SignatureRequestResponseDataValueInitials type(String type) { return this; } - /** + /** * An input field for initials * @return type - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An input field for initials") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -121,12 +102,11 @@ public SignatureRequestResponseDataValueInitials value(String value) { return this; } - /** + /** * The value of the form field. * @return value - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The value of the form field.") @JsonProperty(JSON_PROPERTY_VALUE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -256,20 +236,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SignatureRequestResponseDataValueCheckbox.class); - mappings.put("checkbox-merge", SignatureRequestResponseDataValueCheckboxMerge.class); - mappings.put("date_signed", SignatureRequestResponseDataValueDateSigned.class); - mappings.put("dropdown", SignatureRequestResponseDataValueDropdown.class); - mappings.put("initials", SignatureRequestResponseDataValueInitials.class); - mappings.put("radio", SignatureRequestResponseDataValueRadio.class); - mappings.put("signature", SignatureRequestResponseDataValueSignature.class); - mappings.put("text", SignatureRequestResponseDataValueText.class); - mappings.put("text-merge", SignatureRequestResponseDataValueTextMerge.class); - mappings.put("SignatureRequestResponseDataValueInitials", SignatureRequestResponseDataValueInitials.class); - JSON.registerDiscriminator(SignatureRequestResponseDataValueInitials.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SignatureRequestResponseDataValueInitials", SignatureRequestResponseDataValueInitials.class); + JSON.registerDiscriminator(SignatureRequestResponseDataValueInitials.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueRadio.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueRadio.java index a7b76b6..e5bce3d 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueRadio.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueRadio.java @@ -14,19 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SignatureRequestResponseDataBase; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckbox; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckboxMerge; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDateSigned; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDropdown; -import com.dropbox.sign.model.SignatureRequestResponseDataValueInitials; -import com.dropbox.sign.model.SignatureRequestResponseDataValueRadio; -import com.dropbox.sign.model.SignatureRequestResponseDataValueSignature; -import com.dropbox.sign.model.SignatureRequestResponseDataValueText; -import com.dropbox.sign.model.SignatureRequestResponseDataValueTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -34,12 +25,11 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -47,23 +37,15 @@ * SignatureRequestResponseDataValueRadio */ @JsonPropertyOrder({ - SignatureRequestResponseDataValueRadio.JSON_PROPERTY_TYPE, - SignatureRequestResponseDataValueRadio.JSON_PROPERTY_VALUE + SignatureRequestResponseDataValueRadio.JSON_PROPERTY_TYPE, + SignatureRequestResponseDataValueRadio.JSON_PROPERTY_VALUE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueText.class, name = "text"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueTextMerge.class, name = "text-merge"), -}) public class SignatureRequestResponseDataValueRadio extends SignatureRequestResponseDataBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -95,12 +77,11 @@ public SignatureRequestResponseDataValueRadio type(String type) { return this; } - /** + /** * An input field for radios * @return type - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An input field for radios") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -121,12 +102,11 @@ public SignatureRequestResponseDataValueRadio value(Boolean value) { return this; } - /** + /** * The value of the form field. * @return value - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The value of the form field.") @JsonProperty(JSON_PROPERTY_VALUE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -256,20 +236,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SignatureRequestResponseDataValueCheckbox.class); - mappings.put("checkbox-merge", SignatureRequestResponseDataValueCheckboxMerge.class); - mappings.put("date_signed", SignatureRequestResponseDataValueDateSigned.class); - mappings.put("dropdown", SignatureRequestResponseDataValueDropdown.class); - mappings.put("initials", SignatureRequestResponseDataValueInitials.class); - mappings.put("radio", SignatureRequestResponseDataValueRadio.class); - mappings.put("signature", SignatureRequestResponseDataValueSignature.class); - mappings.put("text", SignatureRequestResponseDataValueText.class); - mappings.put("text-merge", SignatureRequestResponseDataValueTextMerge.class); - mappings.put("SignatureRequestResponseDataValueRadio", SignatureRequestResponseDataValueRadio.class); - JSON.registerDiscriminator(SignatureRequestResponseDataValueRadio.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SignatureRequestResponseDataValueRadio", SignatureRequestResponseDataValueRadio.class); + JSON.registerDiscriminator(SignatureRequestResponseDataValueRadio.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueSignature.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueSignature.java index 7510c3f..228d800 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueSignature.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueSignature.java @@ -14,19 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SignatureRequestResponseDataBase; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckbox; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckboxMerge; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDateSigned; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDropdown; -import com.dropbox.sign.model.SignatureRequestResponseDataValueInitials; -import com.dropbox.sign.model.SignatureRequestResponseDataValueRadio; -import com.dropbox.sign.model.SignatureRequestResponseDataValueSignature; -import com.dropbox.sign.model.SignatureRequestResponseDataValueText; -import com.dropbox.sign.model.SignatureRequestResponseDataValueTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -34,12 +25,11 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -47,23 +37,15 @@ * SignatureRequestResponseDataValueSignature */ @JsonPropertyOrder({ - SignatureRequestResponseDataValueSignature.JSON_PROPERTY_TYPE, - SignatureRequestResponseDataValueSignature.JSON_PROPERTY_VALUE + SignatureRequestResponseDataValueSignature.JSON_PROPERTY_TYPE, + SignatureRequestResponseDataValueSignature.JSON_PROPERTY_VALUE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueText.class, name = "text"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueTextMerge.class, name = "text-merge"), -}) public class SignatureRequestResponseDataValueSignature extends SignatureRequestResponseDataBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -95,12 +77,11 @@ public SignatureRequestResponseDataValueSignature type(String type) { return this; } - /** + /** * A signature input field * @return type - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A signature input field") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -121,12 +102,11 @@ public SignatureRequestResponseDataValueSignature value(String value) { return this; } - /** + /** * The value of the form field. * @return value - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The value of the form field.") @JsonProperty(JSON_PROPERTY_VALUE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -256,20 +236,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SignatureRequestResponseDataValueCheckbox.class); - mappings.put("checkbox-merge", SignatureRequestResponseDataValueCheckboxMerge.class); - mappings.put("date_signed", SignatureRequestResponseDataValueDateSigned.class); - mappings.put("dropdown", SignatureRequestResponseDataValueDropdown.class); - mappings.put("initials", SignatureRequestResponseDataValueInitials.class); - mappings.put("radio", SignatureRequestResponseDataValueRadio.class); - mappings.put("signature", SignatureRequestResponseDataValueSignature.class); - mappings.put("text", SignatureRequestResponseDataValueText.class); - mappings.put("text-merge", SignatureRequestResponseDataValueTextMerge.class); - mappings.put("SignatureRequestResponseDataValueSignature", SignatureRequestResponseDataValueSignature.class); - JSON.registerDiscriminator(SignatureRequestResponseDataValueSignature.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SignatureRequestResponseDataValueSignature", SignatureRequestResponseDataValueSignature.class); + JSON.registerDiscriminator(SignatureRequestResponseDataValueSignature.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueText.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueText.java index e9d28a0..fa15216 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueText.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueText.java @@ -14,19 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SignatureRequestResponseDataBase; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckbox; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckboxMerge; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDateSigned; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDropdown; -import com.dropbox.sign.model.SignatureRequestResponseDataValueInitials; -import com.dropbox.sign.model.SignatureRequestResponseDataValueRadio; -import com.dropbox.sign.model.SignatureRequestResponseDataValueSignature; -import com.dropbox.sign.model.SignatureRequestResponseDataValueText; -import com.dropbox.sign.model.SignatureRequestResponseDataValueTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -34,12 +25,11 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -47,23 +37,15 @@ * SignatureRequestResponseDataValueText */ @JsonPropertyOrder({ - SignatureRequestResponseDataValueText.JSON_PROPERTY_TYPE, - SignatureRequestResponseDataValueText.JSON_PROPERTY_VALUE + SignatureRequestResponseDataValueText.JSON_PROPERTY_TYPE, + SignatureRequestResponseDataValueText.JSON_PROPERTY_VALUE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueText.class, name = "text"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueTextMerge.class, name = "text-merge"), -}) public class SignatureRequestResponseDataValueText extends SignatureRequestResponseDataBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -95,12 +77,11 @@ public SignatureRequestResponseDataValueText type(String type) { return this; } - /** + /** * A text input field * @return type - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A text input field") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -121,12 +102,11 @@ public SignatureRequestResponseDataValueText value(String value) { return this; } - /** + /** * The value of the form field. * @return value - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The value of the form field.") @JsonProperty(JSON_PROPERTY_VALUE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -256,20 +236,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SignatureRequestResponseDataValueCheckbox.class); - mappings.put("checkbox-merge", SignatureRequestResponseDataValueCheckboxMerge.class); - mappings.put("date_signed", SignatureRequestResponseDataValueDateSigned.class); - mappings.put("dropdown", SignatureRequestResponseDataValueDropdown.class); - mappings.put("initials", SignatureRequestResponseDataValueInitials.class); - mappings.put("radio", SignatureRequestResponseDataValueRadio.class); - mappings.put("signature", SignatureRequestResponseDataValueSignature.class); - mappings.put("text", SignatureRequestResponseDataValueText.class); - mappings.put("text-merge", SignatureRequestResponseDataValueTextMerge.class); - mappings.put("SignatureRequestResponseDataValueText", SignatureRequestResponseDataValueText.class); - JSON.registerDiscriminator(SignatureRequestResponseDataValueText.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SignatureRequestResponseDataValueText", SignatureRequestResponseDataValueText.class); + JSON.registerDiscriminator(SignatureRequestResponseDataValueText.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueTextMerge.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueTextMerge.java index e73bb32..9ba6578 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueTextMerge.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseDataValueTextMerge.java @@ -14,19 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SignatureRequestResponseDataBase; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckbox; -import com.dropbox.sign.model.SignatureRequestResponseDataValueCheckboxMerge; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDateSigned; -import com.dropbox.sign.model.SignatureRequestResponseDataValueDropdown; -import com.dropbox.sign.model.SignatureRequestResponseDataValueInitials; -import com.dropbox.sign.model.SignatureRequestResponseDataValueRadio; -import com.dropbox.sign.model.SignatureRequestResponseDataValueSignature; -import com.dropbox.sign.model.SignatureRequestResponseDataValueText; -import com.dropbox.sign.model.SignatureRequestResponseDataValueTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -34,12 +25,11 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -47,23 +37,15 @@ * SignatureRequestResponseDataValueTextMerge */ @JsonPropertyOrder({ - SignatureRequestResponseDataValueTextMerge.JSON_PROPERTY_TYPE, - SignatureRequestResponseDataValueTextMerge.JSON_PROPERTY_VALUE + SignatureRequestResponseDataValueTextMerge.JSON_PROPERTY_TYPE, + SignatureRequestResponseDataValueTextMerge.JSON_PROPERTY_VALUE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueText.class, name = "text"), - @JsonSubTypes.Type(value = SignatureRequestResponseDataValueTextMerge.class, name = "text-merge"), -}) public class SignatureRequestResponseDataValueTextMerge extends SignatureRequestResponseDataBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -95,12 +77,11 @@ public SignatureRequestResponseDataValueTextMerge type(String type) { return this; } - /** + /** * A text field that has default text set by the api * @return type - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A text field that has default text set by the api") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -121,12 +102,11 @@ public SignatureRequestResponseDataValueTextMerge value(String value) { return this; } - /** + /** * The value of the form field. * @return value - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The value of the form field.") @JsonProperty(JSON_PROPERTY_VALUE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -256,20 +236,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SignatureRequestResponseDataValueCheckbox.class); - mappings.put("checkbox-merge", SignatureRequestResponseDataValueCheckboxMerge.class); - mappings.put("date_signed", SignatureRequestResponseDataValueDateSigned.class); - mappings.put("dropdown", SignatureRequestResponseDataValueDropdown.class); - mappings.put("initials", SignatureRequestResponseDataValueInitials.class); - mappings.put("radio", SignatureRequestResponseDataValueRadio.class); - mappings.put("signature", SignatureRequestResponseDataValueSignature.class); - mappings.put("text", SignatureRequestResponseDataValueText.class); - mappings.put("text-merge", SignatureRequestResponseDataValueTextMerge.class); - mappings.put("SignatureRequestResponseDataValueTextMerge", SignatureRequestResponseDataValueTextMerge.class); - JSON.registerDiscriminator(SignatureRequestResponseDataValueTextMerge.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SignatureRequestResponseDataValueTextMerge", SignatureRequestResponseDataValueTextMerge.class); + JSON.registerDiscriminator(SignatureRequestResponseDataValueTextMerge.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseSignatures.java b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseSignatures.java index 40781d9..ea70c95 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestResponseSignatures.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestResponseSignatures.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,42 +21,40 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * An array of signature objects, 1 for each signer. */ -@ApiModel(description = "An array of signature objects, 1 for each signer.") @JsonPropertyOrder({ - SignatureRequestResponseSignatures.JSON_PROPERTY_SIGNATURE_ID, - SignatureRequestResponseSignatures.JSON_PROPERTY_SIGNER_GROUP_GUID, - SignatureRequestResponseSignatures.JSON_PROPERTY_SIGNER_EMAIL_ADDRESS, - SignatureRequestResponseSignatures.JSON_PROPERTY_SIGNER_NAME, - SignatureRequestResponseSignatures.JSON_PROPERTY_SIGNER_ROLE, - SignatureRequestResponseSignatures.JSON_PROPERTY_ORDER, - SignatureRequestResponseSignatures.JSON_PROPERTY_STATUS_CODE, - SignatureRequestResponseSignatures.JSON_PROPERTY_DECLINE_REASON, - SignatureRequestResponseSignatures.JSON_PROPERTY_SIGNED_AT, - SignatureRequestResponseSignatures.JSON_PROPERTY_LAST_VIEWED_AT, - SignatureRequestResponseSignatures.JSON_PROPERTY_LAST_REMINDED_AT, - SignatureRequestResponseSignatures.JSON_PROPERTY_HAS_PIN, - SignatureRequestResponseSignatures.JSON_PROPERTY_HAS_SMS_AUTH, - SignatureRequestResponseSignatures.JSON_PROPERTY_HAS_SMS_DELIVERY, - SignatureRequestResponseSignatures.JSON_PROPERTY_SMS_PHONE_NUMBER, - SignatureRequestResponseSignatures.JSON_PROPERTY_REASSIGNED_BY, - SignatureRequestResponseSignatures.JSON_PROPERTY_REASSIGNMENT_REASON, - SignatureRequestResponseSignatures.JSON_PROPERTY_REASSIGNED_FROM, - SignatureRequestResponseSignatures.JSON_PROPERTY_ERROR + SignatureRequestResponseSignatures.JSON_PROPERTY_SIGNATURE_ID, + SignatureRequestResponseSignatures.JSON_PROPERTY_SIGNER_GROUP_GUID, + SignatureRequestResponseSignatures.JSON_PROPERTY_SIGNER_EMAIL_ADDRESS, + SignatureRequestResponseSignatures.JSON_PROPERTY_SIGNER_NAME, + SignatureRequestResponseSignatures.JSON_PROPERTY_SIGNER_ROLE, + SignatureRequestResponseSignatures.JSON_PROPERTY_ORDER, + SignatureRequestResponseSignatures.JSON_PROPERTY_STATUS_CODE, + SignatureRequestResponseSignatures.JSON_PROPERTY_DECLINE_REASON, + SignatureRequestResponseSignatures.JSON_PROPERTY_SIGNED_AT, + SignatureRequestResponseSignatures.JSON_PROPERTY_LAST_VIEWED_AT, + SignatureRequestResponseSignatures.JSON_PROPERTY_LAST_REMINDED_AT, + SignatureRequestResponseSignatures.JSON_PROPERTY_HAS_PIN, + SignatureRequestResponseSignatures.JSON_PROPERTY_HAS_SMS_AUTH, + SignatureRequestResponseSignatures.JSON_PROPERTY_HAS_SMS_DELIVERY, + SignatureRequestResponseSignatures.JSON_PROPERTY_SMS_PHONE_NUMBER, + SignatureRequestResponseSignatures.JSON_PROPERTY_REASSIGNED_BY, + SignatureRequestResponseSignatures.JSON_PROPERTY_REASSIGNMENT_REASON, + SignatureRequestResponseSignatures.JSON_PROPERTY_REASSIGNED_FROM, + SignatureRequestResponseSignatures.JSON_PROPERTY_ERROR }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SignatureRequestResponseSignatures { public static final String JSON_PROPERTY_SIGNATURE_ID = "signature_id"; private String signatureId; @@ -139,12 +136,11 @@ public SignatureRequestResponseSignatures signatureId(String signatureId) { return this; } - /** + /** * Signature identifier. * @return signatureId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Signature identifier.") @JsonProperty(JSON_PROPERTY_SIGNATURE_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -165,12 +161,11 @@ public SignatureRequestResponseSignatures signerGroupGuid(String signerGroupGuid return this; } - /** + /** * Signer Group GUID * @return signerGroupGuid - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Signer Group GUID") @JsonProperty(JSON_PROPERTY_SIGNER_GROUP_GUID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -191,12 +186,11 @@ public SignatureRequestResponseSignatures signerEmailAddress(String signerEmailA return this; } - /** + /** * The email address of the signer. * @return signerEmailAddress - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The email address of the signer.") @JsonProperty(JSON_PROPERTY_SIGNER_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -217,12 +211,11 @@ public SignatureRequestResponseSignatures signerName(String signerName) { return this; } - /** + /** * The name of the signer. * @return signerName - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the signer.") @JsonProperty(JSON_PROPERTY_SIGNER_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -243,12 +236,11 @@ public SignatureRequestResponseSignatures signerRole(String signerRole) { return this; } - /** + /** * The role of the signer. * @return signerRole - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The role of the signer.") @JsonProperty(JSON_PROPERTY_SIGNER_ROLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -269,12 +261,11 @@ public SignatureRequestResponseSignatures order(Integer order) { return this; } - /** + /** * If signer order is assigned this is the 0-based index for this signer. * @return order - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "If signer order is assigned this is the 0-based index for this signer.") @JsonProperty(JSON_PROPERTY_ORDER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -295,12 +286,11 @@ public SignatureRequestResponseSignatures statusCode(String statusCode) { return this; } - /** + /** * The current status of the signature. eg: awaiting_signature, signed, declined. * @return statusCode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The current status of the signature. eg: awaiting_signature, signed, declined.") @JsonProperty(JSON_PROPERTY_STATUS_CODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -321,12 +311,11 @@ public SignatureRequestResponseSignatures declineReason(String declineReason) { return this; } - /** + /** * The reason provided by the signer for declining the request. * @return declineReason - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The reason provided by the signer for declining the request.") @JsonProperty(JSON_PROPERTY_DECLINE_REASON) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -347,12 +336,11 @@ public SignatureRequestResponseSignatures signedAt(Integer signedAt) { return this; } - /** + /** * Time that the document was signed or null. * @return signedAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Time that the document was signed or null.") @JsonProperty(JSON_PROPERTY_SIGNED_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -373,12 +361,11 @@ public SignatureRequestResponseSignatures lastViewedAt(Integer lastViewedAt) { return this; } - /** + /** * The time that the document was last viewed by this signer or null. * @return lastViewedAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The time that the document was last viewed by this signer or null.") @JsonProperty(JSON_PROPERTY_LAST_VIEWED_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -399,12 +386,11 @@ public SignatureRequestResponseSignatures lastRemindedAt(Integer lastRemindedAt) return this; } - /** + /** * The time the last reminder email was sent to the signer or null. * @return lastRemindedAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The time the last reminder email was sent to the signer or null.") @JsonProperty(JSON_PROPERTY_LAST_REMINDED_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -425,12 +411,11 @@ public SignatureRequestResponseSignatures hasPin(Boolean hasPin) { return this; } - /** + /** * Boolean to indicate whether this signature requires a PIN to access. * @return hasPin - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Boolean to indicate whether this signature requires a PIN to access.") @JsonProperty(JSON_PROPERTY_HAS_PIN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -451,12 +436,11 @@ public SignatureRequestResponseSignatures hasSmsAuth(Boolean hasSmsAuth) { return this; } - /** + /** * Boolean to indicate whether this signature has SMS authentication enabled. * @return hasSmsAuth - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Boolean to indicate whether this signature has SMS authentication enabled.") @JsonProperty(JSON_PROPERTY_HAS_SMS_AUTH) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -477,12 +461,11 @@ public SignatureRequestResponseSignatures hasSmsDelivery(Boolean hasSmsDelivery) return this; } - /** + /** * Boolean to indicate whether this signature has SMS delivery enabled. * @return hasSmsDelivery - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Boolean to indicate whether this signature has SMS delivery enabled.") @JsonProperty(JSON_PROPERTY_HAS_SMS_DELIVERY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -503,12 +486,11 @@ public SignatureRequestResponseSignatures smsPhoneNumber(String smsPhoneNumber) return this; } - /** + /** * The SMS phone number used for authentication or signature request delivery. * @return smsPhoneNumber - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The SMS phone number used for authentication or signature request delivery.") @JsonProperty(JSON_PROPERTY_SMS_PHONE_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -529,12 +511,11 @@ public SignatureRequestResponseSignatures reassignedBy(String reassignedBy) { return this; } - /** + /** * Email address of original signer who reassigned to this signer. * @return reassignedBy - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Email address of original signer who reassigned to this signer.") @JsonProperty(JSON_PROPERTY_REASSIGNED_BY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -555,12 +536,11 @@ public SignatureRequestResponseSignatures reassignmentReason(String reassignment return this; } - /** + /** * Reason provided by original signer who reassigned to this signer. * @return reassignmentReason - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Reason provided by original signer who reassigned to this signer.") @JsonProperty(JSON_PROPERTY_REASSIGNMENT_REASON) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -581,12 +561,11 @@ public SignatureRequestResponseSignatures reassignedFrom(String reassignedFrom) return this; } - /** + /** * Previous signature identifier. * @return reassignedFrom - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Previous signature identifier.") @JsonProperty(JSON_PROPERTY_REASSIGNED_FROM) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -607,12 +586,11 @@ public SignatureRequestResponseSignatures error(String error) { return this; } - /** + /** * Error message pertaining to this signer, or null. * @return error - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Error message pertaining to this signer, or null.") @JsonProperty(JSON_PROPERTY_ERROR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestSendRequest.java b/src/main/java/com/dropbox/sign/model/SignatureRequestSendRequest.java index 3b1a43d..db6fcd4 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestSendRequest.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestSendRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubAttachment; @@ -31,17 +30,16 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; 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.JSON; import com.dropbox.sign.ApiException; @@ -49,35 +47,35 @@ * SignatureRequestSendRequest */ @JsonPropertyOrder({ - SignatureRequestSendRequest.JSON_PROPERTY_FILES, - SignatureRequestSendRequest.JSON_PROPERTY_FILE_URLS, - SignatureRequestSendRequest.JSON_PROPERTY_SIGNERS, - SignatureRequestSendRequest.JSON_PROPERTY_GROUPED_SIGNERS, - SignatureRequestSendRequest.JSON_PROPERTY_ALLOW_DECLINE, - SignatureRequestSendRequest.JSON_PROPERTY_ALLOW_REASSIGN, - SignatureRequestSendRequest.JSON_PROPERTY_ATTACHMENTS, - SignatureRequestSendRequest.JSON_PROPERTY_CC_EMAIL_ADDRESSES, - SignatureRequestSendRequest.JSON_PROPERTY_CLIENT_ID, - SignatureRequestSendRequest.JSON_PROPERTY_CUSTOM_FIELDS, - SignatureRequestSendRequest.JSON_PROPERTY_FIELD_OPTIONS, - SignatureRequestSendRequest.JSON_PROPERTY_FORM_FIELD_GROUPS, - SignatureRequestSendRequest.JSON_PROPERTY_FORM_FIELD_RULES, - SignatureRequestSendRequest.JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT, - SignatureRequestSendRequest.JSON_PROPERTY_HIDE_TEXT_TAGS, - SignatureRequestSendRequest.JSON_PROPERTY_IS_QUALIFIED_SIGNATURE, - SignatureRequestSendRequest.JSON_PROPERTY_IS_EID, - SignatureRequestSendRequest.JSON_PROPERTY_MESSAGE, - SignatureRequestSendRequest.JSON_PROPERTY_METADATA, - SignatureRequestSendRequest.JSON_PROPERTY_SIGNING_OPTIONS, - SignatureRequestSendRequest.JSON_PROPERTY_SIGNING_REDIRECT_URL, - SignatureRequestSendRequest.JSON_PROPERTY_SUBJECT, - SignatureRequestSendRequest.JSON_PROPERTY_TEST_MODE, - SignatureRequestSendRequest.JSON_PROPERTY_TITLE, - SignatureRequestSendRequest.JSON_PROPERTY_USE_TEXT_TAGS, - SignatureRequestSendRequest.JSON_PROPERTY_EXPIRES_AT + SignatureRequestSendRequest.JSON_PROPERTY_FILES, + SignatureRequestSendRequest.JSON_PROPERTY_FILE_URLS, + SignatureRequestSendRequest.JSON_PROPERTY_SIGNERS, + SignatureRequestSendRequest.JSON_PROPERTY_GROUPED_SIGNERS, + SignatureRequestSendRequest.JSON_PROPERTY_ALLOW_DECLINE, + SignatureRequestSendRequest.JSON_PROPERTY_ALLOW_REASSIGN, + SignatureRequestSendRequest.JSON_PROPERTY_ATTACHMENTS, + SignatureRequestSendRequest.JSON_PROPERTY_CC_EMAIL_ADDRESSES, + SignatureRequestSendRequest.JSON_PROPERTY_CLIENT_ID, + SignatureRequestSendRequest.JSON_PROPERTY_CUSTOM_FIELDS, + SignatureRequestSendRequest.JSON_PROPERTY_FIELD_OPTIONS, + SignatureRequestSendRequest.JSON_PROPERTY_FORM_FIELD_GROUPS, + SignatureRequestSendRequest.JSON_PROPERTY_FORM_FIELD_RULES, + SignatureRequestSendRequest.JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT, + SignatureRequestSendRequest.JSON_PROPERTY_HIDE_TEXT_TAGS, + SignatureRequestSendRequest.JSON_PROPERTY_IS_QUALIFIED_SIGNATURE, + SignatureRequestSendRequest.JSON_PROPERTY_IS_EID, + SignatureRequestSendRequest.JSON_PROPERTY_MESSAGE, + SignatureRequestSendRequest.JSON_PROPERTY_METADATA, + SignatureRequestSendRequest.JSON_PROPERTY_SIGNING_OPTIONS, + SignatureRequestSendRequest.JSON_PROPERTY_SIGNING_REDIRECT_URL, + SignatureRequestSendRequest.JSON_PROPERTY_SUBJECT, + SignatureRequestSendRequest.JSON_PROPERTY_TEST_MODE, + SignatureRequestSendRequest.JSON_PROPERTY_TITLE, + SignatureRequestSendRequest.JSON_PROPERTY_USE_TEXT_TAGS, + SignatureRequestSendRequest.JSON_PROPERTY_EXPIRES_AT }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SignatureRequestSendRequest { public static final String JSON_PROPERTY_FILES = "files"; private List files = null; @@ -125,6 +123,7 @@ public class SignatureRequestSendRequest { private Boolean hideTextTags = false; public static final String JSON_PROPERTY_IS_QUALIFIED_SIGNATURE = "is_qualified_signature"; + @Deprecated private Boolean isQualifiedSignature = false; public static final String JSON_PROPERTY_IS_EID = "is_eid"; @@ -188,12 +187,11 @@ public SignatureRequestSendRequest addFilesItem(File filesItem) { return this; } - /** + /** * Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both. * @return files - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -222,12 +220,11 @@ public SignatureRequestSendRequest addFileUrlsItem(String fileUrlsItem) { return this; } - /** + /** * Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both. * @return fileUrls - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILE_URLS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -256,12 +253,11 @@ public SignatureRequestSendRequest addSignersItem(SubSignatureRequestSigner sign return this; } - /** + /** * Add Signers to your Signature Request. This endpoint requires either **signers** or **grouped_signers**, but not both. * @return signers - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Add Signers to your Signature Request. This endpoint requires either **signers** or **grouped_signers**, but not both.") @JsonProperty(JSON_PROPERTY_SIGNERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -290,12 +286,11 @@ public SignatureRequestSendRequest addGroupedSignersItem(SubSignatureRequestGrou return this; } - /** + /** * Add Grouped Signers to your Signature Request. This endpoint requires either **signers** or **grouped_signers**, but not both. * @return groupedSigners - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Add Grouped Signers to your Signature Request. This endpoint requires either **signers** or **grouped_signers**, but not both.") @JsonProperty(JSON_PROPERTY_GROUPED_SIGNERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -316,12 +311,11 @@ public SignatureRequestSendRequest allowDecline(Boolean allowDecline) { return this; } - /** + /** * Allows signers to decline to sign a document if `true`. Defaults to `false`. * @return allowDecline - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows signers to decline to sign a document if `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_ALLOW_DECLINE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -342,12 +336,11 @@ public SignatureRequestSendRequest allowReassign(Boolean allowReassign) { return this; } - /** + /** * Allows signers to reassign their signature requests to other signers if set to `true`. Defaults to `false`. **NOTE:** Only available for Premium plan and higher. * @return allowReassign - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows signers to reassign their signature requests to other signers if set to `true`. Defaults to `false`. **NOTE:** Only available for Premium plan and higher.") @JsonProperty(JSON_PROPERTY_ALLOW_REASSIGN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -376,12 +369,11 @@ public SignatureRequestSendRequest addAttachmentsItem(SubAttachment attachmentsI return this; } - /** + /** * A list describing the attachments * @return attachments - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list describing the attachments") @JsonProperty(JSON_PROPERTY_ATTACHMENTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -410,12 +402,11 @@ public SignatureRequestSendRequest addCcEmailAddressesItem(String ccEmailAddress return this; } - /** + /** * The email addresses that should be CCed. * @return ccEmailAddresses - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The email addresses that should be CCed.") @JsonProperty(JSON_PROPERTY_CC_EMAIL_ADDRESSES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -436,12 +427,11 @@ public SignatureRequestSendRequest clientId(String clientId) { return this; } - /** + /** * The client id of the API App you want to associate with this request. Used to apply the branding and callback url defined for the app. * @return clientId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The client id of the API App you want to associate with this request. Used to apply the branding and callback url defined for the app.") @JsonProperty(JSON_PROPERTY_CLIENT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -470,12 +460,11 @@ public SignatureRequestSendRequest addCustomFieldsItem(SubCustomField customFiel return this; } - /** + /** * When used together with merge fields, `custom_fields` allows users to add pre-filled data to their signature requests. Pre-filled data can be used with \"send-once\" signature requests by adding merge fields with `form_fields_per_document` or [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) while passing values back with `custom_fields` together in one API call. For using pre-filled on repeatable signature requests, merge fields are added to templates in the Dropbox Sign UI or by calling [/template/create_embedded_draft](/api/reference/operation/templateCreateEmbeddedDraft) and then passing `custom_fields` on subsequent signature requests referencing that template. * @return customFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When used together with merge fields, `custom_fields` allows users to add pre-filled data to their signature requests. Pre-filled data can be used with \"send-once\" signature requests by adding merge fields with `form_fields_per_document` or [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) while passing values back with `custom_fields` together in one API call. For using pre-filled on repeatable signature requests, merge fields are added to templates in the Dropbox Sign UI or by calling [/template/create_embedded_draft](/api/reference/operation/templateCreateEmbeddedDraft) and then passing `custom_fields` on subsequent signature requests referencing that template.") @JsonProperty(JSON_PROPERTY_CUSTOM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -496,12 +485,11 @@ public SignatureRequestSendRequest fieldOptions(SubFieldOptions fieldOptions) { return this; } - /** + /** * Get fieldOptions * @return fieldOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIELD_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -530,12 +518,11 @@ public SignatureRequestSendRequest addFormFieldGroupsItem(SubFormFieldGroup form return this; } - /** + /** * Group information for fields defined in `form_fields_per_document`. String-indexed JSON array with `group_label` and `requirement` keys. `form_fields_per_document` must contain fields referencing a group defined in `form_field_groups`. * @return formFieldGroups - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Group information for fields defined in `form_fields_per_document`. String-indexed JSON array with `group_label` and `requirement` keys. `form_fields_per_document` must contain fields referencing a group defined in `form_field_groups`.") @JsonProperty(JSON_PROPERTY_FORM_FIELD_GROUPS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -564,12 +551,11 @@ public SignatureRequestSendRequest addFormFieldRulesItem(SubFormFieldRule formFi return this; } - /** + /** * Conditional Logic rules for fields defined in `form_fields_per_document`. * @return formFieldRules - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Conditional Logic rules for fields defined in `form_fields_per_document`.") @JsonProperty(JSON_PROPERTY_FORM_FIELD_RULES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -598,12 +584,11 @@ public SignatureRequestSendRequest addFormFieldsPerDocumentItem(SubFormFieldsPer return this; } - /** + /** * The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).) **NOTE:** Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types. * Text Field use `SubFormFieldsPerDocumentText` * Dropdown Field use `SubFormFieldsPerDocumentDropdown` * Hyperlink Field use `SubFormFieldsPerDocumentHyperlink` * Checkbox Field use `SubFormFieldsPerDocumentCheckbox` * Radio Field use `SubFormFieldsPerDocumentRadio` * Signature Field use `SubFormFieldsPerDocumentSignature` * Date Signed Field use `SubFormFieldsPerDocumentDateSigned` * Initials Field use `SubFormFieldsPerDocumentInitials` * Text Merge Field use `SubFormFieldsPerDocumentTextMerge` * Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge` * @return formFieldsPerDocument - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).) **NOTE:** Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types. * Text Field use `SubFormFieldsPerDocumentText` * Dropdown Field use `SubFormFieldsPerDocumentDropdown` * Hyperlink Field use `SubFormFieldsPerDocumentHyperlink` * Checkbox Field use `SubFormFieldsPerDocumentCheckbox` * Radio Field use `SubFormFieldsPerDocumentRadio` * Signature Field use `SubFormFieldsPerDocumentSignature` * Date Signed Field use `SubFormFieldsPerDocumentDateSigned` * Initials Field use `SubFormFieldsPerDocumentInitials` * Text Merge Field use `SubFormFieldsPerDocumentTextMerge` * Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge`") @JsonProperty(JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -624,12 +609,11 @@ public SignatureRequestSendRequest hideTextTags(Boolean hideTextTags) { return this; } - /** + /** * Enables automatic Text Tag removal when set to true. **NOTE:** Removing text tags this way can cause unwanted clipping. We recommend leaving this setting on `false` and instead hiding your text tags using white text or a similar approach. See the [Text Tags Walkthrough](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) for more information. * @return hideTextTags - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Enables automatic Text Tag removal when set to true. **NOTE:** Removing text tags this way can cause unwanted clipping. We recommend leaving this setting on `false` and instead hiding your text tags using white text or a similar approach. See the [Text Tags Walkthrough](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) for more information.") @JsonProperty(JSON_PROPERTY_HIDE_TEXT_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -645,19 +629,19 @@ public void setHideTextTags(Boolean hideTextTags) { } + @Deprecated public SignatureRequestSendRequest isQualifiedSignature(Boolean isQualifiedSignature) { this.isQualifiedSignature = isQualifiedSignature; return this; } - /** + /** * Send with a value of `true` if you wish to enable [Qualified Electronic Signatures](https://www.hellosign.com/features/qualified-electronic-signatures) (QES), which requires a face-to-face call to verify the signer's identity.<br> **NOTE:** QES is only available on the Premium API plan as an add-on purchase. Cannot be used in `test_mode`. Only works on requests with one signer. * @return isQualifiedSignature * @deprecated - **/ + */ @Deprecated @javax.annotation.Nullable - @ApiModelProperty(value = "Send with a value of `true` if you wish to enable [Qualified Electronic Signatures](https://www.hellosign.com/features/qualified-electronic-signatures) (QES), which requires a face-to-face call to verify the signer's identity.
**NOTE:** QES is only available on the Premium API plan as an add-on purchase. Cannot be used in `test_mode`. Only works on requests with one signer.") @JsonProperty(JSON_PROPERTY_IS_QUALIFIED_SIGNATURE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -666,6 +650,7 @@ public Boolean getIsQualifiedSignature() { } + @Deprecated @JsonProperty(JSON_PROPERTY_IS_QUALIFIED_SIGNATURE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIsQualifiedSignature(Boolean isQualifiedSignature) { @@ -678,12 +663,11 @@ public SignatureRequestSendRequest isEid(Boolean isEid) { return this; } - /** + /** * Send with a value of `true` if you wish to enable [electronic identification (eID)](https://www.hellosign.com/features/electronic-id), which requires the signer to verify their identity with an eID provider to sign a document.<br> **NOTE:** eID is only available on the Premium API plan. Cannot be used in `test_mode`. Only works on requests with one signer. * @return isEid - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Send with a value of `true` if you wish to enable [electronic identification (eID)](https://www.hellosign.com/features/electronic-id), which requires the signer to verify their identity with an eID provider to sign a document.
**NOTE:** eID is only available on the Premium API plan. Cannot be used in `test_mode`. Only works on requests with one signer.") @JsonProperty(JSON_PROPERTY_IS_EID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -704,12 +688,11 @@ public SignatureRequestSendRequest message(String message) { return this; } - /** + /** * The custom message in the email that will be sent to the signers. * @return message - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The custom message in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -738,12 +721,11 @@ public SignatureRequestSendRequest putMetadataItem(String key, Object metadataIt return this; } - /** + /** * Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long.") @JsonProperty(JSON_PROPERTY_METADATA) @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) @@ -764,12 +746,11 @@ public SignatureRequestSendRequest signingOptions(SubSigningOptions signingOptio return this; } - /** + /** * Get signingOptions * @return signingOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SIGNING_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -790,12 +771,11 @@ public SignatureRequestSendRequest signingRedirectUrl(String signingRedirectUrl) return this; } - /** + /** * The URL you want signers redirected to after they successfully sign. * @return signingRedirectUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL you want signers redirected to after they successfully sign.") @JsonProperty(JSON_PROPERTY_SIGNING_REDIRECT_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -816,12 +796,11 @@ public SignatureRequestSendRequest subject(String subject) { return this; } - /** + /** * The subject in the email that will be sent to the signers. * @return subject - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The subject in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_SUBJECT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -842,12 +821,11 @@ public SignatureRequestSendRequest testMode(Boolean testMode) { return this; } - /** + /** * Whether this is a test, the signature request will not be legally binding if set to `true`. Defaults to `false`. * @return testMode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this is a test, the signature request will not be legally binding if set to `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_TEST_MODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -868,12 +846,11 @@ public SignatureRequestSendRequest title(String title) { return this; } - /** + /** * The title you want to assign to the SignatureRequest. * @return title - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The title you want to assign to the SignatureRequest.") @JsonProperty(JSON_PROPERTY_TITLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -894,12 +871,11 @@ public SignatureRequestSendRequest useTextTags(Boolean useTextTags) { return this; } - /** + /** * Send with a value of `true` if you wish to enable [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) parsing in your document. Defaults to disabled, or `false`. * @return useTextTags - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Send with a value of `true` if you wish to enable [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) parsing in your document. Defaults to disabled, or `false`.") @JsonProperty(JSON_PROPERTY_USE_TEXT_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -920,12 +896,11 @@ public SignatureRequestSendRequest expiresAt(Integer expiresAt) { return this; } - /** + /** * When the signature request will expire. Unsigned signatures will be moved to the expired status, and no longer signable. See [Signature Request Expiration Date](https://developers.hellosign.com/docs/signature-request/expiration/) for details. * @return expiresAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When the signature request will expire. Unsigned signatures will be moved to the expired status, and no longer signable. See [Signature Request Expiration Date](https://developers.hellosign.com/docs/signature-request/expiration/) for details.") @JsonProperty(JSON_PROPERTY_EXPIRES_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestSendWithTemplateRequest.java b/src/main/java/com/dropbox/sign/model/SignatureRequestSendWithTemplateRequest.java index 922b07e..a95c44e 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestSendWithTemplateRequest.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestSendWithTemplateRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubCC; @@ -26,44 +25,43 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; 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.JSON; import com.dropbox.sign.ApiException; /** - * SignatureRequestSendWithTemplateRequest + * */ @JsonPropertyOrder({ - SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_TEMPLATE_IDS, - SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_SIGNERS, - SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_ALLOW_DECLINE, - SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_CCS, - SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_CLIENT_ID, - SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_CUSTOM_FIELDS, - SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_FILES, - SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_FILE_URLS, - SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_IS_QUALIFIED_SIGNATURE, - SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_IS_EID, - SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_MESSAGE, - SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_METADATA, - SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_SIGNING_OPTIONS, - SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_SIGNING_REDIRECT_URL, - SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_SUBJECT, - SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_TEST_MODE, - SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_TITLE + SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_TEMPLATE_IDS, + SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_SIGNERS, + SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_ALLOW_DECLINE, + SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_CCS, + SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_CLIENT_ID, + SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_CUSTOM_FIELDS, + SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_FILES, + SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_FILE_URLS, + SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_IS_QUALIFIED_SIGNATURE, + SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_IS_EID, + SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_MESSAGE, + SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_METADATA, + SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_SIGNING_OPTIONS, + SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_SIGNING_REDIRECT_URL, + SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_SUBJECT, + SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_TEST_MODE, + SignatureRequestSendWithTemplateRequest.JSON_PROPERTY_TITLE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SignatureRequestSendWithTemplateRequest { public static final String JSON_PROPERTY_TEMPLATE_IDS = "template_ids"; private List templateIds = new ArrayList<>(); @@ -90,6 +88,7 @@ public class SignatureRequestSendWithTemplateRequest { private List fileUrls = null; public static final String JSON_PROPERTY_IS_QUALIFIED_SIGNATURE = "is_qualified_signature"; + @Deprecated private Boolean isQualifiedSignature = false; public static final String JSON_PROPERTY_IS_EID = "is_eid"; @@ -140,16 +139,18 @@ public SignatureRequestSendWithTemplateRequest templateIds(List template } public SignatureRequestSendWithTemplateRequest addTemplateIdsItem(String templateIdsItem) { + if (this.templateIds == null) { + this.templateIds = new ArrayList<>(); + } this.templateIds.add(templateIdsItem); return this; } - /** + /** * Use `template_ids` to create a SignatureRequest from one or more templates, in the order in which the template will be used. * @return templateIds - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Use `template_ids` to create a SignatureRequest from one or more templates, in the order in which the template will be used.") @JsonProperty(JSON_PROPERTY_TEMPLATE_IDS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -171,16 +172,18 @@ public SignatureRequestSendWithTemplateRequest signers(List(); + } this.signers.add(signersItem); return this; } - /** + /** * Add Signers to your Templated-based Signature Request. * @return signers - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Add Signers to your Templated-based Signature Request.") @JsonProperty(JSON_PROPERTY_SIGNERS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -201,12 +204,11 @@ public SignatureRequestSendWithTemplateRequest allowDecline(Boolean allowDecline return this; } - /** + /** * Allows signers to decline to sign a document if `true`. Defaults to `false`. * @return allowDecline - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows signers to decline to sign a document if `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_ALLOW_DECLINE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -235,12 +237,11 @@ public SignatureRequestSendWithTemplateRequest addCcsItem(SubCC ccsItem) { return this; } - /** + /** * Add CC email recipients. Required when a CC role exists for the Template. * @return ccs - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Add CC email recipients. Required when a CC role exists for the Template.") @JsonProperty(JSON_PROPERTY_CCS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -261,12 +262,11 @@ public SignatureRequestSendWithTemplateRequest clientId(String clientId) { return this; } - /** + /** * Client id of the app to associate with the signature request. Used to apply the branding and callback url defined for the app. * @return clientId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Client id of the app to associate with the signature request. Used to apply the branding and callback url defined for the app.") @JsonProperty(JSON_PROPERTY_CLIENT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -295,12 +295,11 @@ public SignatureRequestSendWithTemplateRequest addCustomFieldsItem(SubCustomFiel return this; } - /** + /** * An array defining values and options for custom fields. Required when a custom field exists in the Template. * @return customFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array defining values and options for custom fields. Required when a custom field exists in the Template.") @JsonProperty(JSON_PROPERTY_CUSTOM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -329,12 +328,11 @@ public SignatureRequestSendWithTemplateRequest addFilesItem(File filesItem) { return this; } - /** + /** * Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both. * @return files - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -363,12 +361,11 @@ public SignatureRequestSendWithTemplateRequest addFileUrlsItem(String fileUrlsIt return this; } - /** + /** * Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both. * @return fileUrls - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILE_URLS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -384,19 +381,19 @@ public void setFileUrls(List fileUrls) { } + @Deprecated public SignatureRequestSendWithTemplateRequest isQualifiedSignature(Boolean isQualifiedSignature) { this.isQualifiedSignature = isQualifiedSignature; return this; } - /** + /** * Send with a value of `true` if you wish to enable [Qualified Electronic Signatures](https://www.hellosign.com/features/qualified-electronic-signatures) (QES), which requires a face-to-face call to verify the signer's identity.<br> **NOTE:** QES is only available on the Premium API plan as an add-on purchase. Cannot be used in `test_mode`. Only works on requests with one signer. * @return isQualifiedSignature * @deprecated - **/ + */ @Deprecated @javax.annotation.Nullable - @ApiModelProperty(value = "Send with a value of `true` if you wish to enable [Qualified Electronic Signatures](https://www.hellosign.com/features/qualified-electronic-signatures) (QES), which requires a face-to-face call to verify the signer's identity.
**NOTE:** QES is only available on the Premium API plan as an add-on purchase. Cannot be used in `test_mode`. Only works on requests with one signer.") @JsonProperty(JSON_PROPERTY_IS_QUALIFIED_SIGNATURE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -405,6 +402,7 @@ public Boolean getIsQualifiedSignature() { } + @Deprecated @JsonProperty(JSON_PROPERTY_IS_QUALIFIED_SIGNATURE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIsQualifiedSignature(Boolean isQualifiedSignature) { @@ -417,12 +415,11 @@ public SignatureRequestSendWithTemplateRequest isEid(Boolean isEid) { return this; } - /** + /** * Send with a value of `true` if you wish to enable [electronic identification (eID)](https://www.hellosign.com/features/electronic-id), which requires the signer to verify their identity with an eID provider to sign a document.<br> **NOTE:** eID is only available on the Premium API plan. Cannot be used in `test_mode`. Only works on requests with one signer. * @return isEid - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Send with a value of `true` if you wish to enable [electronic identification (eID)](https://www.hellosign.com/features/electronic-id), which requires the signer to verify their identity with an eID provider to sign a document.
**NOTE:** eID is only available on the Premium API plan. Cannot be used in `test_mode`. Only works on requests with one signer.") @JsonProperty(JSON_PROPERTY_IS_EID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -443,12 +440,11 @@ public SignatureRequestSendWithTemplateRequest message(String message) { return this; } - /** + /** * The custom message in the email that will be sent to the signers. * @return message - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The custom message in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -477,12 +473,11 @@ public SignatureRequestSendWithTemplateRequest putMetadataItem(String key, Objec return this; } - /** + /** * Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long.") @JsonProperty(JSON_PROPERTY_METADATA) @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) @@ -503,12 +498,11 @@ public SignatureRequestSendWithTemplateRequest signingOptions(SubSigningOptions return this; } - /** + /** * Get signingOptions * @return signingOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SIGNING_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -529,12 +523,11 @@ public SignatureRequestSendWithTemplateRequest signingRedirectUrl(String signing return this; } - /** + /** * The URL you want signers redirected to after they successfully sign. * @return signingRedirectUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL you want signers redirected to after they successfully sign.") @JsonProperty(JSON_PROPERTY_SIGNING_REDIRECT_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -555,12 +548,11 @@ public SignatureRequestSendWithTemplateRequest subject(String subject) { return this; } - /** + /** * The subject in the email that will be sent to the signers. * @return subject - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The subject in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_SUBJECT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -581,12 +573,11 @@ public SignatureRequestSendWithTemplateRequest testMode(Boolean testMode) { return this; } - /** + /** * Whether this is a test, the signature request will not be legally binding if set to `true`. Defaults to `false`. * @return testMode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this is a test, the signature request will not be legally binding if set to `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_TEST_MODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -607,12 +598,11 @@ public SignatureRequestSendWithTemplateRequest title(String title) { return this; } - /** + /** * The title you want to assign to the SignatureRequest. * @return title - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The title you want to assign to the SignatureRequest.") @JsonProperty(JSON_PROPERTY_TITLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SignatureRequestUpdateRequest.java b/src/main/java/com/dropbox/sign/model/SignatureRequestUpdateRequest.java index eeaa3b3..00e0068 100644 --- a/src/main/java/com/dropbox/sign/model/SignatureRequestUpdateRequest.java +++ b/src/main/java/com/dropbox/sign/model/SignatureRequestUpdateRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,13 +33,13 @@ * SignatureRequestUpdateRequest */ @JsonPropertyOrder({ - SignatureRequestUpdateRequest.JSON_PROPERTY_SIGNATURE_ID, - SignatureRequestUpdateRequest.JSON_PROPERTY_EMAIL_ADDRESS, - SignatureRequestUpdateRequest.JSON_PROPERTY_NAME, - SignatureRequestUpdateRequest.JSON_PROPERTY_EXPIRES_AT + SignatureRequestUpdateRequest.JSON_PROPERTY_SIGNATURE_ID, + SignatureRequestUpdateRequest.JSON_PROPERTY_EMAIL_ADDRESS, + SignatureRequestUpdateRequest.JSON_PROPERTY_NAME, + SignatureRequestUpdateRequest.JSON_PROPERTY_EXPIRES_AT }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SignatureRequestUpdateRequest { public static final String JSON_PROPERTY_SIGNATURE_ID = "signature_id"; private String signatureId; @@ -78,12 +76,11 @@ public SignatureRequestUpdateRequest signatureId(String signatureId) { return this; } - /** + /** * The signature ID for the recipient. * @return signatureId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The signature ID for the recipient.") @JsonProperty(JSON_PROPERTY_SIGNATURE_ID) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -104,12 +101,11 @@ public SignatureRequestUpdateRequest emailAddress(String emailAddress) { return this; } - /** + /** * The new email address for the recipient. This will generate a new `signature_id` value. **NOTE:** Optional if `name` is provided. * @return emailAddress - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The new email address for the recipient. This will generate a new `signature_id` value. **NOTE:** Optional if `name` is provided.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -130,12 +126,11 @@ public SignatureRequestUpdateRequest name(String name) { return this; } - /** + /** * The new name for the recipient. **NOTE:** Optional if `email_address` is provided. * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The new name for the recipient. **NOTE:** Optional if `email_address` is provided.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -156,12 +151,11 @@ public SignatureRequestUpdateRequest expiresAt(Integer expiresAt) { return this; } - /** + /** * The new time when the signature request will expire. Unsigned signatures will be moved to the expired status, and no longer signable. See [Signature Request Expiration Date](https://developers.hellosign.com/docs/signature-request/expiration/) for details. * @return expiresAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The new time when the signature request will expire. Unsigned signatures will be moved to the expired status, and no longer signable. See [Signature Request Expiration Date](https://developers.hellosign.com/docs/signature-request/expiration/) for details.") @JsonProperty(JSON_PROPERTY_EXPIRES_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SubAttachment.java b/src/main/java/com/dropbox/sign/model/SubAttachment.java index bb7ccbd..f8ed3c5 100644 --- a/src/main/java/com/dropbox/sign/model/SubAttachment.java +++ b/src/main/java/com/dropbox/sign/model/SubAttachment.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,13 +33,13 @@ * SubAttachment */ @JsonPropertyOrder({ - SubAttachment.JSON_PROPERTY_NAME, - SubAttachment.JSON_PROPERTY_SIGNER_INDEX, - SubAttachment.JSON_PROPERTY_INSTRUCTIONS, - SubAttachment.JSON_PROPERTY_REQUIRED + SubAttachment.JSON_PROPERTY_NAME, + SubAttachment.JSON_PROPERTY_SIGNER_INDEX, + SubAttachment.JSON_PROPERTY_INSTRUCTIONS, + SubAttachment.JSON_PROPERTY_REQUIRED }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubAttachment { public static final String JSON_PROPERTY_NAME = "name"; private String name; @@ -78,12 +76,11 @@ public SubAttachment name(String name) { return this; } - /** + /** * The name of attachment. * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of attachment.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -104,12 +101,11 @@ public SubAttachment signerIndex(Integer signerIndex) { return this; } - /** + /** * The signer's index in the `signers` parameter (0-based indexing). **NOTE:** Only one signer can be assigned per attachment. * @return signerIndex - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The signer's index in the `signers` parameter (0-based indexing). **NOTE:** Only one signer can be assigned per attachment.") @JsonProperty(JSON_PROPERTY_SIGNER_INDEX) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -130,12 +126,11 @@ public SubAttachment instructions(String instructions) { return this; } - /** + /** * The instructions for uploading the attachment. * @return instructions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The instructions for uploading the attachment.") @JsonProperty(JSON_PROPERTY_INSTRUCTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -156,12 +151,11 @@ public SubAttachment required(Boolean required) { return this; } - /** + /** * Determines if the attachment must be uploaded. * @return required - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Determines if the attachment must be uploaded.") @JsonProperty(JSON_PROPERTY_REQUIRED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SubBulkSignerList.java b/src/main/java/com/dropbox/sign/model/SubBulkSignerList.java index 74b5efa..a5eefba 100644 --- a/src/main/java/com/dropbox/sign/model/SubBulkSignerList.java +++ b/src/main/java/com/dropbox/sign/model/SubBulkSignerList.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubBulkSignerListCustomField; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,11 +37,11 @@ * SubBulkSignerList */ @JsonPropertyOrder({ - SubBulkSignerList.JSON_PROPERTY_CUSTOM_FIELDS, - SubBulkSignerList.JSON_PROPERTY_SIGNERS + SubBulkSignerList.JSON_PROPERTY_CUSTOM_FIELDS, + SubBulkSignerList.JSON_PROPERTY_SIGNERS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubBulkSignerList { public static final String JSON_PROPERTY_CUSTOM_FIELDS = "custom_fields"; private List customFields = null; @@ -82,12 +80,11 @@ public SubBulkSignerList addCustomFieldsItem(SubBulkSignerListCustomField custom return this; } - /** + /** * An array of custom field values. * @return customFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array of custom field values.") @JsonProperty(JSON_PROPERTY_CUSTOM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -116,12 +113,11 @@ public SubBulkSignerList addSignersItem(SubSignatureRequestTemplateSigner signer return this; } - /** + /** * Add Signers to your Templated-based Signature Request. Allows the requester to specify editor options when a preparing a document. Currently only templates with a single role are supported. All signers must have the same `role` value. * @return signers - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Add Signers to your Templated-based Signature Request. Allows the requester to specify editor options when a preparing a document. Currently only templates with a single role are supported. All signers must have the same `role` value.") @JsonProperty(JSON_PROPERTY_SIGNERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SubBulkSignerListCustomField.java b/src/main/java/com/dropbox/sign/model/SubBulkSignerListCustomField.java index 2440f62..1ec2093 100644 --- a/src/main/java/com/dropbox/sign/model/SubBulkSignerListCustomField.java +++ b/src/main/java/com/dropbox/sign/model/SubBulkSignerListCustomField.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,11 +33,11 @@ * SubBulkSignerListCustomField */ @JsonPropertyOrder({ - SubBulkSignerListCustomField.JSON_PROPERTY_NAME, - SubBulkSignerListCustomField.JSON_PROPERTY_VALUE + SubBulkSignerListCustomField.JSON_PROPERTY_NAME, + SubBulkSignerListCustomField.JSON_PROPERTY_VALUE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubBulkSignerListCustomField { public static final String JSON_PROPERTY_NAME = "name"; private String name; @@ -70,12 +68,11 @@ public SubBulkSignerListCustomField name(String name) { return this; } - /** + /** * The name of the custom field. Must be the field's `name` or `api_id`. * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the custom field. Must be the field's `name` or `api_id`.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -96,12 +93,11 @@ public SubBulkSignerListCustomField value(String value) { return this; } - /** + /** * The value of the custom field. * @return value - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The value of the custom field.") @JsonProperty(JSON_PROPERTY_VALUE) @JsonInclude(value = JsonInclude.Include.ALWAYS) diff --git a/src/main/java/com/dropbox/sign/model/SubCC.java b/src/main/java/com/dropbox/sign/model/SubCC.java index f354e2d..a78f7c2 100644 --- a/src/main/java/com/dropbox/sign/model/SubCC.java +++ b/src/main/java/com/dropbox/sign/model/SubCC.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,11 +33,11 @@ * SubCC */ @JsonPropertyOrder({ - SubCC.JSON_PROPERTY_ROLE, - SubCC.JSON_PROPERTY_EMAIL_ADDRESS + SubCC.JSON_PROPERTY_ROLE, + SubCC.JSON_PROPERTY_EMAIL_ADDRESS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubCC { public static final String JSON_PROPERTY_ROLE = "role"; private String role; @@ -70,12 +68,11 @@ public SubCC role(String role) { return this; } - /** + /** * Must match an existing CC role in chosen Template(s). Multiple CC recipients cannot share the same CC role. * @return role - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Must match an existing CC role in chosen Template(s). Multiple CC recipients cannot share the same CC role.") @JsonProperty(JSON_PROPERTY_ROLE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -96,12 +93,11 @@ public SubCC emailAddress(String emailAddress) { return this; } - /** + /** * The email address of the CC recipient. * @return emailAddress - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The email address of the CC recipient.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.ALWAYS) diff --git a/src/main/java/com/dropbox/sign/model/SubCustomField.java b/src/main/java/com/dropbox/sign/model/SubCustomField.java index 41a8ddb..322ceda 100644 --- a/src/main/java/com/dropbox/sign/model/SubCustomField.java +++ b/src/main/java/com/dropbox/sign/model/SubCustomField.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,27 +21,25 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * When used together with merge fields, `custom_fields` allows users to add pre-filled data to their signature requests. Pre-filled data can be used with \"send-once\" signature requests by adding merge fields with `form_fields_per_document` or [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) while passing values back with `custom_fields` together in one API call. For using pre-filled on repeatable signature requests, merge fields are added to templates in the Dropbox Sign UI or by calling [/template/create_embedded_draft](/api/reference/operation/templateCreateEmbeddedDraft) and then passing `custom_fields` on subsequent signature requests referencing that template. */ -@ApiModel(description = "When used together with merge fields, `custom_fields` allows users to add pre-filled data to their signature requests. Pre-filled data can be used with \"send-once\" signature requests by adding merge fields with `form_fields_per_document` or [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) while passing values back with `custom_fields` together in one API call. For using pre-filled on repeatable signature requests, merge fields are added to templates in the Dropbox Sign UI or by calling [/template/create_embedded_draft](/api/reference/operation/templateCreateEmbeddedDraft) and then passing `custom_fields` on subsequent signature requests referencing that template.") @JsonPropertyOrder({ - SubCustomField.JSON_PROPERTY_NAME, - SubCustomField.JSON_PROPERTY_EDITOR, - SubCustomField.JSON_PROPERTY_REQUIRED, - SubCustomField.JSON_PROPERTY_VALUE + SubCustomField.JSON_PROPERTY_NAME, + SubCustomField.JSON_PROPERTY_EDITOR, + SubCustomField.JSON_PROPERTY_REQUIRED, + SubCustomField.JSON_PROPERTY_VALUE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubCustomField { public static final String JSON_PROPERTY_NAME = "name"; private String name; @@ -79,12 +76,11 @@ public SubCustomField name(String name) { return this; } - /** + /** * The name of a custom field. When working with pre-filled data, the custom field's name must have a matching merge field name or the field will remain empty on the document during signing. * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of a custom field. When working with pre-filled data, the custom field's name must have a matching merge field name or the field will remain empty on the document during signing.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -105,12 +101,11 @@ public SubCustomField editor(String editor) { return this; } - /** + /** * Used to create editable merge fields. When the value matches a role passed in with `signers`, that role can edit the data that was pre-filled to that field. This field is optional, but required when this custom field object is set to `required = true`. **NOTE:** Editable merge fields are only supported for single signer requests (or the first signer in ordered signature requests). If used when there are multiple signers in an unordered signature request, the editor value is ignored and the field won't be editable. * @return editor - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Used to create editable merge fields. When the value matches a role passed in with `signers`, that role can edit the data that was pre-filled to that field. This field is optional, but required when this custom field object is set to `required = true`. **NOTE:** Editable merge fields are only supported for single signer requests (or the first signer in ordered signature requests). If used when there are multiple signers in an unordered signature request, the editor value is ignored and the field won't be editable.") @JsonProperty(JSON_PROPERTY_EDITOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -131,12 +126,11 @@ public SubCustomField required(Boolean required) { return this; } - /** + /** * Used to set an editable merge field when working with pre-filled data. When `true`, the custom field must specify a signer role in `editor`. * @return required - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Used to set an editable merge field when working with pre-filled data. When `true`, the custom field must specify a signer role in `editor`.") @JsonProperty(JSON_PROPERTY_REQUIRED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -157,12 +151,11 @@ public SubCustomField value(String value) { return this; } - /** + /** * The string that resolves (aka \"pre-fills\") to the merge field on the final document(s) used for signing. * @return value - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The string that resolves (aka \"pre-fills\") to the merge field on the final document(s) used for signing.") @JsonProperty(JSON_PROPERTY_VALUE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SubEditorOptions.java b/src/main/java/com/dropbox/sign/model/SubEditorOptions.java index f6783dd..f310890 100644 --- a/src/main/java/com/dropbox/sign/model/SubEditorOptions.java +++ b/src/main/java/com/dropbox/sign/model/SubEditorOptions.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,25 +21,23 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This allows the requester to specify editor options when a preparing a document */ -@ApiModel(description = "This allows the requester to specify editor options when a preparing a document") @JsonPropertyOrder({ - SubEditorOptions.JSON_PROPERTY_ALLOW_EDIT_SIGNERS, - SubEditorOptions.JSON_PROPERTY_ALLOW_EDIT_DOCUMENTS + SubEditorOptions.JSON_PROPERTY_ALLOW_EDIT_SIGNERS, + SubEditorOptions.JSON_PROPERTY_ALLOW_EDIT_DOCUMENTS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubEditorOptions { public static final String JSON_PROPERTY_ALLOW_EDIT_SIGNERS = "allow_edit_signers"; private Boolean allowEditSigners = false; @@ -71,12 +68,11 @@ public SubEditorOptions allowEditSigners(Boolean allowEditSigners) { return this; } - /** + /** * Allows requesters to edit the list of signers * @return allowEditSigners - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows requesters to edit the list of signers") @JsonProperty(JSON_PROPERTY_ALLOW_EDIT_SIGNERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -97,12 +93,11 @@ public SubEditorOptions allowEditDocuments(Boolean allowEditDocuments) { return this; } - /** + /** * Allows requesters to edit documents, including delete and add * @return allowEditDocuments - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows requesters to edit documents, including delete and add") @JsonProperty(JSON_PROPERTY_ALLOW_EDIT_DOCUMENTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SubFieldOptions.java b/src/main/java/com/dropbox/sign/model/SubFieldOptions.java index 79c09b2..0d41133 100644 --- a/src/main/java/com/dropbox/sign/model/SubFieldOptions.java +++ b/src/main/java/com/dropbox/sign/model/SubFieldOptions.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,24 +21,22 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This allows the requester to specify field options for a signature request. */ -@ApiModel(description = "This allows the requester to specify field options for a signature request.") @JsonPropertyOrder({ - SubFieldOptions.JSON_PROPERTY_DATE_FORMAT + SubFieldOptions.JSON_PROPERTY_DATE_FORMAT }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubFieldOptions { /** * Allows requester to specify the date format (see list of allowed [formats](/api/reference/constants/#date-formats)) **NOTE:** Only available for Premium and higher. @@ -110,12 +107,11 @@ public SubFieldOptions dateFormat(DateFormatEnum dateFormat) { return this; } - /** + /** * Allows requester to specify the date format (see list of allowed [formats](/api/reference/constants/#date-formats)) **NOTE:** Only available for Premium and higher. * @return dateFormat - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Allows requester to specify the date format (see list of allowed [formats](/api/reference/constants/#date-formats)) **NOTE:** Only available for Premium and higher.") @JsonProperty(JSON_PROPERTY_DATE_FORMAT) @JsonInclude(value = JsonInclude.Include.ALWAYS) diff --git a/src/main/java/com/dropbox/sign/model/SubFormFieldGroup.java b/src/main/java/com/dropbox/sign/model/SubFormFieldGroup.java index 9a143ff..a061d9c 100644 --- a/src/main/java/com/dropbox/sign/model/SubFormFieldGroup.java +++ b/src/main/java/com/dropbox/sign/model/SubFormFieldGroup.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,12 +33,12 @@ * SubFormFieldGroup */ @JsonPropertyOrder({ - SubFormFieldGroup.JSON_PROPERTY_GROUP_ID, - SubFormFieldGroup.JSON_PROPERTY_GROUP_LABEL, - SubFormFieldGroup.JSON_PROPERTY_REQUIREMENT + SubFormFieldGroup.JSON_PROPERTY_GROUP_ID, + SubFormFieldGroup.JSON_PROPERTY_GROUP_LABEL, + SubFormFieldGroup.JSON_PROPERTY_REQUIREMENT }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubFormFieldGroup { public static final String JSON_PROPERTY_GROUP_ID = "group_id"; private String groupId; @@ -74,12 +72,11 @@ public SubFormFieldGroup groupId(String groupId) { return this; } - /** + /** * ID of group. Use this to reference a specific group from the `group` value in `form_fields_per_document`. * @return groupId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "ID of group. Use this to reference a specific group from the `group` value in `form_fields_per_document`.") @JsonProperty(JSON_PROPERTY_GROUP_ID) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -100,12 +97,11 @@ public SubFormFieldGroup groupLabel(String groupLabel) { return this; } - /** + /** * Name of the group * @return groupLabel - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Name of the group") @JsonProperty(JSON_PROPERTY_GROUP_LABEL) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -126,12 +122,11 @@ public SubFormFieldGroup requirement(String requirement) { return this; } - /** + /** * Examples: `require_0-1` `require_1` `require_1-ormore` - Check out the list of [acceptable `requirement` checkbox type values](/api/reference/constants/#checkbox-field-grouping). - Check out the list of [acceptable `requirement` radio type fields](/api/reference/constants/#radio-field-grouping). - Radio groups require **at least** two fields per group. * @return requirement - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Examples: `require_0-1` `require_1` `require_1-ormore` - Check out the list of [acceptable `requirement` checkbox type values](/api/reference/constants/#checkbox-field-grouping). - Check out the list of [acceptable `requirement` radio type fields](/api/reference/constants/#radio-field-grouping). - Radio groups require **at least** two fields per group.") @JsonProperty(JSON_PROPERTY_REQUIREMENT) @JsonInclude(value = JsonInclude.Include.ALWAYS) diff --git a/src/main/java/com/dropbox/sign/model/SubFormFieldRule.java b/src/main/java/com/dropbox/sign/model/SubFormFieldRule.java index b70229f..5b3be6a 100644 --- a/src/main/java/com/dropbox/sign/model/SubFormFieldRule.java +++ b/src/main/java/com/dropbox/sign/model/SubFormFieldRule.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubFormFieldRuleAction; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,13 +37,13 @@ * SubFormFieldRule */ @JsonPropertyOrder({ - SubFormFieldRule.JSON_PROPERTY_ID, - SubFormFieldRule.JSON_PROPERTY_TRIGGER_OPERATOR, - SubFormFieldRule.JSON_PROPERTY_TRIGGERS, - SubFormFieldRule.JSON_PROPERTY_ACTIONS + SubFormFieldRule.JSON_PROPERTY_ID, + SubFormFieldRule.JSON_PROPERTY_TRIGGER_OPERATOR, + SubFormFieldRule.JSON_PROPERTY_TRIGGERS, + SubFormFieldRule.JSON_PROPERTY_ACTIONS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubFormFieldRule { public static final String JSON_PROPERTY_ID = "id"; private String id; @@ -82,12 +80,11 @@ public SubFormFieldRule id(String id) { return this; } - /** + /** * Must be unique across all defined rules. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Must be unique across all defined rules.") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -108,12 +105,11 @@ public SubFormFieldRule triggerOperator(String triggerOperator) { return this; } - /** + /** * Currently only `AND` is supported. Support for `OR` is being worked on. * @return triggerOperator - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Currently only `AND` is supported. Support for `OR` is being worked on.") @JsonProperty(JSON_PROPERTY_TRIGGER_OPERATOR) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -135,16 +131,18 @@ public SubFormFieldRule triggers(List triggers) { } public SubFormFieldRule addTriggersItem(SubFormFieldRuleTrigger triggersItem) { + if (this.triggers == null) { + this.triggers = new ArrayList<>(); + } this.triggers.add(triggersItem); return this; } - /** + /** * An array of trigger definitions, the \"if this\" part of \"**if this**, then that\". Currently only a single trigger per rule is allowed. * @return triggers - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "An array of trigger definitions, the \"if this\" part of \"**if this**, then that\". Currently only a single trigger per rule is allowed.") @JsonProperty(JSON_PROPERTY_TRIGGERS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -166,16 +164,18 @@ public SubFormFieldRule actions(List actions) { } public SubFormFieldRule addActionsItem(SubFormFieldRuleAction actionsItem) { + if (this.actions == null) { + this.actions = new ArrayList<>(); + } this.actions.add(actionsItem); return this; } - /** + /** * An array of action definitions, the \"then that\" part of \"if this, **then that**\". Any number of actions may be attached to a single rule. * @return actions - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "An array of action definitions, the \"then that\" part of \"if this, **then that**\". Any number of actions may be attached to a single rule.") @JsonProperty(JSON_PROPERTY_ACTIONS) @JsonInclude(value = JsonInclude.Include.ALWAYS) diff --git a/src/main/java/com/dropbox/sign/model/SubFormFieldRuleAction.java b/src/main/java/com/dropbox/sign/model/SubFormFieldRuleAction.java index fd67b12..23ba071 100644 --- a/src/main/java/com/dropbox/sign/model/SubFormFieldRuleAction.java +++ b/src/main/java/com/dropbox/sign/model/SubFormFieldRuleAction.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,13 +33,13 @@ * SubFormFieldRuleAction */ @JsonPropertyOrder({ - SubFormFieldRuleAction.JSON_PROPERTY_HIDDEN, - SubFormFieldRuleAction.JSON_PROPERTY_TYPE, - SubFormFieldRuleAction.JSON_PROPERTY_FIELD_ID, - SubFormFieldRuleAction.JSON_PROPERTY_GROUP_ID + SubFormFieldRuleAction.JSON_PROPERTY_HIDDEN, + SubFormFieldRuleAction.JSON_PROPERTY_TYPE, + SubFormFieldRuleAction.JSON_PROPERTY_FIELD_ID, + SubFormFieldRuleAction.JSON_PROPERTY_GROUP_ID }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubFormFieldRuleAction { public static final String JSON_PROPERTY_HIDDEN = "hidden"; private Boolean hidden; @@ -113,12 +111,11 @@ public SubFormFieldRuleAction hidden(Boolean hidden) { return this; } - /** + /** * `true` to hide the target field when rule is satisfied, otherwise `false`. * @return hidden - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "`true` to hide the target field when rule is satisfied, otherwise `false`.") @JsonProperty(JSON_PROPERTY_HIDDEN) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -139,12 +136,11 @@ public SubFormFieldRuleAction type(TypeEnum type) { return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -165,12 +161,11 @@ public SubFormFieldRuleAction fieldId(String fieldId) { return this; } - /** + /** * **field_id** or **group_id** is required, but not both. Must reference the `api_id` of an existing field defined within `form_fields_per_document`. Cannot use with `group_id`. Trigger and action fields must belong to the same signer. * @return fieldId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "**field_id** or **group_id** is required, but not both. Must reference the `api_id` of an existing field defined within `form_fields_per_document`. Cannot use with `group_id`. Trigger and action fields must belong to the same signer.") @JsonProperty(JSON_PROPERTY_FIELD_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -191,12 +186,11 @@ public SubFormFieldRuleAction groupId(String groupId) { return this; } - /** + /** * **group_id** or **field_id** is required, but not both. Must reference the ID of an existing group defined within `form_field_groups`. Cannot use with `field_id`. Trigger and action fields and groups must belong to the same signer. * @return groupId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "**group_id** or **field_id** is required, but not both. Must reference the ID of an existing group defined within `form_field_groups`. Cannot use with `field_id`. Trigger and action fields and groups must belong to the same signer.") @JsonProperty(JSON_PROPERTY_GROUP_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SubFormFieldRuleTrigger.java b/src/main/java/com/dropbox/sign/model/SubFormFieldRuleTrigger.java index ff5b37f..048ffe2 100644 --- a/src/main/java/com/dropbox/sign/model/SubFormFieldRuleTrigger.java +++ b/src/main/java/com/dropbox/sign/model/SubFormFieldRuleTrigger.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,14 +21,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -37,13 +35,13 @@ * SubFormFieldRuleTrigger */ @JsonPropertyOrder({ - SubFormFieldRuleTrigger.JSON_PROPERTY_ID, - SubFormFieldRuleTrigger.JSON_PROPERTY_OPERATOR, - SubFormFieldRuleTrigger.JSON_PROPERTY_VALUE, - SubFormFieldRuleTrigger.JSON_PROPERTY_VALUES + SubFormFieldRuleTrigger.JSON_PROPERTY_ID, + SubFormFieldRuleTrigger.JSON_PROPERTY_OPERATOR, + SubFormFieldRuleTrigger.JSON_PROPERTY_VALUE, + SubFormFieldRuleTrigger.JSON_PROPERTY_VALUES }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubFormFieldRuleTrigger { public static final String JSON_PROPERTY_ID = "id"; private String id; @@ -121,12 +119,11 @@ public SubFormFieldRuleTrigger id(String id) { return this; } - /** + /** * Must reference the `api_id` of an existing field defined within `form_fields_per_document`. Trigger and action fields and groups must belong to the same signer. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Must reference the `api_id` of an existing field defined within `form_fields_per_document`. Trigger and action fields and groups must belong to the same signer.") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -147,12 +144,11 @@ public SubFormFieldRuleTrigger operator(OperatorEnum operator) { return this; } - /** + /** * Different field types allow different `operator` values: - Field type of **text**: - **is**: exact match - **not**: not exact match - **match**: regular expression, without /. Example: - OK `[a-zA-Z0-9]` - Not OK `/[a-zA-Z0-9]/` - Field type of **dropdown**: - **is**: exact match, single value - **not**: not exact match, single value - **any**: exact match, array of values. - **none**: not exact match, array of values. - Field type of **checkbox**: - **is**: exact match, single value - **not**: not exact match, single value - Field type of **radio**: - **is**: exact match, single value - **not**: not exact match, single value * @return operator - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Different field types allow different `operator` values: - Field type of **text**: - **is**: exact match - **not**: not exact match - **match**: regular expression, without /. Example: - OK `[a-zA-Z0-9]` - Not OK `/[a-zA-Z0-9]/` - Field type of **dropdown**: - **is**: exact match, single value - **not**: not exact match, single value - **any**: exact match, array of values. - **none**: not exact match, array of values. - Field type of **checkbox**: - **is**: exact match, single value - **not**: not exact match, single value - Field type of **radio**: - **is**: exact match, single value - **not**: not exact match, single value") @JsonProperty(JSON_PROPERTY_OPERATOR) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -173,12 +169,11 @@ public SubFormFieldRuleTrigger value(String value) { return this; } - /** + /** * **value** or **values** is required, but not both. The value to match against **operator**. - When **operator** is one of the following, **value** must be `String`: - `is` - `not` - `match` Otherwise, - **checkbox**: When **type** of trigger is **checkbox**, **value** must be `0` or `1` - **radio**: When **type** of trigger is **radio**, **value** must be `1` * @return value - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "**value** or **values** is required, but not both. The value to match against **operator**. - When **operator** is one of the following, **value** must be `String`: - `is` - `not` - `match` Otherwise, - **checkbox**: When **type** of trigger is **checkbox**, **value** must be `0` or `1` - **radio**: When **type** of trigger is **radio**, **value** must be `1`") @JsonProperty(JSON_PROPERTY_VALUE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -207,12 +202,11 @@ public SubFormFieldRuleTrigger addValuesItem(String valuesItem) { return this; } - /** + /** * **values** or **value** is required, but not both. The values to match against **operator** when it is one of the following: - `any` - `none` * @return values - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "**values** or **value** is required, but not both. The values to match against **operator** when it is one of the following: - `any` - `none`") @JsonProperty(JSON_PROPERTY_VALUES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentBase.java b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentBase.java index 8b0e92a..052f989 100644 --- a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentBase.java +++ b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentBase.java @@ -14,19 +14,9 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckbox; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckboxMerge; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDateSigned; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDropdown; -import com.dropbox.sign.model.SubFormFieldsPerDocumentHyperlink; -import com.dropbox.sign.model.SubFormFieldsPerDocumentInitials; -import com.dropbox.sign.model.SubFormFieldsPerDocumentRadio; -import com.dropbox.sign.model.SubFormFieldsPerDocumentSignature; -import com.dropbox.sign.model.SubFormFieldsPerDocumentText; -import com.dropbox.sign.model.SubFormFieldsPerDocumentTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -34,46 +24,37 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).) **NOTE:** Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types. * Text Field use `SubFormFieldsPerDocumentText` * Dropdown Field use `SubFormFieldsPerDocumentDropdown` * Hyperlink Field use `SubFormFieldsPerDocumentHyperlink` * Checkbox Field use `SubFormFieldsPerDocumentCheckbox` * Radio Field use `SubFormFieldsPerDocumentRadio` * Signature Field use `SubFormFieldsPerDocumentSignature` * Date Signed Field use `SubFormFieldsPerDocumentDateSigned` * Initials Field use `SubFormFieldsPerDocumentInitials` * Text Merge Field use `SubFormFieldsPerDocumentTextMerge` * Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge` */ -@ApiModel(description = "The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).) **NOTE:** Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types. * Text Field use `SubFormFieldsPerDocumentText` * Dropdown Field use `SubFormFieldsPerDocumentDropdown` * Hyperlink Field use `SubFormFieldsPerDocumentHyperlink` * Checkbox Field use `SubFormFieldsPerDocumentCheckbox` * Radio Field use `SubFormFieldsPerDocumentRadio` * Signature Field use `SubFormFieldsPerDocumentSignature` * Date Signed Field use `SubFormFieldsPerDocumentDateSigned` * Initials Field use `SubFormFieldsPerDocumentInitials` * Text Merge Field use `SubFormFieldsPerDocumentTextMerge` * Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge`") @JsonPropertyOrder({ - SubFormFieldsPerDocumentBase.JSON_PROPERTY_DOCUMENT_INDEX, - SubFormFieldsPerDocumentBase.JSON_PROPERTY_API_ID, - SubFormFieldsPerDocumentBase.JSON_PROPERTY_HEIGHT, - SubFormFieldsPerDocumentBase.JSON_PROPERTY_REQUIRED, - SubFormFieldsPerDocumentBase.JSON_PROPERTY_SIGNER, - SubFormFieldsPerDocumentBase.JSON_PROPERTY_TYPE, - SubFormFieldsPerDocumentBase.JSON_PROPERTY_WIDTH, - SubFormFieldsPerDocumentBase.JSON_PROPERTY_X, - SubFormFieldsPerDocumentBase.JSON_PROPERTY_Y, - SubFormFieldsPerDocumentBase.JSON_PROPERTY_NAME, - SubFormFieldsPerDocumentBase.JSON_PROPERTY_PAGE + SubFormFieldsPerDocumentBase.JSON_PROPERTY_DOCUMENT_INDEX, + SubFormFieldsPerDocumentBase.JSON_PROPERTY_API_ID, + SubFormFieldsPerDocumentBase.JSON_PROPERTY_HEIGHT, + SubFormFieldsPerDocumentBase.JSON_PROPERTY_REQUIRED, + SubFormFieldsPerDocumentBase.JSON_PROPERTY_SIGNER, + SubFormFieldsPerDocumentBase.JSON_PROPERTY_TYPE, + SubFormFieldsPerDocumentBase.JSON_PROPERTY_WIDTH, + SubFormFieldsPerDocumentBase.JSON_PROPERTY_X, + SubFormFieldsPerDocumentBase.JSON_PROPERTY_Y, + SubFormFieldsPerDocumentBase.JSON_PROPERTY_NAME, + SubFormFieldsPerDocumentBase.JSON_PROPERTY_PAGE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) @JsonSubTypes({ - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckbox.class, name = "SubFormFieldsPerDocumentCheckbox"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckboxMerge.class, name = "SubFormFieldsPerDocumentCheckboxMerge"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDateSigned.class, name = "SubFormFieldsPerDocumentDateSigned"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDropdown.class, name = "SubFormFieldsPerDocumentDropdown"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentHyperlink.class, name = "SubFormFieldsPerDocumentHyperlink"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentInitials.class, name = "SubFormFieldsPerDocumentInitials"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentRadio.class, name = "SubFormFieldsPerDocumentRadio"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentSignature.class, name = "SubFormFieldsPerDocumentSignature"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentText.class, name = "SubFormFieldsPerDocumentText"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentTextMerge.class, name = "SubFormFieldsPerDocumentTextMerge"), @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckbox.class, name = "checkbox"), @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckboxMerge.class, name = "checkbox-merge"), @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDateSigned.class, name = "date_signed"), @@ -143,12 +124,11 @@ public SubFormFieldsPerDocumentBase documentIndex(Integer documentIndex) { return this; } - /** + /** * Represents the integer index of the `file` or `file_url` document the field should be attached to. * @return documentIndex - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Represents the integer index of the `file` or `file_url` document the field should be attached to.") @JsonProperty(JSON_PROPERTY_DOCUMENT_INDEX) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -169,12 +149,11 @@ public SubFormFieldsPerDocumentBase apiId(String apiId) { return this; } - /** + /** * An identifier for the field that is unique across all documents in the request. * @return apiId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "An identifier for the field that is unique across all documents in the request.") @JsonProperty(JSON_PROPERTY_API_ID) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -195,12 +174,11 @@ public SubFormFieldsPerDocumentBase height(Integer height) { return this; } - /** + /** * Size of the field in pixels. * @return height - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Size of the field in pixels.") @JsonProperty(JSON_PROPERTY_HEIGHT) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -221,12 +199,11 @@ public SubFormFieldsPerDocumentBase required(Boolean required) { return this; } - /** + /** * Whether this field is required. * @return required - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Whether this field is required.") @JsonProperty(JSON_PROPERTY_REQUIRED) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -251,12 +228,11 @@ public SubFormFieldsPerDocumentBase signer(Integer signer) { return this; } - /** + /** * Signer index identified by the offset in the signers parameter (0-based indexing), indicating which signer should fill out the field. **NOTE:** To set the value of the field as the preparer you must set this to `me_now` **NOTE:** If type is `text-merge` or `checkbox-merge`, you must set this to sender in order to use pre-filled data. * @return signer - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Signer index identified by the offset in the signers parameter (0-based indexing), indicating which signer should fill out the field. **NOTE:** To set the value of the field as the preparer you must set this to `me_now` **NOTE:** If type is `text-merge` or `checkbox-merge`, you must set this to sender in order to use pre-filled data.") @JsonProperty(JSON_PROPERTY_SIGNER) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -281,12 +257,11 @@ public SubFormFieldsPerDocumentBase type(String type) { return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -307,12 +282,11 @@ public SubFormFieldsPerDocumentBase width(Integer width) { return this; } - /** + /** * Size of the field in pixels. * @return width - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Size of the field in pixels.") @JsonProperty(JSON_PROPERTY_WIDTH) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -333,12 +307,11 @@ public SubFormFieldsPerDocumentBase x(Integer x) { return this; } - /** + /** * Location coordinates of the field in pixels. * @return x - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Location coordinates of the field in pixels.") @JsonProperty(JSON_PROPERTY_X) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -359,12 +332,11 @@ public SubFormFieldsPerDocumentBase y(Integer y) { return this; } - /** + /** * Location coordinates of the field in pixels. * @return y - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Location coordinates of the field in pixels.") @JsonProperty(JSON_PROPERTY_Y) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -385,12 +357,11 @@ public SubFormFieldsPerDocumentBase name(String name) { return this; } - /** + /** * Display name for the field. * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Display name for the field.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -411,12 +382,11 @@ public SubFormFieldsPerDocumentBase page(Integer page) { return this; } - /** + /** * Page in the document where the field should be placed (requires documents be PDF files). - When the page number parameter is supplied, the API will use the new coordinate system. - Check out the differences between both [coordinate systems](https://faq.hellosign.com/hc/en-us/articles/217115577) and how to use them. * @return page - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Page in the document where the field should be placed (requires documents be PDF files). - When the page number parameter is supplied, the API will use the new coordinate system. - Check out the differences between both [coordinate systems](https://faq.hellosign.com/hc/en-us/articles/217115577) and how to use them.") @JsonProperty(JSON_PROPERTY_PAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -732,31 +702,21 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("SubFormFieldsPerDocumentCheckbox", SubFormFieldsPerDocumentCheckbox.class); - mappings.put("SubFormFieldsPerDocumentCheckboxMerge", SubFormFieldsPerDocumentCheckboxMerge.class); - mappings.put("SubFormFieldsPerDocumentDateSigned", SubFormFieldsPerDocumentDateSigned.class); - mappings.put("SubFormFieldsPerDocumentDropdown", SubFormFieldsPerDocumentDropdown.class); - mappings.put("SubFormFieldsPerDocumentHyperlink", SubFormFieldsPerDocumentHyperlink.class); - mappings.put("SubFormFieldsPerDocumentInitials", SubFormFieldsPerDocumentInitials.class); - mappings.put("SubFormFieldsPerDocumentRadio", SubFormFieldsPerDocumentRadio.class); - mappings.put("SubFormFieldsPerDocumentSignature", SubFormFieldsPerDocumentSignature.class); - mappings.put("SubFormFieldsPerDocumentText", SubFormFieldsPerDocumentText.class); - mappings.put("SubFormFieldsPerDocumentTextMerge", SubFormFieldsPerDocumentTextMerge.class); - mappings.put("checkbox", SubFormFieldsPerDocumentCheckbox.class); - mappings.put("checkbox-merge", SubFormFieldsPerDocumentCheckboxMerge.class); - mappings.put("date_signed", SubFormFieldsPerDocumentDateSigned.class); - mappings.put("dropdown", SubFormFieldsPerDocumentDropdown.class); - mappings.put("hyperlink", SubFormFieldsPerDocumentHyperlink.class); - mappings.put("initials", SubFormFieldsPerDocumentInitials.class); - mappings.put("radio", SubFormFieldsPerDocumentRadio.class); - mappings.put("signature", SubFormFieldsPerDocumentSignature.class); - mappings.put("text", SubFormFieldsPerDocumentText.class); - mappings.put("text-merge", SubFormFieldsPerDocumentTextMerge.class); - mappings.put("SubFormFieldsPerDocumentBase", SubFormFieldsPerDocumentBase.class); - JSON.registerDiscriminator(SubFormFieldsPerDocumentBase.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("checkbox", SubFormFieldsPerDocumentCheckbox.class); + mappings.put("checkbox-merge", SubFormFieldsPerDocumentCheckboxMerge.class); + mappings.put("date_signed", SubFormFieldsPerDocumentDateSigned.class); + mappings.put("dropdown", SubFormFieldsPerDocumentDropdown.class); + mappings.put("hyperlink", SubFormFieldsPerDocumentHyperlink.class); + mappings.put("initials", SubFormFieldsPerDocumentInitials.class); + mappings.put("radio", SubFormFieldsPerDocumentRadio.class); + mappings.put("signature", SubFormFieldsPerDocumentSignature.class); + mappings.put("text", SubFormFieldsPerDocumentText.class); + mappings.put("text-merge", SubFormFieldsPerDocumentTextMerge.class); + mappings.put("SubFormFieldsPerDocumentBase", SubFormFieldsPerDocumentBase.class); + JSON.registerDiscriminator(SubFormFieldsPerDocumentBase.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentCheckbox.java b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentCheckbox.java index 95b36e9..0a1ab01 100644 --- a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentCheckbox.java +++ b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentCheckbox.java @@ -14,20 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubFormFieldsPerDocumentBase; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckbox; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckboxMerge; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDateSigned; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDropdown; -import com.dropbox.sign.model.SubFormFieldsPerDocumentHyperlink; -import com.dropbox.sign.model.SubFormFieldsPerDocumentInitials; -import com.dropbox.sign.model.SubFormFieldsPerDocumentRadio; -import com.dropbox.sign.model.SubFormFieldsPerDocumentSignature; -import com.dropbox.sign.model.SubFormFieldsPerDocumentText; -import com.dropbox.sign.model.SubFormFieldsPerDocumentTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -35,39 +25,28 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `SubFormFieldsPerDocumentBase`. */ -@ApiModel(description = "This class extends `SubFormFieldsPerDocumentBase`.") @JsonPropertyOrder({ - SubFormFieldsPerDocumentCheckbox.JSON_PROPERTY_TYPE, - SubFormFieldsPerDocumentCheckbox.JSON_PROPERTY_IS_CHECKED, - SubFormFieldsPerDocumentCheckbox.JSON_PROPERTY_GROUP + SubFormFieldsPerDocumentCheckbox.JSON_PROPERTY_TYPE, + SubFormFieldsPerDocumentCheckbox.JSON_PROPERTY_IS_CHECKED, + SubFormFieldsPerDocumentCheckbox.JSON_PROPERTY_GROUP }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentText.class, name = "text"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentTextMerge.class, name = "text-merge"), -}) public class SubFormFieldsPerDocumentCheckbox extends SubFormFieldsPerDocumentBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -102,12 +81,11 @@ public SubFormFieldsPerDocumentCheckbox type(String type) { return this; } - /** + /** * A yes/no checkbox. Use the `SubFormFieldsPerDocumentCheckbox` class. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A yes/no checkbox. Use the `SubFormFieldsPerDocumentCheckbox` class.") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -128,12 +106,11 @@ public SubFormFieldsPerDocumentCheckbox isChecked(Boolean isChecked) { return this; } - /** + /** * `true` for checking the checkbox field by default, otherwise `false`. * @return isChecked - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "`true` for checking the checkbox field by default, otherwise `false`.") @JsonProperty(JSON_PROPERTY_IS_CHECKED) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -154,12 +131,11 @@ public SubFormFieldsPerDocumentCheckbox group(String group) { return this; } - /** + /** * String referencing group defined in `form_field_groups` parameter. * @return group - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "String referencing group defined in `form_field_groups` parameter.") @JsonProperty(JSON_PROPERTY_GROUP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -310,21 +286,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SubFormFieldsPerDocumentCheckbox.class); - mappings.put("checkbox-merge", SubFormFieldsPerDocumentCheckboxMerge.class); - mappings.put("date_signed", SubFormFieldsPerDocumentDateSigned.class); - mappings.put("dropdown", SubFormFieldsPerDocumentDropdown.class); - mappings.put("hyperlink", SubFormFieldsPerDocumentHyperlink.class); - mappings.put("initials", SubFormFieldsPerDocumentInitials.class); - mappings.put("radio", SubFormFieldsPerDocumentRadio.class); - mappings.put("signature", SubFormFieldsPerDocumentSignature.class); - mappings.put("text", SubFormFieldsPerDocumentText.class); - mappings.put("text-merge", SubFormFieldsPerDocumentTextMerge.class); - mappings.put("SubFormFieldsPerDocumentCheckbox", SubFormFieldsPerDocumentCheckbox.class); - JSON.registerDiscriminator(SubFormFieldsPerDocumentCheckbox.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SubFormFieldsPerDocumentCheckbox", SubFormFieldsPerDocumentCheckbox.class); + JSON.registerDiscriminator(SubFormFieldsPerDocumentCheckbox.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentCheckboxMerge.java b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentCheckboxMerge.java index dd54d59..1c10aa6 100644 --- a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentCheckboxMerge.java +++ b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentCheckboxMerge.java @@ -14,20 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubFormFieldsPerDocumentBase; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckbox; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckboxMerge; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDateSigned; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDropdown; -import com.dropbox.sign.model.SubFormFieldsPerDocumentHyperlink; -import com.dropbox.sign.model.SubFormFieldsPerDocumentInitials; -import com.dropbox.sign.model.SubFormFieldsPerDocumentRadio; -import com.dropbox.sign.model.SubFormFieldsPerDocumentSignature; -import com.dropbox.sign.model.SubFormFieldsPerDocumentText; -import com.dropbox.sign.model.SubFormFieldsPerDocumentTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -35,37 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `SubFormFieldsPerDocumentBase`. */ -@ApiModel(description = "This class extends `SubFormFieldsPerDocumentBase`.") @JsonPropertyOrder({ - SubFormFieldsPerDocumentCheckboxMerge.JSON_PROPERTY_TYPE + SubFormFieldsPerDocumentCheckboxMerge.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentText.class, name = "text"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentTextMerge.class, name = "text-merge"), -}) public class SubFormFieldsPerDocumentCheckboxMerge extends SubFormFieldsPerDocumentBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -94,12 +73,11 @@ public SubFormFieldsPerDocumentCheckboxMerge type(String type) { return this; } - /** + /** * A checkbox field that has default value set using pre-filled data. Use the `SubFormFieldsPerDocumentCheckboxMerge` class. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A checkbox field that has default value set using pre-filled data. Use the `SubFormFieldsPerDocumentCheckboxMerge` class.") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -208,21 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SubFormFieldsPerDocumentCheckbox.class); - mappings.put("checkbox-merge", SubFormFieldsPerDocumentCheckboxMerge.class); - mappings.put("date_signed", SubFormFieldsPerDocumentDateSigned.class); - mappings.put("dropdown", SubFormFieldsPerDocumentDropdown.class); - mappings.put("hyperlink", SubFormFieldsPerDocumentHyperlink.class); - mappings.put("initials", SubFormFieldsPerDocumentInitials.class); - mappings.put("radio", SubFormFieldsPerDocumentRadio.class); - mappings.put("signature", SubFormFieldsPerDocumentSignature.class); - mappings.put("text", SubFormFieldsPerDocumentText.class); - mappings.put("text-merge", SubFormFieldsPerDocumentTextMerge.class); - mappings.put("SubFormFieldsPerDocumentCheckboxMerge", SubFormFieldsPerDocumentCheckboxMerge.class); - JSON.registerDiscriminator(SubFormFieldsPerDocumentCheckboxMerge.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SubFormFieldsPerDocumentCheckboxMerge", SubFormFieldsPerDocumentCheckboxMerge.class); + JSON.registerDiscriminator(SubFormFieldsPerDocumentCheckboxMerge.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentDateSigned.java b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentDateSigned.java index abec112..f6b0fbb 100644 --- a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentDateSigned.java +++ b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentDateSigned.java @@ -14,20 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubFormFieldsPerDocumentBase; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckbox; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckboxMerge; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDateSigned; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDropdown; -import com.dropbox.sign.model.SubFormFieldsPerDocumentHyperlink; -import com.dropbox.sign.model.SubFormFieldsPerDocumentInitials; -import com.dropbox.sign.model.SubFormFieldsPerDocumentRadio; -import com.dropbox.sign.model.SubFormFieldsPerDocumentSignature; -import com.dropbox.sign.model.SubFormFieldsPerDocumentText; -import com.dropbox.sign.model.SubFormFieldsPerDocumentTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -35,39 +25,28 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `SubFormFieldsPerDocumentBase`. */ -@ApiModel(description = "This class extends `SubFormFieldsPerDocumentBase`.") @JsonPropertyOrder({ - SubFormFieldsPerDocumentDateSigned.JSON_PROPERTY_TYPE, - SubFormFieldsPerDocumentDateSigned.JSON_PROPERTY_FONT_FAMILY, - SubFormFieldsPerDocumentDateSigned.JSON_PROPERTY_FONT_SIZE + SubFormFieldsPerDocumentDateSigned.JSON_PROPERTY_TYPE, + SubFormFieldsPerDocumentDateSigned.JSON_PROPERTY_FONT_FAMILY, + SubFormFieldsPerDocumentDateSigned.JSON_PROPERTY_FONT_SIZE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentText.class, name = "text"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentTextMerge.class, name = "text-merge"), -}) public class SubFormFieldsPerDocumentDateSigned extends SubFormFieldsPerDocumentBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -97,17 +76,17 @@ public enum FontFamilyEnum { ROBOTO("roboto"), - ROBOTOMONO("robotoMono"), + ROBOTO_MONO("robotoMono"), - NOTOSANS("notoSans"), + NOTO_SANS("notoSans"), - NOTOSERIF("notoSerif"), + NOTO_SERIF("notoSerif"), - NOTOCJK_JP_REGULAR("notoCJK-JP-Regular"), + NOTO_CJK_JP_REGULAR("notoCJK-JP-Regular"), - NOTOHEBREW_REGULAR("notoHebrew-Regular"), + NOTO_HEBREW_REGULAR("notoHebrew-Regular"), - NOTOSANTHAIMERGED("notoSanThaiMerged"); + NOTO_SAN_THAI_MERGED("notoSanThaiMerged"); private String value; @@ -165,12 +144,11 @@ public SubFormFieldsPerDocumentDateSigned type(String type) { return this; } - /** + /** * A date. Use the `SubFormFieldsPerDocumentDateSigned` class. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A date. Use the `SubFormFieldsPerDocumentDateSigned` class.") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -191,12 +169,11 @@ public SubFormFieldsPerDocumentDateSigned fontFamily(FontFamilyEnum fontFamily) return this; } - /** + /** * Font family for the field. * @return fontFamily - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Font family for the field.") @JsonProperty(JSON_PROPERTY_FONT_FAMILY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -217,12 +194,11 @@ public SubFormFieldsPerDocumentDateSigned fontSize(Integer fontSize) { return this; } - /** + /** * The initial px font size for the field contents. Can be any integer value between `7` and `49`. **NOTE:** Font size may be reduced during processing in order to fit the contents within the dimensions of the field. * @return fontSize - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The initial px font size for the field contents. Can be any integer value between `7` and `49`. **NOTE:** Font size may be reduced during processing in order to fit the contents within the dimensions of the field.") @JsonProperty(JSON_PROPERTY_FONT_SIZE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -373,21 +349,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SubFormFieldsPerDocumentCheckbox.class); - mappings.put("checkbox-merge", SubFormFieldsPerDocumentCheckboxMerge.class); - mappings.put("date_signed", SubFormFieldsPerDocumentDateSigned.class); - mappings.put("dropdown", SubFormFieldsPerDocumentDropdown.class); - mappings.put("hyperlink", SubFormFieldsPerDocumentHyperlink.class); - mappings.put("initials", SubFormFieldsPerDocumentInitials.class); - mappings.put("radio", SubFormFieldsPerDocumentRadio.class); - mappings.put("signature", SubFormFieldsPerDocumentSignature.class); - mappings.put("text", SubFormFieldsPerDocumentText.class); - mappings.put("text-merge", SubFormFieldsPerDocumentTextMerge.class); - mappings.put("SubFormFieldsPerDocumentDateSigned", SubFormFieldsPerDocumentDateSigned.class); - JSON.registerDiscriminator(SubFormFieldsPerDocumentDateSigned.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SubFormFieldsPerDocumentDateSigned", SubFormFieldsPerDocumentDateSigned.class); + JSON.registerDiscriminator(SubFormFieldsPerDocumentDateSigned.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentDropdown.java b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentDropdown.java index 2e3f897..cd8dce0 100644 --- a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentDropdown.java +++ b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentDropdown.java @@ -14,20 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubFormFieldsPerDocumentBase; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckbox; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckboxMerge; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDateSigned; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDropdown; -import com.dropbox.sign.model.SubFormFieldsPerDocumentHyperlink; -import com.dropbox.sign.model.SubFormFieldsPerDocumentInitials; -import com.dropbox.sign.model.SubFormFieldsPerDocumentRadio; -import com.dropbox.sign.model.SubFormFieldsPerDocumentSignature; -import com.dropbox.sign.model.SubFormFieldsPerDocumentText; -import com.dropbox.sign.model.SubFormFieldsPerDocumentTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -35,43 +25,32 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `SubFormFieldsPerDocumentBase`. */ -@ApiModel(description = "This class extends `SubFormFieldsPerDocumentBase`.") @JsonPropertyOrder({ - SubFormFieldsPerDocumentDropdown.JSON_PROPERTY_TYPE, - SubFormFieldsPerDocumentDropdown.JSON_PROPERTY_OPTIONS, - SubFormFieldsPerDocumentDropdown.JSON_PROPERTY_CONTENT, - SubFormFieldsPerDocumentDropdown.JSON_PROPERTY_FONT_FAMILY, - SubFormFieldsPerDocumentDropdown.JSON_PROPERTY_FONT_SIZE + SubFormFieldsPerDocumentDropdown.JSON_PROPERTY_TYPE, + SubFormFieldsPerDocumentDropdown.JSON_PROPERTY_OPTIONS, + SubFormFieldsPerDocumentDropdown.JSON_PROPERTY_CONTENT, + SubFormFieldsPerDocumentDropdown.JSON_PROPERTY_FONT_FAMILY, + SubFormFieldsPerDocumentDropdown.JSON_PROPERTY_FONT_SIZE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentText.class, name = "text"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentTextMerge.class, name = "text-merge"), -}) public class SubFormFieldsPerDocumentDropdown extends SubFormFieldsPerDocumentBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -107,17 +86,17 @@ public enum FontFamilyEnum { ROBOTO("roboto"), - ROBOTOMONO("robotoMono"), + ROBOTO_MONO("robotoMono"), - NOTOSANS("notoSans"), + NOTO_SANS("notoSans"), - NOTOSERIF("notoSerif"), + NOTO_SERIF("notoSerif"), - NOTOCJK_JP_REGULAR("notoCJK-JP-Regular"), + NOTO_CJK_JP_REGULAR("notoCJK-JP-Regular"), - NOTOHEBREW_REGULAR("notoHebrew-Regular"), + NOTO_HEBREW_REGULAR("notoHebrew-Regular"), - NOTOSANTHAIMERGED("notoSanThaiMerged"); + NOTO_SAN_THAI_MERGED("notoSanThaiMerged"); private String value; @@ -175,12 +154,11 @@ public SubFormFieldsPerDocumentDropdown type(String type) { return this; } - /** + /** * An input field for dropdowns. Use the `SubFormFieldsPerDocumentDropdown` class. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "An input field for dropdowns. Use the `SubFormFieldsPerDocumentDropdown` class.") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -202,16 +180,18 @@ public SubFormFieldsPerDocumentDropdown options(List options) { } public SubFormFieldsPerDocumentDropdown addOptionsItem(String optionsItem) { + if (this.options == null) { + this.options = new ArrayList<>(); + } this.options.add(optionsItem); return this; } - /** + /** * Array of string values representing dropdown values. * @return options - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Array of string values representing dropdown values.") @JsonProperty(JSON_PROPERTY_OPTIONS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -232,12 +212,11 @@ public SubFormFieldsPerDocumentDropdown content(String content) { return this; } - /** + /** * Selected value in `options` array. Value must exist in array. * @return content - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Selected value in `options` array. Value must exist in array.") @JsonProperty(JSON_PROPERTY_CONTENT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -258,12 +237,11 @@ public SubFormFieldsPerDocumentDropdown fontFamily(FontFamilyEnum fontFamily) { return this; } - /** + /** * Font family for the field. * @return fontFamily - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Font family for the field.") @JsonProperty(JSON_PROPERTY_FONT_FAMILY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -284,12 +262,11 @@ public SubFormFieldsPerDocumentDropdown fontSize(Integer fontSize) { return this; } - /** + /** * The initial px font size for the field contents. Can be any integer value between `7` and `49`. **NOTE:** Font size may be reduced during processing in order to fit the contents within the dimensions of the field. * @return fontSize - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The initial px font size for the field contents. Can be any integer value between `7` and `49`. **NOTE:** Font size may be reduced during processing in order to fit the contents within the dimensions of the field.") @JsonProperty(JSON_PROPERTY_FONT_SIZE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -482,21 +459,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SubFormFieldsPerDocumentCheckbox.class); - mappings.put("checkbox-merge", SubFormFieldsPerDocumentCheckboxMerge.class); - mappings.put("date_signed", SubFormFieldsPerDocumentDateSigned.class); - mappings.put("dropdown", SubFormFieldsPerDocumentDropdown.class); - mappings.put("hyperlink", SubFormFieldsPerDocumentHyperlink.class); - mappings.put("initials", SubFormFieldsPerDocumentInitials.class); - mappings.put("radio", SubFormFieldsPerDocumentRadio.class); - mappings.put("signature", SubFormFieldsPerDocumentSignature.class); - mappings.put("text", SubFormFieldsPerDocumentText.class); - mappings.put("text-merge", SubFormFieldsPerDocumentTextMerge.class); - mappings.put("SubFormFieldsPerDocumentDropdown", SubFormFieldsPerDocumentDropdown.class); - JSON.registerDiscriminator(SubFormFieldsPerDocumentDropdown.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SubFormFieldsPerDocumentDropdown", SubFormFieldsPerDocumentDropdown.class); + JSON.registerDiscriminator(SubFormFieldsPerDocumentDropdown.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentFontEnum.java b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentFontEnum.java index cedbbd8..f557d5a 100644 --- a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentFontEnum.java +++ b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentFontEnum.java @@ -14,13 +14,12 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; 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.JSON; import com.fasterxml.jackson.annotation.JsonCreator; @@ -51,17 +50,17 @@ public enum SubFormFieldsPerDocumentFontEnum { ROBOTO("roboto"), - ROBOTOMONO("robotoMono"), + ROBOTO_MONO("robotoMono"), - NOTOSANS("notoSans"), + NOTO_SANS("notoSans"), - NOTOSERIF("notoSerif"), + NOTO_SERIF("notoSerif"), - NOTOCJK_JP_REGULAR("notoCJK-JP-Regular"), + NOTO_CJK_JP_REGULAR("notoCJK-JP-Regular"), - NOTOHEBREW_REGULAR("notoHebrew-Regular"), + NOTO_HEBREW_REGULAR("notoHebrew-Regular"), - NOTOSANTHAIMERGED("notoSanThaiMerged"); + NOTO_SAN_THAI_MERGED("notoSanThaiMerged"); private String value; diff --git a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentHyperlink.java b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentHyperlink.java index 705eb23..1bbea87 100644 --- a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentHyperlink.java +++ b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentHyperlink.java @@ -14,20 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubFormFieldsPerDocumentBase; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckbox; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckboxMerge; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDateSigned; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDropdown; -import com.dropbox.sign.model.SubFormFieldsPerDocumentHyperlink; -import com.dropbox.sign.model.SubFormFieldsPerDocumentInitials; -import com.dropbox.sign.model.SubFormFieldsPerDocumentRadio; -import com.dropbox.sign.model.SubFormFieldsPerDocumentSignature; -import com.dropbox.sign.model.SubFormFieldsPerDocumentText; -import com.dropbox.sign.model.SubFormFieldsPerDocumentTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -35,41 +25,30 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `SubFormFieldsPerDocumentBase`. */ -@ApiModel(description = "This class extends `SubFormFieldsPerDocumentBase`.") @JsonPropertyOrder({ - SubFormFieldsPerDocumentHyperlink.JSON_PROPERTY_TYPE, - SubFormFieldsPerDocumentHyperlink.JSON_PROPERTY_CONTENT, - SubFormFieldsPerDocumentHyperlink.JSON_PROPERTY_CONTENT_URL, - SubFormFieldsPerDocumentHyperlink.JSON_PROPERTY_FONT_FAMILY, - SubFormFieldsPerDocumentHyperlink.JSON_PROPERTY_FONT_SIZE + SubFormFieldsPerDocumentHyperlink.JSON_PROPERTY_TYPE, + SubFormFieldsPerDocumentHyperlink.JSON_PROPERTY_CONTENT, + SubFormFieldsPerDocumentHyperlink.JSON_PROPERTY_CONTENT_URL, + SubFormFieldsPerDocumentHyperlink.JSON_PROPERTY_FONT_FAMILY, + SubFormFieldsPerDocumentHyperlink.JSON_PROPERTY_FONT_SIZE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentText.class, name = "text"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentTextMerge.class, name = "text-merge"), -}) public class SubFormFieldsPerDocumentHyperlink extends SubFormFieldsPerDocumentBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -105,17 +84,17 @@ public enum FontFamilyEnum { ROBOTO("roboto"), - ROBOTOMONO("robotoMono"), + ROBOTO_MONO("robotoMono"), - NOTOSANS("notoSans"), + NOTO_SANS("notoSans"), - NOTOSERIF("notoSerif"), + NOTO_SERIF("notoSerif"), - NOTOCJK_JP_REGULAR("notoCJK-JP-Regular"), + NOTO_CJK_JP_REGULAR("notoCJK-JP-Regular"), - NOTOHEBREW_REGULAR("notoHebrew-Regular"), + NOTO_HEBREW_REGULAR("notoHebrew-Regular"), - NOTOSANTHAIMERGED("notoSanThaiMerged"); + NOTO_SAN_THAI_MERGED("notoSanThaiMerged"); private String value; @@ -173,12 +152,11 @@ public SubFormFieldsPerDocumentHyperlink type(String type) { return this; } - /** + /** * A hyperlink field. Use the `SubFormFieldsPerDocumentHyperlink` class. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A hyperlink field. Use the `SubFormFieldsPerDocumentHyperlink` class.") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -199,12 +177,11 @@ public SubFormFieldsPerDocumentHyperlink content(String content) { return this; } - /** + /** * Link Text. * @return content - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Link Text.") @JsonProperty(JSON_PROPERTY_CONTENT) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -225,12 +202,11 @@ public SubFormFieldsPerDocumentHyperlink contentUrl(String contentUrl) { return this; } - /** + /** * Link URL. * @return contentUrl - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Link URL.") @JsonProperty(JSON_PROPERTY_CONTENT_URL) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -251,12 +227,11 @@ public SubFormFieldsPerDocumentHyperlink fontFamily(FontFamilyEnum fontFamily) { return this; } - /** + /** * Font family for the field. * @return fontFamily - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Font family for the field.") @JsonProperty(JSON_PROPERTY_FONT_FAMILY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -277,12 +252,11 @@ public SubFormFieldsPerDocumentHyperlink fontSize(Integer fontSize) { return this; } - /** + /** * The initial px font size for the field contents. Can be any integer value between `7` and `49`. **NOTE:** Font size may be reduced during processing in order to fit the contents within the dimensions of the field. * @return fontSize - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The initial px font size for the field contents. Can be any integer value between `7` and `49`. **NOTE:** Font size may be reduced during processing in order to fit the contents within the dimensions of the field.") @JsonProperty(JSON_PROPERTY_FONT_SIZE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -475,21 +449,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SubFormFieldsPerDocumentCheckbox.class); - mappings.put("checkbox-merge", SubFormFieldsPerDocumentCheckboxMerge.class); - mappings.put("date_signed", SubFormFieldsPerDocumentDateSigned.class); - mappings.put("dropdown", SubFormFieldsPerDocumentDropdown.class); - mappings.put("hyperlink", SubFormFieldsPerDocumentHyperlink.class); - mappings.put("initials", SubFormFieldsPerDocumentInitials.class); - mappings.put("radio", SubFormFieldsPerDocumentRadio.class); - mappings.put("signature", SubFormFieldsPerDocumentSignature.class); - mappings.put("text", SubFormFieldsPerDocumentText.class); - mappings.put("text-merge", SubFormFieldsPerDocumentTextMerge.class); - mappings.put("SubFormFieldsPerDocumentHyperlink", SubFormFieldsPerDocumentHyperlink.class); - JSON.registerDiscriminator(SubFormFieldsPerDocumentHyperlink.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SubFormFieldsPerDocumentHyperlink", SubFormFieldsPerDocumentHyperlink.class); + JSON.registerDiscriminator(SubFormFieldsPerDocumentHyperlink.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentInitials.java b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentInitials.java index a08bac2..7075f8b 100644 --- a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentInitials.java +++ b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentInitials.java @@ -14,20 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubFormFieldsPerDocumentBase; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckbox; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckboxMerge; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDateSigned; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDropdown; -import com.dropbox.sign.model.SubFormFieldsPerDocumentHyperlink; -import com.dropbox.sign.model.SubFormFieldsPerDocumentInitials; -import com.dropbox.sign.model.SubFormFieldsPerDocumentRadio; -import com.dropbox.sign.model.SubFormFieldsPerDocumentSignature; -import com.dropbox.sign.model.SubFormFieldsPerDocumentText; -import com.dropbox.sign.model.SubFormFieldsPerDocumentTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -35,37 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `SubFormFieldsPerDocumentBase`. */ -@ApiModel(description = "This class extends `SubFormFieldsPerDocumentBase`.") @JsonPropertyOrder({ - SubFormFieldsPerDocumentInitials.JSON_PROPERTY_TYPE + SubFormFieldsPerDocumentInitials.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentText.class, name = "text"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentTextMerge.class, name = "text-merge"), -}) public class SubFormFieldsPerDocumentInitials extends SubFormFieldsPerDocumentBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -94,12 +73,11 @@ public SubFormFieldsPerDocumentInitials type(String type) { return this; } - /** + /** * An input field for initials. Use the `SubFormFieldsPerDocumentInitials` class. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "An input field for initials. Use the `SubFormFieldsPerDocumentInitials` class.") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -208,21 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SubFormFieldsPerDocumentCheckbox.class); - mappings.put("checkbox-merge", SubFormFieldsPerDocumentCheckboxMerge.class); - mappings.put("date_signed", SubFormFieldsPerDocumentDateSigned.class); - mappings.put("dropdown", SubFormFieldsPerDocumentDropdown.class); - mappings.put("hyperlink", SubFormFieldsPerDocumentHyperlink.class); - mappings.put("initials", SubFormFieldsPerDocumentInitials.class); - mappings.put("radio", SubFormFieldsPerDocumentRadio.class); - mappings.put("signature", SubFormFieldsPerDocumentSignature.class); - mappings.put("text", SubFormFieldsPerDocumentText.class); - mappings.put("text-merge", SubFormFieldsPerDocumentTextMerge.class); - mappings.put("SubFormFieldsPerDocumentInitials", SubFormFieldsPerDocumentInitials.class); - JSON.registerDiscriminator(SubFormFieldsPerDocumentInitials.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SubFormFieldsPerDocumentInitials", SubFormFieldsPerDocumentInitials.class); + JSON.registerDiscriminator(SubFormFieldsPerDocumentInitials.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentRadio.java b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentRadio.java index 0d52b3d..4991e52 100644 --- a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentRadio.java +++ b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentRadio.java @@ -14,20 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubFormFieldsPerDocumentBase; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckbox; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckboxMerge; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDateSigned; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDropdown; -import com.dropbox.sign.model.SubFormFieldsPerDocumentHyperlink; -import com.dropbox.sign.model.SubFormFieldsPerDocumentInitials; -import com.dropbox.sign.model.SubFormFieldsPerDocumentRadio; -import com.dropbox.sign.model.SubFormFieldsPerDocumentSignature; -import com.dropbox.sign.model.SubFormFieldsPerDocumentText; -import com.dropbox.sign.model.SubFormFieldsPerDocumentTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -35,39 +25,28 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `SubFormFieldsPerDocumentBase`. */ -@ApiModel(description = "This class extends `SubFormFieldsPerDocumentBase`.") @JsonPropertyOrder({ - SubFormFieldsPerDocumentRadio.JSON_PROPERTY_TYPE, - SubFormFieldsPerDocumentRadio.JSON_PROPERTY_GROUP, - SubFormFieldsPerDocumentRadio.JSON_PROPERTY_IS_CHECKED + SubFormFieldsPerDocumentRadio.JSON_PROPERTY_TYPE, + SubFormFieldsPerDocumentRadio.JSON_PROPERTY_GROUP, + SubFormFieldsPerDocumentRadio.JSON_PROPERTY_IS_CHECKED }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentText.class, name = "text"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentTextMerge.class, name = "text-merge"), -}) public class SubFormFieldsPerDocumentRadio extends SubFormFieldsPerDocumentBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -102,12 +81,11 @@ public SubFormFieldsPerDocumentRadio type(String type) { return this; } - /** + /** * An input field for radios. Use the `SubFormFieldsPerDocumentRadio` class. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "An input field for radios. Use the `SubFormFieldsPerDocumentRadio` class.") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -128,12 +106,11 @@ public SubFormFieldsPerDocumentRadio group(String group) { return this; } - /** + /** * String referencing group defined in `form_field_groups` parameter. * @return group - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "String referencing group defined in `form_field_groups` parameter.") @JsonProperty(JSON_PROPERTY_GROUP) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -154,12 +131,11 @@ public SubFormFieldsPerDocumentRadio isChecked(Boolean isChecked) { return this; } - /** + /** * `true` for checking the radio field by default, otherwise `false`. Only one radio field per group can be `true`. * @return isChecked - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "`true` for checking the radio field by default, otherwise `false`. Only one radio field per group can be `true`.") @JsonProperty(JSON_PROPERTY_IS_CHECKED) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -310,21 +286,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SubFormFieldsPerDocumentCheckbox.class); - mappings.put("checkbox-merge", SubFormFieldsPerDocumentCheckboxMerge.class); - mappings.put("date_signed", SubFormFieldsPerDocumentDateSigned.class); - mappings.put("dropdown", SubFormFieldsPerDocumentDropdown.class); - mappings.put("hyperlink", SubFormFieldsPerDocumentHyperlink.class); - mappings.put("initials", SubFormFieldsPerDocumentInitials.class); - mappings.put("radio", SubFormFieldsPerDocumentRadio.class); - mappings.put("signature", SubFormFieldsPerDocumentSignature.class); - mappings.put("text", SubFormFieldsPerDocumentText.class); - mappings.put("text-merge", SubFormFieldsPerDocumentTextMerge.class); - mappings.put("SubFormFieldsPerDocumentRadio", SubFormFieldsPerDocumentRadio.class); - JSON.registerDiscriminator(SubFormFieldsPerDocumentRadio.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SubFormFieldsPerDocumentRadio", SubFormFieldsPerDocumentRadio.class); + JSON.registerDiscriminator(SubFormFieldsPerDocumentRadio.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentSignature.java b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentSignature.java index 6b566fd..c6867bd 100644 --- a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentSignature.java +++ b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentSignature.java @@ -14,20 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubFormFieldsPerDocumentBase; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckbox; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckboxMerge; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDateSigned; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDropdown; -import com.dropbox.sign.model.SubFormFieldsPerDocumentHyperlink; -import com.dropbox.sign.model.SubFormFieldsPerDocumentInitials; -import com.dropbox.sign.model.SubFormFieldsPerDocumentRadio; -import com.dropbox.sign.model.SubFormFieldsPerDocumentSignature; -import com.dropbox.sign.model.SubFormFieldsPerDocumentText; -import com.dropbox.sign.model.SubFormFieldsPerDocumentTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -35,37 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `SubFormFieldsPerDocumentBase`. */ -@ApiModel(description = "This class extends `SubFormFieldsPerDocumentBase`.") @JsonPropertyOrder({ - SubFormFieldsPerDocumentSignature.JSON_PROPERTY_TYPE + SubFormFieldsPerDocumentSignature.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentText.class, name = "text"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentTextMerge.class, name = "text-merge"), -}) public class SubFormFieldsPerDocumentSignature extends SubFormFieldsPerDocumentBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -94,12 +73,11 @@ public SubFormFieldsPerDocumentSignature type(String type) { return this; } - /** + /** * A signature input field. Use the `SubFormFieldsPerDocumentSignature` class. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A signature input field. Use the `SubFormFieldsPerDocumentSignature` class.") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -208,21 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SubFormFieldsPerDocumentCheckbox.class); - mappings.put("checkbox-merge", SubFormFieldsPerDocumentCheckboxMerge.class); - mappings.put("date_signed", SubFormFieldsPerDocumentDateSigned.class); - mappings.put("dropdown", SubFormFieldsPerDocumentDropdown.class); - mappings.put("hyperlink", SubFormFieldsPerDocumentHyperlink.class); - mappings.put("initials", SubFormFieldsPerDocumentInitials.class); - mappings.put("radio", SubFormFieldsPerDocumentRadio.class); - mappings.put("signature", SubFormFieldsPerDocumentSignature.class); - mappings.put("text", SubFormFieldsPerDocumentText.class); - mappings.put("text-merge", SubFormFieldsPerDocumentTextMerge.class); - mappings.put("SubFormFieldsPerDocumentSignature", SubFormFieldsPerDocumentSignature.class); - JSON.registerDiscriminator(SubFormFieldsPerDocumentSignature.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SubFormFieldsPerDocumentSignature", SubFormFieldsPerDocumentSignature.class); + JSON.registerDiscriminator(SubFormFieldsPerDocumentSignature.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentText.java b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentText.java index 6cbcfd4..d2b5eed 100644 --- a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentText.java +++ b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentText.java @@ -14,20 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubFormFieldsPerDocumentBase; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckbox; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckboxMerge; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDateSigned; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDropdown; -import com.dropbox.sign.model.SubFormFieldsPerDocumentHyperlink; -import com.dropbox.sign.model.SubFormFieldsPerDocumentInitials; -import com.dropbox.sign.model.SubFormFieldsPerDocumentRadio; -import com.dropbox.sign.model.SubFormFieldsPerDocumentSignature; -import com.dropbox.sign.model.SubFormFieldsPerDocumentText; -import com.dropbox.sign.model.SubFormFieldsPerDocumentTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -35,47 +25,36 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `SubFormFieldsPerDocumentBase`. */ -@ApiModel(description = "This class extends `SubFormFieldsPerDocumentBase`.") @JsonPropertyOrder({ - SubFormFieldsPerDocumentText.JSON_PROPERTY_TYPE, - SubFormFieldsPerDocumentText.JSON_PROPERTY_PLACEHOLDER, - SubFormFieldsPerDocumentText.JSON_PROPERTY_AUTO_FILL_TYPE, - SubFormFieldsPerDocumentText.JSON_PROPERTY_LINK_ID, - SubFormFieldsPerDocumentText.JSON_PROPERTY_MASKED, - SubFormFieldsPerDocumentText.JSON_PROPERTY_VALIDATION_TYPE, - SubFormFieldsPerDocumentText.JSON_PROPERTY_VALIDATION_CUSTOM_REGEX, - SubFormFieldsPerDocumentText.JSON_PROPERTY_VALIDATION_CUSTOM_REGEX_FORMAT_LABEL, - SubFormFieldsPerDocumentText.JSON_PROPERTY_CONTENT, - SubFormFieldsPerDocumentText.JSON_PROPERTY_FONT_FAMILY, - SubFormFieldsPerDocumentText.JSON_PROPERTY_FONT_SIZE + SubFormFieldsPerDocumentText.JSON_PROPERTY_TYPE, + SubFormFieldsPerDocumentText.JSON_PROPERTY_PLACEHOLDER, + SubFormFieldsPerDocumentText.JSON_PROPERTY_AUTO_FILL_TYPE, + SubFormFieldsPerDocumentText.JSON_PROPERTY_LINK_ID, + SubFormFieldsPerDocumentText.JSON_PROPERTY_MASKED, + SubFormFieldsPerDocumentText.JSON_PROPERTY_VALIDATION_TYPE, + SubFormFieldsPerDocumentText.JSON_PROPERTY_VALIDATION_CUSTOM_REGEX, + SubFormFieldsPerDocumentText.JSON_PROPERTY_VALIDATION_CUSTOM_REGEX_FORMAT_LABEL, + SubFormFieldsPerDocumentText.JSON_PROPERTY_CONTENT, + SubFormFieldsPerDocumentText.JSON_PROPERTY_FONT_FAMILY, + SubFormFieldsPerDocumentText.JSON_PROPERTY_FONT_SIZE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentText.class, name = "text"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentTextMerge.class, name = "text-merge"), -}) public class SubFormFieldsPerDocumentText extends SubFormFieldsPerDocumentBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -180,17 +159,17 @@ public enum FontFamilyEnum { ROBOTO("roboto"), - ROBOTOMONO("robotoMono"), + ROBOTO_MONO("robotoMono"), - NOTOSANS("notoSans"), + NOTO_SANS("notoSans"), - NOTOSERIF("notoSerif"), + NOTO_SERIF("notoSerif"), - NOTOCJK_JP_REGULAR("notoCJK-JP-Regular"), + NOTO_CJK_JP_REGULAR("notoCJK-JP-Regular"), - NOTOHEBREW_REGULAR("notoHebrew-Regular"), + NOTO_HEBREW_REGULAR("notoHebrew-Regular"), - NOTOSANTHAIMERGED("notoSanThaiMerged"); + NOTO_SAN_THAI_MERGED("notoSanThaiMerged"); private String value; @@ -248,12 +227,11 @@ public SubFormFieldsPerDocumentText type(String type) { return this; } - /** + /** * A text input field. Use the `SubFormFieldsPerDocumentText` class. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A text input field. Use the `SubFormFieldsPerDocumentText` class.") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -274,12 +252,11 @@ public SubFormFieldsPerDocumentText placeholder(String placeholder) { return this; } - /** + /** * Placeholder value for text field. * @return placeholder - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Placeholder value for text field.") @JsonProperty(JSON_PROPERTY_PLACEHOLDER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -300,12 +277,11 @@ public SubFormFieldsPerDocumentText autoFillType(String autoFillType) { return this; } - /** + /** * Auto fill type for populating fields automatically. Check out the list of [auto fill types](/api/reference/constants/#auto-fill-types) to learn more about the possible values. * @return autoFillType - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Auto fill type for populating fields automatically. Check out the list of [auto fill types](/api/reference/constants/#auto-fill-types) to learn more about the possible values.") @JsonProperty(JSON_PROPERTY_AUTO_FILL_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -326,12 +302,11 @@ public SubFormFieldsPerDocumentText linkId(String linkId) { return this; } - /** + /** * Link two or more text fields. Enter data into one linked text field, which automatically fill all other linked text fields. * @return linkId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Link two or more text fields. Enter data into one linked text field, which automatically fill all other linked text fields.") @JsonProperty(JSON_PROPERTY_LINK_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -352,12 +327,11 @@ public SubFormFieldsPerDocumentText masked(Boolean masked) { return this; } - /** + /** * Masks entered data. For more information see [Masking sensitive information](https://faq.hellosign.com/hc/en-us/articles/360040742811-Masking-sensitive-information). `true` for masking the data in a text field, otherwise `false`. * @return masked - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Masks entered data. For more information see [Masking sensitive information](https://faq.hellosign.com/hc/en-us/articles/360040742811-Masking-sensitive-information). `true` for masking the data in a text field, otherwise `false`.") @JsonProperty(JSON_PROPERTY_MASKED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -378,12 +352,11 @@ public SubFormFieldsPerDocumentText validationType(ValidationTypeEnum validation return this; } - /** + /** * Each text field may contain a `validation_type` parameter. Check out the list of [validation types](https://faq.hellosign.com/hc/en-us/articles/217115577) to learn more about the possible values. **NOTE:** When using `custom_regex` you are required to pass a second parameter `validation_custom_regex` and you can optionally provide `validation_custom_regex_format_label` for the error message the user will see in case of an invalid value. * @return validationType - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Each text field may contain a `validation_type` parameter. Check out the list of [validation types](https://faq.hellosign.com/hc/en-us/articles/217115577) to learn more about the possible values. **NOTE:** When using `custom_regex` you are required to pass a second parameter `validation_custom_regex` and you can optionally provide `validation_custom_regex_format_label` for the error message the user will see in case of an invalid value.") @JsonProperty(JSON_PROPERTY_VALIDATION_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -404,12 +377,11 @@ public SubFormFieldsPerDocumentText validationCustomRegex(String validationCusto return this; } - /** + /** * Get validationCustomRegex * @return validationCustomRegex - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_VALIDATION_CUSTOM_REGEX) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -430,12 +402,11 @@ public SubFormFieldsPerDocumentText validationCustomRegexFormatLabel(String vali return this; } - /** + /** * Get validationCustomRegexFormatLabel * @return validationCustomRegexFormatLabel - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_VALIDATION_CUSTOM_REGEX_FORMAT_LABEL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -456,12 +427,11 @@ public SubFormFieldsPerDocumentText content(String content) { return this; } - /** + /** * Content of a `me_now` text field * @return content - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Content of a `me_now` text field") @JsonProperty(JSON_PROPERTY_CONTENT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -482,12 +452,11 @@ public SubFormFieldsPerDocumentText fontFamily(FontFamilyEnum fontFamily) { return this; } - /** + /** * Font family for the field. * @return fontFamily - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Font family for the field.") @JsonProperty(JSON_PROPERTY_FONT_FAMILY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -508,12 +477,11 @@ public SubFormFieldsPerDocumentText fontSize(Integer fontSize) { return this; } - /** + /** * The initial px font size for the field contents. Can be any integer value between `7` and `49`. **NOTE:** Font size may be reduced during processing in order to fit the contents within the dimensions of the field. * @return fontSize - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The initial px font size for the field contents. Can be any integer value between `7` and `49`. **NOTE:** Font size may be reduced during processing in order to fit the contents within the dimensions of the field.") @JsonProperty(JSON_PROPERTY_FONT_SIZE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -832,21 +800,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SubFormFieldsPerDocumentCheckbox.class); - mappings.put("checkbox-merge", SubFormFieldsPerDocumentCheckboxMerge.class); - mappings.put("date_signed", SubFormFieldsPerDocumentDateSigned.class); - mappings.put("dropdown", SubFormFieldsPerDocumentDropdown.class); - mappings.put("hyperlink", SubFormFieldsPerDocumentHyperlink.class); - mappings.put("initials", SubFormFieldsPerDocumentInitials.class); - mappings.put("radio", SubFormFieldsPerDocumentRadio.class); - mappings.put("signature", SubFormFieldsPerDocumentSignature.class); - mappings.put("text", SubFormFieldsPerDocumentText.class); - mappings.put("text-merge", SubFormFieldsPerDocumentTextMerge.class); - mappings.put("SubFormFieldsPerDocumentText", SubFormFieldsPerDocumentText.class); - JSON.registerDiscriminator(SubFormFieldsPerDocumentText.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SubFormFieldsPerDocumentText", SubFormFieldsPerDocumentText.class); + JSON.registerDiscriminator(SubFormFieldsPerDocumentText.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentTextMerge.java b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentTextMerge.java index 548f33c..a023b64 100644 --- a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentTextMerge.java +++ b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentTextMerge.java @@ -14,20 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubFormFieldsPerDocumentBase; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckbox; -import com.dropbox.sign.model.SubFormFieldsPerDocumentCheckboxMerge; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDateSigned; -import com.dropbox.sign.model.SubFormFieldsPerDocumentDropdown; -import com.dropbox.sign.model.SubFormFieldsPerDocumentHyperlink; -import com.dropbox.sign.model.SubFormFieldsPerDocumentInitials; -import com.dropbox.sign.model.SubFormFieldsPerDocumentRadio; -import com.dropbox.sign.model.SubFormFieldsPerDocumentSignature; -import com.dropbox.sign.model.SubFormFieldsPerDocumentText; -import com.dropbox.sign.model.SubFormFieldsPerDocumentTextMerge; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -35,39 +25,28 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `SubFormFieldsPerDocumentBase`. */ -@ApiModel(description = "This class extends `SubFormFieldsPerDocumentBase`.") @JsonPropertyOrder({ - SubFormFieldsPerDocumentTextMerge.JSON_PROPERTY_TYPE, - SubFormFieldsPerDocumentTextMerge.JSON_PROPERTY_FONT_FAMILY, - SubFormFieldsPerDocumentTextMerge.JSON_PROPERTY_FONT_SIZE + SubFormFieldsPerDocumentTextMerge.JSON_PROPERTY_TYPE, + SubFormFieldsPerDocumentTextMerge.JSON_PROPERTY_FONT_FAMILY, + SubFormFieldsPerDocumentTextMerge.JSON_PROPERTY_FONT_SIZE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentCheckboxMerge.class, name = "checkbox-merge"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentInitials.class, name = "initials"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentRadio.class, name = "radio"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentSignature.class, name = "signature"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentText.class, name = "text"), - @JsonSubTypes.Type(value = SubFormFieldsPerDocumentTextMerge.class, name = "text-merge"), -}) public class SubFormFieldsPerDocumentTextMerge extends SubFormFieldsPerDocumentBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -97,17 +76,17 @@ public enum FontFamilyEnum { ROBOTO("roboto"), - ROBOTOMONO("robotoMono"), + ROBOTO_MONO("robotoMono"), - NOTOSANS("notoSans"), + NOTO_SANS("notoSans"), - NOTOSERIF("notoSerif"), + NOTO_SERIF("notoSerif"), - NOTOCJK_JP_REGULAR("notoCJK-JP-Regular"), + NOTO_CJK_JP_REGULAR("notoCJK-JP-Regular"), - NOTOHEBREW_REGULAR("notoHebrew-Regular"), + NOTO_HEBREW_REGULAR("notoHebrew-Regular"), - NOTOSANTHAIMERGED("notoSanThaiMerged"); + NOTO_SAN_THAI_MERGED("notoSanThaiMerged"); private String value; @@ -165,12 +144,11 @@ public SubFormFieldsPerDocumentTextMerge type(String type) { return this; } - /** + /** * A text field that has default text set using pre-filled data. Use the `SubFormFieldsPerDocumentTextMerge` class. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A text field that has default text set using pre-filled data. Use the `SubFormFieldsPerDocumentTextMerge` class.") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -191,12 +169,11 @@ public SubFormFieldsPerDocumentTextMerge fontFamily(FontFamilyEnum fontFamily) { return this; } - /** + /** * Font family for the field. * @return fontFamily - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Font family for the field.") @JsonProperty(JSON_PROPERTY_FONT_FAMILY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -217,12 +194,11 @@ public SubFormFieldsPerDocumentTextMerge fontSize(Integer fontSize) { return this; } - /** + /** * The initial px font size for the field contents. Can be any integer value between `7` and `49`. **NOTE:** Font size may be reduced during processing in order to fit the contents within the dimensions of the field. * @return fontSize - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The initial px font size for the field contents. Can be any integer value between `7` and `49`. **NOTE:** Font size may be reduced during processing in order to fit the contents within the dimensions of the field.") @JsonProperty(JSON_PROPERTY_FONT_SIZE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -373,21 +349,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", SubFormFieldsPerDocumentCheckbox.class); - mappings.put("checkbox-merge", SubFormFieldsPerDocumentCheckboxMerge.class); - mappings.put("date_signed", SubFormFieldsPerDocumentDateSigned.class); - mappings.put("dropdown", SubFormFieldsPerDocumentDropdown.class); - mappings.put("hyperlink", SubFormFieldsPerDocumentHyperlink.class); - mappings.put("initials", SubFormFieldsPerDocumentInitials.class); - mappings.put("radio", SubFormFieldsPerDocumentRadio.class); - mappings.put("signature", SubFormFieldsPerDocumentSignature.class); - mappings.put("text", SubFormFieldsPerDocumentText.class); - mappings.put("text-merge", SubFormFieldsPerDocumentTextMerge.class); - mappings.put("SubFormFieldsPerDocumentTextMerge", SubFormFieldsPerDocumentTextMerge.class); - JSON.registerDiscriminator(SubFormFieldsPerDocumentTextMerge.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("SubFormFieldsPerDocumentTextMerge", SubFormFieldsPerDocumentTextMerge.class); + JSON.registerDiscriminator(SubFormFieldsPerDocumentTextMerge.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentTypeEnum.java b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentTypeEnum.java index 1fc0ee4..2b9d9c0 100644 --- a/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentTypeEnum.java +++ b/src/main/java/com/dropbox/sign/model/SubFormFieldsPerDocumentTypeEnum.java @@ -14,13 +14,12 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; 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.JSON; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/src/main/java/com/dropbox/sign/model/SubMergeField.java b/src/main/java/com/dropbox/sign/model/SubMergeField.java index df1dcca..2ff60ac 100644 --- a/src/main/java/com/dropbox/sign/model/SubMergeField.java +++ b/src/main/java/com/dropbox/sign/model/SubMergeField.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,11 +33,11 @@ * SubMergeField */ @JsonPropertyOrder({ - SubMergeField.JSON_PROPERTY_NAME, - SubMergeField.JSON_PROPERTY_TYPE + SubMergeField.JSON_PROPERTY_NAME, + SubMergeField.JSON_PROPERTY_TYPE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubMergeField { public static final String JSON_PROPERTY_NAME = "name"; private String name; @@ -105,12 +103,11 @@ public SubMergeField name(String name) { return this; } - /** + /** * The name of the merge field. Must be unique. * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the merge field. Must be unique.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -131,12 +128,11 @@ public SubMergeField type(TypeEnum type) { return this; } - /** + /** * The type of merge field. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of merge field.") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) diff --git a/src/main/java/com/dropbox/sign/model/SubOAuth.java b/src/main/java/com/dropbox/sign/model/SubOAuth.java index d5e37c4..b598b71 100644 --- a/src/main/java/com/dropbox/sign/model/SubOAuth.java +++ b/src/main/java/com/dropbox/sign/model/SubOAuth.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,27 +21,25 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; /** * OAuth related parameters. */ -@ApiModel(description = "OAuth related parameters.") @JsonPropertyOrder({ - SubOAuth.JSON_PROPERTY_CALLBACK_URL, - SubOAuth.JSON_PROPERTY_SCOPES + SubOAuth.JSON_PROPERTY_CALLBACK_URL, + SubOAuth.JSON_PROPERTY_SCOPES }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubOAuth { public static final String JSON_PROPERTY_CALLBACK_URL = "callback_url"; private String callbackUrl; @@ -120,12 +117,11 @@ public SubOAuth callbackUrl(String callbackUrl) { return this; } - /** + /** * The callback URL to be used for OAuth flows. (Required if `oauth[scopes]` is provided) * @return callbackUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The callback URL to be used for OAuth flows. (Required if `oauth[scopes]` is provided)") @JsonProperty(JSON_PROPERTY_CALLBACK_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -154,12 +150,11 @@ public SubOAuth addScopesItem(ScopesEnum scopesItem) { return this; } - /** + /** * A list of [OAuth scopes](/api/reference/tag/OAuth) to be granted to the app. (Required if `oauth[callback_url]` is provided). * @return scopes - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of [OAuth scopes](/api/reference/tag/OAuth) to be granted to the app. (Required if `oauth[callback_url]` is provided).") @JsonProperty(JSON_PROPERTY_SCOPES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SubOptions.java b/src/main/java/com/dropbox/sign/model/SubOptions.java index b5c9e9b..d0908c7 100644 --- a/src/main/java/com/dropbox/sign/model/SubOptions.java +++ b/src/main/java/com/dropbox/sign/model/SubOptions.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,24 +21,22 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * Additional options supported by API App. */ -@ApiModel(description = "Additional options supported by API App.") @JsonPropertyOrder({ - SubOptions.JSON_PROPERTY_CAN_INSERT_EVERYWHERE + SubOptions.JSON_PROPERTY_CAN_INSERT_EVERYWHERE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubOptions { public static final String JSON_PROPERTY_CAN_INSERT_EVERYWHERE = "can_insert_everywhere"; private Boolean canInsertEverywhere = false; @@ -67,12 +64,11 @@ public SubOptions canInsertEverywhere(Boolean canInsertEverywhere) { return this; } - /** + /** * Determines if signers can use \"Insert Everywhere\" when signing a document. * @return canInsertEverywhere - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Determines if signers can use \"Insert Everywhere\" when signing a document.") @JsonProperty(JSON_PROPERTY_CAN_INSERT_EVERYWHERE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SubSignatureRequestGroupedSigners.java b/src/main/java/com/dropbox/sign/model/SubSignatureRequestGroupedSigners.java index 12194c9..5d7a978 100644 --- a/src/main/java/com/dropbox/sign/model/SubSignatureRequestGroupedSigners.java +++ b/src/main/java/com/dropbox/sign/model/SubSignatureRequestGroupedSigners.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubSignatureRequestSigner; @@ -23,14 +22,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -38,12 +36,12 @@ * SubSignatureRequestGroupedSigners */ @JsonPropertyOrder({ - SubSignatureRequestGroupedSigners.JSON_PROPERTY_GROUP, - SubSignatureRequestGroupedSigners.JSON_PROPERTY_SIGNERS, - SubSignatureRequestGroupedSigners.JSON_PROPERTY_ORDER + SubSignatureRequestGroupedSigners.JSON_PROPERTY_GROUP, + SubSignatureRequestGroupedSigners.JSON_PROPERTY_SIGNERS, + SubSignatureRequestGroupedSigners.JSON_PROPERTY_ORDER }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubSignatureRequestGroupedSigners { public static final String JSON_PROPERTY_GROUP = "group"; private String group; @@ -77,12 +75,11 @@ public SubSignatureRequestGroupedSigners group(String group) { return this; } - /** + /** * The name of the group. * @return group - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the group.") @JsonProperty(JSON_PROPERTY_GROUP) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -104,16 +101,18 @@ public SubSignatureRequestGroupedSigners signers(List } public SubSignatureRequestGroupedSigners addSignersItem(SubSignatureRequestSigner signersItem) { + if (this.signers == null) { + this.signers = new ArrayList<>(); + } this.signers.add(signersItem); return this; } - /** + /** * Signers belonging to this Group. **NOTE:** Only `name`, `email_address`, and `pin` are available to Grouped Signers. We will ignore all other properties, even though they are listed below. * @return signers - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Signers belonging to this Group. **NOTE:** Only `name`, `email_address`, and `pin` are available to Grouped Signers. We will ignore all other properties, even though they are listed below.") @JsonProperty(JSON_PROPERTY_SIGNERS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -134,12 +133,11 @@ public SubSignatureRequestGroupedSigners order(Integer order) { return this; } - /** + /** * The order the group is required to sign in. Use this instead of Signer-level `order`. * @return order - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The order the group is required to sign in. Use this instead of Signer-level `order`.") @JsonProperty(JSON_PROPERTY_ORDER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SubSignatureRequestSigner.java b/src/main/java/com/dropbox/sign/model/SubSignatureRequestSigner.java index 660f312..9fba0ef 100644 --- a/src/main/java/com/dropbox/sign/model/SubSignatureRequestSigner.java +++ b/src/main/java/com/dropbox/sign/model/SubSignatureRequestSigner.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,15 +33,15 @@ * SubSignatureRequestSigner */ @JsonPropertyOrder({ - SubSignatureRequestSigner.JSON_PROPERTY_NAME, - SubSignatureRequestSigner.JSON_PROPERTY_EMAIL_ADDRESS, - SubSignatureRequestSigner.JSON_PROPERTY_ORDER, - SubSignatureRequestSigner.JSON_PROPERTY_PIN, - SubSignatureRequestSigner.JSON_PROPERTY_SMS_PHONE_NUMBER, - SubSignatureRequestSigner.JSON_PROPERTY_SMS_PHONE_NUMBER_TYPE + SubSignatureRequestSigner.JSON_PROPERTY_NAME, + SubSignatureRequestSigner.JSON_PROPERTY_EMAIL_ADDRESS, + SubSignatureRequestSigner.JSON_PROPERTY_ORDER, + SubSignatureRequestSigner.JSON_PROPERTY_PIN, + SubSignatureRequestSigner.JSON_PROPERTY_SMS_PHONE_NUMBER, + SubSignatureRequestSigner.JSON_PROPERTY_SMS_PHONE_NUMBER_TYPE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubSignatureRequestSigner { public static final String JSON_PROPERTY_NAME = "name"; private String name; @@ -121,12 +119,11 @@ public SubSignatureRequestSigner name(String name) { return this; } - /** + /** * The name of the signer. * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the signer.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -147,12 +144,11 @@ public SubSignatureRequestSigner emailAddress(String emailAddress) { return this; } - /** + /** * The email address of the signer. * @return emailAddress - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The email address of the signer.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -173,12 +169,11 @@ public SubSignatureRequestSigner order(Integer order) { return this; } - /** + /** * The order the signer is required to sign in. * @return order - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The order the signer is required to sign in.") @JsonProperty(JSON_PROPERTY_ORDER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -199,12 +194,11 @@ public SubSignatureRequestSigner pin(String pin) { return this; } - /** + /** * The 4- to 12-character access code that will secure this signer's signature page. * @return pin - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The 4- to 12-character access code that will secure this signer's signature page.") @JsonProperty(JSON_PROPERTY_PIN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -225,12 +219,11 @@ public SubSignatureRequestSigner smsPhoneNumber(String smsPhoneNumber) { return this; } - /** + /** * An E.164 formatted phone number. By using the feature, you agree you are responsible for obtaining a signer's consent to receive text messages from Dropbox Sign related to this signature request and confirm you have obtained such consent from all signers prior to enabling SMS delivery for this signature request. [Learn more](https://faq.hellosign.com/hc/en-us/articles/15815316468877-Dropbox-Sign-SMS-tools-add-on). **NOTE:** Not available in test mode and requires a Standard plan or higher. * @return smsPhoneNumber - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An E.164 formatted phone number. By using the feature, you agree you are responsible for obtaining a signer's consent to receive text messages from Dropbox Sign related to this signature request and confirm you have obtained such consent from all signers prior to enabling SMS delivery for this signature request. [Learn more](https://faq.hellosign.com/hc/en-us/articles/15815316468877-Dropbox-Sign-SMS-tools-add-on). **NOTE:** Not available in test mode and requires a Standard plan or higher.") @JsonProperty(JSON_PROPERTY_SMS_PHONE_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -251,12 +244,11 @@ public SubSignatureRequestSigner smsPhoneNumberType(SmsPhoneNumberTypeEnum smsPh return this; } - /** + /** * Specifies the feature used with the `sms_phone_number`. Default `authentication`. If `authentication`, signer is sent a verification code via SMS that is required to access the document. If `delivery`, a link to complete the signature request is delivered via SMS (_and_ email). * @return smsPhoneNumberType - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Specifies the feature used with the `sms_phone_number`. Default `authentication`. If `authentication`, signer is sent a verification code via SMS that is required to access the document. If `delivery`, a link to complete the signature request is delivered via SMS (_and_ email).") @JsonProperty(JSON_PROPERTY_SMS_PHONE_NUMBER_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SubSignatureRequestTemplateSigner.java b/src/main/java/com/dropbox/sign/model/SubSignatureRequestTemplateSigner.java index 86a6bcb..71fbf6d 100644 --- a/src/main/java/com/dropbox/sign/model/SubSignatureRequestTemplateSigner.java +++ b/src/main/java/com/dropbox/sign/model/SubSignatureRequestTemplateSigner.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,15 +33,15 @@ * SubSignatureRequestTemplateSigner */ @JsonPropertyOrder({ - SubSignatureRequestTemplateSigner.JSON_PROPERTY_ROLE, - SubSignatureRequestTemplateSigner.JSON_PROPERTY_NAME, - SubSignatureRequestTemplateSigner.JSON_PROPERTY_EMAIL_ADDRESS, - SubSignatureRequestTemplateSigner.JSON_PROPERTY_PIN, - SubSignatureRequestTemplateSigner.JSON_PROPERTY_SMS_PHONE_NUMBER, - SubSignatureRequestTemplateSigner.JSON_PROPERTY_SMS_PHONE_NUMBER_TYPE + SubSignatureRequestTemplateSigner.JSON_PROPERTY_ROLE, + SubSignatureRequestTemplateSigner.JSON_PROPERTY_NAME, + SubSignatureRequestTemplateSigner.JSON_PROPERTY_EMAIL_ADDRESS, + SubSignatureRequestTemplateSigner.JSON_PROPERTY_PIN, + SubSignatureRequestTemplateSigner.JSON_PROPERTY_SMS_PHONE_NUMBER, + SubSignatureRequestTemplateSigner.JSON_PROPERTY_SMS_PHONE_NUMBER_TYPE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubSignatureRequestTemplateSigner { public static final String JSON_PROPERTY_ROLE = "role"; private String role; @@ -121,12 +119,11 @@ public SubSignatureRequestTemplateSigner role(String role) { return this; } - /** + /** * Must match an existing role in chosen Template(s). It's case-sensitive. * @return role - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Must match an existing role in chosen Template(s). It's case-sensitive.") @JsonProperty(JSON_PROPERTY_ROLE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -147,12 +144,11 @@ public SubSignatureRequestTemplateSigner name(String name) { return this; } - /** + /** * The name of the signer. * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the signer.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -173,12 +169,11 @@ public SubSignatureRequestTemplateSigner emailAddress(String emailAddress) { return this; } - /** + /** * The email address of the signer. * @return emailAddress - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The email address of the signer.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -199,12 +194,11 @@ public SubSignatureRequestTemplateSigner pin(String pin) { return this; } - /** + /** * The 4- to 12-character access code that will secure this signer's signature page. * @return pin - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The 4- to 12-character access code that will secure this signer's signature page.") @JsonProperty(JSON_PROPERTY_PIN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -225,12 +219,11 @@ public SubSignatureRequestTemplateSigner smsPhoneNumber(String smsPhoneNumber) { return this; } - /** + /** * An E.164 formatted phone number. By using the feature, you agree you are responsible for obtaining a signer's consent to receive text messages from Dropbox Sign related to this signature request and confirm you have obtained such consent from all signers prior to enabling SMS delivery for this signature request. [Learn more](https://faq.hellosign.com/hc/en-us/articles/15815316468877-Dropbox-Sign-SMS-tools-add-on). **NOTE:** Not available in test mode and requires a Standard plan or higher. * @return smsPhoneNumber - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An E.164 formatted phone number. By using the feature, you agree you are responsible for obtaining a signer's consent to receive text messages from Dropbox Sign related to this signature request and confirm you have obtained such consent from all signers prior to enabling SMS delivery for this signature request. [Learn more](https://faq.hellosign.com/hc/en-us/articles/15815316468877-Dropbox-Sign-SMS-tools-add-on). **NOTE:** Not available in test mode and requires a Standard plan or higher.") @JsonProperty(JSON_PROPERTY_SMS_PHONE_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -251,12 +244,11 @@ public SubSignatureRequestTemplateSigner smsPhoneNumberType(SmsPhoneNumberTypeEn return this; } - /** + /** * Specifies the feature used with the `sms_phone_number`. Default `authentication`. If `authentication`, signer is sent a verification code via SMS that is required to access the document. If `delivery`, a link to complete the signature request is delivered via SMS (_and_ email). * @return smsPhoneNumberType - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Specifies the feature used with the `sms_phone_number`. Default `authentication`. If `authentication`, signer is sent a verification code via SMS that is required to access the document. If `delivery`, a link to complete the signature request is delivered via SMS (_and_ email).") @JsonProperty(JSON_PROPERTY_SMS_PHONE_NUMBER_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SubSigningOptions.java b/src/main/java/com/dropbox/sign/model/SubSigningOptions.java index d33c710..6429cf6 100644 --- a/src/main/java/com/dropbox/sign/model/SubSigningOptions.java +++ b/src/main/java/com/dropbox/sign/model/SubSigningOptions.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,28 +21,26 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This allows the requester to specify the types allowed for creating a signature. **NOTE:** If `signing_options` are not defined in the request, the allowed types will default to those specified in the account settings. */ -@ApiModel(description = "This allows the requester to specify the types allowed for creating a signature. **NOTE:** If `signing_options` are not defined in the request, the allowed types will default to those specified in the account settings.") @JsonPropertyOrder({ - SubSigningOptions.JSON_PROPERTY_DEFAULT_TYPE, - SubSigningOptions.JSON_PROPERTY_DRAW, - SubSigningOptions.JSON_PROPERTY_PHONE, - SubSigningOptions.JSON_PROPERTY_TYPE, - SubSigningOptions.JSON_PROPERTY_UPLOAD + SubSigningOptions.JSON_PROPERTY_DEFAULT_TYPE, + SubSigningOptions.JSON_PROPERTY_DRAW, + SubSigningOptions.JSON_PROPERTY_PHONE, + SubSigningOptions.JSON_PROPERTY_TYPE, + SubSigningOptions.JSON_PROPERTY_UPLOAD }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubSigningOptions { /** * The default type shown (limited to the listed types) @@ -122,12 +119,11 @@ public SubSigningOptions defaultType(DefaultTypeEnum defaultType) { return this; } - /** + /** * The default type shown (limited to the listed types) * @return defaultType - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The default type shown (limited to the listed types)") @JsonProperty(JSON_PROPERTY_DEFAULT_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -148,12 +144,11 @@ public SubSigningOptions draw(Boolean draw) { return this; } - /** + /** * Allows drawing the signature * @return draw - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows drawing the signature") @JsonProperty(JSON_PROPERTY_DRAW) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -174,12 +169,11 @@ public SubSigningOptions phone(Boolean phone) { return this; } - /** + /** * Allows using a smartphone to email the signature * @return phone - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows using a smartphone to email the signature") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -200,12 +194,11 @@ public SubSigningOptions type(Boolean type) { return this; } - /** + /** * Allows typing the signature * @return type - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows typing the signature") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -226,12 +219,11 @@ public SubSigningOptions upload(Boolean upload) { return this; } - /** + /** * Allows uploading the signature * @return upload - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows uploading the signature") @JsonProperty(JSON_PROPERTY_UPLOAD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SubTeamResponse.java b/src/main/java/com/dropbox/sign/model/SubTeamResponse.java index cb25a43..1b14dd3 100644 --- a/src/main/java/com/dropbox/sign/model/SubTeamResponse.java +++ b/src/main/java/com/dropbox/sign/model/SubTeamResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,11 +33,11 @@ * SubTeamResponse */ @JsonPropertyOrder({ - SubTeamResponse.JSON_PROPERTY_TEAM_ID, - SubTeamResponse.JSON_PROPERTY_NAME + SubTeamResponse.JSON_PROPERTY_TEAM_ID, + SubTeamResponse.JSON_PROPERTY_NAME }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubTeamResponse { public static final String JSON_PROPERTY_TEAM_ID = "team_id"; private String teamId; @@ -70,12 +68,11 @@ public SubTeamResponse teamId(String teamId) { return this; } - /** + /** * The id of a team * @return teamId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The id of a team") @JsonProperty(JSON_PROPERTY_TEAM_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -96,12 +93,11 @@ public SubTeamResponse name(String name) { return this; } - /** + /** * The name of a team * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of a team") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SubTemplateRole.java b/src/main/java/com/dropbox/sign/model/SubTemplateRole.java index 49b4bc9..0e38d6f 100644 --- a/src/main/java/com/dropbox/sign/model/SubTemplateRole.java +++ b/src/main/java/com/dropbox/sign/model/SubTemplateRole.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,11 +33,11 @@ * SubTemplateRole */ @JsonPropertyOrder({ - SubTemplateRole.JSON_PROPERTY_NAME, - SubTemplateRole.JSON_PROPERTY_ORDER + SubTemplateRole.JSON_PROPERTY_NAME, + SubTemplateRole.JSON_PROPERTY_ORDER }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubTemplateRole { public static final String JSON_PROPERTY_NAME = "name"; private String name; @@ -70,12 +68,11 @@ public SubTemplateRole name(String name) { return this; } - /** + /** * The role name of the signer that will be displayed when the template is used to create a signature request. * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The role name of the signer that will be displayed when the template is used to create a signature request.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -96,12 +93,11 @@ public SubTemplateRole order(Integer order) { return this; } - /** + /** * The order in which this signer role is required to sign. * @return order - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The order in which this signer role is required to sign.") @JsonProperty(JSON_PROPERTY_ORDER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SubUnclaimedDraftSigner.java b/src/main/java/com/dropbox/sign/model/SubUnclaimedDraftSigner.java index 8c42715..bea1438 100644 --- a/src/main/java/com/dropbox/sign/model/SubUnclaimedDraftSigner.java +++ b/src/main/java/com/dropbox/sign/model/SubUnclaimedDraftSigner.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,12 +33,12 @@ * SubUnclaimedDraftSigner */ @JsonPropertyOrder({ - SubUnclaimedDraftSigner.JSON_PROPERTY_EMAIL_ADDRESS, - SubUnclaimedDraftSigner.JSON_PROPERTY_NAME, - SubUnclaimedDraftSigner.JSON_PROPERTY_ORDER + SubUnclaimedDraftSigner.JSON_PROPERTY_EMAIL_ADDRESS, + SubUnclaimedDraftSigner.JSON_PROPERTY_NAME, + SubUnclaimedDraftSigner.JSON_PROPERTY_ORDER }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubUnclaimedDraftSigner { public static final String JSON_PROPERTY_EMAIL_ADDRESS = "email_address"; private String emailAddress; @@ -74,12 +72,11 @@ public SubUnclaimedDraftSigner emailAddress(String emailAddress) { return this; } - /** + /** * The email address of the signer. * @return emailAddress - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The email address of the signer.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -100,12 +97,11 @@ public SubUnclaimedDraftSigner name(String name) { return this; } - /** + /** * The name of the signer. * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the signer.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -126,12 +122,11 @@ public SubUnclaimedDraftSigner order(Integer order) { return this; } - /** + /** * The order the signer is required to sign in. * @return order - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The order the signer is required to sign in.") @JsonProperty(JSON_PROPERTY_ORDER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/SubUnclaimedDraftTemplateSigner.java b/src/main/java/com/dropbox/sign/model/SubUnclaimedDraftTemplateSigner.java index 14b3fc6..67b1ca0 100644 --- a/src/main/java/com/dropbox/sign/model/SubUnclaimedDraftTemplateSigner.java +++ b/src/main/java/com/dropbox/sign/model/SubUnclaimedDraftTemplateSigner.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,12 +33,12 @@ * SubUnclaimedDraftTemplateSigner */ @JsonPropertyOrder({ - SubUnclaimedDraftTemplateSigner.JSON_PROPERTY_ROLE, - SubUnclaimedDraftTemplateSigner.JSON_PROPERTY_NAME, - SubUnclaimedDraftTemplateSigner.JSON_PROPERTY_EMAIL_ADDRESS + SubUnclaimedDraftTemplateSigner.JSON_PROPERTY_ROLE, + SubUnclaimedDraftTemplateSigner.JSON_PROPERTY_NAME, + SubUnclaimedDraftTemplateSigner.JSON_PROPERTY_EMAIL_ADDRESS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubUnclaimedDraftTemplateSigner { public static final String JSON_PROPERTY_ROLE = "role"; private String role; @@ -74,12 +72,11 @@ public SubUnclaimedDraftTemplateSigner role(String role) { return this; } - /** + /** * Must match an existing role in chosen Template(s). * @return role - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Must match an existing role in chosen Template(s).") @JsonProperty(JSON_PROPERTY_ROLE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -100,12 +97,11 @@ public SubUnclaimedDraftTemplateSigner name(String name) { return this; } - /** + /** * The name of the signer filling the role of `role`. * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the signer filling the role of `role`.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -126,12 +122,11 @@ public SubUnclaimedDraftTemplateSigner emailAddress(String emailAddress) { return this; } - /** + /** * The email address of the signer filling the role of `role`. * @return emailAddress - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The email address of the signer filling the role of `role`.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.ALWAYS) diff --git a/src/main/java/com/dropbox/sign/model/SubWhiteLabelingOptions.java b/src/main/java/com/dropbox/sign/model/SubWhiteLabelingOptions.java index 8e73130..3679ee8 100644 --- a/src/main/java/com/dropbox/sign/model/SubWhiteLabelingOptions.java +++ b/src/main/java/com/dropbox/sign/model/SubWhiteLabelingOptions.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,38 +21,36 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * An array of elements and values serialized to a string, to be used to customize the app's signer page. (Only applies to some API plans) Take a look at our [white labeling guide](https://developers.hellosign.com/api/reference/premium-branding/) to learn more. */ -@ApiModel(description = "An array of elements and values serialized to a string, to be used to customize the app's signer page. (Only applies to some API plans) Take a look at our [white labeling guide](https://developers.hellosign.com/api/reference/premium-branding/) to learn more.") @JsonPropertyOrder({ - SubWhiteLabelingOptions.JSON_PROPERTY_HEADER_BACKGROUND_COLOR, - SubWhiteLabelingOptions.JSON_PROPERTY_LEGAL_VERSION, - SubWhiteLabelingOptions.JSON_PROPERTY_LINK_COLOR, - SubWhiteLabelingOptions.JSON_PROPERTY_PAGE_BACKGROUND_COLOR, - SubWhiteLabelingOptions.JSON_PROPERTY_PRIMARY_BUTTON_COLOR, - SubWhiteLabelingOptions.JSON_PROPERTY_PRIMARY_BUTTON_COLOR_HOVER, - SubWhiteLabelingOptions.JSON_PROPERTY_PRIMARY_BUTTON_TEXT_COLOR, - SubWhiteLabelingOptions.JSON_PROPERTY_PRIMARY_BUTTON_TEXT_COLOR_HOVER, - SubWhiteLabelingOptions.JSON_PROPERTY_SECONDARY_BUTTON_COLOR, - SubWhiteLabelingOptions.JSON_PROPERTY_SECONDARY_BUTTON_COLOR_HOVER, - SubWhiteLabelingOptions.JSON_PROPERTY_SECONDARY_BUTTON_TEXT_COLOR, - SubWhiteLabelingOptions.JSON_PROPERTY_SECONDARY_BUTTON_TEXT_COLOR_HOVER, - SubWhiteLabelingOptions.JSON_PROPERTY_TEXT_COLOR1, - SubWhiteLabelingOptions.JSON_PROPERTY_TEXT_COLOR2, - SubWhiteLabelingOptions.JSON_PROPERTY_RESET_TO_DEFAULT + SubWhiteLabelingOptions.JSON_PROPERTY_HEADER_BACKGROUND_COLOR, + SubWhiteLabelingOptions.JSON_PROPERTY_LEGAL_VERSION, + SubWhiteLabelingOptions.JSON_PROPERTY_LINK_COLOR, + SubWhiteLabelingOptions.JSON_PROPERTY_PAGE_BACKGROUND_COLOR, + SubWhiteLabelingOptions.JSON_PROPERTY_PRIMARY_BUTTON_COLOR, + SubWhiteLabelingOptions.JSON_PROPERTY_PRIMARY_BUTTON_COLOR_HOVER, + SubWhiteLabelingOptions.JSON_PROPERTY_PRIMARY_BUTTON_TEXT_COLOR, + SubWhiteLabelingOptions.JSON_PROPERTY_PRIMARY_BUTTON_TEXT_COLOR_HOVER, + SubWhiteLabelingOptions.JSON_PROPERTY_SECONDARY_BUTTON_COLOR, + SubWhiteLabelingOptions.JSON_PROPERTY_SECONDARY_BUTTON_COLOR_HOVER, + SubWhiteLabelingOptions.JSON_PROPERTY_SECONDARY_BUTTON_TEXT_COLOR, + SubWhiteLabelingOptions.JSON_PROPERTY_SECONDARY_BUTTON_TEXT_COLOR_HOVER, + SubWhiteLabelingOptions.JSON_PROPERTY_TEXT_COLOR1, + SubWhiteLabelingOptions.JSON_PROPERTY_TEXT_COLOR2, + SubWhiteLabelingOptions.JSON_PROPERTY_RESET_TO_DEFAULT }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SubWhiteLabelingOptions { public static final String JSON_PROPERTY_HEADER_BACKGROUND_COLOR = "header_background_color"; private String headerBackgroundColor = "#1A1A1A"; @@ -158,12 +155,11 @@ public SubWhiteLabelingOptions headerBackgroundColor(String headerBackgroundColo return this; } - /** + /** * Get headerBackgroundColor * @return headerBackgroundColor - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_HEADER_BACKGROUND_COLOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -184,12 +180,11 @@ public SubWhiteLabelingOptions legalVersion(LegalVersionEnum legalVersion) { return this; } - /** + /** * Get legalVersion * @return legalVersion - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LEGAL_VERSION) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -210,12 +205,11 @@ public SubWhiteLabelingOptions linkColor(String linkColor) { return this; } - /** + /** * Get linkColor * @return linkColor - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LINK_COLOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -236,12 +230,11 @@ public SubWhiteLabelingOptions pageBackgroundColor(String pageBackgroundColor) { return this; } - /** + /** * Get pageBackgroundColor * @return pageBackgroundColor - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PAGE_BACKGROUND_COLOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -262,12 +255,11 @@ public SubWhiteLabelingOptions primaryButtonColor(String primaryButtonColor) { return this; } - /** + /** * Get primaryButtonColor * @return primaryButtonColor - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PRIMARY_BUTTON_COLOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -288,12 +280,11 @@ public SubWhiteLabelingOptions primaryButtonColorHover(String primaryButtonColor return this; } - /** + /** * Get primaryButtonColorHover * @return primaryButtonColorHover - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PRIMARY_BUTTON_COLOR_HOVER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -314,12 +305,11 @@ public SubWhiteLabelingOptions primaryButtonTextColor(String primaryButtonTextCo return this; } - /** + /** * Get primaryButtonTextColor * @return primaryButtonTextColor - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PRIMARY_BUTTON_TEXT_COLOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -340,12 +330,11 @@ public SubWhiteLabelingOptions primaryButtonTextColorHover(String primaryButtonT return this; } - /** + /** * Get primaryButtonTextColorHover * @return primaryButtonTextColorHover - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PRIMARY_BUTTON_TEXT_COLOR_HOVER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -366,12 +355,11 @@ public SubWhiteLabelingOptions secondaryButtonColor(String secondaryButtonColor) return this; } - /** + /** * Get secondaryButtonColor * @return secondaryButtonColor - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SECONDARY_BUTTON_COLOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -392,12 +380,11 @@ public SubWhiteLabelingOptions secondaryButtonColorHover(String secondaryButtonC return this; } - /** + /** * Get secondaryButtonColorHover * @return secondaryButtonColorHover - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SECONDARY_BUTTON_COLOR_HOVER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -418,12 +405,11 @@ public SubWhiteLabelingOptions secondaryButtonTextColor(String secondaryButtonTe return this; } - /** + /** * Get secondaryButtonTextColor * @return secondaryButtonTextColor - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SECONDARY_BUTTON_TEXT_COLOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -444,12 +430,11 @@ public SubWhiteLabelingOptions secondaryButtonTextColorHover(String secondaryBut return this; } - /** + /** * Get secondaryButtonTextColorHover * @return secondaryButtonTextColorHover - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SECONDARY_BUTTON_TEXT_COLOR_HOVER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -470,12 +455,11 @@ public SubWhiteLabelingOptions textColor1(String textColor1) { return this; } - /** + /** * Get textColor1 * @return textColor1 - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TEXT_COLOR1) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -496,12 +480,11 @@ public SubWhiteLabelingOptions textColor2(String textColor2) { return this; } - /** + /** * Get textColor2 * @return textColor2 - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TEXT_COLOR2) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -522,12 +505,11 @@ public SubWhiteLabelingOptions resetToDefault(Boolean resetToDefault) { return this; } - /** + /** * Resets white labeling options to defaults. Only useful when updating an API App. * @return resetToDefault - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Resets white labeling options to defaults. Only useful when updating an API App.") @JsonProperty(JSON_PROPERTY_RESET_TO_DEFAULT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TeamAddMemberRequest.java b/src/main/java/com/dropbox/sign/model/TeamAddMemberRequest.java index cc20f93..8c2b5bd 100644 --- a/src/main/java/com/dropbox/sign/model/TeamAddMemberRequest.java +++ b/src/main/java/com/dropbox/sign/model/TeamAddMemberRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,12 +33,12 @@ * TeamAddMemberRequest */ @JsonPropertyOrder({ - TeamAddMemberRequest.JSON_PROPERTY_ACCOUNT_ID, - TeamAddMemberRequest.JSON_PROPERTY_EMAIL_ADDRESS, - TeamAddMemberRequest.JSON_PROPERTY_ROLE + TeamAddMemberRequest.JSON_PROPERTY_ACCOUNT_ID, + TeamAddMemberRequest.JSON_PROPERTY_EMAIL_ADDRESS, + TeamAddMemberRequest.JSON_PROPERTY_ROLE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TeamAddMemberRequest { public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; private String accountId; @@ -113,12 +111,11 @@ public TeamAddMemberRequest accountId(String accountId) { return this; } - /** + /** * `account_id` or `email_address` is required. If both are provided, the account id prevails. Account id of the user to invite to your Team. * @return accountId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "`account_id` or `email_address` is required. If both are provided, the account id prevails. Account id of the user to invite to your Team.") @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -139,12 +136,11 @@ public TeamAddMemberRequest emailAddress(String emailAddress) { return this; } - /** + /** * `account_id` or `email_address` is required, If both are provided, the account id prevails. Email address of the user to invite to your Team. * @return emailAddress - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "`account_id` or `email_address` is required, If both are provided, the account id prevails. Email address of the user to invite to your Team.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -165,12 +161,11 @@ public TeamAddMemberRequest role(RoleEnum role) { return this; } - /** + /** * A role member will take in a new Team. **NOTE:** This parameter is used only if `team_id` is provided. * @return role - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A role member will take in a new Team. **NOTE:** This parameter is used only if `team_id` is provided.") @JsonProperty(JSON_PROPERTY_ROLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TeamCreateRequest.java b/src/main/java/com/dropbox/sign/model/TeamCreateRequest.java index 52933d3..5c8d584 100644 --- a/src/main/java/com/dropbox/sign/model/TeamCreateRequest.java +++ b/src/main/java/com/dropbox/sign/model/TeamCreateRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,10 +33,10 @@ * TeamCreateRequest */ @JsonPropertyOrder({ - TeamCreateRequest.JSON_PROPERTY_NAME + TeamCreateRequest.JSON_PROPERTY_NAME }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TeamCreateRequest { public static final String JSON_PROPERTY_NAME = "name"; private String name = "Untitled Team"; @@ -66,12 +64,11 @@ public TeamCreateRequest name(String name) { return this; } - /** + /** * The name of your Team. * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of your Team.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TeamGetInfoResponse.java b/src/main/java/com/dropbox/sign/model/TeamGetInfoResponse.java index 0571c5f..25ce087 100644 --- a/src/main/java/com/dropbox/sign/model/TeamGetInfoResponse.java +++ b/src/main/java/com/dropbox/sign/model/TeamGetInfoResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TeamInfoResponse; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,11 +37,11 @@ * TeamGetInfoResponse */ @JsonPropertyOrder({ - TeamGetInfoResponse.JSON_PROPERTY_TEAM, - TeamGetInfoResponse.JSON_PROPERTY_WARNINGS + TeamGetInfoResponse.JSON_PROPERTY_TEAM, + TeamGetInfoResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TeamGetInfoResponse { public static final String JSON_PROPERTY_TEAM = "team"; private TeamInfoResponse team; @@ -74,14 +72,13 @@ public TeamGetInfoResponse team(TeamInfoResponse team) { return this; } - /** + /** * Get team * @return team - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_TEAM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public TeamInfoResponse getTeam() { return team; @@ -89,7 +86,7 @@ public TeamInfoResponse getTeam() { @JsonProperty(JSON_PROPERTY_TEAM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setTeam(TeamInfoResponse team) { this.team = team; } @@ -108,12 +105,11 @@ public TeamGetInfoResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TeamGetResponse.java b/src/main/java/com/dropbox/sign/model/TeamGetResponse.java index 2e6be02..f862702 100644 --- a/src/main/java/com/dropbox/sign/model/TeamGetResponse.java +++ b/src/main/java/com/dropbox/sign/model/TeamGetResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TeamResponse; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,11 +37,11 @@ * TeamGetResponse */ @JsonPropertyOrder({ - TeamGetResponse.JSON_PROPERTY_TEAM, - TeamGetResponse.JSON_PROPERTY_WARNINGS + TeamGetResponse.JSON_PROPERTY_TEAM, + TeamGetResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TeamGetResponse { public static final String JSON_PROPERTY_TEAM = "team"; private TeamResponse team; @@ -74,14 +72,13 @@ public TeamGetResponse team(TeamResponse team) { return this; } - /** + /** * Get team * @return team - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_TEAM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public TeamResponse getTeam() { return team; @@ -89,7 +86,7 @@ public TeamResponse getTeam() { @JsonProperty(JSON_PROPERTY_TEAM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setTeam(TeamResponse team) { this.team = team; } @@ -108,12 +105,11 @@ public TeamGetResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TeamInfoResponse.java b/src/main/java/com/dropbox/sign/model/TeamInfoResponse.java index 11bd7e2..8dad2c1 100644 --- a/src/main/java/com/dropbox/sign/model/TeamInfoResponse.java +++ b/src/main/java/com/dropbox/sign/model/TeamInfoResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TeamParentResponse; @@ -23,12 +22,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -36,14 +34,14 @@ * TeamInfoResponse */ @JsonPropertyOrder({ - TeamInfoResponse.JSON_PROPERTY_TEAM_ID, - TeamInfoResponse.JSON_PROPERTY_TEAM_PARENT, - TeamInfoResponse.JSON_PROPERTY_NAME, - TeamInfoResponse.JSON_PROPERTY_NUM_MEMBERS, - TeamInfoResponse.JSON_PROPERTY_NUM_SUB_TEAMS + TeamInfoResponse.JSON_PROPERTY_TEAM_ID, + TeamInfoResponse.JSON_PROPERTY_TEAM_PARENT, + TeamInfoResponse.JSON_PROPERTY_NAME, + TeamInfoResponse.JSON_PROPERTY_NUM_MEMBERS, + TeamInfoResponse.JSON_PROPERTY_NUM_SUB_TEAMS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TeamInfoResponse { public static final String JSON_PROPERTY_TEAM_ID = "team_id"; private String teamId; @@ -83,12 +81,11 @@ public TeamInfoResponse teamId(String teamId) { return this; } - /** + /** * The id of a team * @return teamId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The id of a team") @JsonProperty(JSON_PROPERTY_TEAM_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -109,12 +106,11 @@ public TeamInfoResponse teamParent(TeamParentResponse teamParent) { return this; } - /** + /** * Get teamParent * @return teamParent - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TEAM_PARENT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -135,12 +131,11 @@ public TeamInfoResponse name(String name) { return this; } - /** + /** * The name of a team * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of a team") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -161,12 +156,11 @@ public TeamInfoResponse numMembers(Integer numMembers) { return this; } - /** + /** * Number of members within a team * @return numMembers - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Number of members within a team") @JsonProperty(JSON_PROPERTY_NUM_MEMBERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -187,12 +181,11 @@ public TeamInfoResponse numSubTeams(Integer numSubTeams) { return this; } - /** + /** * Number of sub teams within a team * @return numSubTeams - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Number of sub teams within a team") @JsonProperty(JSON_PROPERTY_NUM_SUB_TEAMS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TeamInviteResponse.java b/src/main/java/com/dropbox/sign/model/TeamInviteResponse.java index dddf3b2..d59d630 100644 --- a/src/main/java/com/dropbox/sign/model/TeamInviteResponse.java +++ b/src/main/java/com/dropbox/sign/model/TeamInviteResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,15 +33,15 @@ * TeamInviteResponse */ @JsonPropertyOrder({ - TeamInviteResponse.JSON_PROPERTY_EMAIL_ADDRESS, - TeamInviteResponse.JSON_PROPERTY_TEAM_ID, - TeamInviteResponse.JSON_PROPERTY_ROLE, - TeamInviteResponse.JSON_PROPERTY_SENT_AT, - TeamInviteResponse.JSON_PROPERTY_REDEEMED_AT, - TeamInviteResponse.JSON_PROPERTY_EXPIRES_AT + TeamInviteResponse.JSON_PROPERTY_EMAIL_ADDRESS, + TeamInviteResponse.JSON_PROPERTY_TEAM_ID, + TeamInviteResponse.JSON_PROPERTY_ROLE, + TeamInviteResponse.JSON_PROPERTY_SENT_AT, + TeamInviteResponse.JSON_PROPERTY_REDEEMED_AT, + TeamInviteResponse.JSON_PROPERTY_EXPIRES_AT }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TeamInviteResponse { public static final String JSON_PROPERTY_EMAIL_ADDRESS = "email_address"; private String emailAddress; @@ -86,12 +84,11 @@ public TeamInviteResponse emailAddress(String emailAddress) { return this; } - /** + /** * Email address of the user invited to this team. * @return emailAddress - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Email address of the user invited to this team.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -112,12 +109,11 @@ public TeamInviteResponse teamId(String teamId) { return this; } - /** + /** * Id of the team. * @return teamId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Id of the team.") @JsonProperty(JSON_PROPERTY_TEAM_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -138,12 +134,11 @@ public TeamInviteResponse role(String role) { return this; } - /** + /** * Role of the user invited to this team. * @return role - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Role of the user invited to this team.") @JsonProperty(JSON_PROPERTY_ROLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -164,12 +159,11 @@ public TeamInviteResponse sentAt(Integer sentAt) { return this; } - /** + /** * Timestamp when the invitation was sent. * @return sentAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Timestamp when the invitation was sent.") @JsonProperty(JSON_PROPERTY_SENT_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -190,12 +184,11 @@ public TeamInviteResponse redeemedAt(Integer redeemedAt) { return this; } - /** + /** * Timestamp when the invitation was redeemed. * @return redeemedAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Timestamp when the invitation was redeemed.") @JsonProperty(JSON_PROPERTY_REDEEMED_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -216,12 +209,11 @@ public TeamInviteResponse expiresAt(Integer expiresAt) { return this; } - /** + /** * Timestamp when the invitation is expiring. * @return expiresAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Timestamp when the invitation is expiring.") @JsonProperty(JSON_PROPERTY_EXPIRES_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TeamInvitesResponse.java b/src/main/java/com/dropbox/sign/model/TeamInvitesResponse.java index de9ed95..17d025b 100644 --- a/src/main/java/com/dropbox/sign/model/TeamInvitesResponse.java +++ b/src/main/java/com/dropbox/sign/model/TeamInvitesResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TeamInviteResponse; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,14 +37,14 @@ * TeamInvitesResponse */ @JsonPropertyOrder({ - TeamInvitesResponse.JSON_PROPERTY_TEAM_INVITES, - TeamInvitesResponse.JSON_PROPERTY_WARNINGS + TeamInvitesResponse.JSON_PROPERTY_TEAM_INVITES, + TeamInvitesResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TeamInvitesResponse { public static final String JSON_PROPERTY_TEAM_INVITES = "team_invites"; - private List teamInvites = null; + private List teamInvites = new ArrayList<>(); public static final String JSON_PROPERTY_WARNINGS = "warnings"; private List warnings = null; @@ -82,14 +80,13 @@ public TeamInvitesResponse addTeamInvitesItem(TeamInviteResponse teamInvitesItem return this; } - /** + /** * Contains a list of team invites and their roles. * @return teamInvites - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Contains a list of team invites and their roles.") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_TEAM_INVITES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getTeamInvites() { return teamInvites; @@ -97,7 +94,7 @@ public List getTeamInvites() { @JsonProperty(JSON_PROPERTY_TEAM_INVITES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setTeamInvites(List teamInvites) { this.teamInvites = teamInvites; } @@ -116,12 +113,11 @@ public TeamInvitesResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * Get warnings * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TeamMemberResponse.java b/src/main/java/com/dropbox/sign/model/TeamMemberResponse.java index 688aa01..b774089 100644 --- a/src/main/java/com/dropbox/sign/model/TeamMemberResponse.java +++ b/src/main/java/com/dropbox/sign/model/TeamMemberResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,12 +33,12 @@ * TeamMemberResponse */ @JsonPropertyOrder({ - TeamMemberResponse.JSON_PROPERTY_ACCOUNT_ID, - TeamMemberResponse.JSON_PROPERTY_EMAIL_ADDRESS, - TeamMemberResponse.JSON_PROPERTY_ROLE + TeamMemberResponse.JSON_PROPERTY_ACCOUNT_ID, + TeamMemberResponse.JSON_PROPERTY_EMAIL_ADDRESS, + TeamMemberResponse.JSON_PROPERTY_ROLE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TeamMemberResponse { public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; private String accountId; @@ -74,12 +72,11 @@ public TeamMemberResponse accountId(String accountId) { return this; } - /** + /** * Account id of the team member. * @return accountId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Account id of the team member.") @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -100,12 +97,11 @@ public TeamMemberResponse emailAddress(String emailAddress) { return this; } - /** + /** * Email address of the team member. * @return emailAddress - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Email address of the team member.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -126,12 +122,11 @@ public TeamMemberResponse role(String role) { return this; } - /** + /** * The specific role a member has on the team. * @return role - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The specific role a member has on the team.") @JsonProperty(JSON_PROPERTY_ROLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TeamMembersResponse.java b/src/main/java/com/dropbox/sign/model/TeamMembersResponse.java index 7ca3641..299e8a9 100644 --- a/src/main/java/com/dropbox/sign/model/TeamMembersResponse.java +++ b/src/main/java/com/dropbox/sign/model/TeamMembersResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.ListInfoResponse; @@ -25,14 +24,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -40,15 +38,15 @@ * TeamMembersResponse */ @JsonPropertyOrder({ - TeamMembersResponse.JSON_PROPERTY_TEAM_MEMBERS, - TeamMembersResponse.JSON_PROPERTY_LIST_INFO, - TeamMembersResponse.JSON_PROPERTY_WARNINGS + TeamMembersResponse.JSON_PROPERTY_TEAM_MEMBERS, + TeamMembersResponse.JSON_PROPERTY_LIST_INFO, + TeamMembersResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TeamMembersResponse { public static final String JSON_PROPERTY_TEAM_MEMBERS = "team_members"; - private List teamMembers = null; + private List teamMembers = new ArrayList<>(); public static final String JSON_PROPERTY_LIST_INFO = "list_info"; private ListInfoResponse listInfo; @@ -87,14 +85,13 @@ public TeamMembersResponse addTeamMembersItem(TeamMemberResponse teamMembersItem return this; } - /** + /** * Contains a list of team members and their roles for a specific team. * @return teamMembers - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Contains a list of team members and their roles for a specific team.") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_TEAM_MEMBERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getTeamMembers() { return teamMembers; @@ -102,7 +99,7 @@ public List getTeamMembers() { @JsonProperty(JSON_PROPERTY_TEAM_MEMBERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setTeamMembers(List teamMembers) { this.teamMembers = teamMembers; } @@ -113,14 +110,13 @@ public TeamMembersResponse listInfo(ListInfoResponse listInfo) { return this; } - /** + /** * Get listInfo * @return listInfo - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_LIST_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public ListInfoResponse getListInfo() { return listInfo; @@ -128,7 +124,7 @@ public ListInfoResponse getListInfo() { @JsonProperty(JSON_PROPERTY_LIST_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setListInfo(ListInfoResponse listInfo) { this.listInfo = listInfo; } @@ -147,12 +143,11 @@ public TeamMembersResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * Get warnings * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TeamParentResponse.java b/src/main/java/com/dropbox/sign/model/TeamParentResponse.java index 0d2f943..180e3bb 100644 --- a/src/main/java/com/dropbox/sign/model/TeamParentResponse.java +++ b/src/main/java/com/dropbox/sign/model/TeamParentResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,25 +21,23 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * Information about the parent team if a team has one, set to `null` otherwise. */ -@ApiModel(description = "Information about the parent team if a team has one, set to `null` otherwise.") @JsonPropertyOrder({ - TeamParentResponse.JSON_PROPERTY_TEAM_ID, - TeamParentResponse.JSON_PROPERTY_NAME + TeamParentResponse.JSON_PROPERTY_TEAM_ID, + TeamParentResponse.JSON_PROPERTY_NAME }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TeamParentResponse { public static final String JSON_PROPERTY_TEAM_ID = "team_id"; private String teamId; @@ -71,12 +68,11 @@ public TeamParentResponse teamId(String teamId) { return this; } - /** + /** * The id of a team * @return teamId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The id of a team") @JsonProperty(JSON_PROPERTY_TEAM_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -97,12 +93,11 @@ public TeamParentResponse name(String name) { return this; } - /** + /** * The name of a team * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of a team") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TeamRemoveMemberRequest.java b/src/main/java/com/dropbox/sign/model/TeamRemoveMemberRequest.java index 71bbe54..fd82206 100644 --- a/src/main/java/com/dropbox/sign/model/TeamRemoveMemberRequest.java +++ b/src/main/java/com/dropbox/sign/model/TeamRemoveMemberRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,14 +33,14 @@ * TeamRemoveMemberRequest */ @JsonPropertyOrder({ - TeamRemoveMemberRequest.JSON_PROPERTY_ACCOUNT_ID, - TeamRemoveMemberRequest.JSON_PROPERTY_EMAIL_ADDRESS, - TeamRemoveMemberRequest.JSON_PROPERTY_NEW_OWNER_EMAIL_ADDRESS, - TeamRemoveMemberRequest.JSON_PROPERTY_NEW_TEAM_ID, - TeamRemoveMemberRequest.JSON_PROPERTY_NEW_ROLE + TeamRemoveMemberRequest.JSON_PROPERTY_ACCOUNT_ID, + TeamRemoveMemberRequest.JSON_PROPERTY_EMAIL_ADDRESS, + TeamRemoveMemberRequest.JSON_PROPERTY_NEW_OWNER_EMAIL_ADDRESS, + TeamRemoveMemberRequest.JSON_PROPERTY_NEW_TEAM_ID, + TeamRemoveMemberRequest.JSON_PROPERTY_NEW_ROLE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TeamRemoveMemberRequest { public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; private String accountId; @@ -121,12 +119,11 @@ public TeamRemoveMemberRequest accountId(String accountId) { return this; } - /** + /** * **account_id** or **email_address** is required. If both are provided, the account id prevails. Account id to remove from your Team. * @return accountId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "**account_id** or **email_address** is required. If both are provided, the account id prevails. Account id to remove from your Team.") @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -147,12 +144,11 @@ public TeamRemoveMemberRequest emailAddress(String emailAddress) { return this; } - /** + /** * **account_id** or **email_address** is required. If both are provided, the account id prevails. Email address of the Account to remove from your Team. * @return emailAddress - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "**account_id** or **email_address** is required. If both are provided, the account id prevails. Email address of the Account to remove from your Team.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -173,12 +169,11 @@ public TeamRemoveMemberRequest newOwnerEmailAddress(String newOwnerEmailAddress) return this; } - /** + /** * The email address of an Account on this Team to receive all documents, templates, and API apps (if applicable) from the removed Account. If not provided, and on an Enterprise plan, this data will remain with the removed Account. **NOTE:** Only available for Enterprise plans. * @return newOwnerEmailAddress - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The email address of an Account on this Team to receive all documents, templates, and API apps (if applicable) from the removed Account. If not provided, and on an Enterprise plan, this data will remain with the removed Account. **NOTE:** Only available for Enterprise plans.") @JsonProperty(JSON_PROPERTY_NEW_OWNER_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -199,12 +194,11 @@ public TeamRemoveMemberRequest newTeamId(String newTeamId) { return this; } - /** + /** * Id of the new Team. * @return newTeamId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Id of the new Team.") @JsonProperty(JSON_PROPERTY_NEW_TEAM_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -225,12 +219,11 @@ public TeamRemoveMemberRequest newRole(NewRoleEnum newRole) { return this; } - /** + /** * A new role member will take in a new Team. **NOTE:** This parameter is used only if `new_team_id` is provided. * @return newRole - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A new role member will take in a new Team. **NOTE:** This parameter is used only if `new_team_id` is provided.") @JsonProperty(JSON_PROPERTY_NEW_ROLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TeamResponse.java b/src/main/java/com/dropbox/sign/model/TeamResponse.java index d56d127..06dc6b3 100644 --- a/src/main/java/com/dropbox/sign/model/TeamResponse.java +++ b/src/main/java/com/dropbox/sign/model/TeamResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.AccountResponse; @@ -23,29 +22,27 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; /** * Contains information about your team and its members */ -@ApiModel(description = "Contains information about your team and its members") @JsonPropertyOrder({ - TeamResponse.JSON_PROPERTY_NAME, - TeamResponse.JSON_PROPERTY_ACCOUNTS, - TeamResponse.JSON_PROPERTY_INVITED_ACCOUNTS, - TeamResponse.JSON_PROPERTY_INVITED_EMAILS + TeamResponse.JSON_PROPERTY_NAME, + TeamResponse.JSON_PROPERTY_ACCOUNTS, + TeamResponse.JSON_PROPERTY_INVITED_ACCOUNTS, + TeamResponse.JSON_PROPERTY_INVITED_EMAILS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TeamResponse { public static final String JSON_PROPERTY_NAME = "name"; private String name; @@ -82,12 +79,11 @@ public TeamResponse name(String name) { return this; } - /** + /** * The name of your Team * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of your Team") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -116,12 +112,11 @@ public TeamResponse addAccountsItem(AccountResponse accountsItem) { return this; } - /** + /** * Get accounts * @return accounts - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ACCOUNTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -150,12 +145,11 @@ public TeamResponse addInvitedAccountsItem(AccountResponse invitedAccountsItem) return this; } - /** + /** * A list of all Accounts that have an outstanding invitation to join your Team. Note that this response is a subset of the response parameters found in `GET /account`. * @return invitedAccounts - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of all Accounts that have an outstanding invitation to join your Team. Note that this response is a subset of the response parameters found in `GET /account`.") @JsonProperty(JSON_PROPERTY_INVITED_ACCOUNTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -184,12 +178,11 @@ public TeamResponse addInvitedEmailsItem(String invitedEmailsItem) { return this; } - /** + /** * A list of email addresses that have an outstanding invitation to join your Team and do not yet have a Dropbox Sign account. * @return invitedEmails - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of email addresses that have an outstanding invitation to join your Team and do not yet have a Dropbox Sign account.") @JsonProperty(JSON_PROPERTY_INVITED_EMAILS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TeamSubTeamsResponse.java b/src/main/java/com/dropbox/sign/model/TeamSubTeamsResponse.java index 4e273a7..f103f5f 100644 --- a/src/main/java/com/dropbox/sign/model/TeamSubTeamsResponse.java +++ b/src/main/java/com/dropbox/sign/model/TeamSubTeamsResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.ListInfoResponse; @@ -25,14 +24,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -40,15 +38,15 @@ * TeamSubTeamsResponse */ @JsonPropertyOrder({ - TeamSubTeamsResponse.JSON_PROPERTY_SUB_TEAMS, - TeamSubTeamsResponse.JSON_PROPERTY_LIST_INFO, - TeamSubTeamsResponse.JSON_PROPERTY_WARNINGS + TeamSubTeamsResponse.JSON_PROPERTY_SUB_TEAMS, + TeamSubTeamsResponse.JSON_PROPERTY_LIST_INFO, + TeamSubTeamsResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TeamSubTeamsResponse { public static final String JSON_PROPERTY_SUB_TEAMS = "sub_teams"; - private List subTeams = null; + private List subTeams = new ArrayList<>(); public static final String JSON_PROPERTY_LIST_INFO = "list_info"; private ListInfoResponse listInfo; @@ -87,14 +85,13 @@ public TeamSubTeamsResponse addSubTeamsItem(SubTeamResponse subTeamsItem) { return this; } - /** + /** * Contains a list with sub teams. * @return subTeams - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Contains a list with sub teams.") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_SUB_TEAMS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getSubTeams() { return subTeams; @@ -102,7 +99,7 @@ public List getSubTeams() { @JsonProperty(JSON_PROPERTY_SUB_TEAMS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setSubTeams(List subTeams) { this.subTeams = subTeams; } @@ -113,14 +110,13 @@ public TeamSubTeamsResponse listInfo(ListInfoResponse listInfo) { return this; } - /** + /** * Get listInfo * @return listInfo - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_LIST_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public ListInfoResponse getListInfo() { return listInfo; @@ -128,7 +124,7 @@ public ListInfoResponse getListInfo() { @JsonProperty(JSON_PROPERTY_LIST_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setListInfo(ListInfoResponse listInfo) { this.listInfo = listInfo; } @@ -147,12 +143,11 @@ public TeamSubTeamsResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * Get warnings * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TeamUpdateRequest.java b/src/main/java/com/dropbox/sign/model/TeamUpdateRequest.java index 1e6bb12..b9388bd 100644 --- a/src/main/java/com/dropbox/sign/model/TeamUpdateRequest.java +++ b/src/main/java/com/dropbox/sign/model/TeamUpdateRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,10 +33,10 @@ * TeamUpdateRequest */ @JsonPropertyOrder({ - TeamUpdateRequest.JSON_PROPERTY_NAME + TeamUpdateRequest.JSON_PROPERTY_NAME }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TeamUpdateRequest { public static final String JSON_PROPERTY_NAME = "name"; private String name; @@ -66,12 +64,11 @@ public TeamUpdateRequest name(String name) { return this; } - /** + /** * The name of your Team. * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of your Team.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateAddUserRequest.java b/src/main/java/com/dropbox/sign/model/TemplateAddUserRequest.java index 6fb1ae4..e7dd65c 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateAddUserRequest.java +++ b/src/main/java/com/dropbox/sign/model/TemplateAddUserRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,12 +33,12 @@ * TemplateAddUserRequest */ @JsonPropertyOrder({ - TemplateAddUserRequest.JSON_PROPERTY_ACCOUNT_ID, - TemplateAddUserRequest.JSON_PROPERTY_EMAIL_ADDRESS, - TemplateAddUserRequest.JSON_PROPERTY_SKIP_NOTIFICATION + TemplateAddUserRequest.JSON_PROPERTY_ACCOUNT_ID, + TemplateAddUserRequest.JSON_PROPERTY_EMAIL_ADDRESS, + TemplateAddUserRequest.JSON_PROPERTY_SKIP_NOTIFICATION }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateAddUserRequest { public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; private String accountId; @@ -74,12 +72,11 @@ public TemplateAddUserRequest accountId(String accountId) { return this; } - /** + /** * The id of the Account to give access to the Template. **NOTE:** The account id prevails if email address is also provided. * @return accountId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the Account to give access to the Template. **NOTE:** The account id prevails if email address is also provided.") @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -100,12 +97,11 @@ public TemplateAddUserRequest emailAddress(String emailAddress) { return this; } - /** + /** * The email address of the Account to give access to the Template. **NOTE:** The account id prevails if it is also provided. * @return emailAddress - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The email address of the Account to give access to the Template. **NOTE:** The account id prevails if it is also provided.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -126,12 +122,11 @@ public TemplateAddUserRequest skipNotification(Boolean skipNotification) { return this; } - /** + /** * If set to `true`, the user does not receive an email notification when a template has been shared with them. Defaults to `false`. * @return skipNotification - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "If set to `true`, the user does not receive an email notification when a template has been shared with them. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_SKIP_NOTIFICATION) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateCreateEmbeddedDraftRequest.java b/src/main/java/com/dropbox/sign/model/TemplateCreateEmbeddedDraftRequest.java index 370bf6f..902ec6f 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateCreateEmbeddedDraftRequest.java +++ b/src/main/java/com/dropbox/sign/model/TemplateCreateEmbeddedDraftRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubAttachment; @@ -30,17 +29,16 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; 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.JSON; import com.dropbox.sign.ApiException; @@ -48,34 +46,34 @@ * TemplateCreateEmbeddedDraftRequest */ @JsonPropertyOrder({ - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_CLIENT_ID, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_FILES, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_FILE_URLS, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_ALLOW_CCS, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_ALLOW_REASSIGN, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_ATTACHMENTS, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_CC_ROLES, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_EDITOR_OPTIONS, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_FIELD_OPTIONS, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_FORCE_SIGNER_ROLES, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_FORCE_SUBJECT_MESSAGE, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_FORM_FIELD_GROUPS, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_FORM_FIELD_RULES, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_MERGE_FIELDS, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_MESSAGE, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_METADATA, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_SHOW_PREVIEW, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_SHOW_PROGRESS_STEPPER, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_SIGNER_ROLES, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_SKIP_ME_NOW, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_SUBJECT, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_TEST_MODE, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_TITLE, - TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_USE_PREEXISTING_FIELDS + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_CLIENT_ID, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_FILES, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_FILE_URLS, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_ALLOW_CCS, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_ALLOW_REASSIGN, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_ATTACHMENTS, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_CC_ROLES, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_EDITOR_OPTIONS, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_FIELD_OPTIONS, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_FORCE_SIGNER_ROLES, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_FORCE_SUBJECT_MESSAGE, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_FORM_FIELD_GROUPS, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_FORM_FIELD_RULES, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_MERGE_FIELDS, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_MESSAGE, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_METADATA, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_SHOW_PREVIEW, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_SHOW_PROGRESS_STEPPER, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_SIGNER_ROLES, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_SKIP_ME_NOW, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_SUBJECT, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_TEST_MODE, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_TITLE, + TemplateCreateEmbeddedDraftRequest.JSON_PROPERTY_USE_PREEXISTING_FIELDS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateCreateEmbeddedDraftRequest { public static final String JSON_PROPERTY_CLIENT_ID = "client_id"; private String clientId; @@ -175,12 +173,11 @@ public TemplateCreateEmbeddedDraftRequest clientId(String clientId) { return this; } - /** + /** * Client id of the app you're using to create this draft. Used to apply the branding and callback url defined for the app. * @return clientId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Client id of the app you're using to create this draft. Used to apply the branding and callback url defined for the app.") @JsonProperty(JSON_PROPERTY_CLIENT_ID) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -209,12 +206,11 @@ public TemplateCreateEmbeddedDraftRequest addFilesItem(File filesItem) { return this; } - /** + /** * Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both. * @return files - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -243,12 +239,11 @@ public TemplateCreateEmbeddedDraftRequest addFileUrlsItem(String fileUrlsItem) { return this; } - /** + /** * Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both. * @return fileUrls - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILE_URLS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -269,12 +264,11 @@ public TemplateCreateEmbeddedDraftRequest allowCcs(Boolean allowCcs) { return this; } - /** + /** * This allows the requester to specify whether the user is allowed to provide email addresses to CC when creating a template. * @return allowCcs - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "This allows the requester to specify whether the user is allowed to provide email addresses to CC when creating a template.") @JsonProperty(JSON_PROPERTY_ALLOW_CCS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -295,12 +289,11 @@ public TemplateCreateEmbeddedDraftRequest allowReassign(Boolean allowReassign) { return this; } - /** + /** * Allows signers to reassign their signature requests to other signers if set to `true`. Defaults to `false`. **NOTE:** Only available for Premium plan and higher. * @return allowReassign - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows signers to reassign their signature requests to other signers if set to `true`. Defaults to `false`. **NOTE:** Only available for Premium plan and higher.") @JsonProperty(JSON_PROPERTY_ALLOW_REASSIGN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -329,12 +322,11 @@ public TemplateCreateEmbeddedDraftRequest addAttachmentsItem(SubAttachment attac return this; } - /** + /** * A list describing the attachments * @return attachments - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list describing the attachments") @JsonProperty(JSON_PROPERTY_ATTACHMENTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -363,12 +355,11 @@ public TemplateCreateEmbeddedDraftRequest addCcRolesItem(String ccRolesItem) { return this; } - /** + /** * The CC roles that must be assigned when using the template to send a signature request * @return ccRoles - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The CC roles that must be assigned when using the template to send a signature request") @JsonProperty(JSON_PROPERTY_CC_ROLES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -389,12 +380,11 @@ public TemplateCreateEmbeddedDraftRequest editorOptions(SubEditorOptions editorO return this; } - /** + /** * Get editorOptions * @return editorOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EDITOR_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -415,12 +405,11 @@ public TemplateCreateEmbeddedDraftRequest fieldOptions(SubFieldOptions fieldOpti return this; } - /** + /** * Get fieldOptions * @return fieldOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIELD_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -441,12 +430,11 @@ public TemplateCreateEmbeddedDraftRequest forceSignerRoles(Boolean forceSignerRo return this; } - /** + /** * Provide users the ability to review/edit the template signer roles. * @return forceSignerRoles - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Provide users the ability to review/edit the template signer roles.") @JsonProperty(JSON_PROPERTY_FORCE_SIGNER_ROLES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -467,12 +455,11 @@ public TemplateCreateEmbeddedDraftRequest forceSubjectMessage(Boolean forceSubje return this; } - /** + /** * Provide users the ability to review/edit the template subject and message. * @return forceSubjectMessage - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Provide users the ability to review/edit the template subject and message.") @JsonProperty(JSON_PROPERTY_FORCE_SUBJECT_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -501,12 +488,11 @@ public TemplateCreateEmbeddedDraftRequest addFormFieldGroupsItem(SubFormFieldGro return this; } - /** + /** * Group information for fields defined in `form_fields_per_document`. String-indexed JSON array with `group_label` and `requirement` keys. `form_fields_per_document` must contain fields referencing a group defined in `form_field_groups`. * @return formFieldGroups - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Group information for fields defined in `form_fields_per_document`. String-indexed JSON array with `group_label` and `requirement` keys. `form_fields_per_document` must contain fields referencing a group defined in `form_field_groups`.") @JsonProperty(JSON_PROPERTY_FORM_FIELD_GROUPS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -535,12 +521,11 @@ public TemplateCreateEmbeddedDraftRequest addFormFieldRulesItem(SubFormFieldRule return this; } - /** + /** * Conditional Logic rules for fields defined in `form_fields_per_document`. * @return formFieldRules - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Conditional Logic rules for fields defined in `form_fields_per_document`.") @JsonProperty(JSON_PROPERTY_FORM_FIELD_RULES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -569,12 +554,11 @@ public TemplateCreateEmbeddedDraftRequest addFormFieldsPerDocumentItem(SubFormFi return this; } - /** + /** * The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).) **NOTE:** Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types. * Text Field use `SubFormFieldsPerDocumentText` * Dropdown Field use `SubFormFieldsPerDocumentDropdown` * Hyperlink Field use `SubFormFieldsPerDocumentHyperlink` * Checkbox Field use `SubFormFieldsPerDocumentCheckbox` * Radio Field use `SubFormFieldsPerDocumentRadio` * Signature Field use `SubFormFieldsPerDocumentSignature` * Date Signed Field use `SubFormFieldsPerDocumentDateSigned` * Initials Field use `SubFormFieldsPerDocumentInitials` * Text Merge Field use `SubFormFieldsPerDocumentTextMerge` * Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge` * @return formFieldsPerDocument - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).) **NOTE:** Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types. * Text Field use `SubFormFieldsPerDocumentText` * Dropdown Field use `SubFormFieldsPerDocumentDropdown` * Hyperlink Field use `SubFormFieldsPerDocumentHyperlink` * Checkbox Field use `SubFormFieldsPerDocumentCheckbox` * Radio Field use `SubFormFieldsPerDocumentRadio` * Signature Field use `SubFormFieldsPerDocumentSignature` * Date Signed Field use `SubFormFieldsPerDocumentDateSigned` * Initials Field use `SubFormFieldsPerDocumentInitials` * Text Merge Field use `SubFormFieldsPerDocumentTextMerge` * Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge`") @JsonProperty(JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -603,12 +587,11 @@ public TemplateCreateEmbeddedDraftRequest addMergeFieldsItem(SubMergeField merge return this; } - /** + /** * Add merge fields to the template. Merge fields are placed by the user creating the template and used to pre-fill data by passing values into signature requests with the `custom_fields` parameter. If the signature request using that template *does not* pass a value into a merge field, then an empty field remains in the document. * @return mergeFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Add merge fields to the template. Merge fields are placed by the user creating the template and used to pre-fill data by passing values into signature requests with the `custom_fields` parameter. If the signature request using that template *does not* pass a value into a merge field, then an empty field remains in the document.") @JsonProperty(JSON_PROPERTY_MERGE_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -629,12 +612,11 @@ public TemplateCreateEmbeddedDraftRequest message(String message) { return this; } - /** + /** * The default template email message. * @return message - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The default template email message.") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -663,12 +645,11 @@ public TemplateCreateEmbeddedDraftRequest putMetadataItem(String key, Object met return this; } - /** + /** * Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long.") @JsonProperty(JSON_PROPERTY_METADATA) @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) @@ -689,12 +670,11 @@ public TemplateCreateEmbeddedDraftRequest showPreview(Boolean showPreview) { return this; } - /** + /** * This allows the requester to enable the editor/preview experience. - `show_preview=true`: Allows requesters to enable the editor/preview experience. - `show_preview=false`: Allows requesters to disable the editor/preview experience. * @return showPreview - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "This allows the requester to enable the editor/preview experience. - `show_preview=true`: Allows requesters to enable the editor/preview experience. - `show_preview=false`: Allows requesters to disable the editor/preview experience.") @JsonProperty(JSON_PROPERTY_SHOW_PREVIEW) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -715,12 +695,11 @@ public TemplateCreateEmbeddedDraftRequest showProgressStepper(Boolean showProgre return this; } - /** + /** * When only one step remains in the signature request process and this parameter is set to `false` then the progress stepper will be hidden. * @return showProgressStepper - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When only one step remains in the signature request process and this parameter is set to `false` then the progress stepper will be hidden.") @JsonProperty(JSON_PROPERTY_SHOW_PROGRESS_STEPPER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -749,12 +728,11 @@ public TemplateCreateEmbeddedDraftRequest addSignerRolesItem(SubTemplateRole sig return this; } - /** + /** * An array of the designated signer roles that must be specified when sending a SignatureRequest using this Template. * @return signerRoles - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array of the designated signer roles that must be specified when sending a SignatureRequest using this Template.") @JsonProperty(JSON_PROPERTY_SIGNER_ROLES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -775,12 +753,11 @@ public TemplateCreateEmbeddedDraftRequest skipMeNow(Boolean skipMeNow) { return this; } - /** + /** * Disables the \"Me (Now)\" option for the person preparing the document. Does not work with type `send_document`. Defaults to `false`. * @return skipMeNow - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Disables the \"Me (Now)\" option for the person preparing the document. Does not work with type `send_document`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_SKIP_ME_NOW) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -801,12 +778,11 @@ public TemplateCreateEmbeddedDraftRequest subject(String subject) { return this; } - /** + /** * The template title (alias). * @return subject - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The template title (alias).") @JsonProperty(JSON_PROPERTY_SUBJECT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -827,12 +803,11 @@ public TemplateCreateEmbeddedDraftRequest testMode(Boolean testMode) { return this; } - /** + /** * Whether this is a test, the signature request created from this draft will not be legally binding if set to `true`. Defaults to `false`. * @return testMode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this is a test, the signature request created from this draft will not be legally binding if set to `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_TEST_MODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -853,12 +828,11 @@ public TemplateCreateEmbeddedDraftRequest title(String title) { return this; } - /** + /** * The title you want to assign to the SignatureRequest. * @return title - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The title you want to assign to the SignatureRequest.") @JsonProperty(JSON_PROPERTY_TITLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -879,12 +853,11 @@ public TemplateCreateEmbeddedDraftRequest usePreexistingFields(Boolean usePreexi return this; } - /** + /** * Enable the detection of predefined PDF fields by setting the `use_preexisting_fields` to `true` (defaults to disabled, or `false`). * @return usePreexistingFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Enable the detection of predefined PDF fields by setting the `use_preexisting_fields` to `true` (defaults to disabled, or `false`).") @JsonProperty(JSON_PROPERTY_USE_PREEXISTING_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateCreateEmbeddedDraftResponse.java b/src/main/java/com/dropbox/sign/model/TemplateCreateEmbeddedDraftResponse.java index 598f690..a0f7bba 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateCreateEmbeddedDraftResponse.java +++ b/src/main/java/com/dropbox/sign/model/TemplateCreateEmbeddedDraftResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateCreateEmbeddedDraftResponseTemplate; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,11 +37,11 @@ * TemplateCreateEmbeddedDraftResponse */ @JsonPropertyOrder({ - TemplateCreateEmbeddedDraftResponse.JSON_PROPERTY_TEMPLATE, - TemplateCreateEmbeddedDraftResponse.JSON_PROPERTY_WARNINGS + TemplateCreateEmbeddedDraftResponse.JSON_PROPERTY_TEMPLATE, + TemplateCreateEmbeddedDraftResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateCreateEmbeddedDraftResponse { public static final String JSON_PROPERTY_TEMPLATE = "template"; private TemplateCreateEmbeddedDraftResponseTemplate template; @@ -74,14 +72,13 @@ public TemplateCreateEmbeddedDraftResponse template(TemplateCreateEmbeddedDraftR return this; } - /** + /** * Get template * @return template - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_TEMPLATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public TemplateCreateEmbeddedDraftResponseTemplate getTemplate() { return template; @@ -89,7 +86,7 @@ public TemplateCreateEmbeddedDraftResponseTemplate getTemplate() { @JsonProperty(JSON_PROPERTY_TEMPLATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setTemplate(TemplateCreateEmbeddedDraftResponseTemplate template) { this.template = template; } @@ -108,12 +105,11 @@ public TemplateCreateEmbeddedDraftResponse addWarningsItem(WarningResponse warni return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateCreateEmbeddedDraftResponseTemplate.java b/src/main/java/com/dropbox/sign/model/TemplateCreateEmbeddedDraftResponseTemplate.java index 7748d64..819f1d3 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateCreateEmbeddedDraftResponseTemplate.java +++ b/src/main/java/com/dropbox/sign/model/TemplateCreateEmbeddedDraftResponseTemplate.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.WarningResponse; @@ -23,29 +22,27 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; /** * Template object with parameters: `template_id`, `edit_url`, `expires_at`. */ -@ApiModel(description = "Template object with parameters: `template_id`, `edit_url`, `expires_at`.") @JsonPropertyOrder({ - TemplateCreateEmbeddedDraftResponseTemplate.JSON_PROPERTY_TEMPLATE_ID, - TemplateCreateEmbeddedDraftResponseTemplate.JSON_PROPERTY_EDIT_URL, - TemplateCreateEmbeddedDraftResponseTemplate.JSON_PROPERTY_EXPIRES_AT, - TemplateCreateEmbeddedDraftResponseTemplate.JSON_PROPERTY_WARNINGS + TemplateCreateEmbeddedDraftResponseTemplate.JSON_PROPERTY_TEMPLATE_ID, + TemplateCreateEmbeddedDraftResponseTemplate.JSON_PROPERTY_EDIT_URL, + TemplateCreateEmbeddedDraftResponseTemplate.JSON_PROPERTY_EXPIRES_AT, + TemplateCreateEmbeddedDraftResponseTemplate.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateCreateEmbeddedDraftResponseTemplate { public static final String JSON_PROPERTY_TEMPLATE_ID = "template_id"; private String templateId; @@ -57,6 +54,7 @@ public class TemplateCreateEmbeddedDraftResponseTemplate { private Integer expiresAt; public static final String JSON_PROPERTY_WARNINGS = "warnings"; + @Deprecated private List warnings = null; public TemplateCreateEmbeddedDraftResponseTemplate() { @@ -82,12 +80,11 @@ public TemplateCreateEmbeddedDraftResponseTemplate templateId(String templateId) return this; } - /** + /** * The id of the Template. * @return templateId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the Template.") @JsonProperty(JSON_PROPERTY_TEMPLATE_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -108,12 +105,11 @@ public TemplateCreateEmbeddedDraftResponseTemplate editUrl(String editUrl) { return this; } - /** + /** * Link to edit the template. * @return editUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Link to edit the template.") @JsonProperty(JSON_PROPERTY_EDIT_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -134,12 +130,11 @@ public TemplateCreateEmbeddedDraftResponseTemplate expiresAt(Integer expiresAt) return this; } - /** + /** * When the link expires. * @return expiresAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When the link expires.") @JsonProperty(JSON_PROPERTY_EXPIRES_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -155,6 +150,7 @@ public void setExpiresAt(Integer expiresAt) { } + @Deprecated public TemplateCreateEmbeddedDraftResponseTemplate warnings(List warnings) { this.warnings = warnings; return this; @@ -168,14 +164,13 @@ public TemplateCreateEmbeddedDraftResponseTemplate addWarningsItem(WarningRespon return this; } - /** + /** * A list of warnings. * @return warnings * @deprecated - **/ + */ @Deprecated @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -184,6 +179,7 @@ public List getWarnings() { } + @Deprecated @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setWarnings(List warnings) { diff --git a/src/main/java/com/dropbox/sign/model/TemplateCreateRequest.java b/src/main/java/com/dropbox/sign/model/TemplateCreateRequest.java index 935511b..54f9e49 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateCreateRequest.java +++ b/src/main/java/com/dropbox/sign/model/TemplateCreateRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubAttachment; @@ -29,17 +28,16 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; 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.JSON; import com.dropbox.sign.ApiException; @@ -47,27 +45,27 @@ * TemplateCreateRequest */ @JsonPropertyOrder({ - TemplateCreateRequest.JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT, - TemplateCreateRequest.JSON_PROPERTY_SIGNER_ROLES, - TemplateCreateRequest.JSON_PROPERTY_FILES, - TemplateCreateRequest.JSON_PROPERTY_FILE_URLS, - TemplateCreateRequest.JSON_PROPERTY_ALLOW_REASSIGN, - TemplateCreateRequest.JSON_PROPERTY_ATTACHMENTS, - TemplateCreateRequest.JSON_PROPERTY_CC_ROLES, - TemplateCreateRequest.JSON_PROPERTY_CLIENT_ID, - TemplateCreateRequest.JSON_PROPERTY_FIELD_OPTIONS, - TemplateCreateRequest.JSON_PROPERTY_FORM_FIELD_GROUPS, - TemplateCreateRequest.JSON_PROPERTY_FORM_FIELD_RULES, - TemplateCreateRequest.JSON_PROPERTY_MERGE_FIELDS, - TemplateCreateRequest.JSON_PROPERTY_MESSAGE, - TemplateCreateRequest.JSON_PROPERTY_METADATA, - TemplateCreateRequest.JSON_PROPERTY_SUBJECT, - TemplateCreateRequest.JSON_PROPERTY_TEST_MODE, - TemplateCreateRequest.JSON_PROPERTY_TITLE, - TemplateCreateRequest.JSON_PROPERTY_USE_PREEXISTING_FIELDS + TemplateCreateRequest.JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT, + TemplateCreateRequest.JSON_PROPERTY_SIGNER_ROLES, + TemplateCreateRequest.JSON_PROPERTY_FILES, + TemplateCreateRequest.JSON_PROPERTY_FILE_URLS, + TemplateCreateRequest.JSON_PROPERTY_ALLOW_REASSIGN, + TemplateCreateRequest.JSON_PROPERTY_ATTACHMENTS, + TemplateCreateRequest.JSON_PROPERTY_CC_ROLES, + TemplateCreateRequest.JSON_PROPERTY_CLIENT_ID, + TemplateCreateRequest.JSON_PROPERTY_FIELD_OPTIONS, + TemplateCreateRequest.JSON_PROPERTY_FORM_FIELD_GROUPS, + TemplateCreateRequest.JSON_PROPERTY_FORM_FIELD_RULES, + TemplateCreateRequest.JSON_PROPERTY_MERGE_FIELDS, + TemplateCreateRequest.JSON_PROPERTY_MESSAGE, + TemplateCreateRequest.JSON_PROPERTY_METADATA, + TemplateCreateRequest.JSON_PROPERTY_SUBJECT, + TemplateCreateRequest.JSON_PROPERTY_TEST_MODE, + TemplateCreateRequest.JSON_PROPERTY_TITLE, + TemplateCreateRequest.JSON_PROPERTY_USE_PREEXISTING_FIELDS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateCreateRequest { public static final String JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT = "form_fields_per_document"; private List formFieldsPerDocument = new ArrayList<>(); @@ -147,16 +145,18 @@ public TemplateCreateRequest formFieldsPerDocument(List(); + } this.formFieldsPerDocument.add(formFieldsPerDocumentItem); return this; } - /** + /** * The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).) **NOTE:** Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types. * Text Field use `SubFormFieldsPerDocumentText` * Dropdown Field use `SubFormFieldsPerDocumentDropdown` * Hyperlink Field use `SubFormFieldsPerDocumentHyperlink` * Checkbox Field use `SubFormFieldsPerDocumentCheckbox` * Radio Field use `SubFormFieldsPerDocumentRadio` * Signature Field use `SubFormFieldsPerDocumentSignature` * Date Signed Field use `SubFormFieldsPerDocumentDateSigned` * Initials Field use `SubFormFieldsPerDocumentInitials` * Text Merge Field use `SubFormFieldsPerDocumentTextMerge` * Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge` * @return formFieldsPerDocument - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).) **NOTE:** Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types. * Text Field use `SubFormFieldsPerDocumentText` * Dropdown Field use `SubFormFieldsPerDocumentDropdown` * Hyperlink Field use `SubFormFieldsPerDocumentHyperlink` * Checkbox Field use `SubFormFieldsPerDocumentCheckbox` * Radio Field use `SubFormFieldsPerDocumentRadio` * Signature Field use `SubFormFieldsPerDocumentSignature` * Date Signed Field use `SubFormFieldsPerDocumentDateSigned` * Initials Field use `SubFormFieldsPerDocumentInitials` * Text Merge Field use `SubFormFieldsPerDocumentTextMerge` * Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge`") @JsonProperty(JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -178,16 +178,18 @@ public TemplateCreateRequest signerRoles(List signerRoles) { } public TemplateCreateRequest addSignerRolesItem(SubTemplateRole signerRolesItem) { + if (this.signerRoles == null) { + this.signerRoles = new ArrayList<>(); + } this.signerRoles.add(signerRolesItem); return this; } - /** + /** * An array of the designated signer roles that must be specified when sending a SignatureRequest using this Template. * @return signerRoles - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "An array of the designated signer roles that must be specified when sending a SignatureRequest using this Template.") @JsonProperty(JSON_PROPERTY_SIGNER_ROLES) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -216,12 +218,11 @@ public TemplateCreateRequest addFilesItem(File filesItem) { return this; } - /** + /** * Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both. * @return files - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -250,12 +251,11 @@ public TemplateCreateRequest addFileUrlsItem(String fileUrlsItem) { return this; } - /** + /** * Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both. * @return fileUrls - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILE_URLS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -276,12 +276,11 @@ public TemplateCreateRequest allowReassign(Boolean allowReassign) { return this; } - /** + /** * Allows signers to reassign their signature requests to other signers if set to `true`. Defaults to `false`. **NOTE:** Only available for Premium plan and higher. * @return allowReassign - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows signers to reassign their signature requests to other signers if set to `true`. Defaults to `false`. **NOTE:** Only available for Premium plan and higher.") @JsonProperty(JSON_PROPERTY_ALLOW_REASSIGN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -310,12 +309,11 @@ public TemplateCreateRequest addAttachmentsItem(SubAttachment attachmentsItem) { return this; } - /** + /** * A list describing the attachments * @return attachments - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list describing the attachments") @JsonProperty(JSON_PROPERTY_ATTACHMENTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -344,12 +342,11 @@ public TemplateCreateRequest addCcRolesItem(String ccRolesItem) { return this; } - /** + /** * The CC roles that must be assigned when using the template to send a signature request * @return ccRoles - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The CC roles that must be assigned when using the template to send a signature request") @JsonProperty(JSON_PROPERTY_CC_ROLES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -370,12 +367,11 @@ public TemplateCreateRequest clientId(String clientId) { return this; } - /** + /** * Client id of the app you're using to create this draft. Used to apply the branding and callback url defined for the app. * @return clientId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Client id of the app you're using to create this draft. Used to apply the branding and callback url defined for the app.") @JsonProperty(JSON_PROPERTY_CLIENT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -396,12 +392,11 @@ public TemplateCreateRequest fieldOptions(SubFieldOptions fieldOptions) { return this; } - /** + /** * Get fieldOptions * @return fieldOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIELD_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -430,12 +425,11 @@ public TemplateCreateRequest addFormFieldGroupsItem(SubFormFieldGroup formFieldG return this; } - /** + /** * Group information for fields defined in `form_fields_per_document`. String-indexed JSON array with `group_label` and `requirement` keys. `form_fields_per_document` must contain fields referencing a group defined in `form_field_groups`. * @return formFieldGroups - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Group information for fields defined in `form_fields_per_document`. String-indexed JSON array with `group_label` and `requirement` keys. `form_fields_per_document` must contain fields referencing a group defined in `form_field_groups`.") @JsonProperty(JSON_PROPERTY_FORM_FIELD_GROUPS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -464,12 +458,11 @@ public TemplateCreateRequest addFormFieldRulesItem(SubFormFieldRule formFieldRul return this; } - /** + /** * Conditional Logic rules for fields defined in `form_fields_per_document`. * @return formFieldRules - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Conditional Logic rules for fields defined in `form_fields_per_document`.") @JsonProperty(JSON_PROPERTY_FORM_FIELD_RULES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -498,12 +491,11 @@ public TemplateCreateRequest addMergeFieldsItem(SubMergeField mergeFieldsItem) { return this; } - /** + /** * Add merge fields to the template. Merge fields are placed by the user creating the template and used to pre-fill data by passing values into signature requests with the `custom_fields` parameter. If the signature request using that template *does not* pass a value into a merge field, then an empty field remains in the document. * @return mergeFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Add merge fields to the template. Merge fields are placed by the user creating the template and used to pre-fill data by passing values into signature requests with the `custom_fields` parameter. If the signature request using that template *does not* pass a value into a merge field, then an empty field remains in the document.") @JsonProperty(JSON_PROPERTY_MERGE_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -524,12 +516,11 @@ public TemplateCreateRequest message(String message) { return this; } - /** + /** * The default template email message. * @return message - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The default template email message.") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -558,12 +549,11 @@ public TemplateCreateRequest putMetadataItem(String key, Object metadataItem) { return this; } - /** + /** * Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long.") @JsonProperty(JSON_PROPERTY_METADATA) @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) @@ -584,12 +574,11 @@ public TemplateCreateRequest subject(String subject) { return this; } - /** + /** * The template title (alias). * @return subject - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The template title (alias).") @JsonProperty(JSON_PROPERTY_SUBJECT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -610,12 +599,11 @@ public TemplateCreateRequest testMode(Boolean testMode) { return this; } - /** + /** * Whether this is a test, the signature request created from this draft will not be legally binding if set to `true`. Defaults to `false`. * @return testMode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this is a test, the signature request created from this draft will not be legally binding if set to `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_TEST_MODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -636,12 +624,11 @@ public TemplateCreateRequest title(String title) { return this; } - /** + /** * The title you want to assign to the SignatureRequest. * @return title - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The title you want to assign to the SignatureRequest.") @JsonProperty(JSON_PROPERTY_TITLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -662,12 +649,11 @@ public TemplateCreateRequest usePreexistingFields(Boolean usePreexistingFields) return this; } - /** + /** * Enable the detection of predefined PDF fields by setting the `use_preexisting_fields` to `true` (defaults to disabled, or `false`). * @return usePreexistingFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Enable the detection of predefined PDF fields by setting the `use_preexisting_fields` to `true` (defaults to disabled, or `false`).") @JsonProperty(JSON_PROPERTY_USE_PREEXISTING_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateCreateResponse.java b/src/main/java/com/dropbox/sign/model/TemplateCreateResponse.java index f743b6c..5c51487 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateCreateResponse.java +++ b/src/main/java/com/dropbox/sign/model/TemplateCreateResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateCreateResponseTemplate; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,11 +37,11 @@ * TemplateCreateResponse */ @JsonPropertyOrder({ - TemplateCreateResponse.JSON_PROPERTY_TEMPLATE, - TemplateCreateResponse.JSON_PROPERTY_WARNINGS + TemplateCreateResponse.JSON_PROPERTY_TEMPLATE, + TemplateCreateResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateCreateResponse { public static final String JSON_PROPERTY_TEMPLATE = "template"; private TemplateCreateResponseTemplate template; @@ -74,14 +72,13 @@ public TemplateCreateResponse template(TemplateCreateResponseTemplate template) return this; } - /** + /** * Get template * @return template - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_TEMPLATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public TemplateCreateResponseTemplate getTemplate() { return template; @@ -89,7 +86,7 @@ public TemplateCreateResponseTemplate getTemplate() { @JsonProperty(JSON_PROPERTY_TEMPLATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setTemplate(TemplateCreateResponseTemplate template) { this.template = template; } @@ -108,12 +105,11 @@ public TemplateCreateResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateCreateResponseTemplate.java b/src/main/java/com/dropbox/sign/model/TemplateCreateResponseTemplate.java index a4eb864..7f8e5a5 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateCreateResponseTemplate.java +++ b/src/main/java/com/dropbox/sign/model/TemplateCreateResponseTemplate.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,24 +21,22 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * Template object with parameters: `template_id`. */ -@ApiModel(description = "Template object with parameters: `template_id`.") @JsonPropertyOrder({ - TemplateCreateResponseTemplate.JSON_PROPERTY_TEMPLATE_ID + TemplateCreateResponseTemplate.JSON_PROPERTY_TEMPLATE_ID }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateCreateResponseTemplate { public static final String JSON_PROPERTY_TEMPLATE_ID = "template_id"; private String templateId; @@ -67,12 +64,11 @@ public TemplateCreateResponseTemplate templateId(String templateId) { return this; } - /** + /** * The id of the Template. * @return templateId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the Template.") @JsonProperty(JSON_PROPERTY_TEMPLATE_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateEditResponse.java b/src/main/java/com/dropbox/sign/model/TemplateEditResponse.java index 2f11916..6924483 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateEditResponse.java +++ b/src/main/java/com/dropbox/sign/model/TemplateEditResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,10 +33,10 @@ * TemplateEditResponse */ @JsonPropertyOrder({ - TemplateEditResponse.JSON_PROPERTY_TEMPLATE_ID + TemplateEditResponse.JSON_PROPERTY_TEMPLATE_ID }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateEditResponse { public static final String JSON_PROPERTY_TEMPLATE_ID = "template_id"; private String templateId; @@ -66,14 +64,13 @@ public TemplateEditResponse templateId(String templateId) { return this; } - /** + /** * The id of the Template. * @return templateId - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the Template.") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_TEMPLATE_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getTemplateId() { return templateId; @@ -81,7 +78,7 @@ public String getTemplateId() { @JsonProperty(JSON_PROPERTY_TEMPLATE_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setTemplateId(String templateId) { this.templateId = templateId; } diff --git a/src/main/java/com/dropbox/sign/model/TemplateGetResponse.java b/src/main/java/com/dropbox/sign/model/TemplateGetResponse.java index 61d3651..a5d3467 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateGetResponse.java +++ b/src/main/java/com/dropbox/sign/model/TemplateGetResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponse; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,11 +37,11 @@ * TemplateGetResponse */ @JsonPropertyOrder({ - TemplateGetResponse.JSON_PROPERTY_TEMPLATE, - TemplateGetResponse.JSON_PROPERTY_WARNINGS + TemplateGetResponse.JSON_PROPERTY_TEMPLATE, + TemplateGetResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateGetResponse { public static final String JSON_PROPERTY_TEMPLATE = "template"; private TemplateResponse template; @@ -74,14 +72,13 @@ public TemplateGetResponse template(TemplateResponse template) { return this; } - /** + /** * Get template * @return template - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_TEMPLATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public TemplateResponse getTemplate() { return template; @@ -89,7 +86,7 @@ public TemplateResponse getTemplate() { @JsonProperty(JSON_PROPERTY_TEMPLATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setTemplate(TemplateResponse template) { this.template = template; } @@ -108,12 +105,11 @@ public TemplateGetResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateListResponse.java b/src/main/java/com/dropbox/sign/model/TemplateListResponse.java index 6da50b1..3af113e 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateListResponse.java +++ b/src/main/java/com/dropbox/sign/model/TemplateListResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.ListInfoResponse; @@ -25,14 +24,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -40,15 +38,15 @@ * TemplateListResponse */ @JsonPropertyOrder({ - TemplateListResponse.JSON_PROPERTY_TEMPLATES, - TemplateListResponse.JSON_PROPERTY_LIST_INFO, - TemplateListResponse.JSON_PROPERTY_WARNINGS + TemplateListResponse.JSON_PROPERTY_TEMPLATES, + TemplateListResponse.JSON_PROPERTY_LIST_INFO, + TemplateListResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateListResponse { public static final String JSON_PROPERTY_TEMPLATES = "templates"; - private List templates = null; + private List templates = new ArrayList<>(); public static final String JSON_PROPERTY_LIST_INFO = "list_info"; private ListInfoResponse listInfo; @@ -87,14 +85,13 @@ public TemplateListResponse addTemplatesItem(TemplateResponse templatesItem) { return this; } - /** + /** * List of templates that the API caller has access to. * @return templates - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "List of templates that the API caller has access to.") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_TEMPLATES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getTemplates() { return templates; @@ -102,7 +99,7 @@ public List getTemplates() { @JsonProperty(JSON_PROPERTY_TEMPLATES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setTemplates(List templates) { this.templates = templates; } @@ -113,14 +110,13 @@ public TemplateListResponse listInfo(ListInfoResponse listInfo) { return this; } - /** + /** * Get listInfo * @return listInfo - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_LIST_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public ListInfoResponse getListInfo() { return listInfo; @@ -128,7 +124,7 @@ public ListInfoResponse getListInfo() { @JsonProperty(JSON_PROPERTY_LIST_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setListInfo(ListInfoResponse listInfo) { this.listInfo = listInfo; } @@ -147,12 +143,11 @@ public TemplateListResponse addWarningsItem(WarningResponse warningsItem) { return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateRemoveUserRequest.java b/src/main/java/com/dropbox/sign/model/TemplateRemoveUserRequest.java index 64e82f1..76894ef 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateRemoveUserRequest.java +++ b/src/main/java/com/dropbox/sign/model/TemplateRemoveUserRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,11 +33,11 @@ * TemplateRemoveUserRequest */ @JsonPropertyOrder({ - TemplateRemoveUserRequest.JSON_PROPERTY_ACCOUNT_ID, - TemplateRemoveUserRequest.JSON_PROPERTY_EMAIL_ADDRESS + TemplateRemoveUserRequest.JSON_PROPERTY_ACCOUNT_ID, + TemplateRemoveUserRequest.JSON_PROPERTY_EMAIL_ADDRESS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateRemoveUserRequest { public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; private String accountId; @@ -70,12 +68,11 @@ public TemplateRemoveUserRequest accountId(String accountId) { return this; } - /** + /** * The id or email address of the Account to remove access to the Template. The account id prevails if both are provided. * @return accountId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The id or email address of the Account to remove access to the Template. The account id prevails if both are provided.") @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -96,12 +93,11 @@ public TemplateRemoveUserRequest emailAddress(String emailAddress) { return this; } - /** + /** * The id or email address of the Account to remove access to the Template. The account id prevails if both are provided. * @return emailAddress - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The id or email address of the Account to remove access to the Template. The account id prevails if both are provided.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponse.java b/src/main/java/com/dropbox/sign/model/TemplateResponse.java index 6513c76..5a89f48 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponse.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseAccount; @@ -28,40 +27,38 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; /** * Contains information about the templates you and your team have created. */ -@ApiModel(description = "Contains information about the templates you and your team have created.") @JsonPropertyOrder({ - TemplateResponse.JSON_PROPERTY_TEMPLATE_ID, - TemplateResponse.JSON_PROPERTY_TITLE, - TemplateResponse.JSON_PROPERTY_MESSAGE, - TemplateResponse.JSON_PROPERTY_UPDATED_AT, - TemplateResponse.JSON_PROPERTY_IS_EMBEDDED, - TemplateResponse.JSON_PROPERTY_IS_CREATOR, - TemplateResponse.JSON_PROPERTY_CAN_EDIT, - TemplateResponse.JSON_PROPERTY_IS_LOCKED, - TemplateResponse.JSON_PROPERTY_METADATA, - TemplateResponse.JSON_PROPERTY_SIGNER_ROLES, - TemplateResponse.JSON_PROPERTY_CC_ROLES, - TemplateResponse.JSON_PROPERTY_DOCUMENTS, - TemplateResponse.JSON_PROPERTY_CUSTOM_FIELDS, - TemplateResponse.JSON_PROPERTY_NAMED_FORM_FIELDS, - TemplateResponse.JSON_PROPERTY_ACCOUNTS + TemplateResponse.JSON_PROPERTY_TEMPLATE_ID, + TemplateResponse.JSON_PROPERTY_TITLE, + TemplateResponse.JSON_PROPERTY_MESSAGE, + TemplateResponse.JSON_PROPERTY_UPDATED_AT, + TemplateResponse.JSON_PROPERTY_IS_EMBEDDED, + TemplateResponse.JSON_PROPERTY_IS_CREATOR, + TemplateResponse.JSON_PROPERTY_CAN_EDIT, + TemplateResponse.JSON_PROPERTY_IS_LOCKED, + TemplateResponse.JSON_PROPERTY_METADATA, + TemplateResponse.JSON_PROPERTY_SIGNER_ROLES, + TemplateResponse.JSON_PROPERTY_CC_ROLES, + TemplateResponse.JSON_PROPERTY_DOCUMENTS, + TemplateResponse.JSON_PROPERTY_CUSTOM_FIELDS, + TemplateResponse.JSON_PROPERTY_NAMED_FORM_FIELDS, + TemplateResponse.JSON_PROPERTY_ACCOUNTS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateResponse { public static final String JSON_PROPERTY_TEMPLATE_ID = "template_id"; private String templateId; @@ -100,9 +97,11 @@ public class TemplateResponse { private List documents = null; public static final String JSON_PROPERTY_CUSTOM_FIELDS = "custom_fields"; + @Deprecated private List customFields = null; public static final String JSON_PROPERTY_NAMED_FORM_FIELDS = "named_form_fields"; + @Deprecated private List namedFormFields = null; public static final String JSON_PROPERTY_ACCOUNTS = "accounts"; @@ -131,12 +130,11 @@ public TemplateResponse templateId(String templateId) { return this; } - /** + /** * The id of the Template. * @return templateId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the Template.") @JsonProperty(JSON_PROPERTY_TEMPLATE_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -157,12 +155,11 @@ public TemplateResponse title(String title) { return this; } - /** + /** * The title of the Template. This will also be the default subject of the message sent to signers when using this Template to send a SignatureRequest. This can be overridden when sending the SignatureRequest. * @return title - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The title of the Template. This will also be the default subject of the message sent to signers when using this Template to send a SignatureRequest. This can be overridden when sending the SignatureRequest.") @JsonProperty(JSON_PROPERTY_TITLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -183,12 +180,11 @@ public TemplateResponse message(String message) { return this; } - /** + /** * The default message that will be sent to signers when using this Template to send a SignatureRequest. This can be overridden when sending the SignatureRequest. * @return message - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The default message that will be sent to signers when using this Template to send a SignatureRequest. This can be overridden when sending the SignatureRequest.") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -209,12 +205,11 @@ public TemplateResponse updatedAt(Integer updatedAt) { return this; } - /** + /** * Time the template was last updated. * @return updatedAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Time the template was last updated.") @JsonProperty(JSON_PROPERTY_UPDATED_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -235,12 +230,11 @@ public TemplateResponse isEmbedded(Boolean isEmbedded) { return this; } - /** + /** * `true` if this template was created using an embedded flow, `false` if it was created on our website. * @return isEmbedded - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "`true` if this template was created using an embedded flow, `false` if it was created on our website.") @JsonProperty(JSON_PROPERTY_IS_EMBEDDED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -261,12 +255,11 @@ public TemplateResponse isCreator(Boolean isCreator) { return this; } - /** + /** * `true` if you are the owner of this template, `false` if it's been shared with you by a team member. * @return isCreator - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "`true` if you are the owner of this template, `false` if it's been shared with you by a team member.") @JsonProperty(JSON_PROPERTY_IS_CREATOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -287,12 +280,11 @@ public TemplateResponse canEdit(Boolean canEdit) { return this; } - /** + /** * Indicates whether edit rights have been granted to you by the owner (always `true` if that's you). * @return canEdit - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Indicates whether edit rights have been granted to you by the owner (always `true` if that's you).") @JsonProperty(JSON_PROPERTY_CAN_EDIT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -313,12 +305,11 @@ public TemplateResponse isLocked(Boolean isLocked) { return this; } - /** + /** * Indicates whether the template is locked. If `true`, then the template was created outside your quota and can only be used in `test_mode`. If `false`, then the template is within your quota and can be used to create signature requests. * @return isLocked - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Indicates whether the template is locked. If `true`, then the template was created outside your quota and can only be used in `test_mode`. If `false`, then the template is within your quota and can be used to create signature requests.") @JsonProperty(JSON_PROPERTY_IS_LOCKED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -339,12 +330,11 @@ public TemplateResponse metadata(Object metadata) { return this; } - /** + /** * The metadata attached to the template. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The metadata attached to the template.") @JsonProperty(JSON_PROPERTY_METADATA) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -373,12 +363,11 @@ public TemplateResponse addSignerRolesItem(TemplateResponseSignerRole signerRole return this; } - /** + /** * An array of the designated signer roles that must be specified when sending a SignatureRequest using this Template. * @return signerRoles - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array of the designated signer roles that must be specified when sending a SignatureRequest using this Template.") @JsonProperty(JSON_PROPERTY_SIGNER_ROLES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -407,12 +396,11 @@ public TemplateResponse addCcRolesItem(TemplateResponseCCRole ccRolesItem) { return this; } - /** + /** * An array of the designated CC roles that must be specified when sending a SignatureRequest using this Template. * @return ccRoles - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array of the designated CC roles that must be specified when sending a SignatureRequest using this Template.") @JsonProperty(JSON_PROPERTY_CC_ROLES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -441,12 +429,11 @@ public TemplateResponse addDocumentsItem(TemplateResponseDocument documentsItem) return this; } - /** + /** * An array describing each document associated with this Template. Includes form field data for each document. * @return documents - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array describing each document associated with this Template. Includes form field data for each document.") @JsonProperty(JSON_PROPERTY_DOCUMENTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -462,6 +449,7 @@ public void setDocuments(List documents) { } + @Deprecated public TemplateResponse customFields(List customFields) { this.customFields = customFields; return this; @@ -475,14 +463,13 @@ public TemplateResponse addCustomFieldsItem(TemplateResponseDocumentCustomFieldB return this; } - /** + /** * Deprecated. Use `custom_fields` inside the [documents](https://developers.hellosign.com/api/reference/operation/templateGet/#!c=200&path=template/documents&t=response) array instead. * @return customFields * @deprecated - **/ + */ @Deprecated @javax.annotation.Nullable - @ApiModelProperty(value = "Deprecated. Use `custom_fields` inside the [documents](https://developers.hellosign.com/api/reference/operation/templateGet/#!c=200&path=template/documents&t=response) array instead.") @JsonProperty(JSON_PROPERTY_CUSTOM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -491,6 +478,7 @@ public List getCustomFields() { } + @Deprecated @JsonProperty(JSON_PROPERTY_CUSTOM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCustomFields(List customFields) { @@ -498,6 +486,7 @@ public void setCustomFields(List custom } + @Deprecated public TemplateResponse namedFormFields(List namedFormFields) { this.namedFormFields = namedFormFields; return this; @@ -511,14 +500,13 @@ public TemplateResponse addNamedFormFieldsItem(TemplateResponseDocumentFormField return this; } - /** + /** * Deprecated. Use `form_fields` inside the [documents](https://developers.hellosign.com/api/reference/operation/templateGet/#!c=200&path=template/documents&t=response) array instead. * @return namedFormFields * @deprecated - **/ + */ @Deprecated @javax.annotation.Nullable - @ApiModelProperty(value = "Deprecated. Use `form_fields` inside the [documents](https://developers.hellosign.com/api/reference/operation/templateGet/#!c=200&path=template/documents&t=response) array instead.") @JsonProperty(JSON_PROPERTY_NAMED_FORM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -527,6 +515,7 @@ public List getNamedFormFields() { } + @Deprecated @JsonProperty(JSON_PROPERTY_NAMED_FORM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNamedFormFields(List namedFormFields) { @@ -547,12 +536,11 @@ public TemplateResponse addAccountsItem(TemplateResponseAccount accountsItem) { return this; } - /** + /** * An array of the Accounts that can use this Template. * @return accounts - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array of the Accounts that can use this Template.") @JsonProperty(JSON_PROPERTY_ACCOUNTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseAccount.java b/src/main/java/com/dropbox/sign/model/TemplateResponseAccount.java index fd5d762..ec5f7a9 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseAccount.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseAccount.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseAccountQuota; @@ -23,12 +22,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -36,15 +34,15 @@ * TemplateResponseAccount */ @JsonPropertyOrder({ - TemplateResponseAccount.JSON_PROPERTY_ACCOUNT_ID, - TemplateResponseAccount.JSON_PROPERTY_EMAIL_ADDRESS, - TemplateResponseAccount.JSON_PROPERTY_IS_LOCKED, - TemplateResponseAccount.JSON_PROPERTY_IS_PAID_HS, - TemplateResponseAccount.JSON_PROPERTY_IS_PAID_HF, - TemplateResponseAccount.JSON_PROPERTY_QUOTAS + TemplateResponseAccount.JSON_PROPERTY_ACCOUNT_ID, + TemplateResponseAccount.JSON_PROPERTY_EMAIL_ADDRESS, + TemplateResponseAccount.JSON_PROPERTY_IS_LOCKED, + TemplateResponseAccount.JSON_PROPERTY_IS_PAID_HS, + TemplateResponseAccount.JSON_PROPERTY_IS_PAID_HF, + TemplateResponseAccount.JSON_PROPERTY_QUOTAS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateResponseAccount { public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; private String accountId; @@ -87,12 +85,11 @@ public TemplateResponseAccount accountId(String accountId) { return this; } - /** + /** * The id of the Account. * @return accountId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the Account.") @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -113,12 +110,11 @@ public TemplateResponseAccount emailAddress(String emailAddress) { return this; } - /** + /** * The email address associated with the Account. * @return emailAddress - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The email address associated with the Account.") @JsonProperty(JSON_PROPERTY_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -139,12 +135,11 @@ public TemplateResponseAccount isLocked(Boolean isLocked) { return this; } - /** + /** * Returns `true` if the user has been locked out of their account by a team admin. * @return isLocked - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Returns `true` if the user has been locked out of their account by a team admin.") @JsonProperty(JSON_PROPERTY_IS_LOCKED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -165,12 +160,11 @@ public TemplateResponseAccount isPaidHs(Boolean isPaidHs) { return this; } - /** + /** * Returns `true` if the user has a paid Dropbox Sign account. * @return isPaidHs - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Returns `true` if the user has a paid Dropbox Sign account.") @JsonProperty(JSON_PROPERTY_IS_PAID_HS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -191,12 +185,11 @@ public TemplateResponseAccount isPaidHf(Boolean isPaidHf) { return this; } - /** + /** * Returns `true` if the user has a paid HelloFax account. * @return isPaidHf - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Returns `true` if the user has a paid HelloFax account.") @JsonProperty(JSON_PROPERTY_IS_PAID_HF) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -217,12 +210,11 @@ public TemplateResponseAccount quotas(TemplateResponseAccountQuota quotas) { return this; } - /** + /** * Get quotas * @return quotas - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_QUOTAS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseAccountQuota.java b/src/main/java/com/dropbox/sign/model/TemplateResponseAccountQuota.java index 1da4984..95b805c 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseAccountQuota.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseAccountQuota.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,27 +21,25 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * An array of the designated CC roles that must be specified when sending a SignatureRequest using this Template. */ -@ApiModel(description = "An array of the designated CC roles that must be specified when sending a SignatureRequest using this Template.") @JsonPropertyOrder({ - TemplateResponseAccountQuota.JSON_PROPERTY_TEMPLATES_LEFT, - TemplateResponseAccountQuota.JSON_PROPERTY_API_SIGNATURE_REQUESTS_LEFT, - TemplateResponseAccountQuota.JSON_PROPERTY_DOCUMENTS_LEFT, - TemplateResponseAccountQuota.JSON_PROPERTY_SMS_VERIFICATIONS_LEFT + TemplateResponseAccountQuota.JSON_PROPERTY_TEMPLATES_LEFT, + TemplateResponseAccountQuota.JSON_PROPERTY_API_SIGNATURE_REQUESTS_LEFT, + TemplateResponseAccountQuota.JSON_PROPERTY_DOCUMENTS_LEFT, + TemplateResponseAccountQuota.JSON_PROPERTY_SMS_VERIFICATIONS_LEFT }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateResponseAccountQuota { public static final String JSON_PROPERTY_TEMPLATES_LEFT = "templates_left"; private Integer templatesLeft; @@ -79,12 +76,11 @@ public TemplateResponseAccountQuota templatesLeft(Integer templatesLeft) { return this; } - /** + /** * API templates remaining. * @return templatesLeft - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "API templates remaining.") @JsonProperty(JSON_PROPERTY_TEMPLATES_LEFT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -105,12 +101,11 @@ public TemplateResponseAccountQuota apiSignatureRequestsLeft(Integer apiSignatur return this; } - /** + /** * API signature requests remaining. * @return apiSignatureRequestsLeft - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "API signature requests remaining.") @JsonProperty(JSON_PROPERTY_API_SIGNATURE_REQUESTS_LEFT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -131,12 +126,11 @@ public TemplateResponseAccountQuota documentsLeft(Integer documentsLeft) { return this; } - /** + /** * Signature requests remaining. * @return documentsLeft - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Signature requests remaining.") @JsonProperty(JSON_PROPERTY_DOCUMENTS_LEFT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -157,12 +151,11 @@ public TemplateResponseAccountQuota smsVerificationsLeft(Integer smsVerification return this; } - /** + /** * SMS verifications remaining. * @return smsVerificationsLeft - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "SMS verifications remaining.") @JsonProperty(JSON_PROPERTY_SMS_VERIFICATIONS_LEFT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseCCRole.java b/src/main/java/com/dropbox/sign/model/TemplateResponseCCRole.java index 003372c..0c70b11 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseCCRole.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseCCRole.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,10 +33,10 @@ * TemplateResponseCCRole */ @JsonPropertyOrder({ - TemplateResponseCCRole.JSON_PROPERTY_NAME + TemplateResponseCCRole.JSON_PROPERTY_NAME }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateResponseCCRole { public static final String JSON_PROPERTY_NAME = "name"; private String name; @@ -66,12 +64,11 @@ public TemplateResponseCCRole name(String name) { return this; } - /** + /** * The name of the Role. * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the Role.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocument.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocument.java index 111dc57..74b232d 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocument.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocument.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentCustomFieldBase; @@ -26,14 +25,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -41,15 +39,15 @@ * TemplateResponseDocument */ @JsonPropertyOrder({ - TemplateResponseDocument.JSON_PROPERTY_NAME, - TemplateResponseDocument.JSON_PROPERTY_INDEX, - TemplateResponseDocument.JSON_PROPERTY_FIELD_GROUPS, - TemplateResponseDocument.JSON_PROPERTY_FORM_FIELDS, - TemplateResponseDocument.JSON_PROPERTY_CUSTOM_FIELDS, - TemplateResponseDocument.JSON_PROPERTY_STATIC_FIELDS + TemplateResponseDocument.JSON_PROPERTY_NAME, + TemplateResponseDocument.JSON_PROPERTY_INDEX, + TemplateResponseDocument.JSON_PROPERTY_FIELD_GROUPS, + TemplateResponseDocument.JSON_PROPERTY_FORM_FIELDS, + TemplateResponseDocument.JSON_PROPERTY_CUSTOM_FIELDS, + TemplateResponseDocument.JSON_PROPERTY_STATIC_FIELDS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateResponseDocument { public static final String JSON_PROPERTY_NAME = "name"; private String name; @@ -92,12 +90,11 @@ public TemplateResponseDocument name(String name) { return this; } - /** + /** * Name of the associated file. * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Name of the associated file.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -118,12 +115,11 @@ public TemplateResponseDocument index(Integer index) { return this; } - /** + /** * Document ordering, the lowest index is displayed first and the highest last (0-based indexing). * @return index - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Document ordering, the lowest index is displayed first and the highest last (0-based indexing).") @JsonProperty(JSON_PROPERTY_INDEX) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -152,12 +148,11 @@ public TemplateResponseDocument addFieldGroupsItem(TemplateResponseDocumentField return this; } - /** + /** * An array of Form Field Group objects. * @return fieldGroups - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array of Form Field Group objects.") @JsonProperty(JSON_PROPERTY_FIELD_GROUPS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -186,12 +181,11 @@ public TemplateResponseDocument addFormFieldsItem(TemplateResponseDocumentFormFi return this; } - /** + /** * An array of Form Field objects containing the name and type of each named field. * @return formFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array of Form Field objects containing the name and type of each named field.") @JsonProperty(JSON_PROPERTY_FORM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -220,12 +214,11 @@ public TemplateResponseDocument addCustomFieldsItem(TemplateResponseDocumentCust return this; } - /** + /** * An array of Form Field objects containing the name and type of each named field. * @return customFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array of Form Field objects containing the name and type of each named field.") @JsonProperty(JSON_PROPERTY_CUSTOM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -254,12 +247,11 @@ public TemplateResponseDocument addStaticFieldsItem(TemplateResponseDocumentStat return this; } - /** + /** * An array describing static overlay fields. **NOTE:** Only available for certain subscriptions. * @return staticFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array describing static overlay fields. **NOTE:** Only available for certain subscriptions.") @JsonProperty(JSON_PROPERTY_STATIC_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentCustomFieldBase.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentCustomFieldBase.java index d10fe4f..b9300c5 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentCustomFieldBase.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentCustomFieldBase.java @@ -14,11 +14,9 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; -import com.dropbox.sign.model.TemplateResponseDocumentCustomFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentCustomFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -26,37 +24,36 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * An array of Form Field objects containing the name and type of each named field. */ -@ApiModel(description = "An array of Form Field objects containing the name and type of each named field.") @JsonPropertyOrder({ - TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_TYPE, - TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_API_ID, - TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_NAME, - TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_SIGNER, - TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_X, - TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_Y, - TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_WIDTH, - TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_HEIGHT, - TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_REQUIRED, - TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_GROUP + TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_TYPE, + TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_API_ID, + TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_NAME, + TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_SIGNER, + TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_X, + TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_Y, + TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_WIDTH, + TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_HEIGHT, + TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_REQUIRED, + TemplateResponseDocumentCustomFieldBase.JSON_PROPERTY_GROUP }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) @JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentCustomFieldCheckbox.class, name = "TemplateResponseDocumentCustomFieldCheckbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentCustomFieldText.class, name = "TemplateResponseDocumentCustomFieldText"), @JsonSubTypes.Type(value = TemplateResponseDocumentCustomFieldCheckbox.class, name = "checkbox"), @JsonSubTypes.Type(value = TemplateResponseDocumentCustomFieldText.class, name = "text"), }) @@ -115,12 +112,11 @@ public TemplateResponseDocumentCustomFieldBase type(String type) { return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -141,12 +137,11 @@ public TemplateResponseDocumentCustomFieldBase apiId(String apiId) { return this; } - /** + /** * The unique ID for this field. * @return apiId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The unique ID for this field.") @JsonProperty(JSON_PROPERTY_API_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -167,12 +162,11 @@ public TemplateResponseDocumentCustomFieldBase name(String name) { return this; } - /** + /** * The name of the Custom Field. * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the Custom Field.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -192,13 +186,16 @@ public TemplateResponseDocumentCustomFieldBase signer(String signer) { this.signer = signer; return this; } + public TemplateResponseDocumentCustomFieldBase signer(Integer signer) { + this.signer = String.valueOf(signer); + return this; + } - /** + /** * The signer of the Custom Field. Can be `null` if field is a merge field (assigned to Sender). * @return signer - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The signer of the Custom Field. Can be `null` if field is a merge field (assigned to Sender).") @JsonProperty(JSON_PROPERTY_SIGNER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -213,18 +210,21 @@ public void setSigner(String signer) { this.signer = signer; } + public void setSigner(Integer signer) { + this.signer = String.valueOf(signer); + } + public TemplateResponseDocumentCustomFieldBase x(Integer x) { this.x = x; return this; } - /** + /** * The horizontal offset in pixels for this form field. * @return x - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The horizontal offset in pixels for this form field.") @JsonProperty(JSON_PROPERTY_X) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -245,12 +245,11 @@ public TemplateResponseDocumentCustomFieldBase y(Integer y) { return this; } - /** + /** * The vertical offset in pixels for this form field. * @return y - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The vertical offset in pixels for this form field.") @JsonProperty(JSON_PROPERTY_Y) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -271,12 +270,11 @@ public TemplateResponseDocumentCustomFieldBase width(Integer width) { return this; } - /** + /** * The width in pixels of this form field. * @return width - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The width in pixels of this form field.") @JsonProperty(JSON_PROPERTY_WIDTH) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -297,12 +295,11 @@ public TemplateResponseDocumentCustomFieldBase height(Integer height) { return this; } - /** + /** * The height in pixels of this form field. * @return height - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The height in pixels of this form field.") @JsonProperty(JSON_PROPERTY_HEIGHT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -323,12 +320,11 @@ public TemplateResponseDocumentCustomFieldBase required(Boolean required) { return this; } - /** + /** * Boolean showing whether or not this field is required. * @return required - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Boolean showing whether or not this field is required.") @JsonProperty(JSON_PROPERTY_REQUIRED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -349,12 +345,11 @@ public TemplateResponseDocumentCustomFieldBase group(String group) { return this; } - /** + /** * The name of the group this field is in. If this field is not a group, this defaults to `null`. * @return group - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the group this field is in. If this field is not a group, this defaults to `null`.") @JsonProperty(JSON_PROPERTY_GROUP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -649,15 +644,13 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("TemplateResponseDocumentCustomFieldCheckbox", TemplateResponseDocumentCustomFieldCheckbox.class); - mappings.put("TemplateResponseDocumentCustomFieldText", TemplateResponseDocumentCustomFieldText.class); - mappings.put("checkbox", TemplateResponseDocumentCustomFieldCheckbox.class); - mappings.put("text", TemplateResponseDocumentCustomFieldText.class); - mappings.put("TemplateResponseDocumentCustomFieldBase", TemplateResponseDocumentCustomFieldBase.class); - JSON.registerDiscriminator(TemplateResponseDocumentCustomFieldBase.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("checkbox", TemplateResponseDocumentCustomFieldCheckbox.class); + mappings.put("text", TemplateResponseDocumentCustomFieldText.class); + mappings.put("TemplateResponseDocumentCustomFieldBase", TemplateResponseDocumentCustomFieldBase.class); + JSON.registerDiscriminator(TemplateResponseDocumentCustomFieldBase.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentCustomFieldCheckbox.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentCustomFieldCheckbox.java index 93a503a..e61e8fb 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentCustomFieldCheckbox.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentCustomFieldCheckbox.java @@ -14,12 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentCustomFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentCustomFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentCustomFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -27,29 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentCustomFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentCustomFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentCustomFieldCheckbox.JSON_PROPERTY_TYPE + TemplateResponseDocumentCustomFieldCheckbox.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentCustomFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentCustomFieldText.class, name = "text"), -}) public class TemplateResponseDocumentCustomFieldCheckbox extends TemplateResponseDocumentCustomFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -78,12 +73,11 @@ public TemplateResponseDocumentCustomFieldCheckbox type(String type) { return this; } - /** + /** * The type of this Custom Field. Only `text` and `checkbox` are currently supported. * Text uses `TemplateResponseDocumentCustomFieldText` * Checkbox uses `TemplateResponseDocumentCustomFieldCheckbox` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this Custom Field. Only `text` and `checkbox` are currently supported. * Text uses `TemplateResponseDocumentCustomFieldText` * Checkbox uses `TemplateResponseDocumentCustomFieldCheckbox`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -192,13 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentCustomFieldCheckbox.class); - mappings.put("text", TemplateResponseDocumentCustomFieldText.class); - mappings.put("TemplateResponseDocumentCustomFieldCheckbox", TemplateResponseDocumentCustomFieldCheckbox.class); - JSON.registerDiscriminator(TemplateResponseDocumentCustomFieldCheckbox.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentCustomFieldCheckbox", TemplateResponseDocumentCustomFieldCheckbox.class); + JSON.registerDiscriminator(TemplateResponseDocumentCustomFieldCheckbox.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentCustomFieldText.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentCustomFieldText.java index 31e92fd..74091e3 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentCustomFieldText.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentCustomFieldText.java @@ -14,13 +14,11 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentCustomFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentCustomFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentCustomFieldText; import com.dropbox.sign.model.TemplateResponseFieldAvgTextLength; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -28,33 +26,30 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentCustomFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentCustomFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentCustomFieldText.JSON_PROPERTY_TYPE, - TemplateResponseDocumentCustomFieldText.JSON_PROPERTY_AVG_TEXT_LENGTH, - TemplateResponseDocumentCustomFieldText.JSON_PROPERTY_IS_MULTILINE, - TemplateResponseDocumentCustomFieldText.JSON_PROPERTY_ORIGINAL_FONT_SIZE, - TemplateResponseDocumentCustomFieldText.JSON_PROPERTY_FONT_FAMILY + TemplateResponseDocumentCustomFieldText.JSON_PROPERTY_TYPE, + TemplateResponseDocumentCustomFieldText.JSON_PROPERTY_AVG_TEXT_LENGTH, + TemplateResponseDocumentCustomFieldText.JSON_PROPERTY_IS_MULTILINE, + TemplateResponseDocumentCustomFieldText.JSON_PROPERTY_ORIGINAL_FONT_SIZE, + TemplateResponseDocumentCustomFieldText.JSON_PROPERTY_FONT_FAMILY }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentCustomFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentCustomFieldText.class, name = "text"), -}) public class TemplateResponseDocumentCustomFieldText extends TemplateResponseDocumentCustomFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -95,12 +90,11 @@ public TemplateResponseDocumentCustomFieldText type(String type) { return this; } - /** + /** * The type of this Custom Field. Only `text` and `checkbox` are currently supported. * Text uses `TemplateResponseDocumentCustomFieldText` * Checkbox uses `TemplateResponseDocumentCustomFieldCheckbox` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this Custom Field. Only `text` and `checkbox` are currently supported. * Text uses `TemplateResponseDocumentCustomFieldText` * Checkbox uses `TemplateResponseDocumentCustomFieldCheckbox`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -121,12 +115,11 @@ public TemplateResponseDocumentCustomFieldText avgTextLength(TemplateResponseFie return this; } - /** + /** * Get avgTextLength * @return avgTextLength - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_AVG_TEXT_LENGTH) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -147,12 +140,11 @@ public TemplateResponseDocumentCustomFieldText isMultiline(Boolean isMultiline) return this; } - /** + /** * Whether this form field is multiline text. * @return isMultiline - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this form field is multiline text.") @JsonProperty(JSON_PROPERTY_IS_MULTILINE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -173,12 +165,11 @@ public TemplateResponseDocumentCustomFieldText originalFontSize(Integer original return this; } - /** + /** * Original font size used in this form field's text. * @return originalFontSize - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Original font size used in this form field's text.") @JsonProperty(JSON_PROPERTY_ORIGINAL_FONT_SIZE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -199,12 +190,11 @@ public TemplateResponseDocumentCustomFieldText fontFamily(String fontFamily) { return this; } - /** + /** * Font family used in this form field's text. * @return fontFamily - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Font family used in this form field's text.") @JsonProperty(JSON_PROPERTY_FONT_FAMILY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -397,13 +387,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentCustomFieldCheckbox.class); - mappings.put("text", TemplateResponseDocumentCustomFieldText.class); - mappings.put("TemplateResponseDocumentCustomFieldText", TemplateResponseDocumentCustomFieldText.class); - JSON.registerDiscriminator(TemplateResponseDocumentCustomFieldText.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentCustomFieldText", TemplateResponseDocumentCustomFieldText.class); + JSON.registerDiscriminator(TemplateResponseDocumentCustomFieldText.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFieldGroup.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFieldGroup.java index 30db504..4f3c61f 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFieldGroup.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFieldGroup.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentFieldGroupRule; @@ -23,12 +22,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -36,11 +34,11 @@ * TemplateResponseDocumentFieldGroup */ @JsonPropertyOrder({ - TemplateResponseDocumentFieldGroup.JSON_PROPERTY_NAME, - TemplateResponseDocumentFieldGroup.JSON_PROPERTY_RULE + TemplateResponseDocumentFieldGroup.JSON_PROPERTY_NAME, + TemplateResponseDocumentFieldGroup.JSON_PROPERTY_RULE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateResponseDocumentFieldGroup { public static final String JSON_PROPERTY_NAME = "name"; private String name; @@ -71,12 +69,11 @@ public TemplateResponseDocumentFieldGroup name(String name) { return this; } - /** + /** * The name of the form field group. * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the form field group.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -97,12 +94,11 @@ public TemplateResponseDocumentFieldGroup rule(TemplateResponseDocumentFieldGrou return this; } - /** + /** * Get rule * @return rule - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_RULE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFieldGroupRule.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFieldGroupRule.java index 571bfe3..7fa0688 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFieldGroupRule.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFieldGroupRule.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,25 +21,23 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * The rule used to validate checkboxes in the form field group. See [checkbox field grouping](/api/reference/constants/#checkbox-field-grouping). */ -@ApiModel(description = "The rule used to validate checkboxes in the form field group. See [checkbox field grouping](/api/reference/constants/#checkbox-field-grouping).") @JsonPropertyOrder({ - TemplateResponseDocumentFieldGroupRule.JSON_PROPERTY_REQUIREMENT, - TemplateResponseDocumentFieldGroupRule.JSON_PROPERTY_GROUP_LABEL + TemplateResponseDocumentFieldGroupRule.JSON_PROPERTY_REQUIREMENT, + TemplateResponseDocumentFieldGroupRule.JSON_PROPERTY_GROUP_LABEL }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateResponseDocumentFieldGroupRule { public static final String JSON_PROPERTY_REQUIREMENT = "requirement"; private String requirement; @@ -71,12 +68,11 @@ public TemplateResponseDocumentFieldGroupRule requirement(String requirement) { return this; } - /** + /** * Examples: `require_0-1` `require_1` `require_1-ormore` - Check out the list of [acceptable `requirement` checkbox type values](/api/reference/constants/#checkbox-field-grouping). - Check out the list of [acceptable `requirement` radio type fields](/api/reference/constants/#radio-field-grouping). - Radio groups require **at least** two fields per group. * @return requirement - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Examples: `require_0-1` `require_1` `require_1-ormore` - Check out the list of [acceptable `requirement` checkbox type values](/api/reference/constants/#checkbox-field-grouping). - Check out the list of [acceptable `requirement` radio type fields](/api/reference/constants/#radio-field-grouping). - Radio groups require **at least** two fields per group.") @JsonProperty(JSON_PROPERTY_REQUIREMENT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -97,12 +93,11 @@ public TemplateResponseDocumentFieldGroupRule groupLabel(String groupLabel) { return this; } - /** + /** * Name of the group * @return groupLabel - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Name of the group") @JsonProperty(JSON_PROPERTY_GROUP_LABEL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldBase.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldBase.java index cfeac33..775126f 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldBase.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldBase.java @@ -14,17 +14,9 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -32,43 +24,36 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * An array of Form Field objects containing the name and type of each named field. */ -@ApiModel(description = "An array of Form Field objects containing the name and type of each named field.") @JsonPropertyOrder({ - TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_TYPE, - TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_API_ID, - TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_NAME, - TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_SIGNER, - TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_X, - TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_Y, - TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_WIDTH, - TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_HEIGHT, - TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_REQUIRED, - TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_GROUP + TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_TYPE, + TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_API_ID, + TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_NAME, + TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_SIGNER, + TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_X, + TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_Y, + TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_WIDTH, + TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_HEIGHT, + TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_REQUIRED, + TemplateResponseDocumentFormFieldBase.JSON_PROPERTY_GROUP }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) @JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldCheckbox.class, name = "TemplateResponseDocumentFormFieldCheckbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDateSigned.class, name = "TemplateResponseDocumentFormFieldDateSigned"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDropdown.class, name = "TemplateResponseDocumentFormFieldDropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldHyperlink.class, name = "TemplateResponseDocumentFormFieldHyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldInitials.class, name = "TemplateResponseDocumentFormFieldInitials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldRadio.class, name = "TemplateResponseDocumentFormFieldRadio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldSignature.class, name = "TemplateResponseDocumentFormFieldSignature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldText.class, name = "TemplateResponseDocumentFormFieldText"), @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldCheckbox.class, name = "checkbox"), @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDateSigned.class, name = "date_signed"), @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDropdown.class, name = "dropdown"), @@ -133,12 +118,11 @@ public TemplateResponseDocumentFormFieldBase type(String type) { return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -159,12 +143,11 @@ public TemplateResponseDocumentFormFieldBase apiId(String apiId) { return this; } - /** + /** * A unique id for the form field. * @return apiId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A unique id for the form field.") @JsonProperty(JSON_PROPERTY_API_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -185,12 +168,11 @@ public TemplateResponseDocumentFormFieldBase name(String name) { return this; } - /** + /** * The name of the form field. * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the form field.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -210,13 +192,16 @@ public TemplateResponseDocumentFormFieldBase signer(String signer) { this.signer = signer; return this; } + public TemplateResponseDocumentFormFieldBase signer(Integer signer) { + this.signer = String.valueOf(signer); + return this; + } - /** + /** * The signer of the Form Field. * @return signer - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The signer of the Form Field.") @JsonProperty(JSON_PROPERTY_SIGNER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -231,18 +216,21 @@ public void setSigner(String signer) { this.signer = signer; } + public void setSigner(Integer signer) { + this.signer = String.valueOf(signer); + } + public TemplateResponseDocumentFormFieldBase x(Integer x) { this.x = x; return this; } - /** + /** * The horizontal offset in pixels for this form field. * @return x - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The horizontal offset in pixels for this form field.") @JsonProperty(JSON_PROPERTY_X) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -263,12 +251,11 @@ public TemplateResponseDocumentFormFieldBase y(Integer y) { return this; } - /** + /** * The vertical offset in pixels for this form field. * @return y - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The vertical offset in pixels for this form field.") @JsonProperty(JSON_PROPERTY_Y) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -289,12 +276,11 @@ public TemplateResponseDocumentFormFieldBase width(Integer width) { return this; } - /** + /** * The width in pixels of this form field. * @return width - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The width in pixels of this form field.") @JsonProperty(JSON_PROPERTY_WIDTH) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -315,12 +301,11 @@ public TemplateResponseDocumentFormFieldBase height(Integer height) { return this; } - /** + /** * The height in pixels of this form field. * @return height - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The height in pixels of this form field.") @JsonProperty(JSON_PROPERTY_HEIGHT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -341,12 +326,11 @@ public TemplateResponseDocumentFormFieldBase required(Boolean required) { return this; } - /** + /** * Boolean showing whether or not this field is required. * @return required - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Boolean showing whether or not this field is required.") @JsonProperty(JSON_PROPERTY_REQUIRED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -367,12 +351,11 @@ public TemplateResponseDocumentFormFieldBase group(String group) { return this; } - /** + /** * The name of the group this field is in. If this field is not a group, this defaults to `null` except for Radio fields. * @return group - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the group this field is in. If this field is not a group, this defaults to `null` except for Radio fields.") @JsonProperty(JSON_PROPERTY_GROUP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -667,27 +650,19 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("TemplateResponseDocumentFormFieldCheckbox", TemplateResponseDocumentFormFieldCheckbox.class); - mappings.put("TemplateResponseDocumentFormFieldDateSigned", TemplateResponseDocumentFormFieldDateSigned.class); - mappings.put("TemplateResponseDocumentFormFieldDropdown", TemplateResponseDocumentFormFieldDropdown.class); - mappings.put("TemplateResponseDocumentFormFieldHyperlink", TemplateResponseDocumentFormFieldHyperlink.class); - mappings.put("TemplateResponseDocumentFormFieldInitials", TemplateResponseDocumentFormFieldInitials.class); - mappings.put("TemplateResponseDocumentFormFieldRadio", TemplateResponseDocumentFormFieldRadio.class); - mappings.put("TemplateResponseDocumentFormFieldSignature", TemplateResponseDocumentFormFieldSignature.class); - mappings.put("TemplateResponseDocumentFormFieldText", TemplateResponseDocumentFormFieldText.class); - mappings.put("checkbox", TemplateResponseDocumentFormFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentFormFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentFormFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentFormFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentFormFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentFormFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentFormFieldSignature.class); - mappings.put("text", TemplateResponseDocumentFormFieldText.class); - mappings.put("TemplateResponseDocumentFormFieldBase", TemplateResponseDocumentFormFieldBase.class); - JSON.registerDiscriminator(TemplateResponseDocumentFormFieldBase.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("checkbox", TemplateResponseDocumentFormFieldCheckbox.class); + mappings.put("date_signed", TemplateResponseDocumentFormFieldDateSigned.class); + mappings.put("dropdown", TemplateResponseDocumentFormFieldDropdown.class); + mappings.put("hyperlink", TemplateResponseDocumentFormFieldHyperlink.class); + mappings.put("initials", TemplateResponseDocumentFormFieldInitials.class); + mappings.put("radio", TemplateResponseDocumentFormFieldRadio.class); + mappings.put("signature", TemplateResponseDocumentFormFieldSignature.class); + mappings.put("text", TemplateResponseDocumentFormFieldText.class); + mappings.put("TemplateResponseDocumentFormFieldBase", TemplateResponseDocumentFormFieldBase.class); + JSON.registerDiscriminator(TemplateResponseDocumentFormFieldBase.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldCheckbox.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldCheckbox.java index 8f9cd0c..dab3147 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldCheckbox.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldCheckbox.java @@ -14,18 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentFormFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -33,35 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentFormFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentFormFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentFormFieldCheckbox.JSON_PROPERTY_TYPE + TemplateResponseDocumentFormFieldCheckbox.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldInitials.class, name = "initials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldRadio.class, name = "radio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldSignature.class, name = "signature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldText.class, name = "text"), -}) public class TemplateResponseDocumentFormFieldCheckbox extends TemplateResponseDocumentFormFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -90,12 +73,11 @@ public TemplateResponseDocumentFormFieldCheckbox type(String type) { return this; } - /** + /** * The type of this form field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentFormFieldText` * Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox` * Radio Field uses `TemplateResponseDocumentFormFieldRadio` * Signature Field uses `TemplateResponseDocumentFormFieldSignature` * Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned` * Initials Field uses `TemplateResponseDocumentFormFieldInitials` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this form field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentFormFieldText` * Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox` * Radio Field uses `TemplateResponseDocumentFormFieldRadio` * Signature Field uses `TemplateResponseDocumentFormFieldSignature` * Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned` * Initials Field uses `TemplateResponseDocumentFormFieldInitials`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -204,19 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentFormFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentFormFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentFormFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentFormFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentFormFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentFormFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentFormFieldSignature.class); - mappings.put("text", TemplateResponseDocumentFormFieldText.class); - mappings.put("TemplateResponseDocumentFormFieldCheckbox", TemplateResponseDocumentFormFieldCheckbox.class); - JSON.registerDiscriminator(TemplateResponseDocumentFormFieldCheckbox.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentFormFieldCheckbox", TemplateResponseDocumentFormFieldCheckbox.class); + JSON.registerDiscriminator(TemplateResponseDocumentFormFieldCheckbox.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldDateSigned.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldDateSigned.java index b9701bc..630282e 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldDateSigned.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldDateSigned.java @@ -14,18 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentFormFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -33,35 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentFormFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentFormFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentFormFieldDateSigned.JSON_PROPERTY_TYPE + TemplateResponseDocumentFormFieldDateSigned.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldInitials.class, name = "initials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldRadio.class, name = "radio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldSignature.class, name = "signature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldText.class, name = "text"), -}) public class TemplateResponseDocumentFormFieldDateSigned extends TemplateResponseDocumentFormFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -90,12 +73,11 @@ public TemplateResponseDocumentFormFieldDateSigned type(String type) { return this; } - /** + /** * The type of this form field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentFormFieldText` * Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox` * Radio Field uses `TemplateResponseDocumentFormFieldRadio` * Signature Field uses `TemplateResponseDocumentFormFieldSignature` * Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned` * Initials Field uses `TemplateResponseDocumentFormFieldInitials` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this form field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentFormFieldText` * Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox` * Radio Field uses `TemplateResponseDocumentFormFieldRadio` * Signature Field uses `TemplateResponseDocumentFormFieldSignature` * Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned` * Initials Field uses `TemplateResponseDocumentFormFieldInitials`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -204,19 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentFormFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentFormFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentFormFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentFormFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentFormFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentFormFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentFormFieldSignature.class); - mappings.put("text", TemplateResponseDocumentFormFieldText.class); - mappings.put("TemplateResponseDocumentFormFieldDateSigned", TemplateResponseDocumentFormFieldDateSigned.class); - JSON.registerDiscriminator(TemplateResponseDocumentFormFieldDateSigned.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentFormFieldDateSigned", TemplateResponseDocumentFormFieldDateSigned.class); + JSON.registerDiscriminator(TemplateResponseDocumentFormFieldDateSigned.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldDropdown.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldDropdown.java index cbede28..ffbf252 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldDropdown.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldDropdown.java @@ -14,18 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentFormFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -33,35 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentFormFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentFormFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentFormFieldDropdown.JSON_PROPERTY_TYPE + TemplateResponseDocumentFormFieldDropdown.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldInitials.class, name = "initials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldRadio.class, name = "radio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldSignature.class, name = "signature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldText.class, name = "text"), -}) public class TemplateResponseDocumentFormFieldDropdown extends TemplateResponseDocumentFormFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -90,12 +73,11 @@ public TemplateResponseDocumentFormFieldDropdown type(String type) { return this; } - /** + /** * The type of this form field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentFormFieldText` * Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox` * Radio Field uses `TemplateResponseDocumentFormFieldRadio` * Signature Field uses `TemplateResponseDocumentFormFieldSignature` * Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned` * Initials Field uses `TemplateResponseDocumentFormFieldInitials` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this form field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentFormFieldText` * Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox` * Radio Field uses `TemplateResponseDocumentFormFieldRadio` * Signature Field uses `TemplateResponseDocumentFormFieldSignature` * Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned` * Initials Field uses `TemplateResponseDocumentFormFieldInitials`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -204,19 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentFormFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentFormFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentFormFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentFormFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentFormFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentFormFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentFormFieldSignature.class); - mappings.put("text", TemplateResponseDocumentFormFieldText.class); - mappings.put("TemplateResponseDocumentFormFieldDropdown", TemplateResponseDocumentFormFieldDropdown.class); - JSON.registerDiscriminator(TemplateResponseDocumentFormFieldDropdown.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentFormFieldDropdown", TemplateResponseDocumentFormFieldDropdown.class); + JSON.registerDiscriminator(TemplateResponseDocumentFormFieldDropdown.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldHyperlink.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldHyperlink.java index 6628e42..72024c7 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldHyperlink.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldHyperlink.java @@ -14,19 +14,11 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentFormFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldText; import com.dropbox.sign.model.TemplateResponseFieldAvgTextLength; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -34,39 +26,30 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentFormFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentFormFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentFormFieldHyperlink.JSON_PROPERTY_TYPE, - TemplateResponseDocumentFormFieldHyperlink.JSON_PROPERTY_AVG_TEXT_LENGTH, - TemplateResponseDocumentFormFieldHyperlink.JSON_PROPERTY_IS_MULTILINE, - TemplateResponseDocumentFormFieldHyperlink.JSON_PROPERTY_ORIGINAL_FONT_SIZE, - TemplateResponseDocumentFormFieldHyperlink.JSON_PROPERTY_FONT_FAMILY + TemplateResponseDocumentFormFieldHyperlink.JSON_PROPERTY_TYPE, + TemplateResponseDocumentFormFieldHyperlink.JSON_PROPERTY_AVG_TEXT_LENGTH, + TemplateResponseDocumentFormFieldHyperlink.JSON_PROPERTY_IS_MULTILINE, + TemplateResponseDocumentFormFieldHyperlink.JSON_PROPERTY_ORIGINAL_FONT_SIZE, + TemplateResponseDocumentFormFieldHyperlink.JSON_PROPERTY_FONT_FAMILY }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldInitials.class, name = "initials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldRadio.class, name = "radio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldSignature.class, name = "signature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldText.class, name = "text"), -}) public class TemplateResponseDocumentFormFieldHyperlink extends TemplateResponseDocumentFormFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -107,12 +90,11 @@ public TemplateResponseDocumentFormFieldHyperlink type(String type) { return this; } - /** + /** * The type of this form field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentFormFieldText` * Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox` * Radio Field uses `TemplateResponseDocumentFormFieldRadio` * Signature Field uses `TemplateResponseDocumentFormFieldSignature` * Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned` * Initials Field uses `TemplateResponseDocumentFormFieldInitials` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this form field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentFormFieldText` * Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox` * Radio Field uses `TemplateResponseDocumentFormFieldRadio` * Signature Field uses `TemplateResponseDocumentFormFieldSignature` * Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned` * Initials Field uses `TemplateResponseDocumentFormFieldInitials`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -133,12 +115,11 @@ public TemplateResponseDocumentFormFieldHyperlink avgTextLength(TemplateResponse return this; } - /** + /** * Get avgTextLength * @return avgTextLength - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_AVG_TEXT_LENGTH) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -159,12 +140,11 @@ public TemplateResponseDocumentFormFieldHyperlink isMultiline(Boolean isMultilin return this; } - /** + /** * Whether this form field is multiline text. * @return isMultiline - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this form field is multiline text.") @JsonProperty(JSON_PROPERTY_IS_MULTILINE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -185,12 +165,11 @@ public TemplateResponseDocumentFormFieldHyperlink originalFontSize(Integer origi return this; } - /** + /** * Original font size used in this form field's text. * @return originalFontSize - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Original font size used in this form field's text.") @JsonProperty(JSON_PROPERTY_ORIGINAL_FONT_SIZE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -211,12 +190,11 @@ public TemplateResponseDocumentFormFieldHyperlink fontFamily(String fontFamily) return this; } - /** + /** * Font family used in this form field's text. * @return fontFamily - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Font family used in this form field's text.") @JsonProperty(JSON_PROPERTY_FONT_FAMILY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -409,19 +387,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentFormFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentFormFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentFormFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentFormFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentFormFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentFormFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentFormFieldSignature.class); - mappings.put("text", TemplateResponseDocumentFormFieldText.class); - mappings.put("TemplateResponseDocumentFormFieldHyperlink", TemplateResponseDocumentFormFieldHyperlink.class); - JSON.registerDiscriminator(TemplateResponseDocumentFormFieldHyperlink.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentFormFieldHyperlink", TemplateResponseDocumentFormFieldHyperlink.class); + JSON.registerDiscriminator(TemplateResponseDocumentFormFieldHyperlink.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldInitials.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldInitials.java index 7c11dfc..53bcf1b 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldInitials.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldInitials.java @@ -14,18 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentFormFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -33,35 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentFormFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentFormFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentFormFieldInitials.JSON_PROPERTY_TYPE + TemplateResponseDocumentFormFieldInitials.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldInitials.class, name = "initials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldRadio.class, name = "radio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldSignature.class, name = "signature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldText.class, name = "text"), -}) public class TemplateResponseDocumentFormFieldInitials extends TemplateResponseDocumentFormFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -90,12 +73,11 @@ public TemplateResponseDocumentFormFieldInitials type(String type) { return this; } - /** + /** * The type of this form field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentFormFieldText` * Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox` * Radio Field uses `TemplateResponseDocumentFormFieldRadio` * Signature Field uses `TemplateResponseDocumentFormFieldSignature` * Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned` * Initials Field uses `TemplateResponseDocumentFormFieldInitials` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this form field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentFormFieldText` * Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox` * Radio Field uses `TemplateResponseDocumentFormFieldRadio` * Signature Field uses `TemplateResponseDocumentFormFieldSignature` * Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned` * Initials Field uses `TemplateResponseDocumentFormFieldInitials`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -204,19 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentFormFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentFormFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentFormFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentFormFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentFormFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentFormFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentFormFieldSignature.class); - mappings.put("text", TemplateResponseDocumentFormFieldText.class); - mappings.put("TemplateResponseDocumentFormFieldInitials", TemplateResponseDocumentFormFieldInitials.class); - JSON.registerDiscriminator(TemplateResponseDocumentFormFieldInitials.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentFormFieldInitials", TemplateResponseDocumentFormFieldInitials.class); + JSON.registerDiscriminator(TemplateResponseDocumentFormFieldInitials.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldRadio.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldRadio.java index 778c8ff..245c6d8 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldRadio.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldRadio.java @@ -14,18 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentFormFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -33,35 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentFormFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentFormFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentFormFieldRadio.JSON_PROPERTY_TYPE + TemplateResponseDocumentFormFieldRadio.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldInitials.class, name = "initials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldRadio.class, name = "radio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldSignature.class, name = "signature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldText.class, name = "text"), -}) public class TemplateResponseDocumentFormFieldRadio extends TemplateResponseDocumentFormFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -90,12 +73,11 @@ public TemplateResponseDocumentFormFieldRadio type(String type) { return this; } - /** + /** * The type of this form field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentFormFieldText` * Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox` * Radio Field uses `TemplateResponseDocumentFormFieldRadio` * Signature Field uses `TemplateResponseDocumentFormFieldSignature` * Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned` * Initials Field uses `TemplateResponseDocumentFormFieldInitials` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this form field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentFormFieldText` * Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox` * Radio Field uses `TemplateResponseDocumentFormFieldRadio` * Signature Field uses `TemplateResponseDocumentFormFieldSignature` * Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned` * Initials Field uses `TemplateResponseDocumentFormFieldInitials`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -204,19 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentFormFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentFormFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentFormFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentFormFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentFormFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentFormFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentFormFieldSignature.class); - mappings.put("text", TemplateResponseDocumentFormFieldText.class); - mappings.put("TemplateResponseDocumentFormFieldRadio", TemplateResponseDocumentFormFieldRadio.class); - JSON.registerDiscriminator(TemplateResponseDocumentFormFieldRadio.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentFormFieldRadio", TemplateResponseDocumentFormFieldRadio.class); + JSON.registerDiscriminator(TemplateResponseDocumentFormFieldRadio.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldSignature.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldSignature.java index 49bcfe5..8b3f3fd 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldSignature.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldSignature.java @@ -14,18 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentFormFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -33,35 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentFormFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentFormFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentFormFieldSignature.JSON_PROPERTY_TYPE + TemplateResponseDocumentFormFieldSignature.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldInitials.class, name = "initials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldRadio.class, name = "radio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldSignature.class, name = "signature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldText.class, name = "text"), -}) public class TemplateResponseDocumentFormFieldSignature extends TemplateResponseDocumentFormFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -90,12 +73,11 @@ public TemplateResponseDocumentFormFieldSignature type(String type) { return this; } - /** + /** * The type of this form field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentFormFieldText` * Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox` * Radio Field uses `TemplateResponseDocumentFormFieldRadio` * Signature Field uses `TemplateResponseDocumentFormFieldSignature` * Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned` * Initials Field uses `TemplateResponseDocumentFormFieldInitials` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this form field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentFormFieldText` * Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox` * Radio Field uses `TemplateResponseDocumentFormFieldRadio` * Signature Field uses `TemplateResponseDocumentFormFieldSignature` * Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned` * Initials Field uses `TemplateResponseDocumentFormFieldInitials`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -204,19 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentFormFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentFormFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentFormFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentFormFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentFormFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentFormFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentFormFieldSignature.class); - mappings.put("text", TemplateResponseDocumentFormFieldText.class); - mappings.put("TemplateResponseDocumentFormFieldSignature", TemplateResponseDocumentFormFieldSignature.class); - JSON.registerDiscriminator(TemplateResponseDocumentFormFieldSignature.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentFormFieldSignature", TemplateResponseDocumentFormFieldSignature.class); + JSON.registerDiscriminator(TemplateResponseDocumentFormFieldSignature.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldText.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldText.java index 8f32651..b58e6f6 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldText.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldText.java @@ -14,19 +14,11 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentFormFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentFormFieldText; import com.dropbox.sign.model.TemplateResponseFieldAvgTextLength; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -34,40 +26,31 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentFormFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentFormFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentFormFieldText.JSON_PROPERTY_TYPE, - TemplateResponseDocumentFormFieldText.JSON_PROPERTY_AVG_TEXT_LENGTH, - TemplateResponseDocumentFormFieldText.JSON_PROPERTY_IS_MULTILINE, - TemplateResponseDocumentFormFieldText.JSON_PROPERTY_ORIGINAL_FONT_SIZE, - TemplateResponseDocumentFormFieldText.JSON_PROPERTY_FONT_FAMILY, - TemplateResponseDocumentFormFieldText.JSON_PROPERTY_VALIDATION_TYPE + TemplateResponseDocumentFormFieldText.JSON_PROPERTY_TYPE, + TemplateResponseDocumentFormFieldText.JSON_PROPERTY_AVG_TEXT_LENGTH, + TemplateResponseDocumentFormFieldText.JSON_PROPERTY_IS_MULTILINE, + TemplateResponseDocumentFormFieldText.JSON_PROPERTY_ORIGINAL_FONT_SIZE, + TemplateResponseDocumentFormFieldText.JSON_PROPERTY_FONT_FAMILY, + TemplateResponseDocumentFormFieldText.JSON_PROPERTY_VALIDATION_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldInitials.class, name = "initials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldRadio.class, name = "radio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldSignature.class, name = "signature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentFormFieldText.class, name = "text"), -}) public class TemplateResponseDocumentFormFieldText extends TemplateResponseDocumentFormFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -162,12 +145,11 @@ public TemplateResponseDocumentFormFieldText type(String type) { return this; } - /** + /** * The type of this form field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentFormFieldText` * Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox` * Radio Field uses `TemplateResponseDocumentFormFieldRadio` * Signature Field uses `TemplateResponseDocumentFormFieldSignature` * Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned` * Initials Field uses `TemplateResponseDocumentFormFieldInitials` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this form field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentFormFieldText` * Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox` * Radio Field uses `TemplateResponseDocumentFormFieldRadio` * Signature Field uses `TemplateResponseDocumentFormFieldSignature` * Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned` * Initials Field uses `TemplateResponseDocumentFormFieldInitials`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -188,12 +170,11 @@ public TemplateResponseDocumentFormFieldText avgTextLength(TemplateResponseField return this; } - /** + /** * Get avgTextLength * @return avgTextLength - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_AVG_TEXT_LENGTH) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -214,12 +195,11 @@ public TemplateResponseDocumentFormFieldText isMultiline(Boolean isMultiline) { return this; } - /** + /** * Whether this form field is multiline text. * @return isMultiline - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this form field is multiline text.") @JsonProperty(JSON_PROPERTY_IS_MULTILINE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -240,12 +220,11 @@ public TemplateResponseDocumentFormFieldText originalFontSize(Integer originalFo return this; } - /** + /** * Original font size used in this form field's text. * @return originalFontSize - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Original font size used in this form field's text.") @JsonProperty(JSON_PROPERTY_ORIGINAL_FONT_SIZE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -266,12 +245,11 @@ public TemplateResponseDocumentFormFieldText fontFamily(String fontFamily) { return this; } - /** + /** * Font family used in this form field's text. * @return fontFamily - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Font family used in this form field's text.") @JsonProperty(JSON_PROPERTY_FONT_FAMILY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -292,12 +270,11 @@ public TemplateResponseDocumentFormFieldText validationType(ValidationTypeEnum v return this; } - /** + /** * Each text field may contain a `validation_type` parameter. Check out the list of [validation types](https://faq.hellosign.com/hc/en-us/articles/217115577) to learn more about the possible values. * @return validationType - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Each text field may contain a `validation_type` parameter. Check out the list of [validation types](https://faq.hellosign.com/hc/en-us/articles/217115577) to learn more about the possible values.") @JsonProperty(JSON_PROPERTY_VALIDATION_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -511,19 +488,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentFormFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentFormFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentFormFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentFormFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentFormFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentFormFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentFormFieldSignature.class); - mappings.put("text", TemplateResponseDocumentFormFieldText.class); - mappings.put("TemplateResponseDocumentFormFieldText", TemplateResponseDocumentFormFieldText.class); - JSON.registerDiscriminator(TemplateResponseDocumentFormFieldText.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentFormFieldText", TemplateResponseDocumentFormFieldText.class); + JSON.registerDiscriminator(TemplateResponseDocumentFormFieldText.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldBase.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldBase.java index f49aaac..323d7d2 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldBase.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldBase.java @@ -14,17 +14,9 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -32,43 +24,36 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * An array describing static overlay fields. **NOTE:** Only available for certain subscriptions. */ -@ApiModel(description = "An array describing static overlay fields. **NOTE:** Only available for certain subscriptions.") @JsonPropertyOrder({ - TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_TYPE, - TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_API_ID, - TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_NAME, - TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_SIGNER, - TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_X, - TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_Y, - TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_WIDTH, - TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_HEIGHT, - TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_REQUIRED, - TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_GROUP + TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_TYPE, + TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_API_ID, + TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_NAME, + TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_SIGNER, + TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_X, + TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_Y, + TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_WIDTH, + TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_HEIGHT, + TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_REQUIRED, + TemplateResponseDocumentStaticFieldBase.JSON_PROPERTY_GROUP }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) @JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldCheckbox.class, name = "TemplateResponseDocumentStaticFieldCheckbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDateSigned.class, name = "TemplateResponseDocumentStaticFieldDateSigned"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDropdown.class, name = "TemplateResponseDocumentStaticFieldDropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldHyperlink.class, name = "TemplateResponseDocumentStaticFieldHyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldInitials.class, name = "TemplateResponseDocumentStaticFieldInitials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldRadio.class, name = "TemplateResponseDocumentStaticFieldRadio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldSignature.class, name = "TemplateResponseDocumentStaticFieldSignature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldText.class, name = "TemplateResponseDocumentStaticFieldText"), @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldCheckbox.class, name = "checkbox"), @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDateSigned.class, name = "date_signed"), @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDropdown.class, name = "dropdown"), @@ -133,12 +118,11 @@ public TemplateResponseDocumentStaticFieldBase type(String type) { return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -159,12 +143,11 @@ public TemplateResponseDocumentStaticFieldBase apiId(String apiId) { return this; } - /** + /** * A unique id for the static field. * @return apiId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A unique id for the static field.") @JsonProperty(JSON_PROPERTY_API_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -185,12 +168,11 @@ public TemplateResponseDocumentStaticFieldBase name(String name) { return this; } - /** + /** * The name of the static field. * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the static field.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -211,12 +193,11 @@ public TemplateResponseDocumentStaticFieldBase signer(String signer) { return this; } - /** + /** * The signer of the Static Field. * @return signer - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The signer of the Static Field.") @JsonProperty(JSON_PROPERTY_SIGNER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -237,12 +218,11 @@ public TemplateResponseDocumentStaticFieldBase x(Integer x) { return this; } - /** + /** * The horizontal offset in pixels for this static field. * @return x - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The horizontal offset in pixels for this static field.") @JsonProperty(JSON_PROPERTY_X) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -263,12 +243,11 @@ public TemplateResponseDocumentStaticFieldBase y(Integer y) { return this; } - /** + /** * The vertical offset in pixels for this static field. * @return y - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The vertical offset in pixels for this static field.") @JsonProperty(JSON_PROPERTY_Y) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -289,12 +268,11 @@ public TemplateResponseDocumentStaticFieldBase width(Integer width) { return this; } - /** + /** * The width in pixels of this static field. * @return width - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The width in pixels of this static field.") @JsonProperty(JSON_PROPERTY_WIDTH) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -315,12 +293,11 @@ public TemplateResponseDocumentStaticFieldBase height(Integer height) { return this; } - /** + /** * The height in pixels of this static field. * @return height - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The height in pixels of this static field.") @JsonProperty(JSON_PROPERTY_HEIGHT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -341,12 +318,11 @@ public TemplateResponseDocumentStaticFieldBase required(Boolean required) { return this; } - /** + /** * Boolean showing whether or not this field is required. * @return required - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Boolean showing whether or not this field is required.") @JsonProperty(JSON_PROPERTY_REQUIRED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -367,12 +343,11 @@ public TemplateResponseDocumentStaticFieldBase group(String group) { return this; } - /** + /** * The name of the group this field is in. If this field is not a group, this defaults to `null`. * @return group - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the group this field is in. If this field is not a group, this defaults to `null`.") @JsonProperty(JSON_PROPERTY_GROUP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -667,27 +642,19 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("TemplateResponseDocumentStaticFieldCheckbox", TemplateResponseDocumentStaticFieldCheckbox.class); - mappings.put("TemplateResponseDocumentStaticFieldDateSigned", TemplateResponseDocumentStaticFieldDateSigned.class); - mappings.put("TemplateResponseDocumentStaticFieldDropdown", TemplateResponseDocumentStaticFieldDropdown.class); - mappings.put("TemplateResponseDocumentStaticFieldHyperlink", TemplateResponseDocumentStaticFieldHyperlink.class); - mappings.put("TemplateResponseDocumentStaticFieldInitials", TemplateResponseDocumentStaticFieldInitials.class); - mappings.put("TemplateResponseDocumentStaticFieldRadio", TemplateResponseDocumentStaticFieldRadio.class); - mappings.put("TemplateResponseDocumentStaticFieldSignature", TemplateResponseDocumentStaticFieldSignature.class); - mappings.put("TemplateResponseDocumentStaticFieldText", TemplateResponseDocumentStaticFieldText.class); - mappings.put("checkbox", TemplateResponseDocumentStaticFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentStaticFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentStaticFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentStaticFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentStaticFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentStaticFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentStaticFieldSignature.class); - mappings.put("text", TemplateResponseDocumentStaticFieldText.class); - mappings.put("TemplateResponseDocumentStaticFieldBase", TemplateResponseDocumentStaticFieldBase.class); - JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldBase.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("checkbox", TemplateResponseDocumentStaticFieldCheckbox.class); + mappings.put("date_signed", TemplateResponseDocumentStaticFieldDateSigned.class); + mappings.put("dropdown", TemplateResponseDocumentStaticFieldDropdown.class); + mappings.put("hyperlink", TemplateResponseDocumentStaticFieldHyperlink.class); + mappings.put("initials", TemplateResponseDocumentStaticFieldInitials.class); + mappings.put("radio", TemplateResponseDocumentStaticFieldRadio.class); + mappings.put("signature", TemplateResponseDocumentStaticFieldSignature.class); + mappings.put("text", TemplateResponseDocumentStaticFieldText.class); + mappings.put("TemplateResponseDocumentStaticFieldBase", TemplateResponseDocumentStaticFieldBase.class); + JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldBase.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldCheckbox.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldCheckbox.java index 3ae88c0..8af3ac8 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldCheckbox.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldCheckbox.java @@ -14,18 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -33,35 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentStaticFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentStaticFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentStaticFieldCheckbox.JSON_PROPERTY_TYPE + TemplateResponseDocumentStaticFieldCheckbox.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldInitials.class, name = "initials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldRadio.class, name = "radio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldSignature.class, name = "signature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldText.class, name = "text"), -}) public class TemplateResponseDocumentStaticFieldCheckbox extends TemplateResponseDocumentStaticFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -90,12 +73,11 @@ public TemplateResponseDocumentStaticFieldCheckbox type(String type) { return this; } - /** + /** * The type of this static field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentStaticFieldText` * Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox` * Radio Field uses `TemplateResponseDocumentStaticFieldRadio` * Signature Field uses `TemplateResponseDocumentStaticFieldSignature` * Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned` * Initials Field uses `TemplateResponseDocumentStaticFieldInitials` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this static field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentStaticFieldText` * Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox` * Radio Field uses `TemplateResponseDocumentStaticFieldRadio` * Signature Field uses `TemplateResponseDocumentStaticFieldSignature` * Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned` * Initials Field uses `TemplateResponseDocumentStaticFieldInitials`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -204,19 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentStaticFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentStaticFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentStaticFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentStaticFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentStaticFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentStaticFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentStaticFieldSignature.class); - mappings.put("text", TemplateResponseDocumentStaticFieldText.class); - mappings.put("TemplateResponseDocumentStaticFieldCheckbox", TemplateResponseDocumentStaticFieldCheckbox.class); - JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldCheckbox.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentStaticFieldCheckbox", TemplateResponseDocumentStaticFieldCheckbox.class); + JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldCheckbox.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldDateSigned.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldDateSigned.java index 7b9c675..33b76f5 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldDateSigned.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldDateSigned.java @@ -14,18 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -33,35 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentStaticFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentStaticFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentStaticFieldDateSigned.JSON_PROPERTY_TYPE + TemplateResponseDocumentStaticFieldDateSigned.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldInitials.class, name = "initials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldRadio.class, name = "radio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldSignature.class, name = "signature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldText.class, name = "text"), -}) public class TemplateResponseDocumentStaticFieldDateSigned extends TemplateResponseDocumentStaticFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -90,12 +73,11 @@ public TemplateResponseDocumentStaticFieldDateSigned type(String type) { return this; } - /** + /** * The type of this static field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentStaticFieldText` * Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox` * Radio Field uses `TemplateResponseDocumentStaticFieldRadio` * Signature Field uses `TemplateResponseDocumentStaticFieldSignature` * Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned` * Initials Field uses `TemplateResponseDocumentStaticFieldInitials` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this static field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentStaticFieldText` * Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox` * Radio Field uses `TemplateResponseDocumentStaticFieldRadio` * Signature Field uses `TemplateResponseDocumentStaticFieldSignature` * Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned` * Initials Field uses `TemplateResponseDocumentStaticFieldInitials`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -204,19 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentStaticFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentStaticFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentStaticFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentStaticFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentStaticFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentStaticFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentStaticFieldSignature.class); - mappings.put("text", TemplateResponseDocumentStaticFieldText.class); - mappings.put("TemplateResponseDocumentStaticFieldDateSigned", TemplateResponseDocumentStaticFieldDateSigned.class); - JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldDateSigned.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentStaticFieldDateSigned", TemplateResponseDocumentStaticFieldDateSigned.class); + JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldDateSigned.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldDropdown.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldDropdown.java index 95602d0..42110fb 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldDropdown.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldDropdown.java @@ -14,18 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -33,35 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentStaticFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentStaticFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentStaticFieldDropdown.JSON_PROPERTY_TYPE + TemplateResponseDocumentStaticFieldDropdown.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldInitials.class, name = "initials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldRadio.class, name = "radio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldSignature.class, name = "signature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldText.class, name = "text"), -}) public class TemplateResponseDocumentStaticFieldDropdown extends TemplateResponseDocumentStaticFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -90,12 +73,11 @@ public TemplateResponseDocumentStaticFieldDropdown type(String type) { return this; } - /** + /** * The type of this static field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentStaticFieldText` * Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox` * Radio Field uses `TemplateResponseDocumentStaticFieldRadio` * Signature Field uses `TemplateResponseDocumentStaticFieldSignature` * Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned` * Initials Field uses `TemplateResponseDocumentStaticFieldInitials` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this static field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentStaticFieldText` * Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox` * Radio Field uses `TemplateResponseDocumentStaticFieldRadio` * Signature Field uses `TemplateResponseDocumentStaticFieldSignature` * Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned` * Initials Field uses `TemplateResponseDocumentStaticFieldInitials`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -204,19 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentStaticFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentStaticFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentStaticFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentStaticFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentStaticFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentStaticFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentStaticFieldSignature.class); - mappings.put("text", TemplateResponseDocumentStaticFieldText.class); - mappings.put("TemplateResponseDocumentStaticFieldDropdown", TemplateResponseDocumentStaticFieldDropdown.class); - JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldDropdown.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentStaticFieldDropdown", TemplateResponseDocumentStaticFieldDropdown.class); + JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldDropdown.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldHyperlink.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldHyperlink.java index 8ff161d..b3a7df6 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldHyperlink.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldHyperlink.java @@ -14,18 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -33,35 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentStaticFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentStaticFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentStaticFieldHyperlink.JSON_PROPERTY_TYPE + TemplateResponseDocumentStaticFieldHyperlink.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldInitials.class, name = "initials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldRadio.class, name = "radio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldSignature.class, name = "signature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldText.class, name = "text"), -}) public class TemplateResponseDocumentStaticFieldHyperlink extends TemplateResponseDocumentStaticFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -90,12 +73,11 @@ public TemplateResponseDocumentStaticFieldHyperlink type(String type) { return this; } - /** + /** * The type of this static field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentStaticFieldText` * Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox` * Radio Field uses `TemplateResponseDocumentStaticFieldRadio` * Signature Field uses `TemplateResponseDocumentStaticFieldSignature` * Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned` * Initials Field uses `TemplateResponseDocumentStaticFieldInitials` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this static field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentStaticFieldText` * Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox` * Radio Field uses `TemplateResponseDocumentStaticFieldRadio` * Signature Field uses `TemplateResponseDocumentStaticFieldSignature` * Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned` * Initials Field uses `TemplateResponseDocumentStaticFieldInitials`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -204,19 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentStaticFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentStaticFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentStaticFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentStaticFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentStaticFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentStaticFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentStaticFieldSignature.class); - mappings.put("text", TemplateResponseDocumentStaticFieldText.class); - mappings.put("TemplateResponseDocumentStaticFieldHyperlink", TemplateResponseDocumentStaticFieldHyperlink.class); - JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldHyperlink.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentStaticFieldHyperlink", TemplateResponseDocumentStaticFieldHyperlink.class); + JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldHyperlink.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldInitials.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldInitials.java index 7070ced..9e87a2a 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldInitials.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldInitials.java @@ -14,18 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -33,35 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentStaticFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentStaticFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentStaticFieldInitials.JSON_PROPERTY_TYPE + TemplateResponseDocumentStaticFieldInitials.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldInitials.class, name = "initials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldRadio.class, name = "radio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldSignature.class, name = "signature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldText.class, name = "text"), -}) public class TemplateResponseDocumentStaticFieldInitials extends TemplateResponseDocumentStaticFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -90,12 +73,11 @@ public TemplateResponseDocumentStaticFieldInitials type(String type) { return this; } - /** + /** * The type of this static field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentStaticFieldText` * Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox` * Radio Field uses `TemplateResponseDocumentStaticFieldRadio` * Signature Field uses `TemplateResponseDocumentStaticFieldSignature` * Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned` * Initials Field uses `TemplateResponseDocumentStaticFieldInitials` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this static field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentStaticFieldText` * Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox` * Radio Field uses `TemplateResponseDocumentStaticFieldRadio` * Signature Field uses `TemplateResponseDocumentStaticFieldSignature` * Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned` * Initials Field uses `TemplateResponseDocumentStaticFieldInitials`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -204,19 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentStaticFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentStaticFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentStaticFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentStaticFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentStaticFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentStaticFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentStaticFieldSignature.class); - mappings.put("text", TemplateResponseDocumentStaticFieldText.class); - mappings.put("TemplateResponseDocumentStaticFieldInitials", TemplateResponseDocumentStaticFieldInitials.class); - JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldInitials.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentStaticFieldInitials", TemplateResponseDocumentStaticFieldInitials.class); + JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldInitials.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldRadio.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldRadio.java index 638f4cf..5160c6e 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldRadio.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldRadio.java @@ -14,18 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -33,35 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentStaticFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentStaticFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentStaticFieldRadio.JSON_PROPERTY_TYPE + TemplateResponseDocumentStaticFieldRadio.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldInitials.class, name = "initials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldRadio.class, name = "radio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldSignature.class, name = "signature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldText.class, name = "text"), -}) public class TemplateResponseDocumentStaticFieldRadio extends TemplateResponseDocumentStaticFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -90,12 +73,11 @@ public TemplateResponseDocumentStaticFieldRadio type(String type) { return this; } - /** + /** * The type of this static field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentStaticFieldText` * Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox` * Radio Field uses `TemplateResponseDocumentStaticFieldRadio` * Signature Field uses `TemplateResponseDocumentStaticFieldSignature` * Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned` * Initials Field uses `TemplateResponseDocumentStaticFieldInitials` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this static field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentStaticFieldText` * Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox` * Radio Field uses `TemplateResponseDocumentStaticFieldRadio` * Signature Field uses `TemplateResponseDocumentStaticFieldSignature` * Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned` * Initials Field uses `TemplateResponseDocumentStaticFieldInitials`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -204,19 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentStaticFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentStaticFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentStaticFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentStaticFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentStaticFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentStaticFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentStaticFieldSignature.class); - mappings.put("text", TemplateResponseDocumentStaticFieldText.class); - mappings.put("TemplateResponseDocumentStaticFieldRadio", TemplateResponseDocumentStaticFieldRadio.class); - JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldRadio.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentStaticFieldRadio", TemplateResponseDocumentStaticFieldRadio.class); + JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldRadio.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldSignature.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldSignature.java index 766ee81..55083a9 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldSignature.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldSignature.java @@ -14,18 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -33,35 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentStaticFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentStaticFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentStaticFieldSignature.JSON_PROPERTY_TYPE + TemplateResponseDocumentStaticFieldSignature.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldInitials.class, name = "initials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldRadio.class, name = "radio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldSignature.class, name = "signature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldText.class, name = "text"), -}) public class TemplateResponseDocumentStaticFieldSignature extends TemplateResponseDocumentStaticFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -90,12 +73,11 @@ public TemplateResponseDocumentStaticFieldSignature type(String type) { return this; } - /** + /** * The type of this static field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentStaticFieldText` * Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox` * Radio Field uses `TemplateResponseDocumentStaticFieldRadio` * Signature Field uses `TemplateResponseDocumentStaticFieldSignature` * Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned` * Initials Field uses `TemplateResponseDocumentStaticFieldInitials` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this static field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentStaticFieldText` * Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox` * Radio Field uses `TemplateResponseDocumentStaticFieldRadio` * Signature Field uses `TemplateResponseDocumentStaticFieldSignature` * Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned` * Initials Field uses `TemplateResponseDocumentStaticFieldInitials`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -204,19 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentStaticFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentStaticFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentStaticFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentStaticFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentStaticFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentStaticFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentStaticFieldSignature.class); - mappings.put("text", TemplateResponseDocumentStaticFieldText.class); - mappings.put("TemplateResponseDocumentStaticFieldSignature", TemplateResponseDocumentStaticFieldSignature.class); - JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldSignature.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentStaticFieldSignature", TemplateResponseDocumentStaticFieldSignature.class); + JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldSignature.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldText.java b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldText.java index b3fbe2c..096be22 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldText.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentStaticFieldText.java @@ -14,18 +14,10 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldBase; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldCheckbox; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDateSigned; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldDropdown; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldHyperlink; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldInitials; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldRadio; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldSignature; -import com.dropbox.sign.model.TemplateResponseDocumentStaticFieldText; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; @@ -33,35 +25,26 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * This class extends `TemplateResponseDocumentStaticFieldBase` */ -@ApiModel(description = "This class extends `TemplateResponseDocumentStaticFieldBase`") @JsonPropertyOrder({ - TemplateResponseDocumentStaticFieldText.JSON_PROPERTY_TYPE + TemplateResponseDocumentStaticFieldText.JSON_PROPERTY_TYPE }) -@JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") +@JsonIgnoreProperties( + allowSetters = true, // allows the type to be set during deserialization + ignoreUnknown = true +) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldCheckbox.class, name = "checkbox"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDateSigned.class, name = "date_signed"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldDropdown.class, name = "dropdown"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldHyperlink.class, name = "hyperlink"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldInitials.class, name = "initials"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldRadio.class, name = "radio"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldSignature.class, name = "signature"), - @JsonSubTypes.Type(value = TemplateResponseDocumentStaticFieldText.class, name = "text"), -}) public class TemplateResponseDocumentStaticFieldText extends TemplateResponseDocumentStaticFieldBase { public static final String JSON_PROPERTY_TYPE = "type"; @@ -90,12 +73,11 @@ public TemplateResponseDocumentStaticFieldText type(String type) { return this; } - /** + /** * The type of this static field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentStaticFieldText` * Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox` * Radio Field uses `TemplateResponseDocumentStaticFieldRadio` * Signature Field uses `TemplateResponseDocumentStaticFieldSignature` * Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned` * Initials Field uses `TemplateResponseDocumentStaticFieldInitials` * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this static field. See [field types](/api/reference/constants/#field-types). * Text Field uses `TemplateResponseDocumentStaticFieldText` * Dropdown Field uses `TemplateResponseDocumentStaticFieldDropdown` * Hyperlink Field uses `TemplateResponseDocumentStaticFieldHyperlink` * Checkbox Field uses `TemplateResponseDocumentStaticFieldCheckbox` * Radio Field uses `TemplateResponseDocumentStaticFieldRadio` * Signature Field uses `TemplateResponseDocumentStaticFieldSignature` * Date Signed Field uses `TemplateResponseDocumentStaticFieldDateSigned` * Initials Field uses `TemplateResponseDocumentStaticFieldInitials`") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -204,19 +186,11 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("checkbox", TemplateResponseDocumentStaticFieldCheckbox.class); - mappings.put("date_signed", TemplateResponseDocumentStaticFieldDateSigned.class); - mappings.put("dropdown", TemplateResponseDocumentStaticFieldDropdown.class); - mappings.put("hyperlink", TemplateResponseDocumentStaticFieldHyperlink.class); - mappings.put("initials", TemplateResponseDocumentStaticFieldInitials.class); - mappings.put("radio", TemplateResponseDocumentStaticFieldRadio.class); - mappings.put("signature", TemplateResponseDocumentStaticFieldSignature.class); - mappings.put("text", TemplateResponseDocumentStaticFieldText.class); - mappings.put("TemplateResponseDocumentStaticFieldText", TemplateResponseDocumentStaticFieldText.class); - JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldText.class, "type", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("TemplateResponseDocumentStaticFieldText", TemplateResponseDocumentStaticFieldText.class); + JSON.registerDiscriminator(TemplateResponseDocumentStaticFieldText.class, "type", mappings); + } } diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseFieldAvgTextLength.java b/src/main/java/com/dropbox/sign/model/TemplateResponseFieldAvgTextLength.java index 4ab4df8..96d7f22 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseFieldAvgTextLength.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseFieldAvgTextLength.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,25 +21,23 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * Average text length in this field. */ -@ApiModel(description = "Average text length in this field.") @JsonPropertyOrder({ - TemplateResponseFieldAvgTextLength.JSON_PROPERTY_NUM_LINES, - TemplateResponseFieldAvgTextLength.JSON_PROPERTY_NUM_CHARS_PER_LINE + TemplateResponseFieldAvgTextLength.JSON_PROPERTY_NUM_LINES, + TemplateResponseFieldAvgTextLength.JSON_PROPERTY_NUM_CHARS_PER_LINE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateResponseFieldAvgTextLength { public static final String JSON_PROPERTY_NUM_LINES = "num_lines"; private Integer numLines; @@ -71,12 +68,11 @@ public TemplateResponseFieldAvgTextLength numLines(Integer numLines) { return this; } - /** + /** * Number of lines. * @return numLines - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Number of lines.") @JsonProperty(JSON_PROPERTY_NUM_LINES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -97,12 +93,11 @@ public TemplateResponseFieldAvgTextLength numCharsPerLine(Integer numCharsPerLin return this; } - /** + /** * Number of characters per line. * @return numCharsPerLine - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Number of characters per line.") @JsonProperty(JSON_PROPERTY_NUM_CHARS_PER_LINE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateResponseSignerRole.java b/src/main/java/com/dropbox/sign/model/TemplateResponseSignerRole.java index ae85de6..2db65f1 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateResponseSignerRole.java +++ b/src/main/java/com/dropbox/sign/model/TemplateResponseSignerRole.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,12 +21,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -35,11 +33,11 @@ * TemplateResponseSignerRole */ @JsonPropertyOrder({ - TemplateResponseSignerRole.JSON_PROPERTY_NAME, - TemplateResponseSignerRole.JSON_PROPERTY_ORDER + TemplateResponseSignerRole.JSON_PROPERTY_NAME, + TemplateResponseSignerRole.JSON_PROPERTY_ORDER }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateResponseSignerRole { public static final String JSON_PROPERTY_NAME = "name"; private String name; @@ -70,12 +68,11 @@ public TemplateResponseSignerRole name(String name) { return this; } - /** + /** * The name of the Role. * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the Role.") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -96,12 +93,11 @@ public TemplateResponseSignerRole order(Integer order) { return this; } - /** + /** * If signer order is assigned this is the 0-based index for this role. * @return order - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "If signer order is assigned this is the 0-based index for this role.") @JsonProperty(JSON_PROPERTY_ORDER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateUpdateFilesRequest.java b/src/main/java/com/dropbox/sign/model/TemplateUpdateFilesRequest.java index 9168722..9a98aa7 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateUpdateFilesRequest.java +++ b/src/main/java/com/dropbox/sign/model/TemplateUpdateFilesRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,15 +21,14 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.File; 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.JSON; import com.dropbox.sign.ApiException; @@ -38,15 +36,15 @@ * TemplateUpdateFilesRequest */ @JsonPropertyOrder({ - TemplateUpdateFilesRequest.JSON_PROPERTY_CLIENT_ID, - TemplateUpdateFilesRequest.JSON_PROPERTY_FILES, - TemplateUpdateFilesRequest.JSON_PROPERTY_FILE_URLS, - TemplateUpdateFilesRequest.JSON_PROPERTY_MESSAGE, - TemplateUpdateFilesRequest.JSON_PROPERTY_SUBJECT, - TemplateUpdateFilesRequest.JSON_PROPERTY_TEST_MODE + TemplateUpdateFilesRequest.JSON_PROPERTY_CLIENT_ID, + TemplateUpdateFilesRequest.JSON_PROPERTY_FILES, + TemplateUpdateFilesRequest.JSON_PROPERTY_FILE_URLS, + TemplateUpdateFilesRequest.JSON_PROPERTY_MESSAGE, + TemplateUpdateFilesRequest.JSON_PROPERTY_SUBJECT, + TemplateUpdateFilesRequest.JSON_PROPERTY_TEST_MODE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateUpdateFilesRequest { public static final String JSON_PROPERTY_CLIENT_ID = "client_id"; private String clientId; @@ -89,12 +87,11 @@ public TemplateUpdateFilesRequest clientId(String clientId) { return this; } - /** + /** * Client id of the app you're using to update this template. * @return clientId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Client id of the app you're using to update this template.") @JsonProperty(JSON_PROPERTY_CLIENT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -123,12 +120,11 @@ public TemplateUpdateFilesRequest addFilesItem(File filesItem) { return this; } - /** + /** * Use `files[]` to indicate the uploaded file(s) to use for the template. This endpoint requires either **files** or **file_urls[]**, but not both. * @return files - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `files[]` to indicate the uploaded file(s) to use for the template. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -157,12 +153,11 @@ public TemplateUpdateFilesRequest addFileUrlsItem(String fileUrlsItem) { return this; } - /** + /** * Use `file_urls[]` to have Dropbox Sign download the file(s) to use for the template. This endpoint requires either **files** or **file_urls[]**, but not both. * @return fileUrls - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `file_urls[]` to have Dropbox Sign download the file(s) to use for the template. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILE_URLS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -183,12 +178,11 @@ public TemplateUpdateFilesRequest message(String message) { return this; } - /** + /** * The new default template email message. * @return message - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The new default template email message.") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -209,12 +203,11 @@ public TemplateUpdateFilesRequest subject(String subject) { return this; } - /** + /** * The new default template email subject. * @return subject - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The new default template email subject.") @JsonProperty(JSON_PROPERTY_SUBJECT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -235,12 +228,11 @@ public TemplateUpdateFilesRequest testMode(Boolean testMode) { return this; } - /** + /** * Whether this is a test, the signature request created from this draft will not be legally binding if set to `true`. Defaults to `false`. * @return testMode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this is a test, the signature request created from this draft will not be legally binding if set to `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_TEST_MODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/TemplateUpdateFilesResponse.java b/src/main/java/com/dropbox/sign/model/TemplateUpdateFilesResponse.java index 5c3009f..a393590 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateUpdateFilesResponse.java +++ b/src/main/java/com/dropbox/sign/model/TemplateUpdateFilesResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.TemplateUpdateFilesResponseTemplate; @@ -23,12 +22,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -36,10 +34,10 @@ * TemplateUpdateFilesResponse */ @JsonPropertyOrder({ - TemplateUpdateFilesResponse.JSON_PROPERTY_TEMPLATE + TemplateUpdateFilesResponse.JSON_PROPERTY_TEMPLATE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateUpdateFilesResponse { public static final String JSON_PROPERTY_TEMPLATE = "template"; private TemplateUpdateFilesResponseTemplate template; @@ -67,14 +65,13 @@ public TemplateUpdateFilesResponse template(TemplateUpdateFilesResponseTemplate return this; } - /** + /** * Get template * @return template - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_TEMPLATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public TemplateUpdateFilesResponseTemplate getTemplate() { return template; @@ -82,7 +79,7 @@ public TemplateUpdateFilesResponseTemplate getTemplate() { @JsonProperty(JSON_PROPERTY_TEMPLATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setTemplate(TemplateUpdateFilesResponseTemplate template) { this.template = template; } diff --git a/src/main/java/com/dropbox/sign/model/TemplateUpdateFilesResponseTemplate.java b/src/main/java/com/dropbox/sign/model/TemplateUpdateFilesResponseTemplate.java index 194ebff..3a26fc0 100644 --- a/src/main/java/com/dropbox/sign/model/TemplateUpdateFilesResponseTemplate.java +++ b/src/main/java/com/dropbox/sign/model/TemplateUpdateFilesResponseTemplate.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.WarningResponse; @@ -23,32 +22,31 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; /** * Contains template id */ -@ApiModel(description = "Contains template id") @JsonPropertyOrder({ - TemplateUpdateFilesResponseTemplate.JSON_PROPERTY_TEMPLATE_ID, - TemplateUpdateFilesResponseTemplate.JSON_PROPERTY_WARNINGS + TemplateUpdateFilesResponseTemplate.JSON_PROPERTY_TEMPLATE_ID, + TemplateUpdateFilesResponseTemplate.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TemplateUpdateFilesResponseTemplate { public static final String JSON_PROPERTY_TEMPLATE_ID = "template_id"; private String templateId; public static final String JSON_PROPERTY_WARNINGS = "warnings"; + @Deprecated private List warnings = null; public TemplateUpdateFilesResponseTemplate() { @@ -74,12 +72,11 @@ public TemplateUpdateFilesResponseTemplate templateId(String templateId) { return this; } - /** + /** * The id of the Template. * @return templateId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the Template.") @JsonProperty(JSON_PROPERTY_TEMPLATE_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -95,6 +92,7 @@ public void setTemplateId(String templateId) { } + @Deprecated public TemplateUpdateFilesResponseTemplate warnings(List warnings) { this.warnings = warnings; return this; @@ -108,14 +106,13 @@ public TemplateUpdateFilesResponseTemplate addWarningsItem(WarningResponse warni return this; } - /** + /** * A list of warnings. * @return warnings * @deprecated - **/ + */ @Deprecated @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -124,6 +121,7 @@ public List getWarnings() { } + @Deprecated @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setWarnings(List warnings) { diff --git a/src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateEmbeddedRequest.java b/src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateEmbeddedRequest.java index 25b50b7..34a3441 100644 --- a/src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateEmbeddedRequest.java +++ b/src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateEmbeddedRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubAttachment; @@ -31,63 +30,62 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; 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.JSON; import com.dropbox.sign.ApiException; /** - * UnclaimedDraftCreateEmbeddedRequest + * */ @JsonPropertyOrder({ - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_CLIENT_ID, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_REQUESTER_EMAIL_ADDRESS, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_FILES, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_FILE_URLS, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_ALLOW_CCS, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_ALLOW_DECLINE, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_ALLOW_REASSIGN, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_ATTACHMENTS, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_CC_EMAIL_ADDRESSES, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_CUSTOM_FIELDS, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_EDITOR_OPTIONS, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_FIELD_OPTIONS, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_FORCE_SIGNER_PAGE, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_FORCE_SUBJECT_MESSAGE, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_FORM_FIELD_GROUPS, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_FORM_FIELD_RULES, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_HIDE_TEXT_TAGS, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_HOLD_REQUEST, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_IS_FOR_EMBEDDED_SIGNING, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_MESSAGE, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_METADATA, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_REQUESTING_REDIRECT_URL, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_SHOW_PREVIEW, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_SHOW_PROGRESS_STEPPER, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_SIGNERS, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_SIGNING_OPTIONS, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_SIGNING_REDIRECT_URL, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_SKIP_ME_NOW, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_SUBJECT, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_TEST_MODE, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_TYPE, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_USE_PREEXISTING_FIELDS, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_USE_TEXT_TAGS, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_POPULATE_AUTO_FILL_FIELDS, - UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_EXPIRES_AT + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_CLIENT_ID, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_REQUESTER_EMAIL_ADDRESS, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_FILES, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_FILE_URLS, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_ALLOW_CCS, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_ALLOW_DECLINE, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_ALLOW_REASSIGN, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_ATTACHMENTS, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_CC_EMAIL_ADDRESSES, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_CUSTOM_FIELDS, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_EDITOR_OPTIONS, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_FIELD_OPTIONS, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_FORCE_SIGNER_PAGE, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_FORCE_SUBJECT_MESSAGE, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_FORM_FIELD_GROUPS, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_FORM_FIELD_RULES, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_HIDE_TEXT_TAGS, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_HOLD_REQUEST, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_IS_FOR_EMBEDDED_SIGNING, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_MESSAGE, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_METADATA, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_REQUESTING_REDIRECT_URL, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_SHOW_PREVIEW, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_SHOW_PROGRESS_STEPPER, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_SIGNERS, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_SIGNING_OPTIONS, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_SIGNING_REDIRECT_URL, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_SKIP_ME_NOW, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_SUBJECT, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_TEST_MODE, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_TYPE, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_USE_PREEXISTING_FIELDS, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_USE_TEXT_TAGS, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_POPULATE_AUTO_FILL_FIELDS, + UnclaimedDraftCreateEmbeddedRequest.JSON_PROPERTY_EXPIRES_AT }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class UnclaimedDraftCreateEmbeddedRequest { public static final String JSON_PROPERTY_CLIENT_ID = "client_id"; private String clientId; @@ -255,12 +253,11 @@ public UnclaimedDraftCreateEmbeddedRequest clientId(String clientId) { return this; } - /** + /** * Client id of the app used to create the draft. Used to apply the branding and callback url defined for the app. * @return clientId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Client id of the app used to create the draft. Used to apply the branding and callback url defined for the app.") @JsonProperty(JSON_PROPERTY_CLIENT_ID) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -281,12 +278,11 @@ public UnclaimedDraftCreateEmbeddedRequest requesterEmailAddress(String requeste return this; } - /** + /** * The email address of the user that should be designated as the requester of this draft, if the draft type is `request_signature`. * @return requesterEmailAddress - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The email address of the user that should be designated as the requester of this draft, if the draft type is `request_signature`.") @JsonProperty(JSON_PROPERTY_REQUESTER_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -315,12 +311,11 @@ public UnclaimedDraftCreateEmbeddedRequest addFilesItem(File filesItem) { return this; } - /** + /** * Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both. * @return files - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -349,12 +344,11 @@ public UnclaimedDraftCreateEmbeddedRequest addFileUrlsItem(String fileUrlsItem) return this; } - /** + /** * Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both. * @return fileUrls - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILE_URLS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -375,12 +369,11 @@ public UnclaimedDraftCreateEmbeddedRequest allowCcs(Boolean allowCcs) { return this; } - /** + /** * This allows the requester to specify whether the user is allowed to provide email addresses to CC when claiming the draft. * @return allowCcs - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "This allows the requester to specify whether the user is allowed to provide email addresses to CC when claiming the draft.") @JsonProperty(JSON_PROPERTY_ALLOW_CCS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -401,12 +394,11 @@ public UnclaimedDraftCreateEmbeddedRequest allowDecline(Boolean allowDecline) { return this; } - /** + /** * Allows signers to decline to sign a document if `true`. Defaults to `false`. * @return allowDecline - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows signers to decline to sign a document if `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_ALLOW_DECLINE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -427,12 +419,11 @@ public UnclaimedDraftCreateEmbeddedRequest allowReassign(Boolean allowReassign) return this; } - /** + /** * Allows signers to reassign their signature requests to other signers if set to `true`. Defaults to `false`. **NOTE:** Only available for Premium plan and higher. * @return allowReassign - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows signers to reassign their signature requests to other signers if set to `true`. Defaults to `false`. **NOTE:** Only available for Premium plan and higher.") @JsonProperty(JSON_PROPERTY_ALLOW_REASSIGN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -461,12 +452,11 @@ public UnclaimedDraftCreateEmbeddedRequest addAttachmentsItem(SubAttachment atta return this; } - /** + /** * A list describing the attachments * @return attachments - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list describing the attachments") @JsonProperty(JSON_PROPERTY_ATTACHMENTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -495,12 +485,11 @@ public UnclaimedDraftCreateEmbeddedRequest addCcEmailAddressesItem(String ccEmai return this; } - /** + /** * The email addresses that should be CCed. * @return ccEmailAddresses - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The email addresses that should be CCed.") @JsonProperty(JSON_PROPERTY_CC_EMAIL_ADDRESSES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -529,12 +518,11 @@ public UnclaimedDraftCreateEmbeddedRequest addCustomFieldsItem(SubCustomField cu return this; } - /** + /** * When used together with merge fields, `custom_fields` allows users to add pre-filled data to their signature requests. Pre-filled data can be used with \"send-once\" signature requests by adding merge fields with `form_fields_per_document` or [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) while passing values back with `custom_fields` together in one API call. For using pre-filled on repeatable signature requests, merge fields are added to templates in the Dropbox Sign UI or by calling [/template/create_embedded_draft](/api/reference/operation/templateCreateEmbeddedDraft) and then passing `custom_fields` on subsequent signature requests referencing that template. * @return customFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When used together with merge fields, `custom_fields` allows users to add pre-filled data to their signature requests. Pre-filled data can be used with \"send-once\" signature requests by adding merge fields with `form_fields_per_document` or [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) while passing values back with `custom_fields` together in one API call. For using pre-filled on repeatable signature requests, merge fields are added to templates in the Dropbox Sign UI or by calling [/template/create_embedded_draft](/api/reference/operation/templateCreateEmbeddedDraft) and then passing `custom_fields` on subsequent signature requests referencing that template.") @JsonProperty(JSON_PROPERTY_CUSTOM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -555,12 +543,11 @@ public UnclaimedDraftCreateEmbeddedRequest editorOptions(SubEditorOptions editor return this; } - /** + /** * Get editorOptions * @return editorOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EDITOR_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -581,12 +568,11 @@ public UnclaimedDraftCreateEmbeddedRequest fieldOptions(SubFieldOptions fieldOpt return this; } - /** + /** * Get fieldOptions * @return fieldOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIELD_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -607,12 +593,11 @@ public UnclaimedDraftCreateEmbeddedRequest forceSignerPage(Boolean forceSignerPa return this; } - /** + /** * Provide users the ability to review/edit the signers. * @return forceSignerPage - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Provide users the ability to review/edit the signers.") @JsonProperty(JSON_PROPERTY_FORCE_SIGNER_PAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -633,12 +618,11 @@ public UnclaimedDraftCreateEmbeddedRequest forceSubjectMessage(Boolean forceSubj return this; } - /** + /** * Provide users the ability to review/edit the subject and message. * @return forceSubjectMessage - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Provide users the ability to review/edit the subject and message.") @JsonProperty(JSON_PROPERTY_FORCE_SUBJECT_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -667,12 +651,11 @@ public UnclaimedDraftCreateEmbeddedRequest addFormFieldGroupsItem(SubFormFieldGr return this; } - /** + /** * Group information for fields defined in `form_fields_per_document`. String-indexed JSON array with `group_label` and `requirement` keys. `form_fields_per_document` must contain fields referencing a group defined in `form_field_groups`. * @return formFieldGroups - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Group information for fields defined in `form_fields_per_document`. String-indexed JSON array with `group_label` and `requirement` keys. `form_fields_per_document` must contain fields referencing a group defined in `form_field_groups`.") @JsonProperty(JSON_PROPERTY_FORM_FIELD_GROUPS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -701,12 +684,11 @@ public UnclaimedDraftCreateEmbeddedRequest addFormFieldRulesItem(SubFormFieldRul return this; } - /** + /** * Conditional Logic rules for fields defined in `form_fields_per_document`. * @return formFieldRules - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Conditional Logic rules for fields defined in `form_fields_per_document`.") @JsonProperty(JSON_PROPERTY_FORM_FIELD_RULES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -735,12 +717,11 @@ public UnclaimedDraftCreateEmbeddedRequest addFormFieldsPerDocumentItem(SubFormF return this; } - /** + /** * The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).) **NOTE:** Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types. * Text Field use `SubFormFieldsPerDocumentText` * Dropdown Field use `SubFormFieldsPerDocumentDropdown` * Hyperlink Field use `SubFormFieldsPerDocumentHyperlink` * Checkbox Field use `SubFormFieldsPerDocumentCheckbox` * Radio Field use `SubFormFieldsPerDocumentRadio` * Signature Field use `SubFormFieldsPerDocumentSignature` * Date Signed Field use `SubFormFieldsPerDocumentDateSigned` * Initials Field use `SubFormFieldsPerDocumentInitials` * Text Merge Field use `SubFormFieldsPerDocumentTextMerge` * Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge` * @return formFieldsPerDocument - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).) **NOTE:** Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types. * Text Field use `SubFormFieldsPerDocumentText` * Dropdown Field use `SubFormFieldsPerDocumentDropdown` * Hyperlink Field use `SubFormFieldsPerDocumentHyperlink` * Checkbox Field use `SubFormFieldsPerDocumentCheckbox` * Radio Field use `SubFormFieldsPerDocumentRadio` * Signature Field use `SubFormFieldsPerDocumentSignature` * Date Signed Field use `SubFormFieldsPerDocumentDateSigned` * Initials Field use `SubFormFieldsPerDocumentInitials` * Text Merge Field use `SubFormFieldsPerDocumentTextMerge` * Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge`") @JsonProperty(JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -761,12 +742,11 @@ public UnclaimedDraftCreateEmbeddedRequest hideTextTags(Boolean hideTextTags) { return this; } - /** + /** * Send with a value of `true` if you wish to enable automatic Text Tag removal. Defaults to `false`. When using Text Tags it is preferred that you set this to `false` and hide your tags with white text or something similar because the automatic removal system can cause unwanted clipping. See the [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) walkthrough for more details. * @return hideTextTags - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Send with a value of `true` if you wish to enable automatic Text Tag removal. Defaults to `false`. When using Text Tags it is preferred that you set this to `false` and hide your tags with white text or something similar because the automatic removal system can cause unwanted clipping. See the [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) walkthrough for more details.") @JsonProperty(JSON_PROPERTY_HIDE_TEXT_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -787,12 +767,11 @@ public UnclaimedDraftCreateEmbeddedRequest holdRequest(Boolean holdRequest) { return this; } - /** + /** * The request from this draft will not automatically send to signers post-claim if set to `true`. Requester must [release](/api/reference/operation/signatureRequestReleaseHold/) the request from hold when ready to send. Defaults to `false`. * @return holdRequest - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The request from this draft will not automatically send to signers post-claim if set to `true`. Requester must [release](/api/reference/operation/signatureRequestReleaseHold/) the request from hold when ready to send. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_HOLD_REQUEST) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -813,12 +792,11 @@ public UnclaimedDraftCreateEmbeddedRequest isForEmbeddedSigning(Boolean isForEmb return this; } - /** + /** * The request created from this draft will also be signable in embedded mode if set to `true`. Defaults to `false`. * @return isForEmbeddedSigning - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The request created from this draft will also be signable in embedded mode if set to `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_IS_FOR_EMBEDDED_SIGNING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -839,12 +817,11 @@ public UnclaimedDraftCreateEmbeddedRequest message(String message) { return this; } - /** + /** * The custom message in the email that will be sent to the signers. * @return message - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The custom message in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -873,12 +850,11 @@ public UnclaimedDraftCreateEmbeddedRequest putMetadataItem(String key, Object me return this; } - /** + /** * Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long.") @JsonProperty(JSON_PROPERTY_METADATA) @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) @@ -899,12 +875,11 @@ public UnclaimedDraftCreateEmbeddedRequest requestingRedirectUrl(String requesti return this; } - /** + /** * The URL you want signers redirected to after they successfully request a signature. * @return requestingRedirectUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL you want signers redirected to after they successfully request a signature.") @JsonProperty(JSON_PROPERTY_REQUESTING_REDIRECT_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -925,12 +900,11 @@ public UnclaimedDraftCreateEmbeddedRequest showPreview(Boolean showPreview) { return this; } - /** + /** * This allows the requester to enable the editor/preview experience. - `show_preview=true`: Allows requesters to enable the editor/preview experience. - `show_preview=false`: Allows requesters to disable the editor/preview experience. * @return showPreview - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "This allows the requester to enable the editor/preview experience. - `show_preview=true`: Allows requesters to enable the editor/preview experience. - `show_preview=false`: Allows requesters to disable the editor/preview experience.") @JsonProperty(JSON_PROPERTY_SHOW_PREVIEW) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -951,12 +925,11 @@ public UnclaimedDraftCreateEmbeddedRequest showProgressStepper(Boolean showProgr return this; } - /** + /** * When only one step remains in the signature request process and this parameter is set to `false` then the progress stepper will be hidden. * @return showProgressStepper - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When only one step remains in the signature request process and this parameter is set to `false` then the progress stepper will be hidden.") @JsonProperty(JSON_PROPERTY_SHOW_PROGRESS_STEPPER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -985,12 +958,11 @@ public UnclaimedDraftCreateEmbeddedRequest addSignersItem(SubUnclaimedDraftSigne return this; } - /** + /** * Add Signers to your Unclaimed Draft Signature Request. * @return signers - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Add Signers to your Unclaimed Draft Signature Request.") @JsonProperty(JSON_PROPERTY_SIGNERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1011,12 +983,11 @@ public UnclaimedDraftCreateEmbeddedRequest signingOptions(SubSigningOptions sign return this; } - /** + /** * Get signingOptions * @return signingOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SIGNING_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1037,12 +1008,11 @@ public UnclaimedDraftCreateEmbeddedRequest signingRedirectUrl(String signingRedi return this; } - /** + /** * The URL you want signers redirected to after they successfully sign. * @return signingRedirectUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL you want signers redirected to after they successfully sign.") @JsonProperty(JSON_PROPERTY_SIGNING_REDIRECT_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1063,12 +1033,11 @@ public UnclaimedDraftCreateEmbeddedRequest skipMeNow(Boolean skipMeNow) { return this; } - /** + /** * Disables the \"Me (Now)\" option for the person preparing the document. Does not work with type `send_document`. Defaults to `false`. * @return skipMeNow - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Disables the \"Me (Now)\" option for the person preparing the document. Does not work with type `send_document`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_SKIP_ME_NOW) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1089,12 +1058,11 @@ public UnclaimedDraftCreateEmbeddedRequest subject(String subject) { return this; } - /** + /** * The subject in the email that will be sent to the signers. * @return subject - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The subject in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_SUBJECT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1115,12 +1083,11 @@ public UnclaimedDraftCreateEmbeddedRequest testMode(Boolean testMode) { return this; } - /** + /** * Whether this is a test, the signature request created from this draft will not be legally binding if set to `true`. Defaults to `false`. * @return testMode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this is a test, the signature request created from this draft will not be legally binding if set to `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_TEST_MODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1141,12 +1108,11 @@ public UnclaimedDraftCreateEmbeddedRequest type(TypeEnum type) { return this; } - /** + /** * The type of the draft. By default this is `request_signature`, but you can set it to `send_document` if you want to self sign a document and download it. * @return type - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The type of the draft. By default this is `request_signature`, but you can set it to `send_document` if you want to self sign a document and download it.") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1167,12 +1133,11 @@ public UnclaimedDraftCreateEmbeddedRequest usePreexistingFields(Boolean usePreex return this; } - /** + /** * Set `use_text_tags` to `true` to enable [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) parsing in your document (defaults to disabled, or `false`). Alternatively, if your PDF contains pre-defined fields, enable the detection of these fields by setting the `use_preexisting_fields` to `true` (defaults to disabled, or `false`). Currently we only support use of either `use_text_tags` or `use_preexisting_fields` parameter, not both. * @return usePreexistingFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Set `use_text_tags` to `true` to enable [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) parsing in your document (defaults to disabled, or `false`). Alternatively, if your PDF contains pre-defined fields, enable the detection of these fields by setting the `use_preexisting_fields` to `true` (defaults to disabled, or `false`). Currently we only support use of either `use_text_tags` or `use_preexisting_fields` parameter, not both.") @JsonProperty(JSON_PROPERTY_USE_PREEXISTING_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1193,12 +1158,11 @@ public UnclaimedDraftCreateEmbeddedRequest useTextTags(Boolean useTextTags) { return this; } - /** + /** * Set `use_text_tags` to `true` to enable [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) parsing in your document (defaults to disabled, or `false`). Alternatively, if your PDF contains pre-defined fields, enable the detection of these fields by setting the `use_preexisting_fields` to `true` (defaults to disabled, or `false`). Currently we only support use of either `use_text_tags` or `use_preexisting_fields` parameter, not both. * @return useTextTags - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Set `use_text_tags` to `true` to enable [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) parsing in your document (defaults to disabled, or `false`). Alternatively, if your PDF contains pre-defined fields, enable the detection of these fields by setting the `use_preexisting_fields` to `true` (defaults to disabled, or `false`). Currently we only support use of either `use_text_tags` or `use_preexisting_fields` parameter, not both.") @JsonProperty(JSON_PROPERTY_USE_TEXT_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1219,12 +1183,11 @@ public UnclaimedDraftCreateEmbeddedRequest populateAutoFillFields(Boolean popula return this; } - /** + /** * Controls whether [auto fill fields](https://faq.hellosign.com/hc/en-us/articles/360051467511-Auto-Fill-Fields) can automatically populate a signer's information during signing. **NOTE:** Keep your signer's information safe by ensuring that the _signer on your signature request is the intended party_ before using this feature. * @return populateAutoFillFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Controls whether [auto fill fields](https://faq.hellosign.com/hc/en-us/articles/360051467511-Auto-Fill-Fields) can automatically populate a signer's information during signing. **NOTE:** Keep your signer's information safe by ensuring that the _signer on your signature request is the intended party_ before using this feature.") @JsonProperty(JSON_PROPERTY_POPULATE_AUTO_FILL_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1245,12 +1208,11 @@ public UnclaimedDraftCreateEmbeddedRequest expiresAt(Integer expiresAt) { return this; } - /** + /** * When the signature request will expire. Unsigned signatures will be moved to the expired status, and no longer signable. See [Signature Request Expiration Date](https://developers.hellosign.com/docs/signature-request/expiration/) for details. **NOTE:** This does not correspond to the **expires_at** returned in the response. * @return expiresAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When the signature request will expire. Unsigned signatures will be moved to the expired status, and no longer signable. See [Signature Request Expiration Date](https://developers.hellosign.com/docs/signature-request/expiration/) for details. **NOTE:** This does not correspond to the **expires_at** returned in the response.") @JsonProperty(JSON_PROPERTY_EXPIRES_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.java b/src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.java index 4221ef3..29202b7 100644 --- a/src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.java +++ b/src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubCC; @@ -28,17 +27,16 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; 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.JSON; import com.dropbox.sign.ApiException; @@ -46,39 +44,39 @@ * UnclaimedDraftCreateEmbeddedWithTemplateRequest */ @JsonPropertyOrder({ - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CLIENT_ID, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_REQUESTER_EMAIL_ADDRESS, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TEMPLATE_IDS, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_ALLOW_DECLINE, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_ALLOW_REASSIGN, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CCS, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CUSTOM_FIELDS, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_EDITOR_OPTIONS, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_FIELD_OPTIONS, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_FILES, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_FILE_URLS, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_FORCE_SIGNER_ROLES, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_FORCE_SUBJECT_MESSAGE, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_HOLD_REQUEST, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_IS_FOR_EMBEDDED_SIGNING, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_MESSAGE, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_METADATA, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_PREVIEW_ONLY, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_REQUESTING_REDIRECT_URL, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SHOW_PREVIEW, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SHOW_PROGRESS_STEPPER, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SIGNERS, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SIGNING_OPTIONS, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SIGNING_REDIRECT_URL, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SKIP_ME_NOW, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SUBJECT, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TEST_MODE, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TITLE, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_POPULATE_AUTO_FILL_FIELDS, - UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_ALLOW_CCS + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CLIENT_ID, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_REQUESTER_EMAIL_ADDRESS, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TEMPLATE_IDS, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_ALLOW_DECLINE, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_ALLOW_REASSIGN, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CCS, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_CUSTOM_FIELDS, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_EDITOR_OPTIONS, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_FIELD_OPTIONS, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_FILES, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_FILE_URLS, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_FORCE_SIGNER_ROLES, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_FORCE_SUBJECT_MESSAGE, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_HOLD_REQUEST, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_IS_FOR_EMBEDDED_SIGNING, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_MESSAGE, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_METADATA, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_PREVIEW_ONLY, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_REQUESTING_REDIRECT_URL, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SHOW_PREVIEW, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SHOW_PROGRESS_STEPPER, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SIGNERS, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SIGNING_OPTIONS, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SIGNING_REDIRECT_URL, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SKIP_ME_NOW, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_SUBJECT, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TEST_MODE, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_TITLE, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_POPULATE_AUTO_FILL_FIELDS, + UnclaimedDraftCreateEmbeddedWithTemplateRequest.JSON_PROPERTY_ALLOW_CCS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class UnclaimedDraftCreateEmbeddedWithTemplateRequest { public static final String JSON_PROPERTY_CLIENT_ID = "client_id"; private String clientId; @@ -193,12 +191,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest clientId(String clientId) return this; } - /** + /** * Client id of the app used to create the draft. Used to apply the branding and callback url defined for the app. * @return clientId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Client id of the app used to create the draft. Used to apply the branding and callback url defined for the app.") @JsonProperty(JSON_PROPERTY_CLIENT_ID) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -219,12 +216,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest requesterEmailAddress(Str return this; } - /** + /** * The email address of the user that should be designated as the requester of this draft. * @return requesterEmailAddress - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The email address of the user that should be designated as the requester of this draft.") @JsonProperty(JSON_PROPERTY_REQUESTER_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -246,16 +242,18 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest templateIds(List } public UnclaimedDraftCreateEmbeddedWithTemplateRequest addTemplateIdsItem(String templateIdsItem) { + if (this.templateIds == null) { + this.templateIds = new ArrayList<>(); + } this.templateIds.add(templateIdsItem); return this; } - /** + /** * Use `template_ids` to create a SignatureRequest from one or more templates, in the order in which the templates will be used. * @return templateIds - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Use `template_ids` to create a SignatureRequest from one or more templates, in the order in which the templates will be used.") @JsonProperty(JSON_PROPERTY_TEMPLATE_IDS) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -276,12 +274,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest allowDecline(Boolean allo return this; } - /** + /** * Allows signers to decline to sign a document if `true`. Defaults to `false`. * @return allowDecline - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows signers to decline to sign a document if `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_ALLOW_DECLINE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -302,12 +299,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest allowReassign(Boolean all return this; } - /** + /** * Allows signers to reassign their signature requests to other signers if set to `true`. Defaults to `false`. **NOTE:** Only available for Premium plan and higher. * @return allowReassign - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows signers to reassign their signature requests to other signers if set to `true`. Defaults to `false`. **NOTE:** Only available for Premium plan and higher.") @JsonProperty(JSON_PROPERTY_ALLOW_REASSIGN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -336,12 +332,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest addCcsItem(SubCC ccsItem) return this; } - /** + /** * Add CC email recipients. Required when a CC role exists for the Template. * @return ccs - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Add CC email recipients. Required when a CC role exists for the Template.") @JsonProperty(JSON_PROPERTY_CCS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -370,12 +365,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest addCustomFieldsItem(SubCu return this; } - /** + /** * An array defining values and options for custom fields. Required when a custom field exists in the Template. * @return customFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array defining values and options for custom fields. Required when a custom field exists in the Template.") @JsonProperty(JSON_PROPERTY_CUSTOM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -396,12 +390,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest editorOptions(SubEditorOp return this; } - /** + /** * Get editorOptions * @return editorOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EDITOR_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -422,12 +415,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest fieldOptions(SubFieldOpti return this; } - /** + /** * Get fieldOptions * @return fieldOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIELD_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -456,12 +448,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest addFilesItem(File filesIt return this; } - /** + /** * Use `files[]` to append additional files to the signature request being created from the template. Dropbox Sign will parse the files for [text tags](https://app.hellosign.com/api/textTagsWalkthrough) and append it to the signature request. Text tags for signers not on the template(s) will be ignored. **files** or **file_urls[]** is required, but not both. * @return files - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `files[]` to append additional files to the signature request being created from the template. Dropbox Sign will parse the files for [text tags](https://app.hellosign.com/api/textTagsWalkthrough) and append it to the signature request. Text tags for signers not on the template(s) will be ignored. **files** or **file_urls[]** is required, but not both.") @JsonProperty(JSON_PROPERTY_FILES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -490,12 +481,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest addFileUrlsItem(String fi return this; } - /** + /** * Use file_urls[] to append additional files to the signature request being created from the template. Dropbox Sign will download the file, then parse it for [text tags](https://app.hellosign.com/api/textTagsWalkthrough), and append to the signature request. Text tags for signers not on the template(s) will be ignored. **files** or **file_urls[]** is required, but not both. * @return fileUrls - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use file_urls[] to append additional files to the signature request being created from the template. Dropbox Sign will download the file, then parse it for [text tags](https://app.hellosign.com/api/textTagsWalkthrough), and append to the signature request. Text tags for signers not on the template(s) will be ignored. **files** or **file_urls[]** is required, but not both.") @JsonProperty(JSON_PROPERTY_FILE_URLS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -516,12 +506,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest forceSignerRoles(Boolean return this; } - /** + /** * Provide users the ability to review/edit the template signer roles. * @return forceSignerRoles - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Provide users the ability to review/edit the template signer roles.") @JsonProperty(JSON_PROPERTY_FORCE_SIGNER_ROLES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -542,12 +531,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest forceSubjectMessage(Boole return this; } - /** + /** * Provide users the ability to review/edit the template subject and message. * @return forceSubjectMessage - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Provide users the ability to review/edit the template subject and message.") @JsonProperty(JSON_PROPERTY_FORCE_SUBJECT_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -568,12 +556,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest holdRequest(Boolean holdR return this; } - /** + /** * The request from this draft will not automatically send to signers post-claim if set to 1. Requester must [release](/api/reference/operation/signatureRequestReleaseHold/) the request from hold when ready to send. Defaults to `false`. * @return holdRequest - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The request from this draft will not automatically send to signers post-claim if set to 1. Requester must [release](/api/reference/operation/signatureRequestReleaseHold/) the request from hold when ready to send. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_HOLD_REQUEST) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -594,12 +581,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest isForEmbeddedSigning(Bool return this; } - /** + /** * The request created from this draft will also be signable in embedded mode if set to `true`. Defaults to `false`. * @return isForEmbeddedSigning - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The request created from this draft will also be signable in embedded mode if set to `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_IS_FOR_EMBEDDED_SIGNING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -620,12 +606,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest message(String message) { return this; } - /** + /** * The custom message in the email that will be sent to the signers. * @return message - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The custom message in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -654,12 +639,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest putMetadataItem(String ke return this; } - /** + /** * Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long.") @JsonProperty(JSON_PROPERTY_METADATA) @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) @@ -680,12 +664,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest previewOnly(Boolean previ return this; } - /** + /** * This allows the requester to enable the preview experience (i.e. does not allow the requester's end user to add any additional fields via the editor). - `preview_only=true`: Allows requesters to enable the preview only experience. - `preview_only=false`: Allows requesters to disable the preview only experience. **NOTE:** This parameter overwrites `show_preview=1` (if set). * @return previewOnly - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "This allows the requester to enable the preview experience (i.e. does not allow the requester's end user to add any additional fields via the editor). - `preview_only=true`: Allows requesters to enable the preview only experience. - `preview_only=false`: Allows requesters to disable the preview only experience. **NOTE:** This parameter overwrites `show_preview=1` (if set).") @JsonProperty(JSON_PROPERTY_PREVIEW_ONLY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -706,12 +689,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest requestingRedirectUrl(Str return this; } - /** + /** * The URL you want signers redirected to after they successfully request a signature. * @return requestingRedirectUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL you want signers redirected to after they successfully request a signature.") @JsonProperty(JSON_PROPERTY_REQUESTING_REDIRECT_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -732,12 +714,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest showPreview(Boolean showP return this; } - /** + /** * This allows the requester to enable the editor/preview experience. - `show_preview=true`: Allows requesters to enable the editor/preview experience. - `show_preview=false`: Allows requesters to disable the editor/preview experience. * @return showPreview - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "This allows the requester to enable the editor/preview experience. - `show_preview=true`: Allows requesters to enable the editor/preview experience. - `show_preview=false`: Allows requesters to disable the editor/preview experience.") @JsonProperty(JSON_PROPERTY_SHOW_PREVIEW) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -758,12 +739,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest showProgressStepper(Boole return this; } - /** + /** * When only one step remains in the signature request process and this parameter is set to `false` then the progress stepper will be hidden. * @return showProgressStepper - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When only one step remains in the signature request process and this parameter is set to `false` then the progress stepper will be hidden.") @JsonProperty(JSON_PROPERTY_SHOW_PROGRESS_STEPPER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -792,12 +772,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest addSignersItem(SubUnclaim return this; } - /** + /** * Add Signers to your Templated-based Signature Request. * @return signers - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Add Signers to your Templated-based Signature Request.") @JsonProperty(JSON_PROPERTY_SIGNERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -818,12 +797,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest signingOptions(SubSigning return this; } - /** + /** * Get signingOptions * @return signingOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SIGNING_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -844,12 +822,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest signingRedirectUrl(String return this; } - /** + /** * The URL you want signers redirected to after they successfully sign. * @return signingRedirectUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL you want signers redirected to after they successfully sign.") @JsonProperty(JSON_PROPERTY_SIGNING_REDIRECT_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -870,12 +847,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest skipMeNow(Boolean skipMeN return this; } - /** + /** * Disables the \"Me (Now)\" option for the person preparing the document. Does not work with type `send_document`. Defaults to `false`. * @return skipMeNow - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Disables the \"Me (Now)\" option for the person preparing the document. Does not work with type `send_document`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_SKIP_ME_NOW) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -896,12 +872,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest subject(String subject) { return this; } - /** + /** * The subject in the email that will be sent to the signers. * @return subject - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The subject in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_SUBJECT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -922,12 +897,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest testMode(Boolean testMode return this; } - /** + /** * Whether this is a test, the signature request created from this draft will not be legally binding if set to `true`. Defaults to `false`. * @return testMode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this is a test, the signature request created from this draft will not be legally binding if set to `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_TEST_MODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -948,12 +922,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest title(String title) { return this; } - /** + /** * The title you want to assign to the SignatureRequest. * @return title - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The title you want to assign to the SignatureRequest.") @JsonProperty(JSON_PROPERTY_TITLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -974,12 +947,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest populateAutoFillFields(Bo return this; } - /** + /** * Controls whether [auto fill fields](https://faq.hellosign.com/hc/en-us/articles/360051467511-Auto-Fill-Fields) can automatically populate a signer's information during signing. **NOTE:** Keep your signer's information safe by ensuring that the _signer on your signature request is the intended party_ before using this feature. * @return populateAutoFillFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Controls whether [auto fill fields](https://faq.hellosign.com/hc/en-us/articles/360051467511-Auto-Fill-Fields) can automatically populate a signer's information during signing. **NOTE:** Keep your signer's information safe by ensuring that the _signer on your signature request is the intended party_ before using this feature.") @JsonProperty(JSON_PROPERTY_POPULATE_AUTO_FILL_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1000,12 +972,11 @@ public UnclaimedDraftCreateEmbeddedWithTemplateRequest allowCcs(Boolean allowCcs return this; } - /** + /** * This allows the requester to specify whether the user is allowed to provide email addresses to CC when claiming the draft. * @return allowCcs - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "This allows the requester to specify whether the user is allowed to provide email addresses to CC when claiming the draft.") @JsonProperty(JSON_PROPERTY_ALLOW_CCS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateRequest.java b/src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateRequest.java index a354697..1aff38f 100644 --- a/src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateRequest.java +++ b/src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubAttachment; @@ -30,51 +29,50 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; 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.JSON; import com.dropbox.sign.ApiException; /** - * UnclaimedDraftCreateRequest + * */ @JsonPropertyOrder({ - UnclaimedDraftCreateRequest.JSON_PROPERTY_TYPE, - UnclaimedDraftCreateRequest.JSON_PROPERTY_FILES, - UnclaimedDraftCreateRequest.JSON_PROPERTY_FILE_URLS, - UnclaimedDraftCreateRequest.JSON_PROPERTY_ALLOW_DECLINE, - UnclaimedDraftCreateRequest.JSON_PROPERTY_ATTACHMENTS, - UnclaimedDraftCreateRequest.JSON_PROPERTY_CC_EMAIL_ADDRESSES, - UnclaimedDraftCreateRequest.JSON_PROPERTY_CLIENT_ID, - UnclaimedDraftCreateRequest.JSON_PROPERTY_CUSTOM_FIELDS, - UnclaimedDraftCreateRequest.JSON_PROPERTY_FIELD_OPTIONS, - UnclaimedDraftCreateRequest.JSON_PROPERTY_FORM_FIELD_GROUPS, - UnclaimedDraftCreateRequest.JSON_PROPERTY_FORM_FIELD_RULES, - UnclaimedDraftCreateRequest.JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT, - UnclaimedDraftCreateRequest.JSON_PROPERTY_HIDE_TEXT_TAGS, - UnclaimedDraftCreateRequest.JSON_PROPERTY_MESSAGE, - UnclaimedDraftCreateRequest.JSON_PROPERTY_METADATA, - UnclaimedDraftCreateRequest.JSON_PROPERTY_SHOW_PROGRESS_STEPPER, - UnclaimedDraftCreateRequest.JSON_PROPERTY_SIGNERS, - UnclaimedDraftCreateRequest.JSON_PROPERTY_SIGNING_OPTIONS, - UnclaimedDraftCreateRequest.JSON_PROPERTY_SIGNING_REDIRECT_URL, - UnclaimedDraftCreateRequest.JSON_PROPERTY_SUBJECT, - UnclaimedDraftCreateRequest.JSON_PROPERTY_TEST_MODE, - UnclaimedDraftCreateRequest.JSON_PROPERTY_USE_PREEXISTING_FIELDS, - UnclaimedDraftCreateRequest.JSON_PROPERTY_USE_TEXT_TAGS, - UnclaimedDraftCreateRequest.JSON_PROPERTY_EXPIRES_AT + UnclaimedDraftCreateRequest.JSON_PROPERTY_TYPE, + UnclaimedDraftCreateRequest.JSON_PROPERTY_FILES, + UnclaimedDraftCreateRequest.JSON_PROPERTY_FILE_URLS, + UnclaimedDraftCreateRequest.JSON_PROPERTY_ALLOW_DECLINE, + UnclaimedDraftCreateRequest.JSON_PROPERTY_ATTACHMENTS, + UnclaimedDraftCreateRequest.JSON_PROPERTY_CC_EMAIL_ADDRESSES, + UnclaimedDraftCreateRequest.JSON_PROPERTY_CLIENT_ID, + UnclaimedDraftCreateRequest.JSON_PROPERTY_CUSTOM_FIELDS, + UnclaimedDraftCreateRequest.JSON_PROPERTY_FIELD_OPTIONS, + UnclaimedDraftCreateRequest.JSON_PROPERTY_FORM_FIELD_GROUPS, + UnclaimedDraftCreateRequest.JSON_PROPERTY_FORM_FIELD_RULES, + UnclaimedDraftCreateRequest.JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT, + UnclaimedDraftCreateRequest.JSON_PROPERTY_HIDE_TEXT_TAGS, + UnclaimedDraftCreateRequest.JSON_PROPERTY_MESSAGE, + UnclaimedDraftCreateRequest.JSON_PROPERTY_METADATA, + UnclaimedDraftCreateRequest.JSON_PROPERTY_SHOW_PROGRESS_STEPPER, + UnclaimedDraftCreateRequest.JSON_PROPERTY_SIGNERS, + UnclaimedDraftCreateRequest.JSON_PROPERTY_SIGNING_OPTIONS, + UnclaimedDraftCreateRequest.JSON_PROPERTY_SIGNING_REDIRECT_URL, + UnclaimedDraftCreateRequest.JSON_PROPERTY_SUBJECT, + UnclaimedDraftCreateRequest.JSON_PROPERTY_TEST_MODE, + UnclaimedDraftCreateRequest.JSON_PROPERTY_USE_PREEXISTING_FIELDS, + UnclaimedDraftCreateRequest.JSON_PROPERTY_USE_TEXT_TAGS, + UnclaimedDraftCreateRequest.JSON_PROPERTY_EXPIRES_AT }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class UnclaimedDraftCreateRequest { /** * The type of unclaimed draft to create. Use `send_document` to create a claimable file, and `request_signature` for a claimable signature request. If the type is `request_signature` then signers name and email_address are not optional. @@ -206,12 +204,11 @@ public UnclaimedDraftCreateRequest type(TypeEnum type) { return this; } - /** + /** * The type of unclaimed draft to create. Use `send_document` to create a claimable file, and `request_signature` for a claimable signature request. If the type is `request_signature` then signers name and email_address are not optional. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of unclaimed draft to create. Use `send_document` to create a claimable file, and `request_signature` for a claimable signature request. If the type is `request_signature` then signers name and email_address are not optional.") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -240,12 +237,11 @@ public UnclaimedDraftCreateRequest addFilesItem(File filesItem) { return this; } - /** + /** * Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both. * @return files - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -274,12 +270,11 @@ public UnclaimedDraftCreateRequest addFileUrlsItem(String fileUrlsItem) { return this; } - /** + /** * Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both. * @return fileUrls - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.") @JsonProperty(JSON_PROPERTY_FILE_URLS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -300,12 +295,11 @@ public UnclaimedDraftCreateRequest allowDecline(Boolean allowDecline) { return this; } - /** + /** * Allows signers to decline to sign a document if `true`. Defaults to `false`. * @return allowDecline - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows signers to decline to sign a document if `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_ALLOW_DECLINE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -334,12 +328,11 @@ public UnclaimedDraftCreateRequest addAttachmentsItem(SubAttachment attachmentsI return this; } - /** + /** * A list describing the attachments * @return attachments - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list describing the attachments") @JsonProperty(JSON_PROPERTY_ATTACHMENTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -368,12 +361,11 @@ public UnclaimedDraftCreateRequest addCcEmailAddressesItem(String ccEmailAddress return this; } - /** + /** * The email addresses that should be CCed. * @return ccEmailAddresses - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The email addresses that should be CCed.") @JsonProperty(JSON_PROPERTY_CC_EMAIL_ADDRESSES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -394,12 +386,11 @@ public UnclaimedDraftCreateRequest clientId(String clientId) { return this; } - /** + /** * Client id of the app used to create the draft. Used to apply the branding and callback url defined for the app. * @return clientId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Client id of the app used to create the draft. Used to apply the branding and callback url defined for the app.") @JsonProperty(JSON_PROPERTY_CLIENT_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -428,12 +419,11 @@ public UnclaimedDraftCreateRequest addCustomFieldsItem(SubCustomField customFiel return this; } - /** + /** * When used together with merge fields, `custom_fields` allows users to add pre-filled data to their signature requests. Pre-filled data can be used with \"send-once\" signature requests by adding merge fields with `form_fields_per_document` or [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) while passing values back with `custom_fields` together in one API call. For using pre-filled on repeatable signature requests, merge fields are added to templates in the Dropbox Sign UI or by calling [/template/create_embedded_draft](/api/reference/operation/templateCreateEmbeddedDraft) and then passing `custom_fields` on subsequent signature requests referencing that template. * @return customFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When used together with merge fields, `custom_fields` allows users to add pre-filled data to their signature requests. Pre-filled data can be used with \"send-once\" signature requests by adding merge fields with `form_fields_per_document` or [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) while passing values back with `custom_fields` together in one API call. For using pre-filled on repeatable signature requests, merge fields are added to templates in the Dropbox Sign UI or by calling [/template/create_embedded_draft](/api/reference/operation/templateCreateEmbeddedDraft) and then passing `custom_fields` on subsequent signature requests referencing that template.") @JsonProperty(JSON_PROPERTY_CUSTOM_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -454,12 +444,11 @@ public UnclaimedDraftCreateRequest fieldOptions(SubFieldOptions fieldOptions) { return this; } - /** + /** * Get fieldOptions * @return fieldOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIELD_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -488,12 +477,11 @@ public UnclaimedDraftCreateRequest addFormFieldGroupsItem(SubFormFieldGroup form return this; } - /** + /** * Group information for fields defined in `form_fields_per_document`. String-indexed JSON array with `group_label` and `requirement` keys. `form_fields_per_document` must contain fields referencing a group defined in `form_field_groups`. * @return formFieldGroups - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Group information for fields defined in `form_fields_per_document`. String-indexed JSON array with `group_label` and `requirement` keys. `form_fields_per_document` must contain fields referencing a group defined in `form_field_groups`.") @JsonProperty(JSON_PROPERTY_FORM_FIELD_GROUPS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -522,12 +510,11 @@ public UnclaimedDraftCreateRequest addFormFieldRulesItem(SubFormFieldRule formFi return this; } - /** + /** * Conditional Logic rules for fields defined in `form_fields_per_document`. * @return formFieldRules - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Conditional Logic rules for fields defined in `form_fields_per_document`.") @JsonProperty(JSON_PROPERTY_FORM_FIELD_RULES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -556,12 +543,11 @@ public UnclaimedDraftCreateRequest addFormFieldsPerDocumentItem(SubFormFieldsPer return this; } - /** + /** * The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).) **NOTE:** Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types. * Text Field use `SubFormFieldsPerDocumentText` * Dropdown Field use `SubFormFieldsPerDocumentDropdown` * Hyperlink Field use `SubFormFieldsPerDocumentHyperlink` * Checkbox Field use `SubFormFieldsPerDocumentCheckbox` * Radio Field use `SubFormFieldsPerDocumentRadio` * Signature Field use `SubFormFieldsPerDocumentSignature` * Date Signed Field use `SubFormFieldsPerDocumentDateSigned` * Initials Field use `SubFormFieldsPerDocumentInitials` * Text Merge Field use `SubFormFieldsPerDocumentTextMerge` * Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge` * @return formFieldsPerDocument - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).) **NOTE:** Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types. * Text Field use `SubFormFieldsPerDocumentText` * Dropdown Field use `SubFormFieldsPerDocumentDropdown` * Hyperlink Field use `SubFormFieldsPerDocumentHyperlink` * Checkbox Field use `SubFormFieldsPerDocumentCheckbox` * Radio Field use `SubFormFieldsPerDocumentRadio` * Signature Field use `SubFormFieldsPerDocumentSignature` * Date Signed Field use `SubFormFieldsPerDocumentDateSigned` * Initials Field use `SubFormFieldsPerDocumentInitials` * Text Merge Field use `SubFormFieldsPerDocumentTextMerge` * Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge`") @JsonProperty(JSON_PROPERTY_FORM_FIELDS_PER_DOCUMENT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -582,12 +568,11 @@ public UnclaimedDraftCreateRequest hideTextTags(Boolean hideTextTags) { return this; } - /** + /** * Send with a value of `true` if you wish to enable automatic Text Tag removal. Defaults to `false`. When using Text Tags it is preferred that you set this to `false` and hide your tags with white text or something similar because the automatic removal system can cause unwanted clipping. See the [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) walkthrough for more details. * @return hideTextTags - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Send with a value of `true` if you wish to enable automatic Text Tag removal. Defaults to `false`. When using Text Tags it is preferred that you set this to `false` and hide your tags with white text or something similar because the automatic removal system can cause unwanted clipping. See the [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) walkthrough for more details.") @JsonProperty(JSON_PROPERTY_HIDE_TEXT_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -608,12 +593,11 @@ public UnclaimedDraftCreateRequest message(String message) { return this; } - /** + /** * The custom message in the email that will be sent to the signers. * @return message - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The custom message in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -642,12 +626,11 @@ public UnclaimedDraftCreateRequest putMetadataItem(String key, Object metadataIt return this; } - /** + /** * Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long.") @JsonProperty(JSON_PROPERTY_METADATA) @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) @@ -668,12 +651,11 @@ public UnclaimedDraftCreateRequest showProgressStepper(Boolean showProgressStepp return this; } - /** + /** * When only one step remains in the signature request process and this parameter is set to `false` then the progress stepper will be hidden. * @return showProgressStepper - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When only one step remains in the signature request process and this parameter is set to `false` then the progress stepper will be hidden.") @JsonProperty(JSON_PROPERTY_SHOW_PROGRESS_STEPPER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -702,12 +684,11 @@ public UnclaimedDraftCreateRequest addSignersItem(SubUnclaimedDraftSigner signer return this; } - /** + /** * Add Signers to your Unclaimed Draft Signature Request. * @return signers - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Add Signers to your Unclaimed Draft Signature Request.") @JsonProperty(JSON_PROPERTY_SIGNERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -728,12 +709,11 @@ public UnclaimedDraftCreateRequest signingOptions(SubSigningOptions signingOptio return this; } - /** + /** * Get signingOptions * @return signingOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SIGNING_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -754,12 +734,11 @@ public UnclaimedDraftCreateRequest signingRedirectUrl(String signingRedirectUrl) return this; } - /** + /** * The URL you want signers redirected to after they successfully sign. * @return signingRedirectUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL you want signers redirected to after they successfully sign.") @JsonProperty(JSON_PROPERTY_SIGNING_REDIRECT_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -780,12 +759,11 @@ public UnclaimedDraftCreateRequest subject(String subject) { return this; } - /** + /** * The subject in the email that will be sent to the signers. * @return subject - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The subject in the email that will be sent to the signers.") @JsonProperty(JSON_PROPERTY_SUBJECT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -806,12 +784,11 @@ public UnclaimedDraftCreateRequest testMode(Boolean testMode) { return this; } - /** + /** * Whether this is a test, the signature request created from this draft will not be legally binding if set to `true`. Defaults to `false`. * @return testMode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this is a test, the signature request created from this draft will not be legally binding if set to `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_TEST_MODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -832,12 +809,11 @@ public UnclaimedDraftCreateRequest usePreexistingFields(Boolean usePreexistingFi return this; } - /** + /** * Set `use_text_tags` to `true` to enable [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) parsing in your document (defaults to disabled, or `false`). Alternatively, if your PDF contains pre-defined fields, enable the detection of these fields by setting the `use_preexisting_fields` to `true` (defaults to disabled, or `false`). Currently we only support use of either `use_text_tags` or `use_preexisting_fields` parameter, not both. * @return usePreexistingFields - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Set `use_text_tags` to `true` to enable [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) parsing in your document (defaults to disabled, or `false`). Alternatively, if your PDF contains pre-defined fields, enable the detection of these fields by setting the `use_preexisting_fields` to `true` (defaults to disabled, or `false`). Currently we only support use of either `use_text_tags` or `use_preexisting_fields` parameter, not both.") @JsonProperty(JSON_PROPERTY_USE_PREEXISTING_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -858,12 +834,11 @@ public UnclaimedDraftCreateRequest useTextTags(Boolean useTextTags) { return this; } - /** + /** * Set `use_text_tags` to `true` to enable [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) parsing in your document (defaults to disabled, or `false`). Alternatively, if your PDF contains pre-defined fields, enable the detection of these fields by setting the `use_preexisting_fields` to `true` (defaults to disabled, or `false`). Currently we only support use of either `use_text_tags` or `use_preexisting_fields` parameter, not both. * @return useTextTags - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Set `use_text_tags` to `true` to enable [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) parsing in your document (defaults to disabled, or `false`). Alternatively, if your PDF contains pre-defined fields, enable the detection of these fields by setting the `use_preexisting_fields` to `true` (defaults to disabled, or `false`). Currently we only support use of either `use_text_tags` or `use_preexisting_fields` parameter, not both.") @JsonProperty(JSON_PROPERTY_USE_TEXT_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -884,12 +859,11 @@ public UnclaimedDraftCreateRequest expiresAt(Integer expiresAt) { return this; } - /** + /** * When the signature request will expire. Unsigned signatures will be moved to the expired status, and no longer signable. See [Signature Request Expiration Date](https://developers.hellosign.com/docs/signature-request/expiration/) for details. **NOTE:** This does not correspond to the **expires_at** returned in the response. * @return expiresAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When the signature request will expire. Unsigned signatures will be moved to the expired status, and no longer signable. See [Signature Request Expiration Date](https://developers.hellosign.com/docs/signature-request/expiration/) for details. **NOTE:** This does not correspond to the **expires_at** returned in the response.") @JsonProperty(JSON_PROPERTY_EXPIRES_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateResponse.java b/src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateResponse.java index f72d33d..1bb6397 100644 --- a/src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateResponse.java +++ b/src/main/java/com/dropbox/sign/model/UnclaimedDraftCreateResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.UnclaimedDraftResponse; @@ -24,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; 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.JSON; import com.dropbox.sign.ApiException; @@ -39,11 +37,11 @@ * UnclaimedDraftCreateResponse */ @JsonPropertyOrder({ - UnclaimedDraftCreateResponse.JSON_PROPERTY_UNCLAIMED_DRAFT, - UnclaimedDraftCreateResponse.JSON_PROPERTY_WARNINGS + UnclaimedDraftCreateResponse.JSON_PROPERTY_UNCLAIMED_DRAFT, + UnclaimedDraftCreateResponse.JSON_PROPERTY_WARNINGS }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class UnclaimedDraftCreateResponse { public static final String JSON_PROPERTY_UNCLAIMED_DRAFT = "unclaimed_draft"; private UnclaimedDraftResponse unclaimedDraft; @@ -74,14 +72,13 @@ public UnclaimedDraftCreateResponse unclaimedDraft(UnclaimedDraftResponse unclai return this; } - /** + /** * Get unclaimedDraft * @return unclaimedDraft - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + */ + @javax.annotation.Nonnull @JsonProperty(JSON_PROPERTY_UNCLAIMED_DRAFT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public UnclaimedDraftResponse getUnclaimedDraft() { return unclaimedDraft; @@ -89,7 +86,7 @@ public UnclaimedDraftResponse getUnclaimedDraft() { @JsonProperty(JSON_PROPERTY_UNCLAIMED_DRAFT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setUnclaimedDraft(UnclaimedDraftResponse unclaimedDraft) { this.unclaimedDraft = unclaimedDraft; } @@ -108,12 +105,11 @@ public UnclaimedDraftCreateResponse addWarningsItem(WarningResponse warningsItem return this; } - /** + /** * A list of warnings. * @return warnings - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of warnings.") @JsonProperty(JSON_PROPERTY_WARNINGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/UnclaimedDraftEditAndResendRequest.java b/src/main/java/com/dropbox/sign/model/UnclaimedDraftEditAndResendRequest.java index 3e6399b..d8aaacb 100644 --- a/src/main/java/com/dropbox/sign/model/UnclaimedDraftEditAndResendRequest.java +++ b/src/main/java/com/dropbox/sign/model/UnclaimedDraftEditAndResendRequest.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.dropbox.sign.model.SubEditorOptions; @@ -23,12 +22,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; @@ -36,17 +34,17 @@ * UnclaimedDraftEditAndResendRequest */ @JsonPropertyOrder({ - UnclaimedDraftEditAndResendRequest.JSON_PROPERTY_CLIENT_ID, - UnclaimedDraftEditAndResendRequest.JSON_PROPERTY_EDITOR_OPTIONS, - UnclaimedDraftEditAndResendRequest.JSON_PROPERTY_IS_FOR_EMBEDDED_SIGNING, - UnclaimedDraftEditAndResendRequest.JSON_PROPERTY_REQUESTER_EMAIL_ADDRESS, - UnclaimedDraftEditAndResendRequest.JSON_PROPERTY_REQUESTING_REDIRECT_URL, - UnclaimedDraftEditAndResendRequest.JSON_PROPERTY_SHOW_PROGRESS_STEPPER, - UnclaimedDraftEditAndResendRequest.JSON_PROPERTY_SIGNING_REDIRECT_URL, - UnclaimedDraftEditAndResendRequest.JSON_PROPERTY_TEST_MODE + UnclaimedDraftEditAndResendRequest.JSON_PROPERTY_CLIENT_ID, + UnclaimedDraftEditAndResendRequest.JSON_PROPERTY_EDITOR_OPTIONS, + UnclaimedDraftEditAndResendRequest.JSON_PROPERTY_IS_FOR_EMBEDDED_SIGNING, + UnclaimedDraftEditAndResendRequest.JSON_PROPERTY_REQUESTER_EMAIL_ADDRESS, + UnclaimedDraftEditAndResendRequest.JSON_PROPERTY_REQUESTING_REDIRECT_URL, + UnclaimedDraftEditAndResendRequest.JSON_PROPERTY_SHOW_PROGRESS_STEPPER, + UnclaimedDraftEditAndResendRequest.JSON_PROPERTY_SIGNING_REDIRECT_URL, + UnclaimedDraftEditAndResendRequest.JSON_PROPERTY_TEST_MODE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class UnclaimedDraftEditAndResendRequest { public static final String JSON_PROPERTY_CLIENT_ID = "client_id"; private String clientId; @@ -95,12 +93,11 @@ public UnclaimedDraftEditAndResendRequest clientId(String clientId) { return this; } - /** + /** * Client id of the app used to create the draft. Used to apply the branding and callback url defined for the app. * @return clientId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Client id of the app used to create the draft. Used to apply the branding and callback url defined for the app.") @JsonProperty(JSON_PROPERTY_CLIENT_ID) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -121,12 +118,11 @@ public UnclaimedDraftEditAndResendRequest editorOptions(SubEditorOptions editorO return this; } - /** + /** * Get editorOptions * @return editorOptions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EDITOR_OPTIONS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -147,12 +143,11 @@ public UnclaimedDraftEditAndResendRequest isForEmbeddedSigning(Boolean isForEmbe return this; } - /** + /** * The request created from this draft will also be signable in embedded mode if set to `true`. * @return isForEmbeddedSigning - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The request created from this draft will also be signable in embedded mode if set to `true`.") @JsonProperty(JSON_PROPERTY_IS_FOR_EMBEDDED_SIGNING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -173,12 +168,11 @@ public UnclaimedDraftEditAndResendRequest requesterEmailAddress(String requester return this; } - /** + /** * The email address of the user that should be designated as the requester of this draft. If not set, original requester's email address will be used. * @return requesterEmailAddress - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The email address of the user that should be designated as the requester of this draft. If not set, original requester's email address will be used.") @JsonProperty(JSON_PROPERTY_REQUESTER_EMAIL_ADDRESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -199,12 +193,11 @@ public UnclaimedDraftEditAndResendRequest requestingRedirectUrl(String requestin return this; } - /** + /** * The URL you want signers redirected to after they successfully request a signature. * @return requestingRedirectUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL you want signers redirected to after they successfully request a signature.") @JsonProperty(JSON_PROPERTY_REQUESTING_REDIRECT_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -225,12 +218,11 @@ public UnclaimedDraftEditAndResendRequest showProgressStepper(Boolean showProgre return this; } - /** + /** * When only one step remains in the signature request process and this parameter is set to `false` then the progress stepper will be hidden. * @return showProgressStepper - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When only one step remains in the signature request process and this parameter is set to `false` then the progress stepper will be hidden.") @JsonProperty(JSON_PROPERTY_SHOW_PROGRESS_STEPPER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -251,12 +243,11 @@ public UnclaimedDraftEditAndResendRequest signingRedirectUrl(String signingRedir return this; } - /** + /** * The URL you want signers redirected to after they successfully sign. * @return signingRedirectUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL you want signers redirected to after they successfully sign.") @JsonProperty(JSON_PROPERTY_SIGNING_REDIRECT_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -277,12 +268,11 @@ public UnclaimedDraftEditAndResendRequest testMode(Boolean testMode) { return this; } - /** + /** * Whether this is a test, the signature request created from this draft will not be legally binding if set to `true`. Defaults to `false`. * @return testMode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this is a test, the signature request created from this draft will not be legally binding if set to `true`. Defaults to `false`.") @JsonProperty(JSON_PROPERTY_TEST_MODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/UnclaimedDraftResponse.java b/src/main/java/com/dropbox/sign/model/UnclaimedDraftResponse.java index 673c8c4..261ccf5 100644 --- a/src/main/java/com/dropbox/sign/model/UnclaimedDraftResponse.java +++ b/src/main/java/com/dropbox/sign/model/UnclaimedDraftResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,29 +21,27 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * A group of documents that a user can take ownership of via the claim URL. */ -@ApiModel(description = "A group of documents that a user can take ownership of via the claim URL.") @JsonPropertyOrder({ - UnclaimedDraftResponse.JSON_PROPERTY_SIGNATURE_REQUEST_ID, - UnclaimedDraftResponse.JSON_PROPERTY_CLAIM_URL, - UnclaimedDraftResponse.JSON_PROPERTY_SIGNING_REDIRECT_URL, - UnclaimedDraftResponse.JSON_PROPERTY_REQUESTING_REDIRECT_URL, - UnclaimedDraftResponse.JSON_PROPERTY_EXPIRES_AT, - UnclaimedDraftResponse.JSON_PROPERTY_TEST_MODE + UnclaimedDraftResponse.JSON_PROPERTY_SIGNATURE_REQUEST_ID, + UnclaimedDraftResponse.JSON_PROPERTY_CLAIM_URL, + UnclaimedDraftResponse.JSON_PROPERTY_SIGNING_REDIRECT_URL, + UnclaimedDraftResponse.JSON_PROPERTY_REQUESTING_REDIRECT_URL, + UnclaimedDraftResponse.JSON_PROPERTY_EXPIRES_AT, + UnclaimedDraftResponse.JSON_PROPERTY_TEST_MODE }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class UnclaimedDraftResponse { public static final String JSON_PROPERTY_SIGNATURE_REQUEST_ID = "signature_request_id"; private String signatureRequestId; @@ -87,12 +84,11 @@ public UnclaimedDraftResponse signatureRequestId(String signatureRequestId) { return this; } - /** + /** * The ID of the signature request that is represented by this UnclaimedDraft. * @return signatureRequestId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The ID of the signature request that is represented by this UnclaimedDraft.") @JsonProperty(JSON_PROPERTY_SIGNATURE_REQUEST_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -113,12 +109,11 @@ public UnclaimedDraftResponse claimUrl(String claimUrl) { return this; } - /** + /** * The URL to be used to claim this UnclaimedDraft. * @return claimUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL to be used to claim this UnclaimedDraft.") @JsonProperty(JSON_PROPERTY_CLAIM_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -139,12 +134,11 @@ public UnclaimedDraftResponse signingRedirectUrl(String signingRedirectUrl) { return this; } - /** + /** * The URL you want signers redirected to after they successfully sign. * @return signingRedirectUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL you want signers redirected to after they successfully sign.") @JsonProperty(JSON_PROPERTY_SIGNING_REDIRECT_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -165,12 +159,11 @@ public UnclaimedDraftResponse requestingRedirectUrl(String requestingRedirectUrl return this; } - /** + /** * The URL you want signers redirected to after they successfully request a signature (Will only be returned in the response if it is applicable to the request.). * @return requestingRedirectUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The URL you want signers redirected to after they successfully request a signature (Will only be returned in the response if it is applicable to the request.).") @JsonProperty(JSON_PROPERTY_REQUESTING_REDIRECT_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -191,12 +184,11 @@ public UnclaimedDraftResponse expiresAt(Integer expiresAt) { return this; } - /** + /** * When the link expires. * @return expiresAt - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "When the link expires.") @JsonProperty(JSON_PROPERTY_EXPIRES_AT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -217,12 +209,11 @@ public UnclaimedDraftResponse testMode(Boolean testMode) { return this; } - /** + /** * Whether this is a test draft. Signature requests made from test drafts have no legal value. * @return testMode - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this is a test draft. Signature requests made from test drafts have no legal value.") @JsonProperty(JSON_PROPERTY_TEST_MODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/dropbox/sign/model/WarningResponse.java b/src/main/java/com/dropbox/sign/model/WarningResponse.java index 296e55a..96374e9 100644 --- a/src/main/java/com/dropbox/sign/model/WarningResponse.java +++ b/src/main/java/com/dropbox/sign/model/WarningResponse.java @@ -14,7 +14,6 @@ package com.dropbox.sign.model; import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; @@ -22,25 +21,23 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +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.JSON; import com.dropbox.sign.ApiException; /** * A list of warnings. */ -@ApiModel(description = "A list of warnings.") @JsonPropertyOrder({ - WarningResponse.JSON_PROPERTY_WARNING_MSG, - WarningResponse.JSON_PROPERTY_WARNING_NAME + WarningResponse.JSON_PROPERTY_WARNING_MSG, + WarningResponse.JSON_PROPERTY_WARNING_NAME }) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") @JsonIgnoreProperties(ignoreUnknown=true) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class WarningResponse { public static final String JSON_PROPERTY_WARNING_MSG = "warning_msg"; private String warningMsg; @@ -71,12 +68,11 @@ public WarningResponse warningMsg(String warningMsg) { return this; } - /** + /** * Warning message * @return warningMsg - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Warning message") @JsonProperty(JSON_PROPERTY_WARNING_MSG) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -97,12 +93,11 @@ public WarningResponse warningName(String warningName) { return this; } - /** + /** * Warning name * @return warningName - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Warning name") @JsonProperty(JSON_PROPERTY_WARNING_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) diff --git a/src/test/java/com/dropbox/sign/EventCallbackHelperTest.java b/src/test/java/com/dropbox/sign/EventCallbackHelperTest.java index 903eb2c..8bd0c74 100644 --- a/src/test/java/com/dropbox/sign/EventCallbackHelperTest.java +++ b/src/test/java/com/dropbox/sign/EventCallbackHelperTest.java @@ -4,8 +4,10 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.dropbox.sign.model.EventCallbackRequest; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.nio.file.Files; import java.nio.file.Paths; @@ -35,9 +37,9 @@ public void testIsValid() throws Exception { EventCallbackRequest callbackEvent = EventCallbackRequest.init(content.toString()); - Assert.assertTrue(EventCallbackHelper.isValid(APIKEY, callbackEvent)); - Assert.assertFalse(EventCallbackHelper.isValid(reverseApiKey, callbackEvent)); - Assert.assertEquals( + assertTrue(EventCallbackHelper.isValid(APIKEY, callbackEvent)); + assertFalse(EventCallbackHelper.isValid(reverseApiKey, callbackEvent)); + assertEquals( EventCallbackHelper.EVENT_TYPE_ACCOUNT_CALLBACK, EventCallbackHelper.getCallbackType(callbackEvent) ); @@ -55,9 +57,9 @@ public void testIsValid() throws Exception { EventCallbackRequest callbackEvent = EventCallbackRequest.init(content.toString()); - Assert.assertTrue(EventCallbackHelper.isValid(APIKEY, callbackEvent)); - Assert.assertFalse(EventCallbackHelper.isValid(reverseApiKey, callbackEvent)); - Assert.assertEquals( + assertTrue(EventCallbackHelper.isValid(APIKEY, callbackEvent)); + assertFalse(EventCallbackHelper.isValid(reverseApiKey, callbackEvent)); + assertEquals( EventCallbackHelper.EVENT_TYPE_APP_CALLBACK, EventCallbackHelper.getCallbackType(callbackEvent) ); diff --git a/src/test/java/com/dropbox/sign/FixtureTest.java b/src/test/java/com/dropbox/sign/FixtureTest.java index 2bef238..d173e8d 100644 --- a/src/test/java/com/dropbox/sign/FixtureTest.java +++ b/src/test/java/com/dropbox/sign/FixtureTest.java @@ -2,8 +2,8 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.nio.file.Files; import java.nio.file.Paths; @@ -58,7 +58,7 @@ public void testFixture() throws Exception { JsonNode actual = mapper.readTree(serialized); // String comparison doesn't work due to json fields may be out of order - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } } } diff --git a/src/test/java/com/dropbox/sign/SubFormFieldsPerDocumentTest.java b/src/test/java/com/dropbox/sign/SubFormFieldsPerDocumentTest.java index 4dcbdde..0ec09f9 100644 --- a/src/test/java/com/dropbox/sign/SubFormFieldsPerDocumentTest.java +++ b/src/test/java/com/dropbox/sign/SubFormFieldsPerDocumentTest.java @@ -4,8 +4,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.dropbox.sign.model.SubFormFieldsPerDocumentBase; import com.fasterxml.jackson.databind.node.ObjectNode; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.nio.file.Files; import java.nio.file.Paths; @@ -30,13 +31,13 @@ public void testSubFormFieldsPerDocumentBase() throws Exception { SubFormFieldsPerDocumentBase base = SubFormFieldsPerDocumentBase.init(expected.toString()); - Assert.assertTrue(Class.forName(packageNamePrefix + fieldName).isInstance(base)); + assertTrue(Class.forName(packageNamePrefix + fieldName).isInstance(base)); String serialized = mapper.writeValueAsString(base); JsonNode actual = mapper.readTree(serialized); // String comparison doesn't work due to json fields may be out of order - Assert.assertEquals(expected, actual); + assertEquals(expected, actual); } } @@ -57,7 +58,7 @@ public void testSignersAllowsInt() throws Exception { SubFormFieldsPerDocumentBase result = SubFormFieldsPerDocumentBase.init(data.toString()); - Assert.assertEquals(expected_signer, result.getSigner()); + assertEquals(expected_signer, result.getSigner()); } } @@ -78,7 +79,7 @@ public void testSignersAllowsString() throws Exception { SubFormFieldsPerDocumentBase result = SubFormFieldsPerDocumentBase.init(data.toString()); - Assert.assertEquals(expected_signer, result.getSigner()); + assertEquals(expected_signer, result.getSigner()); } } } diff --git a/src/test/java/com/dropbox/sign/api/AccountApiTest.java b/src/test/java/com/dropbox/sign/api/AccountApiTest.java index 334e8d2..04e0e64 100644 --- a/src/test/java/com/dropbox/sign/api/AccountApiTest.java +++ b/src/test/java/com/dropbox/sign/api/AccountApiTest.java @@ -5,8 +5,9 @@ import com.dropbox.sign.TestHelper; import com.dropbox.sign.model.*; import com.fasterxml.jackson.databind.JsonNode; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.stream.IntStream; @@ -24,7 +25,7 @@ public void accountCreateTest() throws Exception { AccountApi accountApi = new AccountApi(apiClient); AccountCreateResponse response = accountApi.accountCreate(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -36,7 +37,7 @@ public void accountGetTest() throws Exception { AccountApi accountApi = new AccountApi(apiClient); AccountGetResponse response = accountApi.accountGet(null, "jack@example.com"); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -52,7 +53,7 @@ public void accountUpdateTest() throws Exception { AccountApi accountApi = new AccountApi(apiClient); AccountGetResponse response = accountApi.accountUpdate(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -68,7 +69,7 @@ public void accountVerifyTest() throws Exception { AccountApi accountApi = new AccountApi(apiClient); AccountVerifyResponse response = accountApi.accountVerify(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -85,10 +86,10 @@ public void testHttpCodeRange() throws Exception { ApiClient apiClient = TestHelper.setUpMock(value, expectedResponse); AccountApi accountApi = new AccountApi(apiClient); accountApi.accountVerify(request); - Assert.fail(); + fail(); } catch (ApiException e) { - Assert.assertEquals(value, e.getCode()); - Assert.assertEquals(expectedResponse, e.getErrorResponse()); + assertEquals(value, e.getCode()); + assertEquals(expectedResponse, e.getErrorResponse()); } }); } diff --git a/src/test/java/com/dropbox/sign/api/ApiAppApiTest.java b/src/test/java/com/dropbox/sign/api/ApiAppApiTest.java index ddaee98..3c0d800 100644 --- a/src/test/java/com/dropbox/sign/api/ApiAppApiTest.java +++ b/src/test/java/com/dropbox/sign/api/ApiAppApiTest.java @@ -4,8 +4,9 @@ import com.dropbox.sign.TestHelper; import com.dropbox.sign.model.*; import com.fasterxml.jackson.databind.JsonNode; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.File; @@ -24,7 +25,7 @@ public void apiAppCreateTest() throws Exception { ApiAppApi api = new ApiAppApi(apiClient); ApiAppGetResponse response = api.apiAppCreate(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -45,7 +46,7 @@ public void apiAppGetTest() throws Exception { ApiAppApi api = new ApiAppApi(apiClient); ApiAppGetResponse response = api.apiAppGet(clientId); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -57,7 +58,7 @@ public void apiAppListTest() throws Exception { ApiAppApi api = new ApiAppApi(apiClient); ApiAppListResponse response = api.apiAppList(1, 20); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -76,6 +77,6 @@ public void apiAppUpdateTest() throws Exception { ApiAppApi api = new ApiAppApi(apiClient); ApiAppGetResponse response = api.apiAppUpdate(clientId, request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } } diff --git a/src/test/java/com/dropbox/sign/api/BulkSendJobApiTest.java b/src/test/java/com/dropbox/sign/api/BulkSendJobApiTest.java index 08534d1..e70b325 100644 --- a/src/test/java/com/dropbox/sign/api/BulkSendJobApiTest.java +++ b/src/test/java/com/dropbox/sign/api/BulkSendJobApiTest.java @@ -4,8 +4,9 @@ import com.dropbox.sign.TestHelper; import com.dropbox.sign.model.*; import com.fasterxml.jackson.databind.JsonNode; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class BulkSendJobApiTest { @Test @@ -18,7 +19,7 @@ public void bulkSendJobGetTest() throws Exception { BulkSendJobApi api = new BulkSendJobApi(apiClient); BulkSendJobGetResponse response = api.bulkSendJobGet(id); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -30,6 +31,6 @@ public void bulkSendJobListTest() throws Exception { BulkSendJobApi api = new BulkSendJobApi(apiClient); BulkSendJobListResponse response = api.bulkSendJobList(1, 20); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } } diff --git a/src/test/java/com/dropbox/sign/api/EmbeddedApiTest.java b/src/test/java/com/dropbox/sign/api/EmbeddedApiTest.java index 6bb3ed8..e52f455 100644 --- a/src/test/java/com/dropbox/sign/api/EmbeddedApiTest.java +++ b/src/test/java/com/dropbox/sign/api/EmbeddedApiTest.java @@ -4,8 +4,9 @@ import com.dropbox.sign.TestHelper; import com.dropbox.sign.model.*; import com.fasterxml.jackson.databind.JsonNode; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class EmbeddedApiTest { @Test @@ -23,7 +24,7 @@ public void embeddedEditUrlTest() throws Exception { EmbeddedApi api = new EmbeddedApi(apiClient); EmbeddedEditUrlResponse response = api.embeddedEditUrl(templateId, request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -37,6 +38,6 @@ public void embeddedSignUrlTest() throws Exception { EmbeddedApi api = new EmbeddedApi(apiClient); EmbeddedSignUrlResponse response = api.embeddedSignUrl(signatureId); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } } diff --git a/src/test/java/com/dropbox/sign/api/OAuthApiTest.java b/src/test/java/com/dropbox/sign/api/OAuthApiTest.java index 2eb9518..fe95c51 100644 --- a/src/test/java/com/dropbox/sign/api/OAuthApiTest.java +++ b/src/test/java/com/dropbox/sign/api/OAuthApiTest.java @@ -4,8 +4,9 @@ import com.dropbox.sign.TestHelper; import com.dropbox.sign.model.*; import com.fasterxml.jackson.databind.JsonNode; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class OAuthApiTest { @Test @@ -21,7 +22,7 @@ public void oauthTokenGenerateTest() throws Exception { OAuthApi api = new OAuthApi(apiClient); OAuthTokenResponse response = api.oauthTokenGenerate(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -37,6 +38,6 @@ public void oauthTokenRefreshTest() throws Exception { OAuthApi api = new OAuthApi(apiClient); OAuthTokenResponse response = api.oauthTokenRefresh(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } } diff --git a/src/test/java/com/dropbox/sign/api/ReportApiTest.java b/src/test/java/com/dropbox/sign/api/ReportApiTest.java index 0dde796..65c4a9c 100644 --- a/src/test/java/com/dropbox/sign/api/ReportApiTest.java +++ b/src/test/java/com/dropbox/sign/api/ReportApiTest.java @@ -4,8 +4,9 @@ import com.dropbox.sign.TestHelper; import com.dropbox.sign.model.*; import com.fasterxml.jackson.databind.JsonNode; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class ReportApiTest { @Test @@ -21,6 +22,6 @@ public void reportCreateTest() throws Exception { ReportApi api = new ReportApi(apiClient); ReportCreateResponse response = api.reportCreate(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } } diff --git a/src/test/java/com/dropbox/sign/api/SignatureRequestApiTest.java b/src/test/java/com/dropbox/sign/api/SignatureRequestApiTest.java index ed48f9c..eadcbb2 100644 --- a/src/test/java/com/dropbox/sign/api/SignatureRequestApiTest.java +++ b/src/test/java/com/dropbox/sign/api/SignatureRequestApiTest.java @@ -4,8 +4,9 @@ import com.dropbox.sign.TestHelper; import com.dropbox.sign.model.*; import com.fasterxml.jackson.databind.JsonNode; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.mockito.Mockito; import static org.mockito.ArgumentMatchers.any; @@ -50,7 +51,7 @@ public void initAcceptsHashMap() throws Exception { ); assert data.getFormFieldsPerDocument() != null; - Assert.assertEquals( + assertEquals( "signature", data.getFormFieldsPerDocument().get(0).getType() ); @@ -70,7 +71,7 @@ public void signatureRequestBulkCreateEmbeddedWithTemplateTest() throws Exceptio SignatureRequestApi api = new SignatureRequestApi(apiClient); BulkSendJobSendResponse response = api.signatureRequestBulkCreateEmbeddedWithTemplate(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -87,7 +88,7 @@ public void signatureRequestBulkSendWithTemplateTest() throws Exception { SignatureRequestApi api = new SignatureRequestApi(apiClient); BulkSendJobSendResponse response = api.signatureRequestBulkSendWithTemplate(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -111,7 +112,7 @@ public void signatureRequestCreateEmbeddedTest() throws Exception { SignatureRequestApi api = new SignatureRequestApi(apiClient); SignatureRequestGetResponse response = api.signatureRequestCreateEmbedded(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -128,7 +129,7 @@ public void signatureRequestCreateEmbeddedWithTemplateTest() throws Exception { SignatureRequestApi api = new SignatureRequestApi(apiClient); SignatureRequestGetResponse response = api.signatureRequestCreateEmbeddedWithTemplate(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -147,7 +148,7 @@ public void signatureRequestGetTest() throws Exception { SignatureRequestApi api = new SignatureRequestApi(apiClient); SignatureRequestGetResponse response = api.signatureRequestGet(signatureRequestId); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -166,7 +167,7 @@ public void signatureRequestListTest() throws Exception { null ); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -180,7 +181,7 @@ public void signatureRequestReleaseHoldTest() throws Exception { SignatureRequestApi api = new SignatureRequestApi(apiClient); SignatureRequestGetResponse response = api.signatureRequestReleaseHold(signatureRequestId); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -198,7 +199,7 @@ public void signatureRequestRemindTest() throws Exception { SignatureRequestApi api = new SignatureRequestApi(apiClient); SignatureRequestGetResponse response = api.signatureRequestRemind(signatureRequestId, request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -222,7 +223,7 @@ public void signatureRequestSendTest() throws Exception { SignatureRequestApi api = new SignatureRequestApi(apiClient); SignatureRequestGetResponse response = api.signatureRequestSend(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -299,7 +300,7 @@ public void signatureRequestSendWithTemplateTest() throws Exception { SignatureRequestApi api = new SignatureRequestApi(apiClient); SignatureRequestGetResponse response = api.signatureRequestSendWithTemplate(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -317,6 +318,6 @@ public void signatureRequestUpdateTest() throws Exception { SignatureRequestApi api = new SignatureRequestApi(apiClient); SignatureRequestGetResponse response = api.signatureRequestUpdate(signatureRequestId, request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } } diff --git a/src/test/java/com/dropbox/sign/api/TeamApiTest.java b/src/test/java/com/dropbox/sign/api/TeamApiTest.java index a97b2b7..bc9e77e 100644 --- a/src/test/java/com/dropbox/sign/api/TeamApiTest.java +++ b/src/test/java/com/dropbox/sign/api/TeamApiTest.java @@ -4,8 +4,9 @@ import com.dropbox.sign.TestHelper; import com.dropbox.sign.model.*; import com.fasterxml.jackson.databind.JsonNode; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * API tests for TeamApi @@ -24,7 +25,7 @@ public void teamAddMemberTest() throws Exception { TeamApi api = new TeamApi(apiClient); TeamGetResponse response = api.teamAddMember(request, null); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -40,7 +41,7 @@ public void teamCreateTest() throws Exception { TeamApi api = new TeamApi(apiClient); TeamGetResponse response = api.teamCreate(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -58,7 +59,7 @@ public void teamGetTest() throws Exception { TeamApi api = new TeamApi(apiClient); TeamGetResponse response = api.teamGet(); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -74,7 +75,7 @@ public void teamRemoveMemberTest() throws Exception { TeamApi api = new TeamApi(apiClient); TeamGetResponse response = api.teamRemoveMember(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -90,6 +91,6 @@ public void teamUpdateTest() throws Exception { TeamApi api = new TeamApi(apiClient); TeamGetResponse response = api.teamUpdate(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } } diff --git a/src/test/java/com/dropbox/sign/api/TemplateApiTest.java b/src/test/java/com/dropbox/sign/api/TemplateApiTest.java index d69a966..5c1d04b 100644 --- a/src/test/java/com/dropbox/sign/api/TemplateApiTest.java +++ b/src/test/java/com/dropbox/sign/api/TemplateApiTest.java @@ -4,8 +4,9 @@ import com.dropbox.sign.TestHelper; import com.dropbox.sign.model.*; import com.fasterxml.jackson.databind.JsonNode; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.File; @@ -25,7 +26,7 @@ public void templateAddUserTest() throws Exception { TemplateApi api = new TemplateApi(apiClient); TemplateGetResponse response = api.templateAddUser(templateId, request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -42,7 +43,7 @@ public void templateCreateEmbeddedDraftTest() throws Exception { TemplateApi api = new TemplateApi(apiClient); TemplateCreateEmbeddedDraftResponse response = api.templateCreateEmbeddedDraft(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -68,7 +69,7 @@ public void templateGetTest() throws Exception { TemplateApi api = new TemplateApi(apiClient); TemplateGetResponse response = api.templateGet(templateId); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -82,7 +83,7 @@ public void templateListTest() throws Exception { TemplateApi api = new TemplateApi(apiClient); TemplateListResponse response = api.templateList(accountId, 1, 20, null); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -100,7 +101,7 @@ public void templateRemoveUserTest() throws Exception { TemplateApi api = new TemplateApi(apiClient); TemplateGetResponse response = api.templateRemoveUser(templateId, request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -119,6 +120,6 @@ public void templateUpdateFilesTest() throws Exception { TemplateApi api = new TemplateApi(apiClient); TemplateUpdateFilesResponse response = api.templateUpdateFiles(templateId, request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } } diff --git a/src/test/java/com/dropbox/sign/api/UnclaimedDraftApiTest.java b/src/test/java/com/dropbox/sign/api/UnclaimedDraftApiTest.java index 6ee2b65..5d92e30 100644 --- a/src/test/java/com/dropbox/sign/api/UnclaimedDraftApiTest.java +++ b/src/test/java/com/dropbox/sign/api/UnclaimedDraftApiTest.java @@ -4,8 +4,9 @@ import com.dropbox.sign.TestHelper; import com.dropbox.sign.model.*; import com.fasterxml.jackson.databind.JsonNode; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.File; @@ -24,7 +25,7 @@ public void unclaimedDraftCreateTest() throws Exception { UnclaimedDraftApi api = new UnclaimedDraftApi(apiClient); UnclaimedDraftCreateResponse response = api.unclaimedDraftCreate(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -41,7 +42,7 @@ public void unclaimedDraftCreateEmbeddedTest() throws Exception { UnclaimedDraftApi api = new UnclaimedDraftApi(apiClient); UnclaimedDraftCreateResponse response = api.unclaimedDraftCreateEmbedded(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -58,7 +59,7 @@ public void unclaimedDraftCreateEmbeddedWithTemplateTest() throws Exception { UnclaimedDraftApi api = new UnclaimedDraftApi(apiClient); UnclaimedDraftCreateResponse response = api.unclaimedDraftCreateEmbeddedWithTemplate(request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } @Test @@ -76,6 +77,6 @@ public void unclaimedDraftEditAndResendTest() throws Exception { UnclaimedDraftApi api = new UnclaimedDraftApi(apiClient); UnclaimedDraftCreateResponse response = api.unclaimedDraftEditAndResend(signatureRequestId, request); - Assert.assertEquals(expectedResponse, response); + assertEquals(expectedResponse, response); } } diff --git a/templates/ApiClient.mustache b/templates/ApiClient.mustache index 5191e62..9cf548d 100644 --- a/templates/ApiClient.mustache +++ b/templates/ApiClient.mustache @@ -1,25 +1,19 @@ {{>licenseInfo}} package {{invokerPackage}}; -{{#threetenbp}} -import org.threeten.bp.*; - -{{/threetenbp}} import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; {{#joda}} import com.fasterxml.jackson.datatype.joda.JodaModule; {{/joda}} -{{#java8}} import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -{{^threetenbp}} import java.time.OffsetDateTime; -{{/threetenbp}} -{{/java8}} -{{#threetenbp}} -import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; -{{/threetenbp}} +{{#useJakartaEe}} +import com.fasterxml.jackson.jakarta.rs.json.JacksonJsonProvider; +{{/useJakartaEe}} +{{^useJakartaEe}} import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; +{{/useJakartaEe}} import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; @@ -32,9 +26,9 @@ import com.sun.jersey.api.client.WebResource.Builder; import com.sun.jersey.multipart.FormDataMultiPart; import com.sun.jersey.multipart.file.FileDataBodyPart; -import javax.ws.rs.core.Cookie; -import javax.ws.rs.core.Response.Status.Family; -import javax.ws.rs.core.MediaType; +import {{javaxPackage}}.ws.rs.core.Cookie; +import {{javaxPackage}}.ws.rs.core.Response.Status.Family; +import {{javaxPackage}}.ws.rs.core.MediaType; import java.util.Collection; import java.util.Collections; @@ -125,16 +119,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { {{#joda}} objectMapper.registerModule(new JodaModule()); {{/joda}} - {{#java8}} objectMapper.registerModule(new JavaTimeModule()); - {{/java8}} - {{#threetenbp}} - ThreeTenModule module = new ThreeTenModule(); - module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); - module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); - module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); - objectMapper.registerModule(module); - {{/threetenbp}} objectMapper.setDateFormat(ApiClient.buildDefaultDateFormat()); dateFormat = ApiClient.buildDefaultDateFormat(); @@ -144,8 +129,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} - authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} + authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}} + authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} // Prevent the authentications from being modified. @@ -212,6 +197,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { public ApiClient setBasePath(String basePath) { this.basePath = basePath; + this.serverIndex = null; return this; } @@ -552,7 +538,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { List params = new ArrayList(); // preconditions - if (name == null || name.isEmpty() || value == null) { + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { return params; } diff --git a/templates/BeanValidationException.mustache b/templates/BeanValidationException.mustache index 3fc5b84..d8b0fa6 100644 --- a/templates/BeanValidationException.mustache +++ b/templates/BeanValidationException.mustache @@ -1,9 +1,11 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import java.util.Set; -import javax.validation.ConstraintViolation; -import javax.validation.ValidationException; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.ValidationException; public class BeanValidationException extends ValidationException { /** diff --git a/templates/Configuration.mustache b/templates/Configuration.mustache index cb425df..8e9720e 100644 --- a/templates/Configuration.mustache +++ b/templates/Configuration.mustache @@ -4,6 +4,8 @@ package {{invokerPackage}}; {{>generatedAnnotation}} public class Configuration { + public static final String VERSION = "{{{artifactVersion}}}"; + private static ApiClient defaultApiClient = new ApiClient(); /** diff --git a/templates/CustomInstantDeserializer.mustache b/templates/CustomInstantDeserializer.mustache index 5ebea81..d4a3ca9 100644 --- a/templates/CustomInstantDeserializer.mustache +++ b/templates/CustomInstantDeserializer.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import com.fasterxml.jackson.core.JsonParser; diff --git a/templates/JSON.mustache b/templates/JSON.mustache index 00c5530..1d0a813 100644 --- a/templates/JSON.mustache +++ b/templates/JSON.mustache @@ -19,11 +19,6 @@ import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatterBuilder; import org.joda.time.format.ISODateTimeFormat; {{/joda}} -{{#threetenbp}} -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; -{{/threetenbp}} {{#models.0}} import {{modelPackage}}.*; @@ -36,11 +31,9 @@ import java.lang.reflect.Type; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; -{{#java8}} import java.time.LocalDate; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; -{{/java8}} import java.util.Date; import java.util.Locale; import java.util.Map; diff --git a/templates/JavaTimeFormatter.mustache b/templates/JavaTimeFormatter.mustache index 07d0eb6..f3fb34e 100644 --- a/templates/JavaTimeFormatter.mustache +++ b/templates/JavaTimeFormatter.mustache @@ -1,16 +1,9 @@ {{>licenseInfo}} package {{invokerPackage}}; -{{^threetenbp}} import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; -{{/threetenbp}} -{{#threetenbp}} -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; -import org.threeten.bp.format.DateTimeParseException; -{{/threetenbp}} /** * Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class. diff --git a/templates/README.mustache b/templates/README.mustache index d752b70..03b31fa 100644 --- a/templates/README.mustache +++ b/templates/README.mustache @@ -1,13 +1,60 @@ # {{artifactId}} +{{^useCustomTemplateCode}} +{{appName}} + +- API version: {{appVersion}} +{{^hideGenerationTimestamp}} + +- Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} + +- Generator version: {{generatorVersion}} + +{{{appDescriptionWithNewLines}}} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} {{#appDescriptionWithNewLines}} {{{.}}} {{/appDescriptionWithNewLines}} +{{/useCustomTemplateCode}} {{#infoUrl}} For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) {{/infoUrl}} +{{^useCustomTemplateCode}} +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + +## Requirements + +Building the API client library requires: + +1. Java 1.8+ +{{#jersey2}} +2. Maven (3.8.3+)/Gradle (7.2+) +{{/jersey2}} +{{^jersey2}} +2. Maven/Gradle +{{/jersey2}} + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} ## Migrating from legacy SDK This SDK is generated from our officially maintained [OpenAPI spec](https://github.com/hellosign/hellosign-openapi/blob/main/openapi.yaml). @@ -51,6 +98,7 @@ Run the following and everything is done for you: *Attention*: Any changes you have made to the SDK code that you have not made to the OAS file and/or the mustache template files _will be lost_ when you run this command. +{{/useCustomTemplateCode}} ### Maven users @@ -93,6 +141,7 @@ Then manually install the following JARs: - `target/{{{artifactId}}}-{{{artifactVersion}}}.jar` - `target/lib/*.jar` +{{#useCustomTemplateCode}} ## Getting Started Please follow the [installation](#installation) instruction and execute the following Java code: @@ -103,34 +152,111 @@ REPLACE_ME_WITH_EXAMPLE_FOR__{{{operationId}}}_Java_CODE ``` {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +{{/useCustomTemplateCode}} {{#jersey2}} - ## Using a Proxy - - To add a HTTP proxy for the API client, use `ClientConfig`: - - ```java - {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} - import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; - import org.glassfish.jersey.client.ClientConfig; - import org.glassfish.jersey.client.ClientProperties; - import {{{invokerPackage}}}.*; - import {{{package}}}.{{{classname}}}; - - ... +{{^useCustomTemplateCode}} +## Usage +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} +## Using a Proxy +{{/useCustomTemplateCode}} + +To add a HTTP proxy for the API client, use `ClientConfig`: +```java +{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} +import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; +import {{{invokerPackage}}}.*; +import {{{package}}}.{{{classname}}}; + +... + +ApiClient defaultClient = Configuration.getDefaultApiClient(); +ClientConfig clientConfig = defaultClient.getClientConfig(); +clientConfig.connectorProvider(new ApacheConnectorProvider()); +clientConfig.property(ClientProperties.PROXY_URI, "http://proxy_url_here"); +clientConfig.property(ClientProperties.PROXY_USERNAME, "proxy_username"); +clientConfig.property(ClientProperties.PROXY_PASSWORD, "proxy_password"); +defaultClient.setClientConfig(clientConfig); + +{{{classname}}} apiInstance = new {{{classname}}}(defaultClient); +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` - ApiClient defaultClient = Configuration.getDefaultApiClient(); - ClientConfig clientConfig = defaultClient.getClientConfig(); - clientConfig.connectorProvider(new ApacheConnectorProvider()); - clientConfig.property(ClientProperties.PROXY_URI, "http://proxy_url_here"); - clientConfig.property(ClientProperties.PROXY_USERNAME, "proxy_username"); - clientConfig.property(ClientProperties.PROXY_PASSWORD, "proxy_password"); - defaultClient.setClientConfig(clientConfig); +{{/jersey2}} +{{^useCustomTemplateCode}} +## Getting Started - {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); - {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} - ``` +Please follow the [installation](#installation) instruction and execute the following Java code: -{{/jersey2}} +```java +{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} +import {{{invokerPackage}}}.*; +import {{{invokerPackage}}}.auth.*; +import {{{modelPackage}}}.*; +import {{{package}}}.{{{classname}}}; + +public class {{{classname}}}Example { + + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("{{{basePath}}}"); + {{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + // Configure HTTP basic authorization: {{{name}}} + HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setUsername("YOUR USERNAME"); + {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}} + // Configure HTTP bearer authorization: {{{name}}} + HttpBearerAuth {{{name}}} = (HttpBearerAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} + // Configure API key authorization: {{{name}}} + ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} + // Configure OAuth2 access token for authorization: {{{name}}} + OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}}{{#isHttpSignature}} + // Configure HTTP signature authorization: {{{name}}} + HttpSignatureAuth {{{name}}} = (HttpSignatureAuth) defaultClient.getAuthentication("{{{name}}}"); + // All the HTTP signature parameters below should be customized to your environment. + // Configure the keyId + {{{name}}}.setKeyId("YOUR KEY ID"); + // Configure the signature algorithm + {{{name}}}.setSigningAlgorithm(SigningAlgorithm.HS2019); + // Configure the specific cryptographic algorithm + {{{name}}}.setAlgorithm(Algorithm.ECDSA_SHA256); + // Configure the cryptographic algorithm parameters, if applicable + {{{name}}}.setAlgorithmParameterSpec(null); + // Set the cryptographic digest algorithm. + {{{name}}}.setDigestAlgorithm("SHA-256"); + // Set the HTTP headers that should be included in the HTTP signature. + {{{name}}}.setHeaders(Arrays.asList("date", "host")); + // Set the private key used to sign the HTTP messages + {{{name}}}.setPrivateKey();{{/isHttpSignature}} + {{/authMethods}} + {{/hasAuthMethods}} + + {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); + {{#allParams}} + {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} + {{/allParams}} + try { + {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + System.out.println(result);{{/returnType}} + } catch (ApiException e) { + System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` +{{/useCustomTemplateCode}} ## Documentation for API Endpoints @@ -146,11 +272,14 @@ Class | Method | HTTP request | Description {{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md) {{/model}}{{/models}} + ## Documentation for Authorization -{{^authMethods}}All endpoints do not require authorization. -{{/authMethods}}Authentication schemes defined for the API: -{{#authMethods}}### {{name}} +{{^authMethods}}Endpoints do not require authorization.{{/authMethods}} +{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}} +{{#authMethods}} + +### {{name}} {{#isApiKey}} @@ -158,10 +287,18 @@ Class | Method | HTTP request | Description - **API key parameter name**: {{keyParamName}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} {{/isApiKey}} -{{#isBasic}} +{{#isBasicBasic}} - **Type**: HTTP basic authentication -{{/isBasic}} +{{/isBasicBasic}} +{{#isBasicBearer}} + +- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} +{{/isBasicBearer}} +{{#isHttpSignature}} + +- **Type**: HTTP signature authentication +{{/isHttpSignature}} {{#isOAuth}} - **Type**: OAuth @@ -183,6 +320,7 @@ It's recommended to create an instance of `ApiClient` per thread in a multithrea {{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} {{/-last}}{{/apis}}{{/apiInfo}} +{{#useCustomTemplateCode}} ## About this package This Java package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: @@ -220,3 +358,4 @@ mvn clean deploy ``` Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. +{{/useCustomTemplateCode}} diff --git a/templates/RFC3339DateFormat.mustache b/templates/RFC3339DateFormat.mustache index 46c7bb4..d35040f 100644 --- a/templates/RFC3339DateFormat.mustache +++ b/templates/RFC3339DateFormat.mustache @@ -7,9 +7,11 @@ import java.text.DateFormat; import java.text.FieldPosition; import java.text.ParsePosition; import java.util.Date; +import java.text.DecimalFormat; import java.util.GregorianCalendar; import java.util.TimeZone; +{{>generatedAnnotation}} public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); @@ -20,6 +22,7 @@ public class RFC3339DateFormat extends DateFormat { public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.numberFormat = new DecimalFormat(); } @Override @@ -41,4 +44,4 @@ public class RFC3339DateFormat extends DateFormat { public Object clone() { return super.clone(); } -} \ No newline at end of file +} diff --git a/templates/ServerConfiguration.mustache b/templates/ServerConfiguration.mustache index e21b633..7284004 100644 --- a/templates/ServerConfiguration.mustache +++ b/templates/ServerConfiguration.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import java.util.Map; @@ -5,6 +7,7 @@ import java.util.Map; /** * Representing a Server configuration. */ +{{>generatedAnnotation}} public class ServerConfiguration { public String URL; public String description; @@ -39,10 +42,10 @@ public class ServerConfiguration { if (variables != null && variables.containsKey(name)) { value = variables.get(name); if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { - throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + "."); + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); } } - url = url.replaceAll("\\{" + name + "\\}", value); + url = url.replace("{" + name + "}", value); } return url; } diff --git a/templates/ServerVariable.mustache b/templates/ServerVariable.mustache index 1978b1e..41246a7 100644 --- a/templates/ServerVariable.mustache +++ b/templates/ServerVariable.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import java.util.HashSet; @@ -5,6 +7,7 @@ import java.util.HashSet; /** * Representing a Server Variable for server URL template substitution. */ +{{>generatedAnnotation}} public class ServerVariable { public String description; public String defaultValue; diff --git a/templates/additionalOneOfTypeAnnotations.mustache b/templates/additionalOneOfTypeAnnotations.mustache new file mode 100644 index 0000000..283f8f9 --- /dev/null +++ b/templates/additionalOneOfTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalOneOfTypeAnnotations}}{{{.}}} +{{/additionalOneOfTypeAnnotations}} \ No newline at end of file diff --git a/templates/api.mustache b/templates/api.mustache index 28b18e2..8ce0ae1 100644 --- a/templates/api.mustache +++ b/templates/api.mustache @@ -13,12 +13,10 @@ import {{invokerPackage}}.Pair; {{/imports}} -{{^fullJavaUtil}} import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} {{>generatedAnnotation}} {{#operations}} @@ -46,7 +44,7 @@ public class {{classname}} { * {{summary}} * {{notes}} {{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/isContainer}}{{/required}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} {{/allParams}} {{#returnType}} * @return {{.}} @@ -76,11 +74,11 @@ public class {{classname}} { .replaceAll("\\{" + "{{baseName}}" + "\\}", apiClient.escapeString({{{paramName}}}.toString())){{/pathParams}}; // query params - {{javaUtilPrefix}}List localVarQueryParams = new {{javaUtilPrefix}}ArrayList(); - {{javaUtilPrefix}}List localVarCollectionQueryParams = new {{javaUtilPrefix}}ArrayList(); - {{javaUtilPrefix}}Map localVarHeaderParams = new {{javaUtilPrefix}}HashMap(); - {{javaUtilPrefix}}Map localVarCookieParams = new {{javaUtilPrefix}}HashMap(); - {{javaUtilPrefix}}Map localVarFormParams = new {{javaUtilPrefix}}HashMap(); + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); {{#queryParams}} {{#collectionFormat}}localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("{{{.}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(apiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); diff --git a/templates/apiException.mustache b/templates/apiException.mustache index 5b450c9..8944867 100644 --- a/templates/apiException.mustache +++ b/templates/apiException.mustache @@ -7,6 +7,8 @@ import java.util.List; {{>generatedAnnotation}} public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ + private static final long serialVersionUID = 1L; + private int code = 0; private Map> responseHeaders = null; private String responseBody = null; @@ -37,7 +39,7 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us } public ApiException(int code, Map> responseHeaders, String responseBody) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); } public ApiException(int code, String message) { @@ -77,4 +79,13 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us public String getResponseBody() { return responseBody; } + + @Override + public String toString() { + return "ApiException{" + + "code=" + code + + ", responseHeaders=" + responseHeaders + + ", responseBody='" + responseBody + '\'' + + '}'; + } } diff --git a/templates/api_doc.mustache b/templates/api_doc.mustache index 78783f1..5ab8c9d 100644 --- a/templates/api_doc.mustache +++ b/templates/api_doc.mustache @@ -4,10 +4,18 @@ All URIs are relative to *{{basePath}}* +{{^useCustomTemplateCode}} +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +{{#operations}}{{#operation}}| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{commonPath}}{{path}} | {{summary}} | +{{/operation}}{{/operations}} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} Method | HTTP request | Description ------------- | ------------- | ------------- {{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{commonPath}}{{path}} | {{summary}} {{/operation}}{{/operations}} +{{/useCustomTemplateCode}} {{#operations}} {{#operation}} @@ -75,11 +83,20 @@ public class Example { ### Parameters +{{^useCustomTemplateCode}} +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------|{{/-last}}{{/allParams}} +{{#allParams}}| **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} | +{{/allParams}} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} {{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} {{/allParams}} +{{/useCustomTemplateCode}} ### Return type diff --git a/templates/api_test.mustache b/templates/api_test.mustache index b3a544d..155f46e 100644 --- a/templates/api_test.mustache +++ b/templates/api_test.mustache @@ -5,21 +5,21 @@ package {{package}}; import {{invokerPackage}}.ApiException; {{#imports}}import {{import}}; {{/imports}} -import org.junit.Test; -import org.junit.Ignore; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -{{^fullJavaUtil}} +import java.time.LocalDate; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} /** * API tests for {{classname}} */ -public class {{classname}}Test { +class {{classname}}Test { private final {{classname}} api = new {{classname}}(); @@ -38,7 +38,7 @@ public class {{classname}}Test { * if the Api call fails */ @Test - public void {{operationId}}Test() throws ApiException { + void {{operationId}}Test() throws ApiException { //{{#allParams}} //{{{dataType}}} {{paramName}} = null; //{{/allParams}} diff --git a/templates/auth/HttpBasicAuth.mustache b/templates/auth/HttpBasicAuth.mustache index 4d362cb..b5c72de 100644 --- a/templates/auth/HttpBasicAuth.mustache +++ b/templates/auth/HttpBasicAuth.mustache @@ -4,21 +4,12 @@ package {{invokerPackage}}.auth; import {{invokerPackage}}.Pair; -{{^java8}} -import com.migcomponents.migbase64.Base64; -{{/java8}} -{{#java8}} import java.util.Base64; import java.nio.charset.StandardCharsets; -{{/java8}} import java.util.Map; import java.util.List; -{{^java8}} -import java.io.UnsupportedEncodingException; -{{/java8}} - {{>generatedAnnotation}} public class HttpBasicAuth implements Authentication { private String username; @@ -46,15 +37,6 @@ public class HttpBasicAuth implements Authentication { return; } String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); -{{^java8}} - try { - headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - } -{{/java8}} -{{#java8}} headerParams.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); -{{/java8}} } } diff --git a/templates/auth/HttpBearerAuth.mustache b/templates/auth/HttpBearerAuth.mustache index 322281f..6ed2110 100644 --- a/templates/auth/HttpBearerAuth.mustache +++ b/templates/auth/HttpBearerAuth.mustache @@ -4,13 +4,15 @@ package {{invokerPackage}}.auth; import {{invokerPackage}}.Pair; -import java.util.Map; import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Supplier; {{>generatedAnnotation}} public class HttpBearerAuth implements Authentication { private final String scheme; - private String bearerToken; + private Supplier tokenSupplier; public HttpBearerAuth(String scheme) { this.scheme = scheme; @@ -22,7 +24,7 @@ public class HttpBearerAuth implements Authentication { * @return The bearer token */ public String getBearerToken() { - return bearerToken; + return tokenSupplier.get(); } /** @@ -31,12 +33,22 @@ public class HttpBearerAuth implements Authentication { * @param bearerToken The bearer token to send in the Authorization header */ public void setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; + this.tokenSupplier = () -> bearerToken; + } + + /** + * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header + */ + public void setBearerToken(Supplier tokenSupplier) { + this.tokenSupplier = tokenSupplier; } @Override public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { - if(bearerToken == null) { + String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null); + if (bearerToken == null) { return; } diff --git a/templates/auth/OAuthFlow.mustache b/templates/auth/OAuthFlow.mustache index 05bbf28..7a42526 100644 --- a/templates/auth/OAuthFlow.mustache +++ b/templates/auth/OAuthFlow.mustache @@ -2,10 +2,13 @@ package {{invokerPackage}}.auth; +/** + * OAuth flows that are supported by this client + */ {{>generatedAnnotation}} public enum OAuthFlow { - accessCode, //called authorizationCode in OpenAPI 3.0 - implicit, - password, - application //called clientCredentials in OpenAPI 3.0 + ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 + IMPLICIT, + PASSWORD, + APPLICATION //called clientCredentials in OpenAPI 3.0 } diff --git a/templates/beanValidation.mustache b/templates/beanValidation.mustache index 1bc9afa..47f7109 100644 --- a/templates/beanValidation.mustache +++ b/templates/beanValidation.mustache @@ -1,5 +1,7 @@ {{#required}} +{{^isReadOnly}} @NotNull +{{/isReadOnly}} {{/required}} {{#isContainer}} {{^isPrimitiveType}} diff --git a/templates/beanValidationQueryParams.mustache b/templates/beanValidationQueryParams.mustache index c4ff01d..0f99bff 100644 --- a/templates/beanValidationQueryParams.mustache +++ b/templates/beanValidationQueryParams.mustache @@ -1 +1 @@ -{{#required}} @NotNull{{/required}}{{>beanValidationCore}} \ No newline at end of file +{{#required}} @NotNull {{/required}}{{>beanValidationCore}} \ No newline at end of file diff --git a/templates/build.gradle.mustache b/templates/build.gradle.mustache index d9718c1..06f9bd5 100644 --- a/templates/build.gradle.mustache +++ b/templates/build.gradle.mustache @@ -32,14 +32,8 @@ if(hasProperty('target') && target == 'android') { } compileOptions { - {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 - {{/java8}} - {{^java8}} - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - {{/java8}} } // Rename the aar correctly @@ -63,9 +57,9 @@ if(hasProperty('target') && target == 'android') { def task = project.tasks.create "jar${variant.name.capitalize()}", Jar task.description = "Create jar artifact for ${variant.name}" task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - task.destinationDir = project.file("${project.buildDir}/outputs/jar") - task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + task.from variant.javaCompile.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" artifacts.add('archives', task); } } @@ -84,14 +78,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven-publish' - {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - {{/java8}} - {{^java8}} - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 - {{/java8}} publishing { publications { @@ -126,18 +114,18 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.6.3" - jackson_version = "2.12.5" - jackson_databind_version = "2.10.5.1" + jackson_version = "2.17.1" + jackson_databind_version = "2.17.1" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.2" + jackson_databind_nullable_version = "0.2.6" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" - {{#threetenbp}} - jackson_threetenbp_version = "2.9.10" - {{/threetenbp}} + {{#useBeanValidation}} + bean_validation_version = "3.0.2" + {{/useBeanValidation}} jersey_version = "1.19.4" jodatime_version = "2.9.9" - junit_version = "4.13.1" + junit_version = "5.10.2" } dependencies { @@ -155,15 +143,26 @@ dependencies { {{#joda}} implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" {{/joda}} - {{#java8}} implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" - {{/java8}} - {{#threetenbp}} - implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threetenbp_version" - {{/threetenbp}} - {{^java8}} - implementation "com.brsanthu:migbase64:2.2" - {{/java8}} implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + {{#useBeanValidation}} + implementation "jakarta.validation:jakarta.validation-api:$bean_validation_version" + {{/useBeanValidation}} testImplementation "junit:junit:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" +} + +test { + // Enable JUnit 5 (Gradle 4.6+). + useJUnitPlatform() + + // Always run tests, even when nothing changed. + dependsOn 'cleanTest' + + // Show test results. + testLogging { + events "passed", "skipped", "failed" + } + } diff --git a/templates/generatedAnnotation.mustache b/templates/generatedAnnotation.mustache index 875d7b9..e05689d 100644 --- a/templates/generatedAnnotation.mustache +++ b/templates/generatedAnnotation.mustache @@ -1 +1 @@ -@javax.annotation.Generated(value = "{{generatorClass}}"{{^hideGenerationTimestamp}}, date = "{{generatedDate}}"{{/hideGenerationTimestamp}}) \ No newline at end of file +@{{javaxPackage}}.annotation.Generated(value = "{{generatorClass}}"{{^hideGenerationTimestamp}}, date = "{{generatedDate}}"{{/hideGenerationTimestamp}}, comments = "Generator version: {{generatorVersion}}") \ No newline at end of file diff --git a/templates/gitignore.mustache b/templates/gitignore.mustache index b6717f0..05e10a1 100644 --- a/templates/gitignore.mustache +++ b/templates/gitignore.mustache @@ -18,12 +18,12 @@ hs_err_pid* **/target target .gradle -build/ - -.composer -vendor - -# Intellij -.idea/ - -.openapi-generator +build + +{{#useCustomTemplateCode}} +/.composer +/vendor +/.idea/ +/.openapi-generator +/.github/workflows/maven.yml +{{/useCustomTemplateCode}} diff --git a/templates/gradle-wrapper.properties.mustache b/templates/gradle-wrapper.properties.mustache index 774fae8..552ae67 100644 --- a/templates/gradle-wrapper.properties.mustache +++ b/templates/gradle-wrapper.properties.mustache @@ -1,5 +1,12 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +{{^useCustomTemplateCode}} +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip +{{/useCustomTemplateCode}} +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/templates/gradle.properties.mustache b/templates/gradle.properties.mustache index d445b39..101f52b 100644 --- a/templates/gradle.properties.mustache +++ b/templates/gradle.properties.mustache @@ -4,6 +4,7 @@ # Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties # For example, uncomment below to build for Android #target = android +{{#useCustomTemplateCode}} GROUP={{groupId}} POM_ARTIFACT_ID={{artifactId}} VERSION_NAME={{artifactVersion}} @@ -30,6 +31,7 @@ RELEASE_SIGNING_ENABLED=true SONATYPE_CONNECT_TIMEOUT_SECONDS=300 SONATYPE_CLOSE_TIMEOUT_SECONDS=900 +{{/useCustomTemplateCode}} {{#gradleProperties}} {{{.}}} {{/gradleProperties}} diff --git a/templates/gradlew.bat.mustache b/templates/gradlew.bat.mustache index 6a68175..25da30d 100644 --- a/templates/gradlew.bat.mustache +++ b/templates/gradlew.bat.mustache @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -33,20 +34,20 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/templates/gradlew.mustache b/templates/gradlew.mustache index 005bcde..9d0ce63 100644 --- a/templates/gradlew.mustache +++ b/templates/gradlew.mustache @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -69,37 +69,35 @@ app_path=$0 # Need this for daisy-chained symlinks. while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum warn () { - echo "$*" +echo "$*" } >&2 die () { - echo - echo "$*" - echo - exit 1 +echo +echo "$*" +echo +exit 1 } >&2 # OS specific support (must be 'true' or 'false'). @@ -108,10 +106,10 @@ msys=false darwin=false nonstop=false case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -119,39 +117,46 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." - fi +fi else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi +fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac fi # Collect all arguments for the java command, stacking in reverse order: @@ -164,46 +169,56 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi # Use "xargs" to parse quoted args. # @@ -225,10 +240,10 @@ set -- \ # eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' exec "$JAVACMD" "$@" diff --git a/templates/jackson_annotations.mustache b/templates/jackson_annotations.mustache index ccde126..4fbaf98 100644 --- a/templates/jackson_annotations.mustache +++ b/templates/jackson_annotations.mustache @@ -6,14 +6,9 @@ }} @JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}) @JsonInclude({{#isMap}}{{#items.isNullable}}content = JsonInclude.Include.ALWAYS, {{/items.isNullable}}{{/isMap}}value = JsonInclude.Include.{{#required}}ALWAYS{{/required}}{{^required}}USE_DEFAULTS{{/required}}) - {{#withXml}} - {{^isContainer}} - @JacksonXmlProperty({{#isXmlAttribute}}isAttribute = true, {{/isXmlAttribute}}{{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}localName = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/isContainer}} - {{#isContainer}} - {{#isXmlWrapped}} - // items.xmlName={{items.xmlName}} - @JacksonXmlElementWrapper(useWrapping = {{isXmlWrapped}}, {{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}localName = "{{#items.xmlName}}{{items.xmlName}}{{/items.xmlName}}{{^items.xmlName}}{{items.baseName}}{{/items.xmlName}}") - {{/isXmlWrapped}} - {{/isContainer}} - {{/withXml}} \ No newline at end of file +{{#withXml}} + @JacksonXmlProperty(localName = "{{items.xmlName}}{{^items.xmlName}}{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}{{/items.xmlName}}"{{#isXmlAttribute}}, isAttribute = true{{/isXmlAttribute}}{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{#isContainer}} + @JacksonXmlElementWrapper({{#isXmlWrapped}}localName = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}", {{#xmlNamespace}}namespace = "{{.}}", {{/xmlNamespace}}{{/isXmlWrapped}}useWrapping = {{isXmlWrapped}}) + {{/isContainer}} +{{/withXml}} \ No newline at end of file diff --git a/templates/javaBuilder.mustache b/templates/javaBuilder.mustache new file mode 100644 index 0000000..c027300 --- /dev/null +++ b/templates/javaBuilder.mustache @@ -0,0 +1,82 @@ +public static class Builder {{#parentModel}}extends {{classname}}.Builder {{/parentModel}}{ + + private {{classname}} instance; + + public Builder() { + this(new {{classname}}()); + } + + protected Builder({{classname}} instance) { + {{#parentModel}} + super(instance); + {{/parentModel}} + this.instance = instance; + } + + {{#vars}} + public {{classname}}.Builder {{name}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.instance.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + this.instance.{{name}} = {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + return this; + } + {{#vendorExtensions.x-is-jackson-optional-nullable}} + public {{classname}}.Builder {{name}}(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) { + this.instance.{{name}} = {{name}}; + return this; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{/vars}} + +{{#parentVars}} + public {{classname}}.Builder {{name}}({{{datatypeWithEnum}}} {{name}}) { // inherited: {{isInherited}} + super.{{name}}({{name}}); + return this; + } + {{#vendorExtensions.x-is-jackson-optional-nullable}} + public {{classname}}.Builder {{name}}(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) { + this.instance.{{name}} = {{name}}; + return this; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}} + + {{/parentVars}} + + /** + * returns a built {{classname}} instance. + * + * The builder is not reusable. + */ + public {{classname}} build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused{{#parentModel}} + super.build();{{/parentModel}} + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static {{classname}}.Builder builder() { + return new {{classname}}.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public {{classname}}.Builder toBuilder() { + return new {{classname}}.Builder(){{#allVars}} + .{{name}}({{getter}}()){{/allVars}}; + } diff --git a/templates/libraries/apache-httpclient/ApiClient.mustache b/templates/libraries/apache-httpclient/ApiClient.mustache index 371f8ee..a00c6dc 100644 --- a/templates/libraries/apache-httpclient/ApiClient.mustache +++ b/templates/libraries/apache-httpclient/ApiClient.mustache @@ -1,52 +1,42 @@ {{>licenseInfo}} package {{invokerPackage}}; -{{#threetenbp}} -import org.threeten.bp.*; - -{{/threetenbp}} import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; {{#joda}} import com.fasterxml.jackson.datatype.joda.JodaModule; {{/joda}} -{{#java8}} import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -{{^threetenbp}} import java.time.OffsetDateTime; -{{/threetenbp}} -{{/java8}} -{{#threetenbp}} -import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; -{{/threetenbp}} -import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JavaType; - -import org.apache.http.Header; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.NameValuePair; -import org.apache.http.ParseException; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.RequestBuilder; -import org.apache.http.client.protocol.HttpClientContext; -import org.apache.http.entity.ByteArrayEntity; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.FileEntity; -import org.apache.http.entity.StringEntity; -import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.impl.client.BasicCookieStore; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.impl.cookie.BasicClientCookie; -import org.apache.http.message.BasicNameValuePair; -import org.apache.http.util.EntityUtils; -import org.apache.http.cookie.Cookie; +{{#openApiNullable}} +import org.openapitools.jackson.nullable.JsonNullableModule; +{{/openApiNullable}} + +import org.apache.hc.client5.http.cookie.BasicCookieStore; +import org.apache.hc.client5.http.cookie.Cookie; +import org.apache.hc.client5.http.entity.UrlEncodedFormEntity; +import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.client5.http.impl.cookie.BasicClientCookie; +import org.apache.hc.client5.http.protocol.HttpClientContext; +import org.apache.hc.core5.http.ContentType; +import org.apache.hc.core5.http.Header; +import org.apache.hc.core5.http.HttpEntity; +import org.apache.hc.core5.http.HttpResponse; +import org.apache.hc.core5.http.HttpStatus; +import org.apache.hc.core5.http.NameValuePair; +import org.apache.hc.core5.http.ParseException; +import org.apache.hc.core5.http.io.entity.ByteArrayEntity; +import org.apache.hc.core5.http.io.entity.EntityUtils; +import org.apache.hc.core5.http.io.entity.FileEntity; +import org.apache.hc.core5.http.io.entity.StringEntity; +import org.apache.hc.core5.http.io.support.ClassicRequestBuilder; +import org.apache.hc.core5.http.message.BasicNameValuePair; import java.util.Collection; import java.util.Collections; @@ -58,7 +48,9 @@ import java.util.List; import java.util.Arrays; import java.util.ArrayList; import java.util.Date; +import java.util.function.Supplier; import java.util.TimeZone; +import java.util.concurrent.ConcurrentHashMap; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -68,6 +60,9 @@ import java.io.File; import java.io.InputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.nio.charset.UnsupportedCharsetException; import java.nio.file.Files; import java.nio.file.StandardCopyOption; import java.nio.file.Paths; @@ -131,8 +126,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { private Map authentications; - private int statusCode; - private Map> responseHeaders; + private Map lastStatusCodeByThread = new ConcurrentHashMap<>(); + private Map>> lastResponseHeadersByThread = new ConcurrentHashMap<>(); private DateFormat dateFormat; @@ -150,16 +145,10 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { {{#joda}} objectMapper.registerModule(new JodaModule()); {{/joda}} - {{#java8}} objectMapper.registerModule(new JavaTimeModule()); - {{/java8}} - {{#threetenbp}} - ThreeTenModule module = new ThreeTenModule(); - module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); - module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); - module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); - objectMapper.registerModule(module); - {{/threetenbp}} + {{#openApiNullable}} + objectMapper.registerModule(new JsonNullableModule()); + {{/openApiNullable}} objectMapper.setDateFormat(ApiClient.buildDefaultDateFormat()); dateFormat = ApiClient.buildDefaultDateFormat(); @@ -169,8 +158,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} - authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} + authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}} + authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} // Prevent the authentications from being modified. @@ -200,6 +189,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } /** + * Sets the object mapper. + * + * @param objectMapper object mapper * @return API client */ public ApiClient setObjectMapper(ObjectMapper objectMapper) { @@ -212,6 +204,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } /** + * Sets the HTTP client. + * + * @param httpClient HTTP client * @return API client */ public ApiClient setHttpClient(CloseableHttpClient httpClient) { @@ -224,6 +219,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } /** + * Sets the base path. + * + * @param basePath base path * @return API client */ public ApiClient setBasePath(String basePath) { @@ -237,6 +235,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } /** + * Sets the server. + * + * @param servers a list of server configuration * @return API client */ public ApiClient setServers(List servers) { @@ -249,6 +250,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } /** + * Sets the server index. + * + * @param serverIndex server index * @return API client */ public ApiClient setServerIndex(Integer serverIndex) { @@ -261,6 +265,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } /** + * Sets the server variables. + * + * @param serverVariables server variables * @return API client */ public ApiClient setServerVariables(Map serverVariables) { @@ -270,18 +277,21 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { /** * Gets the status code of the previous request + * * @return Status code */ + @Deprecated public int getStatusCode() { - return statusCode; + return lastStatusCodeByThread.get(Thread.currentThread().getId()); } /** * Gets the response headers of the previous request * @return Response headers */ + @Deprecated public Map> getResponseHeaders() { - return responseHeaders; + return lastResponseHeadersByThread.get(Thread.currentThread().getId()); } /** @@ -329,6 +339,20 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { throw new RuntimeException("No Bearer authentication configured!"); } + /** + * Helper method to set the supplier of access tokens for Bearer authentication. + * + * @param tokenSupplier the token supplier function + */ + public void setBearerToken(Supplier tokenSupplier) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(tokenSupplier); + return; + } + } + throw new RuntimeException("No Bearer authentication configured!"); + } {{/hasHttpBearerMethods}} {{#hasHttpBasicMethods}} @@ -580,9 +604,11 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { List params = new ArrayList(); // preconditions - if (name == null || name.isEmpty() || value == null || value instanceof Collection) return params; + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } - params.add(new Pair(name, parameterToString(value))); + params.add(new Pair(name, escapeString(parameterToString(value)))); return params; } @@ -600,7 +626,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { List params = new ArrayList(); // preconditions - if (name == null || name.isEmpty() || value == null) { + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { return params; } @@ -707,7 +733,10 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } /** - * Transform response headers into map + * Transforms response headers into map. + * + * @param headers HTTP headers + * @return a map of string array */ protected Map> transformResponseHeaders(Header[] headers) { Map> headersMap = new HashMap<>(); @@ -730,7 +759,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { private ContentType getContentType(String headerValue) throws ApiException { try { return ContentType.parse(headerValue); - } catch (ParseException e) { + } catch (UnsupportedCharsetException e) { throw new ApiException("Could not parse content type " + headerValue); } } @@ -759,7 +788,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { String mimeType = contentType.getMimeType(); if (isJsonMime(mimeType)) { try { - return new StringEntity(objectMapper.writeValueAsString(obj), contentType); + return new StringEntity(objectMapper.writeValueAsString(obj), contentType.withCharset(StandardCharsets.UTF_8)); } catch (JsonProcessingException e) { throw new ApiException(e); } @@ -772,7 +801,14 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } else if (value instanceof byte[]) { multiPartBuilder.addBinaryBody(paramEntry.getKey(), (byte[]) value); } else { - multiPartBuilder.addTextBody(paramEntry.getKey(), parameterToString(paramEntry.getValue())); + Charset charset = contentType.getCharset(); + if (charset != null) { + ContentType customContentType = ContentType.create(ContentType.TEXT_PLAIN.getMimeType(), charset); + multiPartBuilder.addTextBody(paramEntry.getKey(), parameterToString(paramEntry.getValue()), + customContentType); + } else { + multiPartBuilder.addTextBody(paramEntry.getKey(), parameterToString(paramEntry.getValue())); + } } } return multiPartBuilder.build(); @@ -781,11 +817,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { for (Entry paramEntry : formParams.entrySet()) { formValues.add(new BasicNameValuePair(paramEntry.getKey(), parameterToString(paramEntry.getValue()))); } - try { - return new UrlEncodedFormEntity(formValues); - } catch (UnsupportedEncodingException e) { - throw new ApiException(e); - } + return new UrlEncodedFormEntity(formValues, contentType.getCharset()); } else { // Handle files with unknown content type if (obj instanceof File) { @@ -798,9 +830,17 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } /** - * Deserialize response content + * Deserialize response body to Java object according to the Content-Type. + * + * @param Type + * @param response Response + * @param valueType Return type + * @return Deserialized object + * @throws ApiException API exception + * @throws IOException IO exception */ - public T deserialize(HttpResponse response, TypeReference valueType) throws ApiException, IOException { + @SuppressWarnings("unchecked") + public T deserialize(CloseableHttpResponse response, TypeReference valueType) throws ApiException, IOException, ParseException { if (valueType == null) { return null; } @@ -814,18 +854,29 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { String mimeType = getResponseMimeType(response); if (mimeType == null || isJsonMime(mimeType)) { // Assume json if no mime type - return objectMapper.readValue(entity.getContent(), valueType); + // convert input stream to string + String content = EntityUtils.toString(entity); + + if ("".equals(content)) { // returns null for empty body + return null; + } + + return objectMapper.readValue(content, valueType); + } else if (mimeType.toLowerCase().startsWith("text/")) { + // convert input stream to string + return (T) EntityUtils.toString(entity); } else { + Map> responseHeaders = transformResponseHeaders(response.getHeaders()); throw new ApiException( "Deserialization for content type '" + mimeType + "' not supported for type '" + valueType + "'", - response.getStatusLine().getStatusCode(), + response.getCode(), responseHeaders, EntityUtils.toString(entity) ); } } - private File downloadFileFromResponse(HttpResponse response) throws IOException { + private File downloadFileFromResponse(CloseableHttpResponse response) throws IOException { Header contentDispositionHeader = response.getFirstHeader("Content-Disposition"); String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue(); File file = prepareDownloadFile(contentDisposition); @@ -868,14 +919,11 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } /** - * Build full URL by concatenating base path, the given sub path and query parameters. + * Returns the URL of the client as defined by the server (if exists) or the base path. * - * @param path The sub path - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @return The full URL + * @return The URL for the client. */ - private String buildUrl(String path, List queryParams, List collectionQueryParams) { + public String getBaseURL() { String baseURL; if (serverIndex != null) { if (serverIndex < 0 || serverIndex >= servers.size()) { @@ -887,6 +935,20 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } else { baseURL = basePath; } + return baseURL; + } + + /** + * Build full URL by concatenating base URL, the given sub path and query parameters. + * + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param urlQueryDeepObject URL query string of the deep object parameters + * @return The full URL + */ + private String buildUrl(String path, List queryParams, List collectionQueryParams, String urlQueryDeepObject) { + String baseURL = getBaseURL(); final StringBuilder url = new StringBuilder(); url.append(baseURL).append(path); @@ -903,7 +965,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { url.append("&"); } String value = parameterToString(param.getValue()); - url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + // query parameter value already escaped as part of parameterToPair + url.append(escapeString(param.getName())).append("=").append(value); } } } @@ -925,6 +988,11 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } } + if (urlQueryDeepObject != null && urlQueryDeepObject.length() > 0) { + url.append(url.toString().contains("?") ? "&" : "?"); + url.append(urlQueryDeepObject); + } + return url.toString(); } @@ -943,13 +1011,16 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { return cookie; } - protected T processResponse(CloseableHttpResponse response, TypeReference returnType) throws ApiException, IOException { - statusCode = response.getStatusLine().getStatusCode(); + protected T processResponse(CloseableHttpResponse response, TypeReference returnType) throws ApiException, IOException, ParseException { + int statusCode = response.getCode(); + lastStatusCodeByThread.put(Thread.currentThread().getId(), statusCode); if (statusCode == HttpStatus.SC_NO_CONTENT) { return null; } - responseHeaders = transformResponseHeaders(response.getAllHeaders()); + Map> responseHeaders = transformResponseHeaders(response.getHeaders()); + lastResponseHeadersByThread.put(Thread.currentThread().getId(), responseHeaders); + if (isSuccessfulStatus(statusCode)) { return this.deserialize(response, returnType); } else { @@ -966,6 +1037,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * @param method The request method, one of "GET", "POST", "PUT", and "DELETE" * @param queryParams The query parameters * @param collectionQueryParams The collection query parameters + * @param urlQueryDeepObject A URL query string for deep object parameters * @param body The request body object - if it is not binary, otherwise null * @param headerParams The header parameters * @param cookieParams The cookie parameters @@ -982,6 +1054,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { String method, List queryParams, List collectionQueryParams, + String urlQueryDeepObject, Object body, Map headerParams, Map cookieParams, @@ -995,16 +1068,11 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); - final String url = buildUrl(path, queryParams, collectionQueryParams); + final String url = buildUrl(path, queryParams, collectionQueryParams, urlQueryDeepObject); - RequestBuilder builder = RequestBuilder.create(method); + ClassicRequestBuilder builder = ClassicRequestBuilder.create(method); builder.setUri(url); - RequestConfig config = RequestConfig.custom() - .setConnectionRequestTimeout(connectionTimeout) - .build(); - builder.setConfig(config); - if (accept != null) { builder.addHeader("Accept", accept); } @@ -1038,11 +1106,14 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } else { throw new ApiException("method " + method + " does not support a request body"); } + } else { + // for empty body + builder.setEntity(new StringEntity("", contentTypeObj)); } try (CloseableHttpResponse response = httpClient.execute(builder.build(), context)) { return processResponse(response, returnType); - } catch (IOException e) { + } catch (IOException | ParseException e) { throw new ApiException(e); } } diff --git a/templates/libraries/apache-httpclient/BaseApi.mustache b/templates/libraries/apache-httpclient/BaseApi.mustache new file mode 100644 index 0000000..8b48de0 --- /dev/null +++ b/templates/libraries/apache-httpclient/BaseApi.mustache @@ -0,0 +1,110 @@ +{{>licenseInfo}} +package {{invokerPackage}}; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.util.Collections; +import java.util.Map; + +{{>generatedAnnotation}} +public abstract class BaseApi { + + protected ApiClient apiClient; + + public BaseApi() { + this(Configuration.getDefaultApiClient()); + } + + public BaseApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @throws ApiException if fails to make API call. + */ + public void invokeAPI(String url, String method) throws ApiException { + invokeAPI(url, method, null, null, Collections.emptyMap()); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @param additionalHeaders Additional headers for the request. + * @throws ApiException if fails to make API call. + */ + public void invokeAPI(String url, String method, Map additionalHeaders) throws ApiException { + invokeAPI(url, method, null, null, additionalHeaders); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @param request The request object. + * @throws ApiException if fails to make API call. + */ + public void invokeAPI(String url, String method, Object request) throws ApiException { + invokeAPI(url, method, request, null, Collections.emptyMap()); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @param request The request object. + * @param additionalHeaders Additional headers for the request. + * @throws ApiException if fails to make API call. + */ + public void invokeAPI(String url, String method, Object request, Map additionalHeaders) throws ApiException { + invokeAPI(url, method, request, null, additionalHeaders); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @param returnType The return type. + * @return The API response in the specified type. + * @throws ApiException if fails to make API call. + */ + public T invokeAPI(String url, String method, TypeReference returnType) throws ApiException { + return invokeAPI(url, method, null, returnType, Collections.emptyMap()); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @param request The request object. + * @param returnType The return type. + * @return The API response in the specified type. + * @throws ApiException if fails to make API call. + */ + public T invokeAPI(String url, String method, Object request, TypeReference returnType) throws ApiException { + return invokeAPI(url, method, request, returnType, Collections.emptyMap()); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @param request The request object. + * @param returnType The return type. + * @param additionalHeaders Additional headers for the request. + * @return The API response in the specified type. + * @throws ApiException if fails to make API call. + */ + public abstract T invokeAPI(String url, String method, Object request, TypeReference returnType, Map additionalHeaders) throws ApiException; +} diff --git a/templates/libraries/apache-httpclient/README.mustache b/templates/libraries/apache-httpclient/README.mustache index 9082f62..b50e7db 100644 --- a/templates/libraries/apache-httpclient/README.mustache +++ b/templates/libraries/apache-httpclient/README.mustache @@ -8,6 +8,8 @@ - Build date: {{generatedDate}} {{/hideGenerationTimestamp}} +- Generator version: {{generatorVersion}} + {{#appDescriptionWithNewLines}}{{{appDescriptionWithNewLines}}}{{/appDescriptionWithNewLines}} {{#infoUrl}} @@ -20,7 +22,7 @@ Building the API client library requires: -1. Java {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}+ +1. Java 1.8+ 2. Maven/Gradle ## Installation @@ -158,11 +160,14 @@ Class | Method | HTTP request | Description {{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md) {{/model}}{{/models}} + ## Documentation for Authorization -{{^authMethods}}All endpoints do not require authorization. -{{/authMethods}}Authentication schemes defined for the API: -{{#authMethods}}### {{name}} +{{^authMethods}}Endpoints do not require authorization.{{/authMethods}} +{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}} +{{#authMethods}} + +### {{name}} {{#isApiKey}} @@ -170,10 +175,18 @@ Class | Method | HTTP request | Description - **API key parameter name**: {{keyParamName}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} {{/isApiKey}} -{{#isBasic}} +{{#isBasicBasic}} - **Type**: HTTP basic authentication -{{/isBasic}} +{{/isBasicBasic}} +{{#isBasicBearer}} + +- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} +{{/isBasicBearer}} +{{#isHttpSignature}} + +- **Type**: HTTP signature authentication +{{/isHttpSignature}} {{#isOAuth}} - **Type**: OAuth diff --git a/templates/libraries/apache-httpclient/api.mustache b/templates/libraries/apache-httpclient/api.mustache index 44122a1..27b4564 100644 --- a/templates/libraries/apache-httpclient/api.mustache +++ b/templates/libraries/apache-httpclient/api.mustache @@ -5,49 +5,75 @@ import com.fasterxml.jackson.core.type.TypeReference; import {{invokerPackage}}.ApiException; import {{invokerPackage}}.ApiClient; +import {{invokerPackage}}.BaseApi; import {{invokerPackage}}.Configuration; +{{#models.0}} import {{modelPackage}}.*; +{{/models.0}} import {{invokerPackage}}.Pair; {{#imports}}import {{import}}; {{/imports}} -{{^fullJavaUtil}} import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} +import java.util.StringJoiner; +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} {{>generatedAnnotation}} {{#operations}} -public class {{classname}} { - private ApiClient apiClient; +public class {{classname}} extends BaseApi { public {{classname}}() { - this(Configuration.getDefaultApiClient()); + super(Configuration.getDefaultApiClient()); } public {{classname}}(ApiClient apiClient) { - this.apiClient = apiClient; + super(apiClient); } - public ApiClient getApiClient() { - return apiClient; + {{#operation}} + /** + * {{summary}} + * {{notes}} + {{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} + {{/allParams}} + {{#returnType}} + * @return {{returnType}} + {{/returnType}} + * @throws ApiException if fails to make API call + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + {{#returnType}}return {{/returnType}}this.{{operationId}}({{#allParams}}{{paramName}}, {{/allParams}}Collections.emptyMap()); } - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - {{#operation}} /** * {{summary}} * {{notes}} {{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/isContainer}}{{/required}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} {{/allParams}} + * @param additionalHeaders additionalHeaders for this call {{#returnType}} * @return {{returnType}} {{/returnType}} @@ -63,7 +89,7 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}Map additionalHeaders) throws ApiException { Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set @@ -75,21 +101,58 @@ public class {{classname}} { String localVarPath = "{{{path}}}"{{#pathParams}} .replaceAll("\\{" + "{{baseName}}" + "\\}", apiClient.escapeString({{{paramName}}}.toString())){{/pathParams}}; - // query params - {{javaUtilPrefix}}List localVarQueryParams = new {{javaUtilPrefix}}ArrayList(); - {{javaUtilPrefix}}List localVarCollectionQueryParams = new {{javaUtilPrefix}}ArrayList(); - {{javaUtilPrefix}}Map localVarHeaderParams = new {{javaUtilPrefix}}HashMap(); - {{javaUtilPrefix}}Map localVarCookieParams = new {{javaUtilPrefix}}HashMap(); - {{javaUtilPrefix}}Map localVarFormParams = new {{javaUtilPrefix}}HashMap(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); {{#queryParams}} + {{#isDeepObject}} + localVarQueryParameterBaseName = "{{{baseName}}}"; + {{#isArray}} + for (int i=0; i < {{paramName}}.size(); i++) { + localVarQueryStringJoiner.add({{paramName}}.get(i).toUrlQueryString(String.format("{{baseName}}[%d]", i))); + } + {{/isArray}} + {{^isArray}} + localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString("{{baseName}}")); + {{/isArray}} + {{/isDeepObject}} + {{^isDeepObject}} + {{#isExplode}} + {{#hasVars}} + {{#vars}} + {{#isArray}} + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "{{baseName}}", {{paramName}}.{{getter}}())); + {{/isArray}} + {{^isArray}} + localVarQueryParams.addAll(apiClient.parameterToPair("{{baseName}}", {{paramName}}.{{getter}}())); + {{/isArray}} + {{/vars}} + {{/hasVars}} + {{^hasVars}} + {{#isModel}} + localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString()); + {{/isModel}} + {{^isModel}} + {{#collectionFormat}}localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("{{{collectionFormat}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(apiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); + {{/isModel}} + {{/hasVars}} + {{/isExplode}} + {{^isExplode}} {{#collectionFormat}}localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("{{{collectionFormat}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(apiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); + {{/isExplode}} + {{/isDeepObject}} {{/queryParams}} - {{#headerParams}}if ({{paramName}} != null) localVarHeaderParams.put("{{baseName}}", apiClient.parameterToString({{paramName}})); {{/headerParams}} + localVarHeaderParams.putAll(additionalHeaders); + {{#cookieParams}}if ({{paramName}} != null) localVarCookieParams.put("{{baseName}}", apiClient.parameterToString({{paramName}})); {{/cookieParams}} @@ -121,6 +184,7 @@ public class {{classname}} { "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), localVarPostBody, localVarHeaderParams, localVarCookieParams, @@ -131,6 +195,49 @@ public class {{classname}} { {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}} ); } + + {{#-last}} + @Override + public T invokeAPI(String url, String method, Object request, TypeReference returnType, Map additionalHeaders) throws ApiException { + String localVarPath = url.replace(apiClient.getBaseURL(), ""); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarHeaderParams.putAll(additionalHeaders); + + final String[] localVarAccepts = { + {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; + + return apiClient.invokeAPI( + localVarPath, + method, + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + request, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + returnType + ); + } + {{/-last}} {{/operation}} } {{/operations}} diff --git a/templates/libraries/apache-httpclient/api_test.mustache b/templates/libraries/apache-httpclient/api_test.mustache index 8071e03..b4393ea 100644 --- a/templates/libraries/apache-httpclient/api_test.mustache +++ b/templates/libraries/apache-httpclient/api_test.mustache @@ -5,21 +5,26 @@ package {{package}}; import {{invokerPackage}}.ApiException; {{#imports}}import {{import}}; {{/imports}} -import org.junit.Test; -import org.junit.Ignore; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -{{^fullJavaUtil}} +import java.time.LocalDate; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} /** * API tests for {{classname}} */ -@Ignore +@Disabled public class {{classname}}Test { private final {{classname}} api = new {{classname}}(); diff --git a/templates/libraries/apache-httpclient/build.gradle.mustache b/templates/libraries/apache-httpclient/build.gradle.mustache index 5ae33f3..f18581f 100644 --- a/templates/libraries/apache-httpclient/build.gradle.mustache +++ b/templates/libraries/apache-httpclient/build.gradle.mustache @@ -32,14 +32,8 @@ if(hasProperty('target') && target == 'android') { } compileOptions { - {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 - {{/java8}} - {{^java8}} - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - {{/java8}} } // Rename the aar correctly @@ -63,9 +57,9 @@ if(hasProperty('target') && target == 'android') { def task = project.tasks.create "jar${variant.name.capitalize()}", Jar task.description = "Create jar artifact for ${variant.name}" task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - task.destinationDir = project.file("${project.buildDir}/outputs/jar") - task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + task.from variant.javaCompile.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" artifacts.add('archives', task); } } @@ -84,14 +78,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven-publish' - {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - {{/java8}} - {{^java8}} - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 - {{/java8}} publishing { publications { @@ -125,26 +113,22 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.22" - jackson_version = "2.12.1" - jackson_databind_version = "2.10.5.1" + swagger_annotations_version = "1.6.6" + jackson_version = "2.17.1" + jackson_databind_version = "2.17.1" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.2" + jackson_databind_nullable_version = "0.2.6" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" - {{#threetenbp}} - jackson_threetenbp_version = "2.9.10" - {{/threetenbp}} - httpclient_version = "4.5.13" + httpclient_version = "5.1.3" jodatime_version = "2.9.9" - junit_version = "4.13.1" + junit_version = "4.13.2" } dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" - implementation "org.apache.httpcomponents:httpclient:$httpclient_version" - implementation "org.apache.httpcomponents:httpmime:$httpclient_version" + implementation "org.apache.httpcomponents.client5:httpclient5:$httpclient_version" implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" @@ -155,15 +139,7 @@ dependencies { {{#joda}} implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" {{/joda}} - {{#java8}} implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" - {{/java8}} - {{#threetenbp}} - implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threetenbp_version" - {{/threetenbp}} - {{^java8}} - implementation "com.brsanthu:migbase64:2.2" - {{/java8}} implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" testImplementation "junit:junit:$junit_version" } diff --git a/templates/libraries/apache-httpclient/pom.mustache b/templates/libraries/apache-httpclient/pom.mustache index 89c3f5f..74a70a3 100644 --- a/templates/libraries/apache-httpclient/pom.mustache +++ b/templates/libraries/apache-httpclient/pom.mustache @@ -43,8 +43,10 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.10.1 + 1.8 + 1.8 true 128m 512m @@ -58,7 +60,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M1 + 3.1.0 enforce-maven @@ -78,17 +80,17 @@ org.apache.maven.plugins maven-surefire-plugin - 2.12 + 3.2.5 - + loggerPath conf/log4j.properties - + -Xms512m -Xmx1500m methods - pertest + 10 @@ -110,11 +112,10 @@ org.apache.maven.plugins maven-jar-plugin - 2.2 + 3.3.0 - jar test-jar @@ -126,7 +127,7 @@ org.codehaus.mojo build-helper-maven-plugin - 1.10 + 3.3.0 add_sources @@ -154,33 +155,13 @@ - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.1 - - {{#java8}} - 1.8 - 1.8 - {{/java8}} - {{^java8}} - 1.7 - 1.7 - {{/java8}} - - org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.4.1 none - {{#java8}} - 1.8 - {{/java8}} - {{^java8}} - 1.7 - {{/java8}} + 1.8 @@ -194,7 +175,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.2.1 attach-sources @@ -215,7 +196,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 + 3.0.1 sign-artifacts @@ -232,11 +213,20 @@ + {{#swagger1AnnotationLibrary}} io.swagger swagger-annotations ${swagger-annotations-version} + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + + io.swagger.core.v3 + swagger-annotations + ${swagger-annotations-version} + + {{/swagger2AnnotationLibrary}} @@ -248,13 +238,8 @@ - org.apache.httpcomponents - httpclient - ${httpclient-version} - - - org.apache.httpcomponents - httpmime + org.apache.httpcomponents.client5 + httpclient5 ${httpclient-version} @@ -272,78 +257,77 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} + {{^useJakartaEe}} com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider ${jackson-version} + {{/useJakartaEe}} + {{#useJakartaEe}} + + com.fasterxml.jackson.jakarta.rs + jackson-jakarta-rs-json-provider + ${jackson-version} + + {{/useJakartaEe}} {{#withXml}} - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson-version} - + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson-version} + {{/withXml}} {{#joda}} - - com.fasterxml.jackson.datatype - jackson-datatype-joda - ${jackson-version} - + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-version} + {{/joda}} - {{#java8}} - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${jackson-version} - - {{/java8}} - {{#threetenbp}} - - com.github.joschi.jackson - jackson-datatype-threetenbp - ${jackson-threetenbp-version} - - {{/threetenbp}} - {{^java8}} - - - com.brsanthu - migbase64 - 2.2 - - {{/java8}} + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + {{#useBeanValidation}} - - - jakarta.validation - jakarta.validation-api - ${beanvalidation-version} - provided - + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + {{/useBeanValidation}} {{#performBeanValidation}} - - - org.hibernate - hibernate-validator - 5.4.1.Final - + + + org.hibernate + hibernate-validator + 5.4.3.Final + {{/performBeanValidation}} {{#parcelableModel}} - - - com.google.android - android - 4.1.1.4 - provided - + + + com.google.android + android + 4.1.1.4 + provided + {{/parcelableModel}} + {{#openApiNullable}} + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + {{/openApiNullable}} jakarta.annotation jakarta.annotation-api @@ -352,25 +336,35 @@ - junit - junit + org.junit.jupiter + junit-jupiter-api ${junit-version} test UTF-8 - 1.5.21 - 4.5.13 - 2.12.1 - {{#threetenbp}} - 2.9.10 - {{/threetenbp}} + {{#swagger1AnnotationLibrary}} + 1.6.6 + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + 2.2.15 + {{/swagger2AnnotationLibrary}} + 5.2.1 + 2.17.1 + 2.17.1 + {{#openApiNullable}} + 0.2.6 + {{/openApiNullable}} + {{#useJakartaEe}} + 2.1.1 + {{/useJakartaEe}} + {{^useJakartaEe}} 1.3.5 -{{#useBeanValidation}} - 2.0.2 -{{/useBeanValidation}} - 1.0.0 - 4.13.1 + {{/useJakartaEe}} + {{#useBeanValidation}} + 3.0.2 + {{/useBeanValidation}} + 5.10.2 diff --git a/templates/libraries/feign/ApiClient.mustache b/templates/libraries/feign/ApiClient.mustache index 5c4e789..9a5b9bc 100644 --- a/templates/libraries/feign/ApiClient.mustache +++ b/templates/libraries/feign/ApiClient.mustache @@ -1,41 +1,47 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import java.util.LinkedHashMap; import java.util.Map; +import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; -{{#threetenbp}} -import org.threeten.bp.*; -{{/threetenbp}} +{{#jackson}} import feign.okhttp.OkHttpClient; - import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; {{#openApiNullable}} import org.openapitools.jackson.nullable.JsonNullableModule; {{/openApiNullable}} +{{/jackson}} {{#joda}} import com.fasterxml.jackson.datatype.joda.JodaModule; {{/joda}} -{{#java8}} +{{#jackson}} import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -{{/java8}} -{{#threetenbp}} -import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; -{{/threetenbp}} +{{/jackson}} import feign.Feign; import feign.RequestInterceptor; import feign.form.FormEncoder; +{{#jackson}} import feign.jackson.JacksonDecoder; import feign.jackson.JacksonEncoder; +{{/jackson}} +{{#gson}} +import feign.gson.GsonDecoder; +import feign.gson.GsonEncoder; +{{/gson}} import feign.slf4j.Slf4jLogger; import {{invokerPackage}}.auth.HttpBasicAuth; import {{invokerPackage}}.auth.HttpBearerAuth; import {{invokerPackage}}.auth.ApiKeyAuth; +{{#jackson}} import {{invokerPackage}}.ApiResponseDecoder; +{{/jackson}} {{#hasOAuthMethods}} import {{invokerPackage}}.auth.ApiErrorDecoder; @@ -53,14 +59,17 @@ public class ApiClient { public interface Api {} + {{#jackson}} protected ObjectMapper objectMapper; + {{/jackson}} private String basePath = "{{{basePath}}}"; private Map apiAuthorizations; private Feign.Builder feignBuilder; public ApiClient() { - objectMapper = createObjectMapper(); apiAuthorizations = new LinkedHashMap(); + {{#jackson}} + objectMapper = createObjectMapper(); feignBuilder = Feign.builder() .client(new OkHttpClient()) .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) @@ -70,6 +79,17 @@ public class ApiClient { .retryer(new Retryer.Default(0, 0, 2)) {{/hasOAuthMethods}} .logger(new Slf4jLogger()); + {{/jackson}} + {{#gson}} + feignBuilder = Feign.builder() + .encoder(new FormEncoder(new GsonEncoder())) + .decoder(new GsonDecoder()) + {{#hasOAuthMethods}} + .errorDecoder(new ApiErrorDecoder()) + .retryer(new Retryer.Default(0, 0, 2)) + {{/hasOAuthMethods}} + .logger(new Slf4jLogger()); + {{/gson}} } public ApiClient(String[] authNames) { @@ -77,26 +97,26 @@ public class ApiClient { for(String authName : authNames) { log.log(Level.FINE, "Creating authentication {0}", authName); {{#hasAuthMethods}} - RequestInterceptor auth; + RequestInterceptor auth = null; {{#authMethods}}if ("{{name}}".equals(authName)) { - {{#isBasic}} {{#isBasicBasic}} auth = new HttpBasicAuth(); {{/isBasicBasic}} - {{^isBasicBasic}} + {{#isBasicBearer}} auth = new HttpBearerAuth("{{scheme}}"); - {{/isBasicBasic}} - {{/isBasic}} + {{/isBasicBearer}} {{#isApiKey}} auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"); {{/isApiKey}} {{#isOAuth}} - auth = buildOauthRequestInterceptor(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}"); + auth = buildOauthRequestInterceptor(OAuthFlow.{{#lambda.uppercase}}{{#lambda.snakecase}}{{flow}}{{/lambda.snakecase}}{{/lambda.uppercase}}, "{{{authorizationUrl}}}", "{{{tokenUrl}}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}"); {{/isOAuth}} } else {{/authMethods}}{ throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } - addAuthorization(authName, auth); + if (auth != null) { + addAuthorization(authName, auth); + } {{/hasAuthMethods}} {{^hasAuthMethods}} throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); @@ -148,6 +168,7 @@ public class ApiClient { return this; } + {{#jackson}} private ObjectMapper createObjectMapper() { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); @@ -159,29 +180,21 @@ public class ApiClient { {{#joda}} objectMapper.registerModule(new JodaModule()); {{/joda}} - {{#java8}} objectMapper.registerModule(new JavaTimeModule()); - {{/java8}} - {{#threetenbp}} - ThreeTenModule module = new ThreeTenModule(); - module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); - module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); - module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); - objectMapper.registerModule(module); - {{/threetenbp}} {{#openApiNullable}} JsonNullableModule jnm = new JsonNullableModule(); objectMapper.registerModule(jnm); {{/openApiNullable}} return objectMapper; } + {{/jackson}} {{#hasOAuthMethods}} private RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) { switch (flow) { - case password: + case PASSWORD: return new OauthPasswordGrant(tokenUrl, scopes); - case application: + case APPLICATION: return new OauthClientCredentialsGrant(authorizationUrl, tokenUrl, scopes); default: throw new RuntimeException("Oauth flow \"" + flow + "\" is not implemented"); @@ -189,6 +202,8 @@ public class ApiClient { } {{/hasOAuthMethods}} + + {{#jackson}} public ObjectMapper getObjectMapper(){ return objectMapper; } @@ -196,6 +211,7 @@ public class ApiClient { public void setObjectMapper(ObjectMapper objectMapper) { this.objectMapper = objectMapper; } + {{/jackson}} /** * Creates a feign client for given API interface. @@ -252,6 +268,15 @@ public class ApiClient { apiAuthorization.setBearerToken(bearerToken); } + /** + * Helper method to configure the supplier of bearer tokens. + * @param tokenSupplier the supplier of bearer tokens. + */ + public void setBearerToken(Supplier tokenSupplier) { + HttpBearerAuth apiAuthorization = getAuthorization(HttpBearerAuth.class); + apiAuthorization.setBearerToken(tokenSupplier); + } + /** * Helper method to configure the first api key found * @param apiKey API key @@ -274,8 +299,8 @@ public class ApiClient { {{#hasOAuthMethods}} /** * Helper method to configure the client credentials for Oauth - * @param username Username - * @param password Password + * @param clientId Client ID + * @param clientSecret Client secret */ public void setClientCredentials(String clientId, String clientSecret) { OauthClientCredentialsGrant authorization = getAuthorization(OauthClientCredentialsGrant.class); @@ -286,6 +311,8 @@ public class ApiClient { * Helper method to configure the username/password for Oauth password grant * @param username Username * @param password Password + * @param clientId Client ID + * @param clientSecret Client secret */ public void setOauthPassword(String username, String password, String clientId, String clientSecret) { OauthPasswordGrant apiAuthorization = getAuthorization(OauthPasswordGrant.class); @@ -314,7 +341,7 @@ public class ApiClient { /** * Configures a listener which is notified when a new access token is received. - * @param accessTokenListener Acesss token listener + * @param accessTokenListener Access token listener */ public void registerAccessTokenListener(AccessTokenListener accessTokenListener) { OAuth apiAuthorization = getAuthorization(OAuth.class); diff --git a/templates/libraries/feign/ApiResponseDecoder.mustache b/templates/libraries/feign/ApiResponseDecoder.mustache index ef171de..9062b64 100644 --- a/templates/libraries/feign/ApiResponseDecoder.mustache +++ b/templates/libraries/feign/ApiResponseDecoder.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import com.fasterxml.jackson.databind.ObjectMapper; @@ -22,17 +24,16 @@ public class ApiResponseDecoder extends JacksonDecoder { @Override public Object decode(Response response, Type type) throws IOException { - Map> responseHeaders = Collections.unmodifiableMap(response.headers()); //Detects if the type is an instance of the parameterized class ApiResponse - Type responseBodyType; - if (Types.getRawType(type).isAssignableFrom(ApiResponse.class)) { + if (type instanceof ParameterizedType && Types.getRawType(type).isAssignableFrom(ApiResponse.class)) { //The ApiResponse class has a single type parameter, the Dto class itself - responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0]; + Type responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0]; Object body = super.decode(response, responseBodyType); - return new ApiResponse(response.status(), responseHeaders, body); + Map> responseHeaders = Collections.unmodifiableMap(response.headers()); + return new ApiResponse<>(response.status(), responseHeaders, body); } else { //The response is not encapsulated in the ApiResponse, decode the Dto as normal return super.decode(response, type); } } -} \ No newline at end of file +} diff --git a/templates/libraries/feign/EncodingUtils.mustache b/templates/libraries/feign/EncodingUtils.mustache index 705eb6a..2312fc6 100644 --- a/templates/libraries/feign/EncodingUtils.mustache +++ b/templates/libraries/feign/EncodingUtils.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import java.io.UnsupportedEncodingException; diff --git a/templates/libraries/feign/ParamExpander.mustache b/templates/libraries/feign/ParamExpander.mustache index 2f5095d..88f0ae2 100644 --- a/templates/libraries/feign/ParamExpander.mustache +++ b/templates/libraries/feign/ParamExpander.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import feign.Param; diff --git a/templates/libraries/feign/additional_properties.mustache b/templates/libraries/feign/additional_properties.mustache new file mode 100644 index 0000000..8e71827 --- /dev/null +++ b/templates/libraries/feign/additional_properties.mustache @@ -0,0 +1,45 @@ +{{#additionalPropertiesType}} + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * @param key the name of the property + * @param value the value of the property + * @return self reference + */ + @JsonAnySetter + public {{classname}} putAdditionalProperty(String key, {{{.}}} value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) properties. + * @return the additional (undeclared) properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * @param key the name of the property + * @return the additional (undeclared) property with the specified name + */ + public {{{.}}} getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } +{{/additionalPropertiesType}} diff --git a/templates/libraries/feign/api.mustache b/templates/libraries/feign/api.mustache index c494070..af05d65 100644 --- a/templates/libraries/feign/api.mustache +++ b/templates/libraries/feign/api.mustache @@ -10,12 +10,15 @@ import {{modelPackage}}.ApiResponse; {{#imports}}import {{import}}; {{/imports}} -{{^fullJavaUtil}} import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} import feign.*; {{>generatedAnnotation}} @@ -44,12 +47,12 @@ public interface {{classname}} extends ApiClient.Api { {{/isDeprecated}} @RequestLine("{{httpMethod}} {{{path}}}{{#hasQueryParams}}?{{/hasQueryParams}}{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") @Headers({ -{{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", -{{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} +{{#vendorExtensions.x-content-type}} "Content-Type: {{vendorExtensions.x-content-type}}", +{{/vendorExtensions.x-content-type}} "Accept: {{#vendorExtensions.x-accepts}}{{.}}{{^-last}},{{/-last}}{{/vendorExtensions.x-accepts}}",{{#headerParams}} "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}}, {{/-last}}{{/headerParams}} }) - {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isBodyParam}}{{^isFormParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isFormParam}}{{#isFormParam}}@Param("{{baseName}}") {{/isFormParam}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); /** * {{summary}} @@ -74,12 +77,12 @@ public interface {{classname}} extends ApiClient.Api { {{/isDeprecated}} @RequestLine("{{httpMethod}} {{{path}}}{{#hasQueryParams}}?{{/hasQueryParams}}{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") @Headers({ -{{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", -{{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} +{{#vendorExtensions.x-content-type}} "Content-Type: {{vendorExtensions.x-content-type}}", +{{/vendorExtensions.x-content-type}} "Accept: {{#vendorExtensions.x-accepts}}{{.}}{{^-last}},{{/-last}}{{/vendorExtensions.x-accepts}}",{{#headerParams}} "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}}, {{/-last}}{{/headerParams}} }) - ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{nickname}}WithHttpInfo({{#allParams}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{nickname}}WithHttpInfo({{#allParams}}{{^isBodyParam}}{{^isFormParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isFormParam}}{{#isFormParam}}@Param("{{baseName}}") {{/isFormParam}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); {{#hasQueryParams}} @@ -119,12 +122,12 @@ public interface {{classname}} extends ApiClient.Api { {{/isDeprecated}} @RequestLine("{{httpMethod}} {{{path}}}?{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") @Headers({ -{{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", -{{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} +{{#vendorExtensions.x-content-type}} "Content-Type: {{vendorExtensions.x-content-type}}", +{{/vendorExtensions.x-content-type}} "Accept: {{#vendorExtensions.x-accepts}}{{.}}{{^-last}},{{/-last}}{{/vendorExtensions.x-accepts}}",{{#headerParams}} "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}}, {{/-last}}{{/headerParams}} }) - {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) Map queryParams); + {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^isFormParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isFormParam}}{{#isFormParam}}@Param("{{baseName}}") {{/isFormParam}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) {{operationIdCamelCase}}QueryParams queryParams); /** * {{summary}} @@ -159,12 +162,12 @@ public interface {{classname}} extends ApiClient.Api { {{/isDeprecated}} @RequestLine("{{httpMethod}} {{{path}}}?{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") @Headers({ - {{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", - {{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} + {{#vendorExtensions.x-content-type}} "Content-Type: {{vendorExtensions.x-content-type}}", + {{/vendorExtensions.x-content-type}} "Accept: {{#vendorExtensions.x-accepts}}{{.}}{{^-last}},{{/-last}}{{/vendorExtensions.x-accepts}}",{{#headerParams}} "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}}, {{/-last}}{{/headerParams}} }) - ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{nickname}}WithHttpInfo({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) Map queryParams); + ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{nickname}}WithHttpInfo({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^isFormParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isFormParam}}{{#isFormParam}}@Param("{{baseName}}") {{/isFormParam}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) {{operationIdCamelCase}}QueryParams queryParams); /** diff --git a/templates/libraries/feign/api_test.mustache b/templates/libraries/feign/api_test.mustache index a7f5bb0..1db8411 100644 --- a/templates/libraries/feign/api_test.mustache +++ b/templates/libraries/feign/api_test.mustache @@ -6,13 +6,18 @@ import {{invokerPackage}}.ApiClient; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.BeforeEach; -{{^fullJavaUtil}} +import java.time.LocalDate; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} /** * API tests for {{classname}} */ diff --git a/templates/libraries/feign/auth/ApiErrorDecoder.mustache b/templates/libraries/feign/auth/ApiErrorDecoder.mustache index da87f25..aeea7f9 100644 --- a/templates/libraries/feign/auth/ApiErrorDecoder.mustache +++ b/templates/libraries/feign/auth/ApiErrorDecoder.mustache @@ -1,5 +1,9 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; +import java.util.Date; + import feign.Response; import feign.RetryableException; import feign.codec.ErrorDecoder; @@ -18,7 +22,7 @@ public class ApiErrorDecoder implements ErrorDecoder { Exception httpException = defaultErrorDecoder.decode(methodKey, response); if (response.status() == 401 || response.status() == 403) { return new RetryableException(response.status(), "Received status " + response.status() + " trying to renew access token", - response.request().httpMethod(), httpException, null, response.request()); + response.request().httpMethod(), httpException, (Date) null, response.request()); } return httpException; } diff --git a/templates/libraries/feign/auth/ApiKeyAuth.mustache b/templates/libraries/feign/auth/ApiKeyAuth.mustache index c03fe5c..bf7e32c 100644 --- a/templates/libraries/feign/auth/ApiKeyAuth.mustache +++ b/templates/libraries/feign/auth/ApiKeyAuth.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import feign.RequestInterceptor; diff --git a/templates/libraries/feign/auth/DefaultApi20Impl.mustache b/templates/libraries/feign/auth/DefaultApi20Impl.mustache index 72b0a00..0c178ae 100644 --- a/templates/libraries/feign/auth/DefaultApi20Impl.mustache +++ b/templates/libraries/feign/auth/DefaultApi20Impl.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import com.github.scribejava.core.builder.api.DefaultApi20; diff --git a/templates/libraries/feign/auth/HttpBasicAuth.mustache b/templates/libraries/feign/auth/HttpBasicAuth.mustache index c308131..d95589b 100644 --- a/templates/libraries/feign/auth/HttpBasicAuth.mustache +++ b/templates/libraries/feign/auth/HttpBasicAuth.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import feign.RequestInterceptor; diff --git a/templates/libraries/feign/auth/HttpBearerAuth.mustache b/templates/libraries/feign/auth/HttpBearerAuth.mustache index 2240a55..466c1b2 100644 --- a/templates/libraries/feign/auth/HttpBearerAuth.mustache +++ b/templates/libraries/feign/auth/HttpBearerAuth.mustache @@ -1,14 +1,18 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import feign.RequestInterceptor; import feign.RequestTemplate; +import java.util.Optional; +import java.util.function.Supplier; /** * An interceptor that adds the request header needed to use HTTP bearer authentication. */ public class HttpBearerAuth implements RequestInterceptor { private final String scheme; - private String bearerToken; + private Supplier tokenSupplier; public HttpBearerAuth(String scheme) { this.scheme = scheme; @@ -16,21 +20,35 @@ public class HttpBearerAuth implements RequestInterceptor { /** * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token */ public String getBearerToken() { - return bearerToken; + return tokenSupplier.get(); } /** * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header */ public void setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; + this.tokenSupplier = () -> bearerToken; + } + + /** + * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header + */ + public void setBearerToken(Supplier tokenSupplier) { + this.tokenSupplier = tokenSupplier; } @Override public void apply(RequestTemplate template) { - if(bearerToken == null) { + String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null); + if (bearerToken == null) { return; } diff --git a/templates/libraries/feign/auth/OAuth.mustache b/templates/libraries/feign/auth/OAuth.mustache index e608296..8309a1f 100644 --- a/templates/libraries/feign/auth/OAuth.mustache +++ b/templates/libraries/feign/auth/OAuth.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import com.github.scribejava.core.model.OAuth2AccessToken; @@ -10,6 +12,9 @@ import java.util.Collection; {{>generatedAnnotation}} public abstract class OAuth implements RequestInterceptor { + //https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.4 + static final int LEEWAY_SECONDS = 10; + static final int MILLIS_PER_SECOND = 1000; public interface AccessTokenListener { @@ -17,7 +22,7 @@ public abstract class OAuth implements RequestInterceptor { } private volatile String accessToken; - private Long expirationTimeMillis; + private Long expirationTimeSeconds; private AccessTokenListener accessTokenListener; protected OAuth20Service service; @@ -39,6 +44,7 @@ public abstract class OAuth implements RequestInterceptor { } String accessToken = getAccessToken(); if (accessToken != null) { + template.removeHeader("Authorization"); template.header("Authorization", "Bearer " + accessToken); } } @@ -73,7 +79,7 @@ public abstract class OAuth implements RequestInterceptor { public synchronized String getAccessToken() { // If first time, get the token - if (expirationTimeMillis == null || System.currentTimeMillis() >= expirationTimeMillis) { + if (expirationTimeSeconds == null || System.currentTimeMillis() >= expirationTimeSeconds * MILLIS_PER_SECOND) { updateAccessToken(); } return accessToken; @@ -86,7 +92,7 @@ public abstract class OAuth implements RequestInterceptor { */ public synchronized void setAccessToken(String accessToken, Integer expiresIn) { this.accessToken = accessToken; - this.expirationTimeMillis = expiresIn == null ? null : System.currentTimeMillis() + expiresIn * MILLIS_PER_SECOND; + this.expirationTimeSeconds = expiresIn == null ? null : System.currentTimeMillis() / MILLIS_PER_SECOND + expiresIn - LEEWAY_SECONDS; } -} \ No newline at end of file +} diff --git a/templates/libraries/feign/auth/OauthClientCredentialsGrant.mustache b/templates/libraries/feign/auth/OauthClientCredentialsGrant.mustache index ef22c21..3b8c342 100644 --- a/templates/libraries/feign/auth/OauthClientCredentialsGrant.mustache +++ b/templates/libraries/feign/auth/OauthClientCredentialsGrant.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import com.github.scribejava.core.builder.ServiceBuilder; @@ -21,7 +23,7 @@ public class OauthClientCredentialsGrant extends OAuth { @Override protected OAuthFlow getFlow() { - return OAuthFlow.application; + return OAuthFlow.APPLICATION; } /** diff --git a/templates/libraries/feign/auth/OauthPasswordGrant.mustache b/templates/libraries/feign/auth/OauthPasswordGrant.mustache index 870c375..b51ee91 100644 --- a/templates/libraries/feign/auth/OauthPasswordGrant.mustache +++ b/templates/libraries/feign/auth/OauthPasswordGrant.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import com.github.scribejava.core.builder.ServiceBuilder; @@ -24,7 +26,7 @@ public class OauthPasswordGrant extends OAuth { @Override protected OAuthFlow getFlow() { - return OAuthFlow.password; + return OAuthFlow.PASSWORD; } /** @@ -45,4 +47,4 @@ public class OauthPasswordGrant extends OAuth { .defaultScope(scopes) .build(new DefaultApi20Impl(authorizationUrl, tokenUrl)); } -} \ No newline at end of file +} diff --git a/templates/libraries/feign/build.gradle.mustache b/templates/libraries/feign/build.gradle.mustache index c9bf7c3..8af1cb1 100644 --- a/templates/libraries/feign/build.gradle.mustache +++ b/templates/libraries/feign/build.gradle.mustache @@ -57,9 +57,9 @@ if(hasProperty('target') && target == 'android') { def task = project.tasks.create "jar${variant.name.capitalize()}", Jar task.description = "Create jar artifact for ${variant.name}" task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - task.destinationDir = project.file("${project.buildDir}/outputs/jar") - task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + task.from variant.javaCompile.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" artifacts.add('archives', task); } } @@ -101,17 +101,16 @@ test { } ext { - swagger_annotations_version = "1.5.24" - jackson_version = "2.10.3" - jackson_databind_version = "2.10.3" + swagger_annotations_version = "1.6.11" + {{#jackson}} + jackson_version = "2.17.1" + jackson_databind_version = "2.17.1" + {{/jackson}} {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.2" + jackson_databind_nullable_version = "0.2.6" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" - {{#threetenbp}} - jackson_threetenbp_version = "2.9.10" - {{/threetenbp}} - feign_version = "10.11" + feign_version = "10.12" feign_form_version = "3.8.0" junit_version = "5.7.0" scribejava_version = "8.0.0" @@ -121,25 +120,24 @@ dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "io.github.openfeign:feign-core:$feign_version" + {{#jackson}} implementation "io.github.openfeign:feign-jackson:$feign_version" + {{/jackson}} implementation "io.github.openfeign:feign-slf4j:$feign_version" implementation "io.github.openfeign:feign-okhttp:$feign_version" implementation "io.github.openfeign.form:feign-form:$feign_form_version" + {{#jackson}} + {{#joda}} + implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" + {{/joda}} implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + {{/jackson}} {{#openApiNullable}} implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" {{/openApiNullable}} - {{#joda}} - implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" - {{/joda}} - {{#java8}} - implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" - {{/java8}} - {{#threetenbp}} - implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threetenbp_version" - {{/threetenbp}} implementation "com.brsanthu:migbase64:2.2" implementation "com.github.scribejava:scribejava-core:$scribejava_version" implementation "com.brsanthu:migbase64:2.2" @@ -147,7 +145,7 @@ dependencies { testImplementation "org.junit.jupiter:junit-jupiter:$junit_version" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version" - testImplementation "com.github.tomakehurst:wiremock-jre8:2.27.2" + testImplementation "com.github.tomakehurst:wiremock-jre8:2.35.1" testImplementation "org.hamcrest:hamcrest:2.2" testImplementation "commons-io:commons-io:2.8.0" testImplementation "ch.qos.logback:logback-classic:1.2.3" diff --git a/templates/libraries/feign/build.sbt.mustache b/templates/libraries/feign/build.sbt.mustache index f2912f0..9af32c2 100644 --- a/templates/libraries/feign/build.sbt.mustache +++ b/templates/libraries/feign/build.sbt.mustache @@ -9,24 +9,28 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.24" % "compile", + "io.swagger" % "swagger-annotations" % "1.6.11" % "compile", "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", - "io.github.openfeign" % "feign-core" % "10.11" % "compile", - "io.github.openfeign" % "feign-jackson" % "10.11" % "compile", - "io.github.openfeign" % "feign-slf4j" % "10.11" % "compile", + "io.github.openfeign" % "feign-core" % "10.12" % "compile", +{{#jackson}} + "io.github.openfeign" % "feign-jackson" % "10.12" % "compile", +{{/jackson}} + "io.github.openfeign" % "feign-slf4j" % "10.12" % "compile", "io.github.openfeign.form" % "feign-form" % "3.8.0" % "compile", - "io.github.openfeign" % "feign-okhttp" % "10.11" % "compile", - "com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "compile", - "com.fasterxml.jackson.datatype" % "jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}" % "2.9.10" % "compile", - "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile", + "io.github.openfeign" % "feign-okhttp" % "10.12" % "compile", +{{#jackson}} + "com.fasterxml.jackson.core" % "jackson-core" % "2.17.1" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.17.1" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.17.1" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.17.1" % "compile", + "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.15.2" % "compile", +{{/jackson}} "com.github.scribejava" % "scribejava-core" % "8.0.0" % "compile", "com.brsanthu" % "migbase64" % "2.2" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", "org.junit.jupiter" % "junit-jupiter" % "5.7.0" % "test", "org.junit.jupiter" % "junit-jupiter-params" % "5.7.0" % "test", - "com.github.tomakehurst" % "wiremock-jre8" % "2.27.2" % "test", + "com.github.tomakehurst" % "wiremock-jre8" % "2.35.1" % "test", "org.hamcrest" % "hamcrest" % "2.2" % "test", "commons-io" % "commons-io" % "2.8.0" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" diff --git a/templates/libraries/feign/model.mustache b/templates/libraries/feign/model.mustache new file mode 100644 index 0000000..5fa9bca --- /dev/null +++ b/templates/libraries/feign/model.mustache @@ -0,0 +1,78 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#useReflectionEqualsHashCode}} +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +{{/useReflectionEqualsHashCode}} +{{#models}} +{{#model}} +{{#additionalPropertiesType}} +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +{{/additionalPropertiesType}} +{{/model}} +{{/models}} +import java.util.Objects; +import java.util.Arrays; +{{#imports}} +import {{import}}; +{{/imports}} +{{#serializableModel}} +import java.io.Serializable; +{{/serializableModel}} +{{#jackson}} +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +{{#withXml}} +import com.fasterxml.jackson.dataformat.xml.annotation.*; +{{/withXml}} +{{#vendorExtensions.x-has-readonly-properties}} +import com.fasterxml.jackson.annotation.JsonCreator; +{{/vendorExtensions.x-has-readonly-properties}} +{{/jackson}} +{{#withXml}} +import {{javaxPackage}}.xml.bind.annotation.*; +import {{javaxPackage}}.xml.bind.annotation.adapters.*; +import io.github.threetenjaxb.core.*; +{{/withXml}} +{{#jsonb}} +import java.lang.reflect.Type; +import {{javaxPackage}}.json.bind.annotation.JsonbTypeDeserializer; +import {{javaxPackage}}.json.bind.annotation.JsonbTypeSerializer; +import {{javaxPackage}}.json.bind.serializer.DeserializationContext; +import {{javaxPackage}}.json.bind.serializer.JsonbDeserializer; +import {{javaxPackage}}.json.bind.serializer.JsonbSerializer; +import {{javaxPackage}}.json.bind.serializer.SerializationContext; +import {{javaxPackage}}.json.stream.JsonGenerator; +import {{javaxPackage}}.json.stream.JsonParser; +import {{javaxPackage}}.json.bind.annotation.JsonbProperty; +{{#vendorExtensions.x-has-readonly-properties}} +import {{javaxPackage}}.json.bind.annotation.JsonbCreator; +{{/vendorExtensions.x-has-readonly-properties}} +{{/jsonb}} +{{#parcelableModel}} +import android.os.Parcelable; +import android.os.Parcel; +{{/parcelableModel}} +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; +{{/useBeanValidation}} +{{#performBeanValidation}} +import org.hibernate.validator.constraints.*; +{{/performBeanValidation}} +{{#supportUrlQuery}} +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.StringJoiner; +{{/supportUrlQuery}} + +{{#models}} +{{#model}} +{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{#vendorExtensions.x-is-one-of-interface}}{{>oneof_interface}}{{/vendorExtensions.x-is-one-of-interface}}{{^vendorExtensions.x-is-one-of-interface}}{{>pojo}}{{/vendorExtensions.x-is-one-of-interface}}{{/isEnum}} +{{/model}} +{{/models}} diff --git a/templates/libraries/feign/model/ApiResponse.mustache b/templates/libraries/feign/model/ApiResponse.mustache index bc460dc..9c9b107 100644 --- a/templates/libraries/feign/model/ApiResponse.mustache +++ b/templates/libraries/feign/model/ApiResponse.mustache @@ -1,19 +1,21 @@ +{{>licenseInfo}} + package {{modelPackage}}; import java.util.Map; -import java.util.List; +import java.util.Collection; public class ApiResponse{ final private int statusCode; - final private Map> headers; + final private Map> headers; final private T data; /** * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response */ - public ApiResponse(int statusCode, Map> headers) { + public ApiResponse(int statusCode, Map> headers) { this(statusCode, headers, null); } @@ -22,7 +24,7 @@ public class ApiResponse{ * @param headers The headers of HTTP response * @param data The object deserialized from response bod */ - public ApiResponse(int statusCode, Map> headers, T data) { + public ApiResponse(int statusCode, Map> headers, T data) { this.statusCode = statusCode; this.headers = headers; this.data = data; @@ -32,7 +34,7 @@ public class ApiResponse{ return statusCode; } - public Map> getHeaders() { + public Map> getHeaders() { return headers; } diff --git a/templates/libraries/feign/model_test.mustache b/templates/libraries/feign/model_test.mustache index 0d75e12..2759ff5 100644 --- a/templates/libraries/feign/model_test.mustache +++ b/templates/libraries/feign/model_test.mustache @@ -6,13 +6,6 @@ package {{package}}; {{/imports}} import org.junit.jupiter.api.Test; -{{#fullJavaUtil}} -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -{{/fullJavaUtil}} - /** * Model tests for {{classname}} */ diff --git a/templates/libraries/okhttp-gson-nextgen/pojo.mustache b/templates/libraries/feign/pojo.mustache similarity index 54% rename from templates/libraries/okhttp-gson-nextgen/pojo.mustache rename to templates/libraries/feign/pojo.mustache index b30ce06..fe97e3b 100644 --- a/templates/libraries/okhttp-gson-nextgen/pojo.mustache +++ b/templates/libraries/feign/pojo.mustache @@ -1,37 +1,29 @@ -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashSet; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import {{invokerPackage}}.JSON; - /** * {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} * @deprecated{{/isDeprecated}} */{{#isDeprecated}} -@Deprecated{{/isDeprecated}}{{#description}} -@ApiModel(description = "{{{.}}}"){{/description}} +@Deprecated{{/isDeprecated}} +{{#swagger1AnnotationLibrary}} +{{#description}} +@ApiModel(description = "{{{.}}}") +{{/description}} +{{/swagger1AnnotationLibrary}} {{#jackson}} @JsonPropertyOrder({ {{#vars}} {{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}} {{/vars}} }) +{{#isClassnameSanitized}} +{{^hasDiscriminatorWithNonEmptyMapping}} @JsonTypeName("{{name}}") +{{/hasDiscriminatorWithNonEmptyMapping}} +{{/isClassnameSanitized}} {{/jackson}} {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} +{{#vendorExtensions.x-class-extra-annotation}} +{{{vendorExtensions.x-class-extra-annotation}}} +{{/vendorExtensions.x-class-extra-annotation}} public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ {{#serializableModel}} private static final long serialVersionUID = 1L; @@ -55,29 +47,22 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens public static final String JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}"; {{/jackson}} {{#withXml}} - {{#isXmlAttribute}} - @XmlAttribute(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/isXmlAttribute}} - {{^isXmlAttribute}} - {{^isContainer}} - @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/isContainer}} - {{#isContainer}} - // Is a container wrapped={{isXmlWrapped}} - {{#items}} - // items.name={{name}} items.baseName={{baseName}} items.xmlName={{xmlName}} items.xmlNamespace={{xmlNamespace}} - // items.example={{example}} items.type={{dataType}} - @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/items}} - {{#isXmlWrapped}} - @XmlElementWrapper({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/isXmlWrapped}} - {{/isContainer}} - {{/isXmlAttribute}} + @Xml{{#isXmlAttribute}}Attribute{{/isXmlAttribute}}{{^isXmlAttribute}}Element{{/isXmlAttribute}}(name = "{{items.xmlName}}{{^items.xmlName}}{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}{{/items.xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{#isXmlWrapped}} + @XmlElementWrapper(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{/isXmlWrapped}} + {{^isXmlAttribute}} + {{#isDateTime}} + @XmlJavaTypeAdapter(OffsetDateTimeXmlAdapter.class) + {{/isDateTime}} + {{/isXmlAttribute}} {{/withXml}} {{#gson}} @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) {{/gson}} + {{#vendorExtensions.x-field-extra-annotation}} + {{{vendorExtensions.x-field-extra-annotation}}} + {{/vendorExtensions.x-field-extra-annotation}} {{#vendorExtensions.x-is-jackson-optional-nullable}} {{#isContainer}} private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); @@ -88,7 +73,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/vendorExtensions.x-is-jackson-optional-nullable}} {{^vendorExtensions.x-is-jackson-optional-nullable}} {{#isContainer}} - private {{{datatypeWithEnum}}} {{name}}{{#required}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/required}}{{^required}} = null{{/required}}; + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/isContainer}} {{^isContainer}} {{#isDiscriminator}}protected{{/isDiscriminator}}{{^isDiscriminator}}private{{/isDiscriminator}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; @@ -96,22 +81,35 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/vendorExtensions.x-is-jackson-optional-nullable}} {{/vars}} - public {{classname}}() { {{#parent}}{{#parcelableModel}} - super();{{/parcelableModel}}{{/parent}}{{#gson}}{{#discriminator}} - this.{{{discriminatorName}}} = this.getClass().getSimpleName();{{/discriminator}}{{/gson}} - }{{#vendorExtensions.x-has-readonly-properties}}{{^withXml}} + public {{classname}}() { + {{#parent}} + {{#parcelableModel}} + super();{{/parcelableModel}} + {{/parent}} + {{#gson}} + {{#discriminator}} + {{#discriminator.isEnum}} + this.{{{discriminatorName}}} = this.getClass().getSimpleName(); + {{/discriminator.isEnum}} + {{/discriminator}} + {{/gson}} + } + {{#vendorExtensions.x-has-readonly-properties}} + {{^withXml}} {{#jsonb}}@JsonbCreator{{/jsonb}}{{#jackson}}@JsonCreator{{/jackson}} public {{classname}}( {{#readOnlyVars}} - {{#jsonb}}@JsonbProperty("{{baseName}}"){{/jsonb}}{{#jackson}}@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}){{/jackson}} {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}} + {{#jsonb}}@JsonbProperty(value = "{{baseName}}"{{^required}}, nullable = true{{/required}}){{/jsonb}}{{#jackson}}@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}){{/jackson}} {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}} {{/readOnlyVars}} ) { this(); {{#readOnlyVars}} - this.{{name}} = {{name}}; + this.{{name}} = {{#vendorExtensions.x-is-jackson-optional-nullable}}{{name}} == null ? JsonNullable.<{{{datatypeWithEnum}}}>undefined() : JsonNullable.of({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{name}}{{/vendorExtensions.x-is-jackson-optional-nullable}}; {{/readOnlyVars}} - }{{/withXml}}{{/vendorExtensions.x-has-readonly-properties}} + } + {{/withXml}} + {{/vendorExtensions.x-has-readonly-properties}} {{#vars}} {{^isReadOnly}} @@ -122,10 +120,10 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens } {{#isArray}} - public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} if (this.{{name}} == null || !this.{{name}}.isPresent()) { - this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}); } try { this.{{name}}.get().add({{name}}Item); @@ -135,11 +133,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens return this; {{/vendorExtensions.x-is-jackson-optional-nullable}} {{^vendorExtensions.x-is-jackson-optional-nullable}} - {{^required}} if (this.{{name}} == null) { - this.{{name}} = {{{defaultValue}}}; + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}; } - {{/required}} this.{{name}}.add({{name}}Item); return this; {{/vendorExtensions.x-is-jackson-optional-nullable}} @@ -147,10 +143,10 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/isArray}} {{#isMap}} - public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} if (this.{{name}} == null || !this.{{name}}.isPresent()) { - this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}); } try { this.{{name}}.get().put(key, {{name}}Item); @@ -162,7 +158,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{^vendorExtensions.x-is-jackson-optional-nullable}} {{^required}} if (this.{{name}} == null) { - this.{{name}} = {{{defaultValue}}}; + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}; } {{/required}} this.{{name}}.put(key, {{name}}Item); @@ -172,7 +168,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/isMap}} {{/isReadOnly}} - /** + /** {{#description}} * {{.}} {{/description}} @@ -189,25 +185,30 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{#deprecated}} * @deprecated {{/deprecated}} - **/ + */ {{#deprecated}} @Deprecated {{/deprecated}} {{#required}} {{#isNullable}} - @javax.annotation.Nullable + @{{javaxPackage}}.annotation.Nullable {{/isNullable}} {{^isNullable}} - @javax.annotation.Nonnull + @{{javaxPackage}}.annotation.Nonnull {{/isNullable}} {{/required}} {{^required}} - @javax.annotation.Nullable + @{{javaxPackage}}.annotation.Nullable {{/required}} {{#jsonb}} @JsonbProperty("{{baseName}}") {{/jsonb}} -{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{#useBeanValidation}} +{{>beanValidation}} +{{/useBeanValidation}} +{{#swagger1AnnotationLibrary}} + @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{/swagger1AnnotationLibrary}} {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} {{/vendorExtensions.x-extra-annotation}} @@ -256,7 +257,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/isReadOnly}} {{/vars}} - +{{>libraries/feign/additional_properties}} @Override public boolean equals(Object o) { {{#useReflectionEqualsHashCode}} @@ -306,7 +307,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens sb.append(" ").append(toIndentedString(super.toString())).append("\n"); {{/parent}} {{#vars}} - sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); + sb.append(" {{name}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{name}}){{/isPassword}}).append("\n"); {{/vars}} sb.append("}"); return sb.toString(); @@ -322,7 +323,200 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens } return o.toString().replace("\n", "\n "); } +{{#supportUrlQuery}} + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + {{#allVars}} + // add `{{baseName}}` to the URL query string + {{#isArray}} + {{#items.isPrimitiveType}} + {{#uniqueItems}} + if ({{getter}}() != null) { + int i = 0; + for ({{items.dataType}} _item : {{getter}}()) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if ({{getter}}() != null) { + for (int i = 0; i < {{getter}}().size(); i++) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + {{/uniqueItems}} + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + {{#items.isModel}} + {{#uniqueItems}} + if ({{getter}}() != null) { + int i = 0; + for ({{items.dataType}} _item : {{getter}}()) { + if (_item != null) { + joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if ({{getter}}() != null) { + for (int i = 0; i < {{getter}}().size(); i++) { + if ({{getter}}().get(i) != null) { + joiner.add({{getter}}().get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{^items.isModel}} + {{#uniqueItems}} + if ({{getter}}() != null) { + int i = 0; + for ({{items.dataType}} _item : {{getter}}()) { + if (_item != null) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + i++; + } + } + {{/uniqueItems}} + {{^uniqueItems}} + if ({{getter}}() != null) { + for (int i = 0; i < {{getter}}().size(); i++) { + if ({{getter}}().get(i) != null) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{/items.isPrimitiveType}} + {{/isArray}} + {{^isArray}} + {{#isMap}} + {{#items.isPrimitiveType}} + if ({{getter}}() != null) { + for (String _key : {{getter}}().keySet()) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix), + {{getter}}().get(_key), URLEncoder.encode(String.valueOf({{getter}}().get(_key)), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + if ({{getter}}() != null) { + for (String _key : {{getter}}().keySet()) { + if ({{getter}}().get(_key) != null) { + joiner.add({{getter}}().get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix)))); + } + } + } + {{/items.isPrimitiveType}} + {{/isMap}} + {{^isMap}} + {{#isPrimitiveType}} + if ({{getter}}() != null) { + try { + joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isModel}} + if ({{getter}}() != null) { + joiner.add({{getter}}().toUrlQueryString(prefix + "{{{baseName}}}" + suffix)); + } + {{/isModel}} + {{^isModel}} + if ({{getter}}() != null) { + try { + joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + {{/isModel}} + {{/isPrimitiveType}} + {{/isMap}} + {{/isArray}} + {{/allVars}} + return joiner.toString(); + } +{{/supportUrlQuery}} {{#parcelableModel}} public void writeToParcel(Parcel out, int flags) { @@ -383,159 +577,4 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens }; {{/parcelableModel}} - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - {{#allVars}} - openapiFields.add("{{baseName}}"); - {{/allVars}} - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - {{#requiredVars}} - openapiRequiredFields.add("{{baseName}}"); - {{/requiredVars}} - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to {{classname}} - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if ({{classname}}.openapiRequiredFields.isEmpty()) { - return; - } else { // has reuqired fields - throw new IllegalArgumentException(String.format("The required field(s) %s in {{{classname}}} is not found in the empty JSON string", {{classname}}.openapiRequiredFields.toString())); - } - } - {{^hasChildren}} - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!{{classname}}.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `{{classname}}` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - {{#requiredVars}} - {{#-first}} - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : {{classname}}.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); - } - } - {{/-first}} - {{/requiredVars}} - {{/hasChildren}} - {{^discriminator}} - {{#vars}} - {{#isArray}} - {{#items.isModel}} - JsonArray jsonArray{{name}} = jsonObj.getAsJsonArray("{{{baseName}}}"); - {{#isRequired}} - // validate the required field `{{{baseName}}}` (array) - for (int i = 0; i < jsonArray{{name}}.size(); i++) { - {{{items.dataType}}}.validateJsonObject(jsonArray{{name}}.get(i).getAsJsonObject()); - }; - {{/isRequired}} - {{^isRequired}} - // validate the optional field `{{{baseName}}}` (array) - if (jsonArray{{name}} != null) { - for (int i = 0; i < jsonArray{{name}}.size(); i++) { - {{{items.dataType}}}.validateJsonObject(jsonArray{{name}}.get(i).getAsJsonObject()); - }; - } - {{/isRequired}} - {{/items.isModel}} - {{/isArray}} - {{^isContainer}} - {{#isModel}} - {{#isRequired}} - // validate the required field `{{{baseName}}}` - {{{dataType}}}.validateJsonObject(jsonObj.getAsJsonObject("{{{baseName}}}")); - {{/isRequired}} - {{^isRequired}} - // validate the optional field `{{{baseName}}}` - if (jsonObj.getAsJsonObject("{{{baseName}}}") != null) { - {{{dataType}}}.validateJsonObject(jsonObj.getAsJsonObject("{{{baseName}}}")); - } - {{/isRequired}} - {{/isModel}} - {{/isContainer}} - {{/vars}} - {{/discriminator}} - {{#hasChildren}} - {{#discriminator}} - - String discriminatorValue = jsonObj.get("{{{propertyBaseName}}}").getAsString(); - switch (discriminatorValue) { - {{#mappedModels}} - case "{{mappingName}}": - {{modelName}}.validateJsonObject(jsonObj); - break; - {{/mappedModels}} - default: - throw new IllegalArgumentException(String.format("The value of the `{{{propertyBaseName}}}` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); - } - {{/discriminator}} - {{/hasChildren}} - } - -{{^hasChildren}} - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!{{classname}}.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes '{{classname}}' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter<{{classname}}> thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get({{classname}}.class)); - - return (TypeAdapter) new TypeAdapter<{{classname}}>() { - @Override - public void write(JsonWriter out, {{classname}} value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public {{classname}} read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } -{{/hasChildren}} - - /** - * Create an instance of {{classname}} given an JSON string - * - * @param jsonString JSON string - * @return An instance of {{classname}} - * @throws IOException if the JSON string is invalid with respect to {{classname}} - */ - public static {{{classname}}} fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, {{{classname}}}.class); - } - - /** - * Convert an instance of {{classname}} to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } } diff --git a/templates/libraries/feign/pom.mustache b/templates/libraries/feign/pom.mustache index f57614c..9be4a09 100644 --- a/templates/libraries/feign/pom.mustache +++ b/templates/libraries/feign/pom.mustache @@ -65,12 +65,12 @@ maven-surefire-plugin 3.0.0-M4 - + loggerPath conf/log4j.properties - + -Xms512m -Xmx1500m methods 10 @@ -158,7 +158,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.2 none 1.8 @@ -213,11 +213,20 @@ + {{#swagger1AnnotationLibrary}} io.swagger swagger-annotations ${swagger-annotations-version} + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + + io.swagger.core.v3 + swagger-annotations + ${swagger-annotations-version} + + {{/swagger2AnnotationLibrary}} @@ -232,11 +241,20 @@ feign-core ${feign-version} + {{#jackson}} io.github.openfeign feign-jackson ${feign-version} + {{/jackson}} + {{#gson}} + + io.github.openfeign + feign-gson + ${feign-version} + + {{/gson}} io.github.openfeign feign-slf4j @@ -253,6 +271,7 @@ ${feign-version} + {{#jackson}} com.fasterxml.jackson.core @@ -269,6 +288,14 @@ jackson-databind ${jackson-databind-version} + {{/jackson}} + {{#gson}} + + com.google.code.gson + gson + ${gson-version} + + {{/gson}} {{#openApiNullable}} org.openapitools @@ -291,20 +318,13 @@ ${jackson-version} {{/joda}} - {{#java8}} + {{#jackson}} com.fasterxml.jackson.datatype jackson-datatype-jsr310 ${jackson-version} - {{/java8}} - {{#threetenbp}} - - com.github.joschi.jackson - jackson-datatype-threetenbp - ${jackson-threetenbp-version} - - {{/threetenbp}} + {{/jackson}} com.github.scribejava scribejava-core @@ -316,12 +336,21 @@ ${jakarta-annotation-version} provided + {{#useBeanValidation}} + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + {{/useBeanValidation}} ch.qos.logback logback-classic - 1.2.3 + 1.3.13 test @@ -345,13 +374,7 @@ com.github.tomakehurst wiremock-jre8 - 2.27.2 - test - - - commons-io - commons-io - 2.8.0 + 2.35.1 test @@ -360,20 +383,35 @@ 1.8 ${java.version} ${java.version} - 1.5.24 - 10.11 + {{#swagger1AnnotationLibrary}} + 1.6.11 + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + 2.2.15 + {{/swagger2AnnotationLibrary}} + 13.2.1 3.8.0 - 2.10.3 + {{#jackson}} + 2.17.1 + 2.17.1 + {{/jackson}} + {{#gson}} + 2.10.1 + {{/gson}} {{#openApiNullable}} - 0.2.2 + 0.2.6 {{/openApiNullable}} - 2.10.3 - {{#threetenbp}} - 2.9.10 - {{/threetenbp}} + {{#useJakartaEe}} + 2.1.1 + {{/useJakartaEe}} + {{^useJakartaEe}} 1.3.5 - 5.7.0 + {{/useJakartaEe}} + {{#useBeanValidation}} + 3.0.2 + {{/useBeanValidation}} + 5.10.0 1.0.0 - 8.0.0 + 8.3.3 diff --git a/templates/libraries/google-api-client/ApiClient.mustache b/templates/libraries/google-api-client/ApiClient.mustache index aa91362..03c44a8 100644 --- a/templates/libraries/google-api-client/ApiClient.mustache +++ b/templates/libraries/google-api-client/ApiClient.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import {{apiPackage}}.*; @@ -10,15 +12,7 @@ import org.openapitools.jackson.nullable.JsonNullableModule; {{#joda}} import com.fasterxml.jackson.datatype.joda.JodaModule; {{/joda}} -{{#java8}} import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -{{/java8}} -{{#threetenbp}} -import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; -{{/threetenbp}} -{{#threetenbp}} -import org.threeten.bp.*; -{{/threetenbp}} import com.google.api.client.googleapis.util.Utils; import com.google.api.client.http.AbstractHttpContent; import com.google.api.client.http.HttpRequestFactory; @@ -46,16 +40,7 @@ public class ApiClient { {{#joda}} objectMapper.registerModule(new JodaModule()); {{/joda}} - {{#java8}} objectMapper.registerModule(new JavaTimeModule()); - {{/java8}} - {{#threetenbp}} - ThreeTenModule module = new ThreeTenModule(); - module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); - module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); - module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); - objectMapper.registerModule(module); - {{/threetenbp}} {{#openApiNullable}} JsonNullableModule jnm = new JsonNullableModule(); objectMapper.registerModule(jnm); diff --git a/templates/libraries/google-api-client/api.mustache b/templates/libraries/google-api-client/api.mustache index 97b1dd6..6ca6a28 100644 --- a/templates/libraries/google-api-client/api.mustache +++ b/templates/libraries/google-api-client/api.mustache @@ -14,7 +14,7 @@ import com.google.api.client.http.HttpMethods; import com.google.api.client.http.HttpResponse; import com.google.api.client.json.Json; -import javax.ws.rs.core.UriBuilder; +import {{javaxPackage}}.ws.rs.core.UriBuilder; import java.io.IOException; import java.util.Collection; import java.util.HashMap; @@ -121,7 +121,7 @@ public class {{classname}} { String localVarUrl = uriBuilder{{#hasPathParams}}.buildFromMap(uriVariables).toString();{{/hasPathParams}}{{^hasPathParams}}.build().toString();{{/hasPathParams}} GenericUrl genericUrl = new GenericUrl(localVarUrl); - HttpContent content = {{#isMethodPutOrPatchOrPost}}{{#bodyParam}}apiClient.new JacksonJsonHttpContent({{paramName}}){{/bodyParam}}{{^bodyParam}}new EmptyContent(){{/bodyParam}}{{/isMethodPutOrPatchOrPost}}{{^isMethodPutOrPatchOrPost}}null{{/isMethodPutOrPatchOrPost}}; + HttpContent content = {{#isBodyAllowed}}{{#bodyParam}}apiClient.new JacksonJsonHttpContent({{paramName}}){{/bodyParam}}{{^bodyParam}}new EmptyContent(){{/bodyParam}}{{/isBodyAllowed}}{{^isBodyAllowed}}null{{/isBodyAllowed}}; return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.{{httpMethod}}, genericUrl, content).execute(); }{{#bodyParam}} @@ -199,7 +199,7 @@ public class {{classname}} { String localVarUrl = uriBuilder{{#hasPathParams}}.buildFromMap(uriVariables).toString();{{/hasPathParams}}{{^hasPathParams}}.build().toString();{{/hasPathParams}} GenericUrl genericUrl = new GenericUrl(localVarUrl); - HttpContent content = {{#isMethodPutOrPatchOrPost}}{{#bodyParam}}apiClient.new JacksonJsonHttpContent({{paramName}}){{/bodyParam}}{{^bodyParam}}new EmptyContent(){{/bodyParam}}{{/isMethodPutOrPatchOrPost}}{{^isMethodPutOrPatchOrPost}}null{{/isMethodPutOrPatchOrPost}}; + HttpContent content = {{#isBodyAllowed}}{{#bodyParam}}apiClient.new JacksonJsonHttpContent({{paramName}}){{/bodyParam}}{{^bodyParam}}new EmptyContent(){{/bodyParam}}{{/isBodyAllowed}}{{^isBodyAllowed}}null{{/isBodyAllowed}}; return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.{{httpMethod}}, genericUrl, content).execute(); } diff --git a/templates/libraries/google-api-client/api_test.mustache b/templates/libraries/google-api-client/api_test.mustache index 1dc2f17..bfb939f 100644 --- a/templates/libraries/google-api-client/api_test.mustache +++ b/templates/libraries/google-api-client/api_test.mustache @@ -4,26 +4,26 @@ package {{package}}; {{#imports}}import {{import}}; {{/imports}} -import org.junit.Test; -import org.junit.Ignore; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import java.io.IOException; -{{^fullJavaUtil}} +import java.time.LocalDate; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} /** * API tests for {{classname}} */ -@Ignore public class {{classname}}Test { private final {{classname}} api = new {{classname}}(); - {{#operations}}{{#operation}} + {{#operations}} + {{#operation}} /** * {{summary}} * @@ -37,9 +37,12 @@ public class {{classname}}Test { {{#allParams}} {{{dataType}}} {{paramName}} = null; {{/allParams}} - {{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + // uncomment below to test the API function + //{{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); // TODO: test validations } - {{/operation}}{{/operations}} + + {{/operation}} + {{/operations}} } diff --git a/templates/libraries/google-api-client/build.gradle.mustache b/templates/libraries/google-api-client/build.gradle.mustache index 6341f02..c879831 100644 --- a/templates/libraries/google-api-client/build.gradle.mustache +++ b/templates/libraries/google-api-client/build.gradle.mustache @@ -32,14 +32,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 22 } compileOptions { - {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 - {{/java8}} - {{^java8}} - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - {{/java8}} } // Rename the aar correctly @@ -63,9 +57,9 @@ if(hasProperty('target') && target == 'android') { def task = project.tasks.create "jar${variant.name.capitalize()}", Jar task.description = "Create jar artifact for ${variant.name}" task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - task.destinationDir = project.file("${project.buildDir}/outputs/jar") - task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + task.from variant.javaCompile.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" artifacts.add('archives', task); } } @@ -84,14 +78,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven-publish' - {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - {{/java8}} - {{^java8}} - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 - {{/java8}} publishing { publications { @@ -110,19 +98,16 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.6.3" - jackson_version = "2.12.5" - jackson_databind_version = "2.10.5.1" + jackson_version = "2.17.1" + jackson_databind_version = "2.17.1" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.2" + jackson_databind_nullable_version = "0.2.6" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" google_api_client_version = "1.32.2" jersey_common_version = "2.25.1" jodatime_version = "2.9.9" - junit_version = "4.13.1" - {{#threetenbp}} - jackson_threeten_version = "2.9.10" - {{/threetenbp}} + junit_version = "4.13.2" } dependencies { @@ -137,16 +122,11 @@ dependencies { {{#openApiNullable}} implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" {{/openApiNullable}} - {{#java8}} implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" - {{/java8}} {{#joda}} implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" implementation "joda-time:joda-time:$jodatime_version" {{/joda}} - {{#threetenbp}} - implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threeten_version" - {{/threetenbp}} {{#withXml}} implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version" {{/withXml}} diff --git a/templates/libraries/google-api-client/build.sbt.mustache b/templates/libraries/google-api-client/build.sbt.mustache index 721b638..78da21f 100644 --- a/templates/libraries/google-api-client/build.sbt.mustache +++ b/templates/libraries/google-api-client/build.sbt.mustache @@ -12,23 +12,18 @@ lazy val root = (project in file(".")). "io.swagger" % "swagger-annotations" % "1.5.22", "com.google.api-client" % "google-api-client" % "1.23.0", "org.glassfish.jersey.core" % "jersey-common" % "2.25.1", - "com.fasterxml.jackson.core" % "jackson-core" % "2.12.1" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.13.4" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.1" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.5.1" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.4.2" % "compile", {{#withXml}} "com.fasterxml.jackson.dataformat" % "jackson-dataformat-xml" % "2.9.10" % "compile", {{/withXml}} {{#joda}} "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.9.10" % "compile", {{/joda}} - {{#java8}} "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.9.10" % "compile", - {{/java8}} - {{#threetenbp}} - "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile", - {{/threetenbp}} "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "junit" % "junit" % "4.13.1" % "test", + "junit" % "junit" % "4.13.2" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) ) diff --git a/templates/libraries/google-api-client/pom.mustache b/templates/libraries/google-api-client/pom.mustache index 81e0ee4..97c5123 100644 --- a/templates/libraries/google-api-client/pom.mustache +++ b/templates/libraries/google-api-client/pom.mustache @@ -63,17 +63,16 @@ org.apache.maven.plugins maven-surefire-plugin - 2.12 + 2.22.2 - + loggerPath conf/log4j.properties - + -Xms512m -Xmx1500m methods - pertest @@ -144,28 +143,17 @@ maven-compiler-plugin 3.6.1 - {{#java8}} - 1.8 - 1.8 - {{/java8}} - {{^java8}} - 1.7 - 1.7 - {{/java8}} + 1.8 + 1.8 org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.2 none - {{#java8}} - 1.8 - {{/java8}} - {{^java8}} - 1.7 - {{/java8}} + 1.8 @@ -217,11 +205,20 @@ + {{#swagger1AnnotationLibrary}} io.swagger swagger-annotations ${swagger-annotations-version} + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + + io.swagger.core.v3 + swagger-annotations + ${swagger-annotations-version} + + {{/swagger2AnnotationLibrary}} com.google.code.findbugs @@ -254,7 +251,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} {{#openApiNullable}} @@ -271,13 +268,11 @@ ${jackson-version} {{/withXml}} - {{#java8}} com.fasterxml.jackson.datatype jackson-datatype-jsr310 ${jackson-version} - {{/java8}} {{#joda}} com.fasterxml.jackson.datatype @@ -290,13 +285,6 @@ ${jodatime-version} {{/joda}} - {{#threetenbp}} - - com.github.joschi.jackson - jackson-datatype-threetenbp - ${jackson-threetenbp-version} - - {{/threetenbp}} jakarta.annotation jakarta.annotation-api @@ -306,30 +294,37 @@ - junit - junit + org.junit.jupiter + junit-jupiter-api ${junit-version} test UTF-8 - 1.5.22 - 1.32.2 - 2.25.1 - 2.12.1 - 2.10.5.1 + {{#swagger1AnnotationLibrary}} + 1.6.6 + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + 2.2.15 + {{/swagger2AnnotationLibrary}} + 2.2.0 + 2.40 + 2.17.1 + 2.17.1 {{#openApiNullable}} - 0.2.2 + 0.2.6 {{/openApiNullable}} {{#joda}} 2.9.9 {{/joda}} - {{#threetenbp}} - 2.9.10 - {{/threetenbp}} + {{#useJakartaEe}} + 2.1.1 + {{/useJakartaEe}} + {{^useJakartaEe}} 1.3.5 + {{/useJakartaEe}} 1.0.0 - 4.13.1 + 5.10.2 diff --git a/templates/libraries/jersey2/AbstractOpenApiSchema.mustache b/templates/libraries/jersey2/AbstractOpenApiSchema.mustache index 00253cc..d92c85e 100644 --- a/templates/libraries/jersey2/AbstractOpenApiSchema.mustache +++ b/templates/libraries/jersey2/AbstractOpenApiSchema.mustache @@ -6,14 +6,14 @@ import {{invokerPackage}}.ApiException; import java.util.Objects; import java.lang.reflect.Type; import java.util.Map; -import javax.ws.rs.core.GenericType; +import {{javaxPackage}}.ws.rs.core.GenericType; import com.fasterxml.jackson.annotation.JsonValue; /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}} +{{>generatedAnnotation}} public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object @@ -35,7 +35,7 @@ public abstract class AbstractOpenApiSchema { * * @return an instance of the actual schema/object */ - public abstract Map getSchemas(); + public abstract Map> getSchemas(); /** * Get the actual instance diff --git a/templates/libraries/jersey2/ApiClient.mustache b/templates/libraries/jersey2/ApiClient.mustache index 5c0f887..6d5f833 100644 --- a/templates/libraries/jersey2/ApiClient.mustache +++ b/templates/libraries/jersey2/ApiClient.mustache @@ -1,15 +1,17 @@ +{{>licenseInfo}} + package {{invokerPackage}}; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.Form; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; +import {{javaxPackage}}.ws.rs.client.Client; +import {{javaxPackage}}.ws.rs.client.ClientBuilder; +import {{javaxPackage}}.ws.rs.client.Entity; +import {{javaxPackage}}.ws.rs.client.Invocation; +import {{javaxPackage}}.ws.rs.client.WebTarget; +import {{javaxPackage}}.ws.rs.core.Form; +import {{javaxPackage}}.ws.rs.core.GenericType; +import {{javaxPackage}}.ws.rs.core.MediaType; +import {{javaxPackage}}.ws.rs.core.Response; +import {{javaxPackage}}.ws.rs.core.Response.Status; {{#hasOAuthMethods}} import com.github.scribejava.core.model.OAuth2AccessToken; @@ -38,6 +40,7 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; import org.glassfish.jersey.logging.LoggingFeature; +import java.util.AbstractMap.SimpleEntry; import java.util.logging.Level; import java.util.logging.Logger; import java.util.Collection; @@ -45,18 +48,16 @@ import java.util.Collections; import java.util.Map; import java.util.Map.Entry; import java.util.HashMap; -import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.List; import java.util.Arrays; import java.util.ArrayList; import java.util.Date; +import java.util.stream.Collectors; +import java.util.stream.Stream; {{#jsr310}} -{{#threetenbp}} -import org.threeten.bp.OffsetDateTime; -{{/threetenbp}} -{{^threetenbp}} import java.time.OffsetDateTime; -{{/threetenbp}} {{/jsr310}} import java.net.URLEncoder; @@ -78,88 +79,102 @@ import {{invokerPackage}}.auth.ApiKeyAuth; {{#hasOAuthMethods}} import {{invokerPackage}}.auth.OAuth; {{/hasOAuthMethods}} - +{{#useCustomTemplateCode}} import com.dropbox.sign.model.ErrorResponse; +{{/useCustomTemplateCode}} /** *

ApiClient class.

*/ {{>generatedAnnotation}} public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { - protected Map defaultHeaderMap = new HashMap(); - protected Map defaultCookieMap = new HashMap(); + private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + protected Map defaultHeaderMap = new HashMap<>(); + protected Map defaultCookieMap = new HashMap<>(); protected String basePath = "{{{basePath}}}"; protected String userAgent; private static final Logger log = Logger.getLogger(ApiClient.class.getName()); - protected List servers = new ArrayList({{#servers}}{{#-first}}Arrays.asList( -{{/-first}} new ServerConfiguration( - "{{{url}}}", - "{{{description}}}{{^description}}No description provided{{/description}}", - new HashMap(){{#variables}}{{#-first}} {{ -{{/-first}} put("{{{name}}}", new ServerVariable( - "{{{description}}}{{^description}}No description provided{{/description}}", - "{{{defaultValue}}}", - new HashSet( - {{#enumValues}} - {{#-first}} - Arrays.asList( - {{/-first}} - "{{{.}}}"{{^-last}},{{/-last}} - {{#-last}} - ) - {{/-last}} - {{/enumValues}} - ) - )); - {{#-last}} - }}{{/-last}}{{/variables}} - ){{^-last}},{{/-last}} + protected List servers = new ArrayList<>({{#servers}}{{#-first}}Arrays.asList( +{{/-first}} new ServerConfiguration( + "{{{url}}}", + "{{{description}}}{{^description}}No description provided{{/description}}", + {{^variables}} + new LinkedHashMap<>() + {{/variables}} + {{#variables}} + {{#-first}} + Stream.>of( + {{/-first}} + new SimpleEntry<>("{{{name}}}", new ServerVariable( + "{{{description}}}{{^description}}No description provided{{/description}}", + "{{{defaultValue}}}", + new LinkedHashSet<>({{#enumValues}}{{#-first}}Arrays.asList({{/-first}} + "{{{.}}}"{{^-last}},{{/-last}}{{#-last}} + ){{/-last}}{{/enumValues}}) + )){{^-last}},{{/-last}} + {{#-last}} + ).collect(Collectors.toMap(Entry::getKey, Entry::getValue, (a, b) -> a, LinkedHashMap::new)) + {{/-last}} + {{/variables}} + ){{^-last}},{{/-last}} {{#-last}} ){{/-last}}{{/servers}}); protected Integer serverIndex = 0; protected Map serverVariables = null; - protected Map> operationServers = new HashMap>() {{ + {{^hasOperationServers}} + protected Map> operationServers = new HashMap<>(); + {{/hasOperationServers}} + {{#hasOperationServers}} + protected Map> operationServers; + + { + Map> operationServers = new HashMap<>(); {{#apiInfo}} {{#apis}} {{#operations}} {{#operation}} {{#servers}} {{#-first}} - put("{{{classname}}}.{{{operationId}}}", new ArrayList(Arrays.asList( + operationServers.put("{{{classname}}}.{{{operationId}}}", new ArrayList<>(Arrays.asList( {{/-first}} - new ServerConfiguration( - "{{{url}}}", - "{{{description}}}{{^description}}No description provided{{/description}}", - new HashMap(){{#variables}}{{#-first}} {{ -{{/-first}} put("{{{name}}}", new ServerVariable( - "{{{description}}}{{^description}}No description provided{{/description}}", - "{{{defaultValue}}}", - new HashSet( - {{#enumValues}} - {{#-first}} - Arrays.asList( - {{/-first}} - "{{{.}}}"{{^-last}},{{/-last}} - {{#-last}} - ) - {{/-last}} - {{/enumValues}} - ) - )); - {{#-last}} - }}{{/-last}}{{/variables}} - ){{^-last}},{{/-last}} + new ServerConfiguration( + "{{{url}}}", + "{{{description}}}{{^description}}No description provided{{/description}}", + {{^variables}} + new LinkedHashMap<>() + {{/variables}} + {{#variables}} + {{#-first}} + Stream.>of( + {{/-first}} + new SimpleEntry<>("{{{name}}}", new ServerVariable( + "{{{description}}}{{^description}}No description provided{{/description}}", + "{{{defaultValue}}}", + new LinkedHashSet<>({{#enumValues}}{{#-first}}Arrays.asList({{/-first}} + "{{{.}}}"{{^-last}},{{/-last}}{{#-last}} + ){{/-last}}{{/enumValues}}) + )){{^-last}},{{/-last}} + {{#-last}} + ).collect(Collectors.toMap(Entry::getKey, Entry::getValue, (a, b) -> a, LinkedHashMap::new)) + {{/-last}} + {{/variables}} + ){{^-last}},{{/-last}} {{#-last}} - )));{{/-last}} + ))); + {{/-last}} {{/servers}} {{/operation}} {{/operations}} {{/apis}} {{/apiInfo}} - }}; - protected Map operationServerIndex = new HashMap(); - protected Map> operationServerVariables = new HashMap>(); + this.operationServers = operationServers; + } + + {{/hasOperationServers}} + protected Map operationServerIndex = new HashMap<>(); + protected Map> operationServerVariables = new HashMap<>(); protected boolean debugging = false; protected ClientConfig clientConfig; protected int connectionTimeout = 0; @@ -196,7 +211,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { setUserAgent("{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}"); // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap(); + authentications = new HashMap<>(); Authentication auth = null; {{#authMethods}} if (authMap != null) { @@ -234,7 +249,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { if (auth instanceof OAuth) { authentications.put("{{name}}", auth); } else { - authentications.put("{{name}}", new OAuth(basePath, "{{tokenUrl}}")); + authentications.put("{{name}}", new OAuth(basePath, "{{{tokenUrl}}}")); } {{/isOAuth}} {{/authMethods}} @@ -242,7 +257,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { authentications = Collections.unmodifiableMap(authentications); // Setup authentication lookup (key: authentication alias, value: authentication name) - authenticationLookup = new HashMap();{{#authMethods}}{{#vendorExtensions.x-auth-id-alias}} + authenticationLookup = new HashMap<>();{{#authMethods}}{{#vendorExtensions.x-auth-id-alias}} authenticationLookup.put("{{name}}", "{{.}}");{{/vendorExtensions.x-auth-id-alias}}{{/authMethods}} } @@ -258,7 +273,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { /** *

Getter for the field httpClient.

* - * @return a {@link javax.ws.rs.client.Client} object. + * @return a {@link {{javaxPackage}}.ws.rs.client.Client} object. */ public Client getHttpClient() { return httpClient; @@ -267,8 +282,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { /** *

Setter for the field httpClient.

* - * @param httpClient a {@link javax.ws.rs.client.Client} object. - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @param httpClient a {@link {{javaxPackage}}.ws.rs.client.Client} object. + * @return a {@link ApiClient} object. */ public ApiClient setHttpClient(Client httpClient) { this.httpClient = httpClient; @@ -288,7 +303,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * Sets the base URL to the location where the OpenAPI document is being served. * * @param basePath The base URL to the target host. - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setBasePath(String basePath) { this.basePath = basePath; @@ -311,7 +326,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { *

Setter for the field servers.

* * @param servers a {@link java.util.List} of servers. - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setServers(List servers) { this.servers = servers; @@ -332,7 +347,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { *

Setter for the field serverIndex.

* * @param serverIndex the server index - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setServerIndex(Integer serverIndex) { this.serverIndex = serverIndex; @@ -353,7 +368,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { *

Setter for the field serverVariables.

* * @param serverVariables a {@link java.util.Map} of server variables. - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setServerVariables(Map serverVariables) { this.serverVariables = serverVariables; @@ -400,7 +415,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * Helper method to set username for the first HTTP basic authentication. * * @param username Username - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setUsername(String username) { for (Authentication auth : authentications.values()) { @@ -416,7 +431,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * Helper method to set password for the first HTTP basic authentication. * * @param password Password - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setPassword(String password) { for (Authentication auth : authentications.values()) { @@ -432,14 +447,19 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * Helper method to set API key value for the first API key authentication. * * @param apiKey API key - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setApiKey(String apiKey) { for (Authentication auth : authentications.values()) { +{{^useCustomTemplateCode}} + if (auth instanceof ApiKeyAuth) { +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} if (auth instanceof HttpBasicAuth) { ((HttpBasicAuth) auth).setUsername(apiKey); return this; } else if (auth instanceof ApiKeyAuth) { +{{/useCustomTemplateCode}} ((ApiKeyAuth) auth).setApiKey(apiKey); return this; } @@ -447,11 +467,51 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { throw new RuntimeException("No API key authentication configured!"); } +{{^useCustomTemplateCode}} + /** + * Helper method to configure authentications which respects aliases of API keys. + * + * @param secrets Hash map from authentication name to its secret. + * @return a {@link ApiClient} object. + */ + public ApiClient configureApiKeys(Map secrets) { + for (Map.Entry authEntry : authentications.entrySet()) { + Authentication auth = authEntry.getValue(); + if (auth instanceof ApiKeyAuth) { + String name = authEntry.getKey(); + // respect x-auth-id-alias property + name = authenticationLookup.getOrDefault(name, name); + String secret = secrets.get(name); + if (secret != null) { + ((ApiKeyAuth) auth).setApiKey(secret); + } + } + } + return this; + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + * @return a {@link ApiClient} object. + */ + public ApiClient setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return this; + } + } + throw new RuntimeException("No API key authentication configured!"); + } +{{/useCustomTemplateCode}} + /** * Helper method to set bearer token for the first Bearer authentication. * * @param bearerToken Bearer token - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setBearerToken(String bearerToken) { for (Authentication auth : authentications.values()) { @@ -468,7 +528,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * Helper method to set access token for the first OAuth2 authentication. * * @param accessToken Access token - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setAccessToken(String accessToken) { for (Authentication auth : authentications.values()) { @@ -485,7 +545,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * * @param clientId the client ID * @param clientSecret the client secret - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setOauthCredentials(String clientId, String clientSecret) { for (Authentication auth : authentications.values()) { @@ -497,12 +557,28 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { throw new RuntimeException("No OAuth2 authentication configured!"); } + /** + * Helper method to set the credentials of a public client for the first OAuth2 authentication. + * + * @param clientId the client ID + * @return a {@link ApiClient} object. + */ + public ApiClient setOauthCredentialsForPublicClient(String clientId) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setCredentialsForPublicClient(clientId, isDebugging()); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + /** * Helper method to set the password flow for the first OAuth2 authentication. * * @param username the user name * @param password the user password - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setOauthPasswordFlow(String username, String password) { for (Authentication auth : authentications.values()) { @@ -518,7 +594,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * Helper method to set the authorization code flow for the first OAuth2 authentication. * * @param code the authorization code - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setOauthAuthorizationCodeFlow(String code) { for (Authentication auth : authentications.values()) { @@ -534,7 +610,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * Helper method to set the scopes for the first OAuth2 authentication. * * @param scope the oauth scope - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setOauthScope(String scope) { for (Authentication auth : authentications.values()) { @@ -551,7 +627,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * Set the User-Agent header's value (by adding to the default header map). * * @param userAgent Http user agent - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setUserAgent(String userAgent) { this.userAgent = userAgent; @@ -573,7 +649,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * * @param key The header's key * @param value The header's value - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient addDefaultHeader(String key, String value) { defaultHeaderMap.put(key, value); @@ -585,7 +661,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * * @param key The cookie's key * @param value The cookie's value - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient addDefaultCookie(String key, String value) { defaultCookieMap.put(key, value); @@ -605,7 +681,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * Set the client config. * * @param clientConfig Set the client config - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setClientConfig(ClientConfig clientConfig) { this.clientConfig = clientConfig; @@ -627,7 +703,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * Enable/disable debugging for this API client. * * @param debugging To enable (true) or disable (false) debugging - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setDebugging(boolean debugging) { this.debugging = debugging; @@ -651,7 +727,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * Set temp folder path * * @param tempFolderPath Temp folder path - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setTempFolderPath(String tempFolderPath) { this.tempFolderPath = tempFolderPath; @@ -673,7 +749,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * {@link Integer#MAX_VALUE}. * * @param connectionTimeout Connection timeout in milliseconds - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setConnectTimeout(int connectionTimeout) { this.connectionTimeout = connectionTimeout; @@ -696,7 +772,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * {@link Integer#MAX_VALUE}. * * @param readTimeout Read timeout in milliseconds - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setReadTimeout(int readTimeout) { this.readTimeout = readTimeout; @@ -717,7 +793,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * Set the date format used to parse/format date parameters. * * @param dateFormat Date format - * @return a {@link {{invokerPackage}}.ApiClient} object. + * @return a {@link ApiClient} object. */ public ApiClient setDateFormat(DateFormat dateFormat) { this.dateFormat = dateFormat; @@ -763,9 +839,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { return formatDate((Date) param); } {{#jsr310}}else if (param instanceof OffsetDateTime) { return formatOffsetDateTime((OffsetDateTime) param); - } {{/jsr310}}else if (param instanceof Collection) { + } {{/jsr310}}else if (param instanceof Collection) { StringBuilder b = new StringBuilder(); - for(Object o : (Collection)param) { + for(Object o : (Collection)param) { if(b.length() > 0) { b.append(','); } @@ -786,14 +862,14 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * @return List of pairs */ public List parameterToPairs(String collectionFormat, String name, Object value){ - List params = new ArrayList(); + List params = new ArrayList<>(); // preconditions if (name == null || name.isEmpty() || value == null) return params; - Collection valueCollection; - if (value instanceof Collection) { - valueCollection = (Collection) value; + Collection valueCollection; + if (value instanceof Collection) { + valueCollection = (Collection) value; } else { params.add(new Pair(name, parameterToString(value))); return params; @@ -845,14 +921,13 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * application/json; charset=UTF8 * APPLICATION/JSON * application/vnd.company+json - * "* / *" is also default to JSON + * "*{@literal /}*" is also considered JSON by this method. * * @param mime MIME * @return True if the MIME type is JSON */ public boolean isJsonMime(String mime) { - String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + return mime != null && (mime.equals("*/*") || JSON_MIME_PATTERN.matcher(mime).matches()); } /** @@ -864,8 +939,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * @return The Accept header to use. If the given array is empty, * null will be returned (not to set the Accept header explicitly). */ - public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) { + public String selectHeaderAccept(String... accepts) { + if (accepts == null || accepts.length == 0) { return null; } for (String accept : accepts) { @@ -885,8 +960,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * @return The Content-Type header to use. If the given array is empty, * JSON will be used. */ - public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0) { + public String selectHeaderContentType(String... contentTypes) { + if (contentTypes == null || contentTypes.length == 0) { return "application/json"; } for (String contentType : contentTypes) { @@ -930,7 +1005,17 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { File file = (File) param.getValue(); FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()) .fileName(file.getName()).size(file.length()).build(); - multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); + + // Attempt to probe the content type for the file so that the form part is more correctly + // and precisely identified, but fall back to application/octet-stream if that fails. + MediaType type; + try { + type = MediaType.valueOf(Files.probeContentType(file.toPath())); + } catch (IOException | IllegalArgumentException e) { + type = MediaType.APPLICATION_OCTET_STREAM_TYPE; + } + + multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, type)); } else { FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build(); multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(param.getValue()))); @@ -1024,11 +1109,6 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { return file; } - String contentType = null; - List contentTypes = response.getHeaders().get("Content-Type"); - if (contentTypes != null && !contentTypes.isEmpty()) - contentType = String.valueOf(contentTypes.get(0)); - // read the entity stream multiple times response.bufferEntity(); @@ -1055,7 +1135,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { /** *

Prepare the file for download from the response.

* - * @param response a {@link javax.ws.rs.core.Response} object. + * @param response a {@link {{javaxPackage}}.ws.rs.core.Response} object. * @return a {@link java.io.File} object. * @throws java.io.IOException if any. */ @@ -1130,14 +1210,11 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { boolean isBodyNullable) throws ApiException { - // Not using `.target(targetURL).path(path)` below, - // to support (constant) query string in `path`, e.g. "/posts?draft=1" String targetURL; - if (serverIndex != null && operationServers.containsKey(operation)) { - Integer index = operationServerIndex.containsKey(operation) ? operationServerIndex.get(operation) : serverIndex; - Map variables = operationServerVariables.containsKey(operation) ? - operationServerVariables.get(operation) : serverVariables; - List serverConfigurations = operationServers.get(operation); + List serverConfigurations; + if (serverIndex != null && (serverConfigurations = operationServers.get(operation)) != null) { + int index = operationServerIndex.getOrDefault(operation, serverIndex).intValue(); + Map variables = operationServerVariables.getOrDefault(operation, serverVariables); if (index < 0 || index >= serverConfigurations.size()) { throw new ArrayIndexOutOfBoundsException( String.format( @@ -1148,6 +1225,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } else { targetURL = this.basePath + path; } + // Not using `.target(targetURL).path(path)` below, + // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); if (queryParams != null) { @@ -1158,11 +1237,10 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } } - Invocation.Builder invocationBuilder; + Invocation.Builder invocationBuilder = target.request(); + if (accept != null) { - invocationBuilder = target.request().accept(accept); - } else { - invocationBuilder = target.request(); + invocationBuilder = invocationBuilder.accept(accept); } for (Entry entry : cookieParams.entrySet()) { @@ -1185,15 +1263,22 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { Map allHeaderParams = new HashMap<>(defaultHeaderMap); allHeaderParams.putAll(headerParams); - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + {{#hasHttpSignatureMethods}} + serializeToString(body, formParams, contentType, isBodyNullable), + {{/hasHttpSignatureMethods}} + {{^hasHttpSignatureMethods}} + null, + {{/hasHttpSignatureMethods}} + method, + target.getUri()); + } for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); @@ -1207,9 +1292,11 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { try { response = sendRequest(method, invocationBuilder, entity); + final int statusCode = response.getStatusInfo().getStatusCode(); + {{#hasOAuthMethods}} // If OAuth is used and a status 401 is received, renew the access token and retry the request - if (response.getStatusInfo() == Status.UNAUTHORIZED) { + if (authNames != null && statusCode == Status.UNAUTHORIZED.getStatusCode()) { for (String authName : authNames) { Authentication authentication = authentications.get(authName); if (authentication instanceof OAuth) { @@ -1225,10 +1312,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } {{/hasOAuthMethods}} - int statusCode = response.getStatusInfo().getStatusCode(); Map> responseHeaders = buildResponseHeaders(response); - if (response.getStatusInfo() == Status.NO_CONTENT) { + if (statusCode == Status.NO_CONTENT.getStatusCode()) { return new ApiResponse(statusCode, responseHeaders); } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { if (returnType == null) { @@ -1237,6 +1323,22 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { return new ApiResponse(statusCode, responseHeaders, deserialize(response, returnType)); } } else { +{{^useCustomTemplateCode}} + String message = "error"; + String respBody = null; + if (response.hasEntity()) { + try { + respBody = String.valueOf(response.readEntity(String.class)); + message = respBody; + } catch (RuntimeException e) { + // e.printStackTrace(); + } + } + throw new ApiException( + response.getStatus(), message, buildResponseHeaders(response), respBody); + } +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} String message = "error"; String respBody = null; ErrorResponse errorResponse = null; @@ -1257,6 +1359,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { throw new ApiException( response.getStatus(), message, buildResponseHeaders(response), respBody, errorResponse); } +{{/useCustomTemplateCode}} } finally { try { response.close(); @@ -1301,8 +1404,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { clientConfig = getDefaultClientConfig(); ClientBuilder clientBuilder = ClientBuilder.newBuilder(); - customizeClientBuilder(clientBuilder); clientBuilder = clientBuilder.withConfig(clientConfig); + customizeClientBuilder(clientBuilder); return clientBuilder.build(); } @@ -1346,7 +1449,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * To completely disable certificate validation (at your own risk), you can * override this method and invoke disableCertificateValidation(clientBuilder). * - * @param clientBuilder a {@link javax.ws.rs.client.ClientBuilder} object. + * @param clientBuilder a {@link {{javaxPackage}}.ws.rs.client.ClientBuilder} object. */ protected void customizeClientBuilder(ClientBuilder clientBuilder) { // No-op extension point @@ -1358,7 +1461,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * Please note that trusting all certificates is extremely risky. * This may be useful in a development environment with self-signed certificates. * - * @param clientBuilder a {@link javax.ws.rs.client.ClientBuilder} object. + * @param clientBuilder a {@link {{javaxPackage}}.ws.rs.client.ClientBuilder} object. * @throws java.security.KeyManagementException if any. * @throws java.security.NoSuchAlgorithmException if any. */ @@ -1385,14 +1488,14 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { /** *

Build the response headers.

* - * @param response a {@link javax.ws.rs.core.Response} object. + * @param response a {@link {{javaxPackage}}.ws.rs.core.Response} object. * @return a {@link java.util.Map} of response headers. */ protected Map> buildResponseHeaders(Response response) { - Map> responseHeaders = new HashMap>(); + Map> responseHeaders = new HashMap<>(); for (Entry> entry: response.getHeaders().entrySet()) { List values = entry.getValue(); - List headers = new ArrayList(); + List headers = new ArrayList<>(); for (Object o : values) { headers.add(String.valueOf(o)); } diff --git a/templates/libraries/jersey2/JSON.mustache b/templates/libraries/jersey2/JSON.mustache index f132a31..e1f17c9 100644 --- a/templates/libraries/jersey2/JSON.mustache +++ b/templates/libraries/jersey2/JSON.mustache @@ -1,23 +1,17 @@ +{{>licenseInfo}} + package {{invokerPackage}}; -{{#threetenbp}} -import org.threeten.bp.*; -{{/threetenbp}} import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.json.JsonMapper; {{#openApiNullable}} import org.openapitools.jackson.nullable.JsonNullableModule; {{/openApiNullable}} -{{#java8}} import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -{{/java8}} {{#joda}} import com.fasterxml.jackson.datatype.joda.JodaModule; {{/joda}} -{{#threetenbp}} -import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; -{{/threetenbp}} {{#models.0}} import {{modelPackage}}.*; {{/models.0}} @@ -27,40 +21,36 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.ext.ContextResolver; +import {{javaxPackage}}.ws.rs.core.GenericType; +import {{javaxPackage}}.ws.rs.ext.ContextResolver; {{>generatedAnnotation}} public class JSON implements ContextResolver { private ObjectMapper mapper; public JSON() { - mapper = new ObjectMapper(); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); - mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); - mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); - mapper.setDateFormat(new RFC3339DateFormat()); - {{#java8}} - mapper.registerModule(new JavaTimeModule()); - {{/java8}} - {{#joda}} - mapper.registerModule(new JodaModule()); - {{/joda}} - {{#threetenbp}} - ThreeTenModule module = new ThreeTenModule(); - module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); - module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); - module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); - mapper.registerModule(module); - {{/threetenbp}} - {{#openApiNullable}} - JsonNullableModule jnm = new JsonNullableModule(); - mapper.registerModule(jnm); - {{/openApiNullable}} + mapper = JsonMapper.builder() + .serializationInclusion(JsonInclude.Include.NON_NULL) + .configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false) +{{^useCustomTemplateCode}} + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true) +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) +{{/useCustomTemplateCode}} + .configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) + .enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING) + .defaultDateFormat(new RFC3339DateFormat()) + .addModule(new JavaTimeModule()) + {{#joda}} + .addModule(new JodaModule()) + {{/joda}} + {{#openApiNullable}} + .addModule(new JsonNullableModule()) + {{/openApiNullable}} + .build(); } /** @@ -93,7 +83,7 @@ public class JSON implements ContextResolver { public static Class getClassForElement(JsonNode node, Class modelClass) { ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); if (cdm != null) { - return cdm.getClassForElement(node, new HashSet>()); + return cdm.getClassForElement(node, new HashSet<>()); } return null; } @@ -113,7 +103,7 @@ public class JSON implements ContextResolver { ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { modelClass = cls; discriminatorName = propertyName; - discriminatorMappings = new HashMap>(); + discriminatorMappings = new HashMap<>(); if (mappings != null) { discriminatorMappings.putAll(mappings); } @@ -197,6 +187,9 @@ public class JSON implements ContextResolver { */ public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { if (modelClass.isInstance(inst)) { +{{^useCustomTemplateCode}} + // This handles the 'allOf' use case with single parent inheritance. +{{/useCustomTemplateCode}} return true; } if (visitedClasses.contains(modelClass)) { @@ -207,9 +200,9 @@ public class JSON implements ContextResolver { visitedClasses.add(modelClass); // Traverse the oneOf/anyOf composed schemas. - Map descendants = modelDescendants.get(modelClass); + Map> descendants = modelDescendants.get(modelClass); if (descendants != null) { - for (GenericType childType : descendants.values()) { + for (GenericType childType : descendants.values()) { if (isInstanceOf(childType.getRawType(), inst, visitedClasses)) { return true; } @@ -221,12 +214,12 @@ public class JSON implements ContextResolver { /** * A map of discriminators for all model classes. */ - private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap, ClassDiscriminatorMapping>(); + private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<>(); /** * A map of oneOf/anyOf descendants for each model class. */ - private static Map, Map> modelDescendants = new HashMap, Map>(); + private static Map, Map>> modelDescendants = new HashMap<>(); /** * Register a model class discriminator. @@ -246,7 +239,7 @@ public class JSON implements ContextResolver { * @param modelClass the model class * @param descendants a map of oneOf/anyOf descendants. */ - public static void registerDescendants(Class modelClass, Map descendants) { + public static void registerDescendants(Class modelClass, Map> descendants) { modelDescendants.put(modelClass, descendants); } diff --git a/templates/libraries/jersey2/additional_properties.mustache b/templates/libraries/jersey2/additional_properties.mustache index 61973dc..2955e93 100644 --- a/templates/libraries/jersey2/additional_properties.mustache +++ b/templates/libraries/jersey2/additional_properties.mustache @@ -13,7 +13,7 @@ @JsonAnySetter public {{classname}} putAdditionalProperty(String key, {{{.}}} value) { if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); + this.additionalProperties = new HashMap<>(); } this.additionalProperties.put(key, value); return this; diff --git a/templates/libraries/jersey2/anyof_model.mustache b/templates/libraries/jersey2/anyof_model.mustache index d5b3819..d480667 100644 --- a/templates/libraries/jersey2/anyof_model.mustache +++ b/templates/libraries/jersey2/anyof_model.mustache @@ -1,5 +1,5 @@ -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.Response; +import {{javaxPackage}}.ws.rs.core.GenericType; +import {{javaxPackage}}.ws.rs.core.Response; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; @@ -24,7 +24,7 @@ import {{invokerPackage}}.JSON; {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} @JsonDeserialize(using={{classname}}.{{classname}}Deserializer.class) @JsonSerialize(using = {{classname}}.{{classname}}Serializer.class) -public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} { +public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}} implements {{{.}}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-implements}} { private static final Logger log = Logger.getLogger({{classname}}.class.getName()); public static class {{classname}}Serializer extends StdSerializer<{{classname}}> { @@ -57,7 +57,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im Object deserialized = null; {{#discriminator}} - Class cls = JSON.getClassForElement(tree, {{classname}}.class); + Class cls = JSON.getClassForElement(tree, new {{classname}}().getClass()); if (cls != null) { // When the OAS schema includes a discriminator, use the discriminator value to // discriminate the anyOf schemas. @@ -99,7 +99,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im } // store a list of schema names defined in anyOf - public static final Map schemas = new HashMap(); + public static final Map> schemas = new HashMap<>(); public {{classname}}() { super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); @@ -134,7 +134,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im JSON.registerDescendants({{classname}}.class, Collections.unmodifiableMap(schemas)); {{#discriminator}} // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); + Map> mappings = new HashMap<>(); {{#mappedModels}} mappings.put("{{mappingName}}", {{modelName}}.class); {{/mappedModels}} @@ -144,7 +144,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im } @Override - public Map getSchemas() { + public Map> getSchemas() { return {{classname}}.schemas; } @@ -166,7 +166,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im {{/isNullable}} {{#anyOf}} - if (JSON.isInstanceOf({{{.}}}.class, instance, new HashSet>())) { + if (JSON.isInstanceOf({{{.}}}.class, instance, new HashSet<>())) { super.setActualInstance(instance); return; } diff --git a/templates/libraries/jersey2/api.mustache b/templates/libraries/jersey2/api.mustache index dc965e1..6290978 100644 --- a/templates/libraries/jersey2/api.mustache +++ b/templates/libraries/jersey2/api.mustache @@ -6,18 +6,22 @@ import {{invokerPackage}}.ApiResponse; import {{invokerPackage}}.Configuration; import {{invokerPackage}}.Pair; -import javax.ws.rs.core.GenericType; +import {{javaxPackage}}.ws.rs.core.GenericType; {{#imports}}import {{import}}; {{/imports}} -{{^fullJavaUtil}} +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} {{>generatedAnnotation}} {{#operations}} public class {{classname}} { @@ -86,8 +90,10 @@ public class {{classname}} { } {{/vendorExtensions.x-group-parameters}} + {{#useCustomTemplateCode}} __OVERLOAD_DELIMITER { "class": "{{classname}}", "method": "{{operationId}}", "returnType": "{{#returnType}}{{.}}{{/returnType}}", "parameters": [ {{#allParams}}{ "type": "{{{dataType}}}", "name": "{{paramName}}", "required": {{#required}}true{{/required}}{{^required}}false{{/required}}, "value": {{^defaultValue}}null{{/defaultValue}}{{#defaultValue}}{{#isString}}"{{/isString}}{{{.}}}{{#isString}}"{{/isString}}{{/defaultValue}} }{{^-last}},{{/-last}}{{/allParams}} ]} + {{/useCustomTemplateCode}} {{^vendorExtensions.x-group-parameters}} /** * {{summary}} @@ -118,72 +124,126 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { +{{#useCustomTemplateCode}} {{#allParams}}{{^required}}{{#defaultValue}} if ({{paramName}} == null) { {{paramName}} = {{#isString}}"{{/isString}}{{{defaultValue}}}{{#isString}}"{{/isString}}; }{{/defaultValue}}{{/required}}{{/allParams}} - Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; - {{#allParams}}{{#required}} - // verify the required parameter '{{paramName}}' is set +{{/useCustomTemplateCode}} + {{#hasRequiredParams}} + // Check required parameters + {{#allParams}} + {{#required}} if ({{paramName}} == null) { throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}"); } - {{/required}}{{/allParams}} - // create path and map variables - String localVarPath = "{{{path}}}"{{#pathParams}} - .replaceAll("\\{" + "{{baseName}}" + "\\}", apiClient.escapeString({{{paramName}}}.toString())){{/pathParams}}; + {{/required}} + {{/allParams}} - // query params - {{javaUtilPrefix}}List localVarQueryParams = new {{javaUtilPrefix}}ArrayList(); - {{javaUtilPrefix}}Map localVarHeaderParams = new {{javaUtilPrefix}}HashMap(); - {{javaUtilPrefix}}Map localVarCookieParams = new {{javaUtilPrefix}}HashMap(); - {{javaUtilPrefix}}Map localVarFormParams = new {{javaUtilPrefix}}HashMap(); + {{/hasRequiredParams}} + {{#hasPathParams}} + // Path parameters + String localVarPath = "{{{path}}}"{{#pathParams}} + .replaceAll({{=% %=}}"\\{%baseName%}"%={{ }}=%, apiClient.escapeString({{{paramName}}}.toString())){{/pathParams}}; + {{/hasPathParams}} {{#queryParams}} + {{#-first}} + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("{{{collectionFormat}}}", "{{baseName}}", {{paramName}}) + ); + {{/-first}} + {{^-first}} localVarQueryParams.addAll(apiClient.parameterToPairs("{{{collectionFormat}}}", "{{baseName}}", {{paramName}})); + {{/-first}} + {{#-last}} + + {{/-last}} {{/queryParams}} + {{#headerParams}} + {{#-first}} + // Header parameters + Map localVarHeaderParams = new LinkedHashMap<>(); + {{/-first}} + {{^required}}if ({{paramName}} != null) { + {{/required}}localVarHeaderParams.put("{{baseName}}", apiClient.parameterToString({{paramName}}));{{^required}} + }{{/required}} + {{#-last}} - {{#headerParams}}if ({{paramName}} != null) - localVarHeaderParams.put("{{baseName}}", apiClient.parameterToString({{paramName}})); + {{/-last}} {{/headerParams}} + {{#cookieParams}} + {{#-first}} + // Cookie parameters + Map localVarCookieParams = new LinkedHashMap<>(); + {{/-first}} + {{^required}}if ({{paramName}} != null) { + {{/required}}localVarCookieParams.put("{{baseName}}", apiClient.parameterToString({{paramName}}));{{^required}} + }{{/required}} + {{#-last}} - {{#cookieParams}}if ({{paramName}} != null) - localVarCookieParams.put("{{baseName}}", apiClient.parameterToString({{paramName}})); + {{/-last}} {{/cookieParams}} +{{^useCustomTemplateCode}} + {{#formParams}} + {{#-first}} + // Form parameters + Map localVarFormParams = new LinkedHashMap<>(); + {{/-first}} + {{^required}}if ({{paramName}} != null) { + {{/required}}localVarFormParams.put("{{baseName}}", {{paramName}});{{^required}} + }{{/required}} + {{#-last}} - {{#formParams}}if ({{paramName}} != null) - localVarFormParams.put("{{baseName}}", {{paramName}}); + {{/-last}} {{/formParams}} - - final String[] localVarAccepts = { - {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} - }; - +{{/useCustomTemplateCode}} + String localVarAccept = apiClient.selectHeaderAccept({{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}); +{{^useCustomTemplateCode}} + String localVarContentType = apiClient.selectHeaderContentType({{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}); +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} + Map localVarFormParams = new LinkedHashMap<>(); localVarFormParams = {{#bodyParam}}{{paramName}}.createFormData(){{/bodyParam}}{{^bodyParam}}new {{javaUtilPrefix}}HashMap(){{/bodyParam}}; boolean isFileTypeFound = !localVarFormParams.isEmpty(); - - final String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; - + String localVarContentType = isFileTypeFound? "multipart/form-data" : apiClient.selectHeaderContentType({{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}); +{{/useCustomTemplateCode}} + {{#hasAuthMethods}} + String[] localVarAuthNames = {{=% %=}}new String[] {%#authMethods%"%name%"%^-last%, %/-last%%/authMethods%};%={{ }}=% + {{/hasAuthMethods}} {{#returnType}} GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {}; - {{/returnType}} - return apiClient.invokeAPI("{{classname}}.{{operationId}}", localVarPath, "{{httpMethod}}", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}}, {{#bodyParam}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/bodyParam}}{{^bodyParam}}false{{/bodyParam}}); +{{^useCustomTemplateCode}} + return apiClient.invokeAPI("{{classname}}.{{operationId}}", {{#hasPathParams}}localVarPath{{/hasPathParams}}{{^hasPathParams}}"{{path}}"{{/hasPathParams}}, "{{httpMethod}}", {{#queryParams}}{{#-first}}localVarQueryParams{{/-first}}{{/queryParams}}{{^queryParams}}new ArrayList<>(){{/queryParams}}, {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}, + {{#headerParams}}{{#-first}}localVarHeaderParams{{/-first}}{{/headerParams}}{{^headerParams}}new LinkedHashMap<>(){{/headerParams}}, {{#cookieParams}}{{#-first}}localVarCookieParams{{/-first}}{{/cookieParams}}{{^cookieParams}}new LinkedHashMap<>(){{/cookieParams}}, {{#formParams}}{{#-first}}localVarFormParams{{/-first}}{{/formParams}}{{^formParams}}new LinkedHashMap<>(){{/formParams}}, localVarAccept, localVarContentType, + {{#hasAuthMethods}}localVarAuthNames{{/hasAuthMethods}}{{^hasAuthMethods}}null{{/hasAuthMethods}}, {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}}, {{#bodyParam}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/bodyParam}}{{^bodyParam}}false{{/bodyParam}}); +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} + return apiClient.invokeAPI( + "{{classname}}.{{operationId}}", + {{#hasPathParams}}localVarPath{{/hasPathParams}}{{^hasPathParams}}"{{path}}"{{/hasPathParams}}, + "{{httpMethod}}", + {{#queryParams}}{{#-first}}localVarQueryParams{{/-first}}{{/queryParams}}{{^queryParams}}new ArrayList<>(){{/queryParams}}, + {{#bodyParam}}isFileTypeFound ? null : {{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}, + {{#headerParams}}{{#-first}}localVarHeaderParams{{/-first}}{{/headerParams}}{{^headerParams}}new LinkedHashMap<>(){{/headerParams}}, + {{#cookieParams}}{{#-first}}localVarCookieParams{{/-first}}{{/cookieParams}}{{^cookieParams}}new LinkedHashMap<>(){{/cookieParams}}, + localVarFormParams, + localVarAccept, + localVarContentType, + {{#hasAuthMethods}}localVarAuthNames{{/hasAuthMethods}}{{^hasAuthMethods}}null{{/hasAuthMethods}}, + {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}}, + {{#bodyParam}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/bodyParam}}{{^bodyParam}}false{{/bodyParam}} + ); +{{/useCustomTemplateCode}} + } {{#vendorExtensions.x-group-parameters}} public class API{{operationId}}Request { {{#allParams}} - private {{#isRequired}}final {{/isRequired}}{{{dataType}}} {{paramName}}; + private {{{dataType}}} {{paramName}}; {{/allParams}} private API{{operationId}}Request({{#pathParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}) { diff --git a/templates/libraries/jersey2/apiException.mustache b/templates/libraries/jersey2/apiException.mustache index 84b4567..70c2af5 100644 --- a/templates/libraries/jersey2/apiException.mustache +++ b/templates/libraries/jersey2/apiException.mustache @@ -2,23 +2,29 @@ package {{invokerPackage}}; -import com.dropbox.sign.model.ErrorResponse; import java.util.Map; import java.util.List; {{#caseInsensitiveResponseHeaders}} import java.util.Map.Entry; import java.util.TreeMap; {{/caseInsensitiveResponseHeaders}} +{{#useCustomTemplateCode}} +import com.dropbox.sign.model.ErrorResponse; +{{/useCustomTemplateCode}} /** * API Exception */ {{>generatedAnnotation}} public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ + private static final long serialVersionUID = 1L; + private int code = 0; private Map> responseHeaders = null; private String responseBody = null; +{{#useCustomTemplateCode}} private ErrorResponse errorResponse; +{{/useCustomTemplateCode}} public ApiException() {} @@ -72,11 +78,13 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us this.responseBody = responseBody; } +{{#useCustomTemplateCode}} public ApiException(int code, String message, Map> responseHeaders, String responseBody, ErrorResponse errorResponse) { this(code, message, responseHeaders, responseBody); this.errorResponse = errorResponse; } +{{/useCustomTemplateCode}} /** * Get the HTTP status code. * @@ -103,8 +111,10 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us public String getResponseBody() { return responseBody; } +{{#useCustomTemplateCode}} public ErrorResponse getErrorResponse() { return errorResponse; } +{{/useCustomTemplateCode}} } diff --git a/templates/libraries/jersey2/api_doc.mustache b/templates/libraries/jersey2/api_doc.mustache index 3994b56..4570967 100644 --- a/templates/libraries/jersey2/api_doc.mustache +++ b/templates/libraries/jersey2/api_doc.mustache @@ -4,10 +4,16 @@ All URIs are relative to *{{basePath}}* -Method | HTTP request | Description -------------- | ------------- | ------------- +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +{{^useCustomTemplateCode}} +{{#operations}}{{#operation}}| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} | +{{/operation}}{{/operations}} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} {{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} {{/operation}}{{/operations}} +{{/useCustomTemplateCode}} {{#operations}} {{#operation}} @@ -28,16 +34,86 @@ Method | HTTP request | Description ### Example ```java +{{^useCustomTemplateCode}} +{{#vendorExtensions.x-java-import}} +import {{.}}; +{{/vendorExtensions.x-java-import}} +// Import classes: +import {{{invokerPackage}}}.ApiClient; +import {{{invokerPackage}}}.ApiException; +import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}} +import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}} +import {{{invokerPackage}}}.model.*; +import {{{package}}}.{{{classname}}}; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("{{{basePath}}}"); + {{#hasAuthMethods}} + {{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + // Configure HTTP basic authorization: {{{name}}} + HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setUsername("YOUR USERNAME"); + {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}} + // Configure HTTP bearer authorization: {{{name}}} + HttpBearerAuth {{{name}}} = (HttpBearerAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} + // Configure API key authorization: {{{name}}} + ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} + // Configure OAuth2 access token for authorization: {{{name}}} + OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}} + {{/authMethods}} + {{/hasAuthMethods}} + + {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); + {{#allParams}} + {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} + {{/allParams}} + try { + {{^vendorExtensions.x-group-parameters}} + {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}); + {{/vendorExtensions.x-group-parameters}} + {{#vendorExtensions.x-group-parameters}} + {{#returnType}}{{{.}}} result = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}){{#allParams}}{{^isPathParam}} + .{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}} + .execute(); + {{/vendorExtensions.x-group-parameters}} + {{#returnType}} + System.out.println(result); + {{/returnType}} + } catch (ApiException e) { + System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} REPLACE_ME_WITH_EXAMPLE_FOR__{{{operationId}}}_Java_CODE +{{/useCustomTemplateCode}} ``` ### Parameters {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} -Name | Type | Description | Notes -------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------|{{/-last}}{{/allParams}} +{{^useCustomTemplateCode}} +{{#allParams}}| **{{paramName}}** | {{#isContainer}}{{#isArray}}{{#items}}{{#isModel}}{{^isFile}}[{{/isFile}}{{/isModel}}**List<{{dataType}}>**{{#isModel}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isModel}}{{/items}}{{/isArray}}{{#isMap}}{{#items}}{{#isModel}}{{^isFile}}[{{/isFile}}{{/isModel}}**Map<String,{{dataType}}>**{{#isModel}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isModel}}{{/items}}{{/isMap}}{{/isContainer}}{{^isContainer}}{{#isModel}}{{^isFile}}[{{/isFile}}{{/isModel}}**{{dataType}}**{{#isModel}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isModel}}{{/isContainer}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} | +{{/allParams}} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} {{#allParams}} **{{paramName}}** | {{#isContainer}}{{#isArray}}{{#items}}{{#isModel}}{{^isFile}}[{{/isFile}}{{/isModel}}**List<{{dataType}}>**{{#isModel}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isModel}}{{/items}}{{/isArray}}{{#isMap}}{{#items}}{{#isModel}}{{^isFile}}[{{/isFile}}{{/isModel}}**Map<String,{{dataType}}>**{{#isModel}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isModel}}{{/items}}{{/isMap}}{{/isContainer}}{{^isContainer}}{{#isModel}}{{^isFile}}[{{/isFile}}{{/isModel}}**{{dataType}}**{{#isModel}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isModel}}{{/isContainer}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} {{/allParams}} +{{/useCustomTemplateCode}} ### Return type diff --git a/templates/libraries/jersey2/api_test.mustache b/templates/libraries/jersey2/api_test.mustache index c325e3d..7b8214b 100644 --- a/templates/libraries/jersey2/api_test.mustache +++ b/templates/libraries/jersey2/api_test.mustache @@ -6,18 +6,21 @@ import {{invokerPackage}}.*; import {{invokerPackage}}.auth.*; {{#imports}}import {{import}}; {{/imports}} -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -{{^fullJavaUtil}} import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} /** * API tests for {{classname}} */ @@ -28,12 +31,15 @@ public class {{classname}}Test { {{#operations}} {{#operation}} /** + {{#summary}} * {{summary}} * + {{/summary}} + {{#notes}} * {{notes}} * - * @throws ApiException - * if the Api call fails + {{/notes}} + * @throws ApiException if the Api call fails */ @Test public void {{operationId}}Test() throws ApiException { diff --git a/templates/libraries/jersey2/auth/HttpBasicAuth.mustache b/templates/libraries/jersey2/auth/HttpBasicAuth.mustache index 898bb97..13cecfa 100644 --- a/templates/libraries/jersey2/auth/HttpBasicAuth.mustache +++ b/templates/libraries/jersey2/auth/HttpBasicAuth.mustache @@ -5,22 +5,13 @@ package {{invokerPackage}}.auth; import {{invokerPackage}}.Pair; import {{invokerPackage}}.ApiException; -{{^java8}} -import com.migcomponents.migbase64.Base64; -{{/java8}} -{{#java8}} import java.util.Base64; import java.nio.charset.StandardCharsets; -{{/java8}} import java.net.URI; import java.util.Map; import java.util.List; -{{^java8}} -import java.io.UnsupportedEncodingException; -{{/java8}} - {{>generatedAnnotation}} public class HttpBasicAuth implements Authentication { private String username; @@ -48,15 +39,6 @@ public class HttpBasicAuth implements Authentication { return; } String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); -{{^java8}} - try { - headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - } -{{/java8}} -{{#java8}} headerParams.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); -{{/java8}} } } diff --git a/templates/libraries/jersey2/auth/OAuth.mustache b/templates/libraries/jersey2/auth/OAuth.mustache index 62b573a..6617522 100644 --- a/templates/libraries/jersey2/auth/OAuth.mustache +++ b/templates/libraries/jersey2/auth/OAuth.mustache @@ -10,7 +10,7 @@ import com.github.scribejava.core.exceptions.OAuthException; import com.github.scribejava.core.model.OAuth2AccessToken; import com.github.scribejava.core.oauth.OAuth20Service; -import javax.ws.rs.core.UriBuilder; +import {{javaxPackage}}.ws.rs.core.UriBuilder; import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; @@ -26,7 +26,7 @@ public class OAuth implements Authentication { private String tokenUrl; private String absoluteTokenUrl; - private OAuthFlow flow = OAuthFlow.application; + private OAuthFlow flow = OAuthFlow.APPLICATION; private OAuth20Service service; private DefaultApi20 authApi; private String scope; @@ -99,22 +99,22 @@ public class OAuth implements Authentication { return service.refreshAccessToken(refreshToken); } } catch (OAuthException | InterruptedException | ExecutionException | IOException e) { - log.log(Level.FINE, "Refreshing the access token using the refresh token failed", e); + throw new ApiException("Refreshing the access token using the refresh token failed: " + e.toString()); } try { switch (flow) { - case password: + case PASSWORD: if (username != null && password != null) { accessToken = service.getAccessTokenPasswordGrant(username, password, scope); } break; - case accessCode: + case ACCESS_CODE: if (code != null) { accessToken = service.getAccessToken(code); code = null; } break; - case application: + case APPLICATION: accessToken = service.getAccessTokenClientCredentialsGrant(scope); break; default: @@ -158,15 +158,28 @@ public class OAuth implements Authentication { return this; } + public OAuth setCredentialsForPublicClient(String clientId, Boolean debug) { + if (Boolean.TRUE.equals(debug)) { + service = new ServiceBuilder(clientId) + .apiSecretIsEmptyStringUnsafe().debug() + .build(authApi); + } else { + service = new ServiceBuilder(clientId) + .apiSecretIsEmptyStringUnsafe() + .build(authApi); + } + return this; + } + public OAuth usePasswordFlow(String username, String password) { - this.flow = OAuthFlow.password; + this.flow = OAuthFlow.PASSWORD; this.username = username; this.password = password; return this; } public OAuth useAuthorizationCodeFlow(String code) { - this.flow = OAuthFlow.accessCode; + this.flow = OAuthFlow.ACCESS_CODE; this.code = code; return this; } diff --git a/templates/libraries/jersey2/auth/OAuthFlow.mustache b/templates/libraries/jersey2/auth/OAuthFlow.mustache index 002e957..190781f 100644 --- a/templates/libraries/jersey2/auth/OAuthFlow.mustache +++ b/templates/libraries/jersey2/auth/OAuthFlow.mustache @@ -2,6 +2,12 @@ package {{invokerPackage}}.auth; +/** + * OAuth flows that are supported by this client + */ public enum OAuthFlow { - accessCode, implicit, password, application + ACCESS_CODE, + IMPLICIT, + PASSWORD, + APPLICATION } diff --git a/templates/libraries/jersey2/build.gradle.mustache b/templates/libraries/jersey2/build.gradle.mustache index 76671e7..7b991eb 100644 --- a/templates/libraries/jersey2/build.gradle.mustache +++ b/templates/libraries/jersey2/build.gradle.mustache @@ -1,14 +1,24 @@ +{{^useCustomTemplateCode}} +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'com.diffplug.spotless' + +group = '{{groupId}}' +version = '{{artifactVersion}}' +{{/useCustomTemplateCode}} + buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' - classpath 'com.diffplug.spotless:spotless-plugin-gradle:5.17.1' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.3.0' } } +{{#useCustomTemplateCode}} plugins { id 'com.vanniktech.maven.publish' version '0.24.0' } @@ -24,10 +34,90 @@ version = '{{artifactVersion}}' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 +{{/useCustomTemplateCode}} repositories { mavenCentral() } +{{^useCustomTemplateCode}} +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 25 + buildToolsVersion '25.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 25 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task); + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven-publish' + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + + publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + + from components.java + } + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } @@ -113,32 +203,37 @@ publishing { } } } +{{/useCustomTemplateCode}} ext { - swagger_annotations_version = "1.6.3" - jackson_version = "2.13.0" - jackson_databind_version = "2.13.0" + swagger_annotations_version = "1.6.5" + jackson_version = "2.17.1" + jackson_databind_version = "2.17.1" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.2" + jackson_databind_nullable_version = "0.2.6" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" + {{#useBeanValidation}} + bean_validation_version = "3.0.2" + {{/useBeanValidation}} jersey_version = "2.35" - junit_version = "4.13.2" - {{#threetenbp}} - threetenbp_version = "2.9.10" - {{/threetenbp}} + junit_version = "5.8.2" {{#hasOAuthMethods}} scribejava_apis_version = "8.3.1" {{/hasOAuthMethods}} {{#hasHttpSignatureMethods}} tomitribe_http_signatures_version = "1.7" {{/hasHttpSignatureMethods}} +{{#useCustomTemplateCode}} mockito_version = "3.12.4" +{{/useCustomTemplateCode}} } dependencies { implementation "io.swagger:swagger-annotations:$swagger_annotations_version" +{{#useCustomTemplateCode}} implementation 'commons-codec:commons-codec:1.15' +{{/useCustomTemplateCode}} implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.glassfish.jersey.core:jersey-client:$jersey_version" implementation "org.glassfish.jersey.inject:jersey-hk2:$jersey_version" @@ -154,24 +249,26 @@ dependencies { {{#joda}} implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" {{/joda}} - {{#java8}} implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" - {{/java8}} {{#hasOAuthMethods}} implementation "com.github.scribejava:scribejava-apis:$scribejava_apis_version" {{/hasOAuthMethods}} {{#hasHttpSignatureMethods}} implementation "org.tomitribe:tomitribe-http-signatures:$tomitribe_http_signatures_version" {{/hasHttpSignatureMethods}} - {{#threetenbp}} - implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version" - {{/threetenbp}} - {{^java8}} - implementation "com.brsanthu:migbase64:2.2" - {{/java8}} implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation "junit:junit:$junit_version" + {{#useBeanValidation}} + implementation "jakarta.validation:jakarta.validation-api:$bean_validation_version" + {{/useBeanValidation}} + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" +{{#useCustomTemplateCode}} testImplementation "org.mockito:mockito-core:$mockito_version" +{{/useCustomTemplateCode}} +} + +test { + useJUnitPlatform() } javadoc { diff --git a/templates/libraries/jersey2/build.sbt.mustache b/templates/libraries/jersey2/build.sbt.mustache index d296ad4..bb525bf 100644 --- a/templates/libraries/jersey2/build.sbt.mustache +++ b/templates/libraries/jersey2/build.sbt.mustache @@ -9,28 +9,25 @@ lazy val root = (project in file(".")). Compile / packageDoc / publishArtifact := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( +{{#useCustomTemplateCode}} libraryDependencies += "commons-codec" % "commons-codec" % "1.15" +{{/useCustomTemplateCode}} "com.google.code.findbugs" % "jsr305" % "3.0.0", - "io.swagger" % "swagger-annotations" % "1.6.3", + "io.swagger" % "swagger-annotations" % "1.6.5", "org.glassfish.jersey.core" % "jersey-client" % "2.35", "org.glassfish.jersey.inject" % "jersey-hk2" % "2.35", "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.35", "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.35", "org.glassfish.jersey.connectors" % "jersey-apache-connector" % "2.35", - "com.fasterxml.jackson.core" % "jackson-core" % "2.13.0" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.0" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.0" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.17.1" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.17.1" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.17.1" % "compile", {{#joda}} - "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.13.0" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.17.1" % "compile", {{/joda}} - {{#java8}} - "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile", - {{/java8}} - {{#threetenbp}} - "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.12.5" % "compile", - {{/threetenbp}} + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.17.1" % "compile", {{#openApiNullable}} - "org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile", + "org.openapitools" % "jackson-databind-nullable" % "0.2.6" % "compile", {{/openApiNullable}} {{#hasOAuthMethods}} "com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile", @@ -38,11 +35,7 @@ lazy val root = (project in file(".")). {{#hasHttpSignatureMethods}} "org.tomitribe" % "tomitribe-http-signatures" % "1.7" % "compile", {{/hasHttpSignatureMethods}} - {{^java8}} - "com.brsanthu" % "migbase64" % "2.2", - {{/java8}} "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "junit" % "junit" % "4.13.2" % "test", - "com.novocode" % "junit-interface" % "0.10" % "test" + "org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test" ) ) diff --git a/templates/libraries/jersey2/model.mustache b/templates/libraries/jersey2/model.mustache index c5abf57..5098577 100644 --- a/templates/libraries/jersey2/model.mustache +++ b/templates/libraries/jersey2/model.mustache @@ -17,7 +17,6 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; {{/model}} {{/models}} import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; {{#imports}} @@ -28,8 +27,6 @@ import java.io.Serializable; {{/serializableModel}} {{#jackson}} import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.databind.ObjectMapper; {{#withXml}} import com.fasterxml.jackson.dataformat.xml.annotation.*; {{/withXml}} @@ -38,20 +35,24 @@ import com.fasterxml.jackson.annotation.JsonCreator; {{/vendorExtensions.x-has-readonly-properties}} {{/jackson}} {{#withXml}} -import javax.xml.bind.annotation.*; +import {{javaxPackage}}.xml.bind.annotation.*; {{/withXml}} {{#parcelableModel}} import android.os.Parcelable; import android.os.Parcel; {{/parcelableModel}} {{#useBeanValidation}} -import javax.validation.constraints.*; -import javax.validation.Valid; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; {{/useBeanValidation}} {{#performBeanValidation}} import org.hibernate.validator.constraints.*; {{/performBeanValidation}} import {{invokerPackage}}.JSON; +{{#useCustomTemplateCode}} +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.ObjectMapper; +{{/useCustomTemplateCode}} {{#models}} {{#model}} diff --git a/templates/libraries/jersey2/model_test.mustache b/templates/libraries/jersey2/model_test.mustache new file mode 100644 index 0000000..acd659b --- /dev/null +++ b/templates/libraries/jersey2/model_test.mustache @@ -0,0 +1,44 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for {{classname}} + */ +public class {{classname}}Test { + {{#models}} + {{#model}} + {{^vendorExtensions.x-is-one-of-interface}} + {{^isEnum}} + private final {{classname}} model = new {{classname}}(); + + {{/isEnum}} + /** + * Model tests for {{classname}} + */ + @Test + public void test{{classname}}() { + // TODO: test {{classname}} + } + + {{#allVars}} + /** + * Test the property '{{name}}' + */ + @Test + public void {{name}}Test() { + // TODO: test {{name}} + } + + {{/allVars}} + {{/vendorExtensions.x-is-one-of-interface}} + {{/model}} + {{/models}} +} diff --git a/templates/libraries/jersey2/oneof_model.mustache b/templates/libraries/jersey2/oneof_model.mustache index 18bcbc5..09906d7 100644 --- a/templates/libraries/jersey2/oneof_model.mustache +++ b/templates/libraries/jersey2/oneof_model.mustache @@ -1,5 +1,5 @@ -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.Response; +import {{javaxPackage}}.ws.rs.core.GenericType; +import {{javaxPackage}}.ws.rs.core.Response; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; @@ -26,7 +26,7 @@ import {{invokerPackage}}.JSON; {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} @JsonDeserialize(using = {{classname}}.{{classname}}Deserializer.class) @JsonSerialize(using = {{classname}}.{{classname}}Serializer.class) -public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} { +public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}} implements {{{.}}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-implements}} { private static final Logger log = Logger.getLogger({{classname}}.class.getName()); public static class {{classname}}Serializer extends StdSerializer<{{classname}}> { @@ -60,7 +60,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im {{#useOneOfDiscriminatorLookup}} {{#discriminator}} {{classname}} new{{classname}} = new {{classname}}(); - Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); String discriminatorValue = (String)result2.get("{{{propertyBaseName}}}"); switch (discriminatorValue) { {{#mappedModels}} @@ -78,37 +78,74 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); int match = 0; JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + {{#composedSchemas}} {{#oneOf}} - // deserialize {{{.}}} + // deserialize {{{dataType}}}{{#isNullable}} (nullable){{/isNullable}} try { + {{^isArray}} boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if ({{{.}}}.class.equals(Integer.class) || {{{.}}}.class.equals(Long.class) || {{{.}}}.class.equals(Float.class) || {{{.}}}.class.equals(Double.class) || {{{.}}}.class.equals(Boolean.class) || {{{.}}}.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= (({{{.}}}.class.equals(Integer.class) || {{{.}}}.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= (({{{.}}}.class.equals(Float.class) || {{{.}}}.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= ({{{.}}}.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= ({{{.}}}.class.equals(String.class) && token == JsonToken.VALUE_STRING); - {{#isNullable}} - attemptParsing |= (token == JsonToken.VALUE_NULL); - {{/isNullable}} - } + {{#isPrimitiveType}} + attemptParsing = typeCoercion; //respect type coercion setting + if (!attemptParsing) { + {{#isString}} + attemptParsing |= (token == JsonToken.VALUE_STRING); + {{/isString}} + {{#isInteger}} + attemptParsing |= (token == JsonToken.VALUE_NUMBER_INT); + {{/isInteger}} + {{#isLong}} + attemptParsing |= (token == JsonToken.VALUE_NUMBER_INT); + {{/isLong}} + {{#isShort}} + attemptParsing |= (token == JsonToken.VALUE_NUMBER_INT); + {{/isShort}} + {{#isFloat}} + attemptParsing |= (token == JsonToken.VALUE_NUMBER_FLOAT); + {{/isFloat}} + {{#isDouble}} + attemptParsing |= (token == JsonToken.VALUE_NUMBER_FLOAT); + {{/isDouble}} + {{#isNumber}} + attemptParsing |= (token == JsonToken.VALUE_NUMBER_FLOAT); + {{/isNumber}} + {{#isDecimal}} + attemptParsing |= (token == JsonToken.VALUE_NUMBER_FLOAT); + {{/isDecimal}} + {{#isBoolean}} + attemptParsing |= (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + {{/isBoolean}} + {{#isNullable}} + attemptParsing |= (token == JsonToken.VALUE_NULL); + {{/isNullable}} } + {{/isPrimitiveType}} if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs({{{.}}}.class); + deserialized = tree.traverse(jp.getCodec()).readValueAs({{{dataType}}}.class); // TODO: there is no validation against JSON schema constraints // (min, max, enum, pattern...), this does not perform a strict JSON // validation, which means the 'match' count may be higher than it should be. match++; - log.log(Level.FINER, "Input data matches schema '{{{.}}}'"); + log.log(Level.FINER, "Input data matches schema '{{{dataType}}}'"); } + {{/isArray}} + {{#isArray}} + if (token == JsonToken.START_ARRAY) { + final TypeReference<{{{dataType}}}> ref = new TypeReference<{{{dataType}}}>(){}; + deserialized = tree.traverse(jp.getCodec()).readValueAs(ref); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema '{{{dataType}}}'"); + } + {{/isArray}} } catch (Exception e) { // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema '{{{.}}}'", e); + log.log(Level.FINER, "Input data does not match schema '{{{dataType}}}'", e); } {{/oneOf}} + {{/composedSchemas}} if (match == 1) { {{classname}} ret = new {{classname}}(); ret.setActualInstance(deserialized); @@ -132,7 +169,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im } // store a list of schema names defined in oneOf - public static final Map schemas = new HashMap(); + public static final Map> schemas = new HashMap<>(); public {{classname}}() { super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); @@ -152,13 +189,17 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); } {{/additionalPropertiesType}} + {{#composedSchemas}} {{#oneOf}} - public {{classname}}({{{.}}} o) { + {{^vendorExtensions.x-duplicated-data-type}} + public {{classname}}({{{baseType}}} o) { super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); setActualInstance(o); } + {{/vendorExtensions.x-duplicated-data-type}} {{/oneOf}} + {{/composedSchemas}} static { {{#oneOf}} schemas.put("{{{.}}}", new GenericType<{{{.}}}>() { @@ -167,7 +208,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im JSON.registerDescendants({{classname}}.class, Collections.unmodifiableMap(schemas)); {{#discriminator}} // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); + Map> mappings = new HashMap<>(); {{#mappedModels}} mappings.put("{{mappingName}}", {{modelName}}.class); {{/mappedModels}} @@ -177,7 +218,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im } @Override - public Map getSchemas() { + public Map> getSchemas() { return {{classname}}.schemas; } @@ -198,13 +239,17 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im } {{/isNullable}} + {{#composedSchemas}} {{#oneOf}} - if (JSON.isInstanceOf({{{.}}}.class, instance, new HashSet>())) { + {{^vendorExtensions.x-duplicated-data-type}} + if (JSON.isInstanceOf({{{baseType}}}.class, instance, new HashSet<>())) { super.setActualInstance(instance); return; } + {{/vendorExtensions.x-duplicated-data-type}} {{/oneOf}} + {{/composedSchemas}} throw new RuntimeException("Invalid instance type. Must be {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}"); } @@ -219,17 +264,26 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im return super.getActualInstance(); } + {{#composedSchemas}} {{#oneOf}} /** - * Get the actual instance of `{{{.}}}`. If the actual instance is not `{{{.}}}`, + * Get the actual instance of `{{{dataType}}}`. If the actual instance is not `{{{dataType}}}`, * the ClassCastException will be thrown. * - * @return The actual instance of `{{{.}}}` - * @throws ClassCastException if the instance is not `{{{.}}}` + * @return The actual instance of `{{{dataType}}}` + * @throws ClassCastException if the instance is not `{{{dataType}}}` */ - public {{{.}}} get{{{.}}}() throws ClassCastException { - return ({{{.}}})super.getActualInstance(); + {{^isArray}} + public {{{dataType}}} get{{{dataType}}}() throws ClassCastException { + return ({{{dataType}}})super.getActualInstance(); } + {{/isArray}} + {{#isArray}} + public {{{dataType}}} get{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}() throws ClassCastException { + return ({{{dataType}}})super.getActualInstance(); + } + {{/isArray}} {{/oneOf}} + {{/composedSchemas}} } diff --git a/templates/libraries/jersey2/pojo.mustache b/templates/libraries/jersey2/pojo.mustache index 4dea6ca..0ba5ad0 100644 --- a/templates/libraries/jersey2/pojo.mustache +++ b/templates/libraries/jersey2/pojo.mustache @@ -1,19 +1,42 @@ +{{#useCustomTemplateCode}} import com.dropbox.sign.ApiException; +{{/useCustomTemplateCode}} /** * {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} * @deprecated{{/isDeprecated}} */{{#isDeprecated}} -@Deprecated{{/isDeprecated}}{{#description}} -@ApiModel(description = "{{{.}}}"){{/description}} +@Deprecated{{/isDeprecated}} +{{#swagger1AnnotationLibrary}} +{{#description}} +@ApiModel(description = "{{{.}}}") +{{/description}} +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} +{{#description}} +@Schema(description = "{{{.}}}") +{{/description}} +{{/swagger2AnnotationLibrary}} {{#jackson}} @JsonPropertyOrder({ {{#vars}} - {{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}} + {{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}} {{/vars}} }) -@JsonIgnoreProperties(ignoreUnknown=true) +{{#isClassnameSanitized}} +@JsonTypeName("{{name}}") +{{/isClassnameSanitized}} {{/jackson}} {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} +{{#vendorExtensions.x-class-extra-annotation}} +{{{vendorExtensions.x-class-extra-annotation}}} +{{/vendorExtensions.x-class-extra-annotation}} +{{#useCustomTemplateCode}} +{{^parent}} +{{^discriminator}} +@JsonIgnoreProperties(ignoreUnknown=true) +{{/discriminator}} +{{/parent}} +{{/useCustomTemplateCode}} public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ {{#serializableModel}} private static final long serialVersionUID = 1L; @@ -39,44 +62,46 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens public static final String JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}"; {{/jackson}} {{#withXml}} - {{#isXmlAttribute}} - @XmlAttribute(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/isXmlAttribute}} - {{^isXmlAttribute}} - {{^isContainer}} - @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/isContainer}} - {{#isContainer}} - // Is a container wrapped={{isXmlWrapped}} - {{#items}} - // items.name={{name}} items.baseName={{baseName}} items.xmlName={{xmlName}} items.xmlNamespace={{xmlNamespace}} - // items.example={{example}} items.type={{dataType}} - @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/items}} - {{#isXmlWrapped}} - @XmlElementWrapper({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/isXmlWrapped}} - {{/isContainer}} - {{/isXmlAttribute}} + @Xml{{#isXmlAttribute}}Attribute{{/isXmlAttribute}}{{^isXmlAttribute}}Element{{/isXmlAttribute}}(name = "{{items.xmlName}}{{^items.xmlName}}{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}{{/items.xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{#isXmlWrapped}} + @XmlElementWrapper(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{/isXmlWrapped}} {{/withXml}} {{#gson}} @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) {{/gson}} + {{#vendorExtensions.x-field-extra-annotation}} + {{{vendorExtensions.x-field-extra-annotation}}} + {{/vendorExtensions.x-field-extra-annotation}} {{#vendorExtensions.x-is-jackson-optional-nullable}} {{#isContainer}} + {{#deprecated}} + @Deprecated + {{/deprecated}} private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); {{/isContainer}} {{^isContainer}} + {{#deprecated}} + @Deprecated + {{/deprecated}} private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}}; {{/isContainer}} {{/vendorExtensions.x-is-jackson-optional-nullable}} {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{#deprecated}} + @Deprecated + {{/deprecated}} +{{^useCustomTemplateCode}} + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} {{#isContainer}} private {{{datatypeWithEnum}}} {{name}}{{#required}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/required}}{{^required}} = null{{/required}}; {{/isContainer}} {{^isContainer}} private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/isContainer}} +{{/useCustomTemplateCode}} {{/vendorExtensions.x-is-jackson-optional-nullable}} {{/vars}} @@ -93,9 +118,10 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens ) { this(); {{#readOnlyVars}} - this.{{name}} = {{name}}; + this.{{name}} = {{#vendorExtensions.x-is-jackson-optional-nullable}}{{name}} == null ? JsonNullable.<{{{datatypeWithEnum}}}>undefined() : JsonNullable.of({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{name}}{{/vendorExtensions.x-is-jackson-optional-nullable}}; {{/readOnlyVars}} }{{/jackson}}{{/withXml}}{{/vendorExtensions.x-has-readonly-properties}} +{{#useCustomTemplateCode}} /** * Attempt to instantiate and hydrate a new instance of this class @@ -111,6 +137,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{classname}}.class ); } +{{/useCustomTemplateCode}} {{#vars}} {{^isReadOnly}} @@ -120,6 +147,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens )); {{/vendorExtensions.x-enum-as-string}} + {{#deprecated}} + @Deprecated + {{/deprecated}} public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { {{#vendorExtensions.x-enum-as-string}} if (!{{{nameInSnakeCase}}}_VALUES.contains({{name}})) { @@ -135,18 +165,20 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/vendorExtensions.x-is-jackson-optional-nullable}} return this; } +{{#useCustomTemplateCode}} {{#vendorExtensions.x-int-or-string}} public {{classname}} {{name}}(Integer {{name}}) { this.{{name}} = String.valueOf({{name}}); return this; } {{/vendorExtensions.x-int-or-string}} +{{/useCustomTemplateCode}} {{#isArray}} - public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} if (this.{{name}} == null || !this.{{name}}.isPresent()) { - this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}); } try { this.{{name}}.get().add({{name}}Item); @@ -156,11 +188,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens return this; {{/vendorExtensions.x-is-jackson-optional-nullable}} {{^vendorExtensions.x-is-jackson-optional-nullable}} - {{^required}} if (this.{{name}} == null) { - this.{{name}} = {{{defaultValue}}}; + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}; } - {{/required}} this.{{name}}.add({{name}}Item); return this; {{/vendorExtensions.x-is-jackson-optional-nullable}} @@ -168,10 +198,10 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/isArray}} {{#isMap}} - public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} if (this.{{name}} == null || !this.{{name}}.isPresent()) { - this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}); } try { this.{{name}}.get().put(key, {{name}}Item); @@ -181,11 +211,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens return this; {{/vendorExtensions.x-is-jackson-optional-nullable}} {{^vendorExtensions.x-is-jackson-optional-nullable}} - {{^required}} if (this.{{name}} == null) { - this.{{name}} = {{{defaultValue}}}; + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}; } - {{/required}} this.{{name}}.put(key, {{name}}Item); return this; {{/vendorExtensions.x-is-jackson-optional-nullable}} @@ -193,7 +221,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/isMap}} {{/isReadOnly}} - /** + /** {{#description}} * {{.}} {{/description}} @@ -210,22 +238,30 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{#deprecated}} * @deprecated {{/deprecated}} - **/ + */ {{#deprecated}} @Deprecated {{/deprecated}} {{#required}} {{#isNullable}} - @javax.annotation.Nullable + @{{javaxPackage}}.annotation.Nullable {{/isNullable}} {{^isNullable}} - @javax.annotation.Nonnull + @{{javaxPackage}}.annotation.Nonnull {{/isNullable}} {{/required}} {{^required}} - @javax.annotation.Nullable + @{{javaxPackage}}.annotation.Nullable {{/required}} -{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{#useBeanValidation}} +{{>beanValidation}} +{{/useBeanValidation}} +{{#swagger1AnnotationLibrary}} + @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} + @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}") +{{/swagger2AnnotationLibrary}} {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} {{/vendorExtensions.x-extra-annotation}} @@ -262,6 +298,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/vendorExtensions.x-is-jackson-optional-nullable}} {{^isReadOnly}} + {{#deprecated}} + @Deprecated + {{/deprecated}} {{#vendorExtensions.x-setter-extra-annotation}} {{{vendorExtensions.x-setter-extra-annotation}}} {{/vendorExtensions.x-setter-extra-annotation}}{{#jackson}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{> jackson_annotations}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{/jackson}} public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { {{#vendorExtensions.x-enum-as-string}} @@ -277,12 +316,14 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens this.{{name}} = {{name}}; {{/vendorExtensions.x-is-jackson-optional-nullable}} } +{{#useCustomTemplateCode}} {{#vendorExtensions.x-int-or-string}} public void {{setter}}(Integer {{name}}) { this.{{name}} = String.valueOf({{name}}); } {{/vendorExtensions.x-int-or-string}} +{{/useCustomTemplateCode}} {{/isReadOnly}} {{/vars}} @@ -340,7 +381,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens sb.append(" ").append(toIndentedString(super.toString())).append("\n"); {{/parent}} {{#vars}} - sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); + sb.append(" {{name}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{name}}){{/isPassword}}).append("\n"); {{/vars}} {{#additionalPropertiesType}} sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); @@ -349,6 +390,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens return sb.toString(); } +{{#useCustomTemplateCode}} public Map createFormData() throws ApiException { Map map = new HashMap<>(); boolean fileTypeFound = false; @@ -404,6 +446,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens return (int) Class.forName(java.util.List.class.getName()).getMethod("size").invoke(obj); } +{{/useCustomTemplateCode}} /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). @@ -456,7 +499,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens return 0; } - public static final Parcelable.Creator<{{classname}}> CREATOR = new Parcelable.Creator<{{classname}}>() { + public static final Parcelable.Creator<{{classname}}> CREATOR = new Parcelable.Creator<>() { public {{classname}} createFromParcel(Parcel in) { {{#model}} {{#isArray}} @@ -475,14 +518,14 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens }; {{/parcelableModel}} {{#discriminator}} -static { - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - {{#mappedModels}} - mappings.put("{{mappingName}}", {{modelName}}.class); - {{/mappedModels}} - mappings.put("{{name}}", {{classname}}.class); - JSON.registerDiscriminator({{classname}}.class, "{{propertyBaseName}}", mappings); -} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + {{#mappedModels}} + mappings.put("{{mappingName}}", {{modelName}}.class); + {{/mappedModels}} + mappings.put("{{name}}", {{classname}}.class); + JSON.registerDiscriminator({{classname}}.class, "{{propertyBaseName}}", mappings); + } {{/discriminator}} } diff --git a/templates/libraries/jersey2/pom.mustache b/templates/libraries/jersey2/pom.mustache index 15bae37..9a596b0 100644 --- a/templates/libraries/jersey2/pom.mustache +++ b/templates/libraries/jersey2/pom.mustache @@ -65,12 +65,12 @@ maven-surefire-plugin 3.0.0-M5 - + loggerPath conf/log4j.properties - + -Xms512m -Xmx1500m methods 10 @@ -91,6 +91,7 @@ +{{#useCustomTemplateCode}} maven-assembly-plugin @@ -107,11 +108,12 @@ +{{/useCustomTemplateCode}} org.apache.maven.plugins maven-jar-plugin - 3.2.0 + 3.2.2 @@ -125,7 +127,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.2.0 + 3.3.0 add_sources @@ -156,7 +158,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.10.1 1.8 1.8 @@ -172,7 +174,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.3.1 + 3.3.2 attach-javadocs @@ -257,7 +259,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 + 3.0.1 sign-artifacts @@ -274,17 +276,27 @@ + {{#swagger1AnnotationLibrary}} io.swagger swagger-annotations ${swagger-annotations-version} - + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + + io.swagger.core.v3 + swagger-annotations + ${swagger-annotations-version} + + {{/swagger2AnnotationLibrary}} +{{#useCustomTemplateCode}} commons-codec commons-codec 1.15 +{{/useCustomTemplateCode}} @@ -358,13 +370,6 @@ jackson-datatype-jsr310 ${jackson-version} - {{#threetenbp}} - - com.github.joschi.jackson - jackson-datatype-threetenbp - ${threetenbp-version} - - {{/threetenbp}} {{#hasHttpSignatureMethods}} org.tomitribe @@ -401,40 +406,51 @@ - junit - junit + org.junit.jupiter + junit-jupiter-api ${junit-version} test +{{#useCustomTemplateCode}} org.mockito mockito-core ${mockito.version} test +{{/useCustomTemplateCode}} UTF-8 - 1.6.3 - 2.35 - 2.13.0 - 2.13.0 - 0.2.2 - {{#threetenbp}} - 2.9.10 - {{/threetenbp}} + {{#swagger1AnnotationLibrary}} + 1.6.6 + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + 2.2.15 + {{/swagger2AnnotationLibrary}} + 2.37 + 2.17.1 + 2.17.1 + 0.2.6 + {{#useJakartaEe}} + 2.1.1 + {{/useJakartaEe}} + {{^useJakartaEe}} 1.3.5 + {{/useJakartaEe}} {{#useBeanValidation}} - 2.0.2 + 3.0.2 {{/useBeanValidation}} - 4.13.2 + 5.10.0 {{#hasHttpSignatureMethods}} - 1.7 + 1.8 {{/hasHttpSignatureMethods}} {{#hasOAuthMethods}} - 8.3.1 + 8.3.3 {{/hasOAuthMethods}} - 2.17.3 + 2.21.0 +{{#useCustomTemplateCode}} 3.12.4 +{{/useCustomTemplateCode}} diff --git a/templates/libraries/jersey3/AbstractOpenApiSchema.mustache b/templates/libraries/jersey3/AbstractOpenApiSchema.mustache new file mode 100644 index 0000000..d92c85e --- /dev/null +++ b/templates/libraries/jersey3/AbstractOpenApiSchema.mustache @@ -0,0 +1,138 @@ +{{>licenseInfo}} + +package {{modelPackage}}; + +import {{invokerPackage}}.ApiException; +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; +import {{javaxPackage}}.ws.rs.core.GenericType; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +{{>generatedAnnotation}} +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /** + * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map> getSchemas(); + + /** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + @JsonValue + public Object getActualInstance() {return instance;} + + /** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} + + /** + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * 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 "); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /** + * Is nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + +{{>libraries/jersey2/additional_properties}} + +} diff --git a/templates/libraries/jersey3/ApiClient.mustache b/templates/libraries/jersey3/ApiClient.mustache new file mode 100644 index 0000000..09563af --- /dev/null +++ b/templates/libraries/jersey3/ApiClient.mustache @@ -0,0 +1,1490 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import {{javaxPackage}}.ws.rs.client.Client; +import {{javaxPackage}}.ws.rs.client.ClientBuilder; +import {{javaxPackage}}.ws.rs.client.Entity; +import {{javaxPackage}}.ws.rs.client.Invocation; +import {{javaxPackage}}.ws.rs.client.WebTarget; +import {{javaxPackage}}.ws.rs.core.Form; +import {{javaxPackage}}.ws.rs.core.GenericType; +import {{javaxPackage}}.ws.rs.core.MediaType; +import {{javaxPackage}}.ws.rs.core.Response; +import {{javaxPackage}}.ws.rs.core.Response.Status; + +{{#hasOAuthMethods}} +import com.github.scribejava.core.model.OAuth2AccessToken; +{{/hasOAuthMethods}} +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.HttpUrlConnectorProvider; +import org.glassfish.jersey.jackson.JacksonFeature; +import org.glassfish.jersey.media.multipart.FormDataBodyPart; +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.MultiPart; +import org.glassfish.jersey.media.multipart.MultiPartFeature; + +import java.io.IOException; +import java.io.InputStream; + +import java.net.URI; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import java.security.cert.X509Certificate; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import org.glassfish.jersey.logging.LoggingFeature; +import java.util.AbstractMap.SimpleEntry; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import java.util.Map.Entry; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.Date; +import java.util.stream.Collectors; +import java.util.stream.Stream; +{{#jsr310}} +import java.time.OffsetDateTime; +{{/jsr310}} + +import java.net.URLEncoder; + +import java.io.File; +import java.io.UnsupportedEncodingException; + +import java.text.DateFormat; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import {{invokerPackage}}.auth.Authentication; +import {{invokerPackage}}.auth.HttpBasicAuth; +import {{invokerPackage}}.auth.HttpBearerAuth; +{{#hasHttpSignatureMethods}} +import {{invokerPackage}}.auth.HttpSignatureAuth; +{{/hasHttpSignatureMethods}} +import {{invokerPackage}}.auth.ApiKeyAuth; +{{#hasOAuthMethods}} +import {{invokerPackage}}.auth.OAuth; +{{/hasOAuthMethods}} + +/** + *

ApiClient class.

+ */ +{{>generatedAnnotation}} +public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { + private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + protected Map defaultHeaderMap = new HashMap<>(); + protected Map defaultCookieMap = new HashMap<>(); + protected String basePath = "{{{basePath}}}"; + protected String userAgent; + private static final Logger log = Logger.getLogger(ApiClient.class.getName()); + + protected List servers = new ArrayList<>({{#servers}}{{#-first}}Arrays.asList( +{{/-first}} new ServerConfiguration( + "{{{url}}}", + "{{{description}}}{{^description}}No description provided{{/description}}", + {{^variables}} + new LinkedHashMap<>() + {{/variables}} + {{#variables}} + {{#-first}} + Stream.>of( + {{/-first}} + new SimpleEntry<>("{{{name}}}", new ServerVariable( + "{{{description}}}{{^description}}No description provided{{/description}}", + "{{{defaultValue}}}", + new LinkedHashSet<>({{#enumValues}}{{#-first}}Arrays.asList({{/-first}} + "{{{.}}}"{{^-last}},{{/-last}}{{#-last}} + ){{/-last}}{{/enumValues}}) + )){{^-last}},{{/-last}} + {{#-last}} + ).collect(Collectors.toMap(Entry::getKey, Entry::getValue, (a, b) -> a, LinkedHashMap::new)) + {{/-last}} + {{/variables}} + ){{^-last}},{{/-last}} + {{#-last}} + ){{/-last}}{{/servers}}); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + {{^hasOperationServers}} + protected Map> operationServers = new HashMap<>(); + {{/hasOperationServers}} + {{#hasOperationServers}} + protected Map> operationServers; + + { + Map> operationServers = new HashMap<>(); + {{#apiInfo}} + {{#apis}} + {{#operations}} + {{#operation}} + {{#servers}} + {{#-first}} + operationServers.put("{{{classname}}}.{{{operationId}}}", new ArrayList<>(Arrays.asList( + {{/-first}} + new ServerConfiguration( + "{{{url}}}", + "{{{description}}}{{^description}}No description provided{{/description}}", + {{^variables}} + new LinkedHashMap<>() + {{/variables}} + {{#variables}} + {{#-first}} + Stream.>of( + {{/-first}} + new SimpleEntry<>("{{{name}}}", new ServerVariable( + "{{{description}}}{{^description}}No description provided{{/description}}", + "{{{defaultValue}}}", + new LinkedHashSet<>({{#enumValues}}{{#-first}}Arrays.asList({{/-first}} + "{{{.}}}"{{^-last}},{{/-last}}{{#-last}} + ){{/-last}}{{/enumValues}}) + )){{^-last}},{{/-last}} + {{#-last}} + ).collect(Collectors.toMap(Entry::getKey, Entry::getValue, (a, b) -> a, LinkedHashMap::new)) + {{/-last}} + {{/variables}} + ){{^-last}},{{/-last}} + {{#-last}} + ))); + {{/-last}} + {{/servers}} + {{/operation}} + {{/operations}} + {{/apis}} + {{/apiInfo}} + this.operationServers = operationServers; + } + + {{/hasOperationServers}} + protected Map operationServerIndex = new HashMap<>(); + protected Map> operationServerVariables = new HashMap<>(); + protected boolean debugging = false; + protected ClientConfig clientConfig; + protected int connectionTimeout = 0; + private int readTimeout = 0; + + protected Client httpClient; + protected JSON json; + protected String tempFolderPath = null; + + protected Map authentications; + protected Map authenticationLookup; + + protected DateFormat dateFormat; + + /** + * Constructs a new ApiClient with default parameters. + */ + public ApiClient() { + this(null); + } + + /** + * Constructs a new ApiClient with the specified authentication parameters. + * + * @param authMap A hash map containing authentication parameters. + */ + public ApiClient(Map authMap) { + json = new JSON(); + httpClient = buildHttpClient(); + + this.dateFormat = new RFC3339DateFormat(); + + // Set default User-Agent. + setUserAgent("{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}"); + + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap<>(); + Authentication auth = null; + {{#authMethods}} + if (authMap != null) { + auth = authMap.get("{{name}}"); + } + {{#isBasic}} + {{#isBasicBasic}} + if (auth instanceof HttpBasicAuth) { + authentications.put("{{name}}", auth); + } else { + authentications.put("{{name}}", new HttpBasicAuth()); + } + {{/isBasicBasic}} + {{#isBasicBearer}} + if (auth instanceof HttpBearerAuth) { + authentications.put("{{name}}", auth); + } else { + authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}")); + } + {{/isBasicBearer}} + {{#isHttpSignature}} + if (auth instanceof HttpSignatureAuth) { + authentications.put("{{name}}", auth); + } + {{/isHttpSignature}} + {{/isBasic}} + {{#isApiKey}} + if (auth instanceof ApiKeyAuth) { + authentications.put("{{name}}", auth); + } else { + authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}")); + } + {{/isApiKey}} + {{#isOAuth}} + if (auth instanceof OAuth) { + authentications.put("{{name}}", auth); + } else { + authentications.put("{{name}}", new OAuth(basePath, "{{{tokenUrl}}}")); + } + {{/isOAuth}} + {{/authMethods}} + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + + // Setup authentication lookup (key: authentication alias, value: authentication name) + authenticationLookup = new HashMap<>();{{#authMethods}}{{#vendorExtensions.x-auth-id-alias}} + authenticationLookup.put("{{name}}", "{{.}}");{{/vendorExtensions.x-auth-id-alias}}{{/authMethods}} + } + + /** + * Gets the JSON instance to do JSON serialization and deserialization. + * + * @return JSON + */ + public JSON getJSON() { + return json; + } + + /** + *

Getter for the field httpClient.

+ * + * @return a {@link {{javaxPackage}}.ws.rs.client.Client} object. + */ + public Client getHttpClient() { + return httpClient; + } + + /** + *

Setter for the field httpClient.

+ * + * @param httpClient a {@link {{javaxPackage}}.ws.rs.client.Client} object. + * @return a {@link ApiClient} object. + */ + public ApiClient setHttpClient(Client httpClient) { + this.httpClient = httpClient; + return this; + } + + /** + * Returns the base URL to the location where the OpenAPI document is being served. + * + * @return The base URL to the target host. + */ + public String getBasePath() { + return basePath; + } + + /** + * Sets the base URL to the location where the OpenAPI document is being served. + * + * @param basePath The base URL to the target host. + * @return a {@link ApiClient} object. + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + {{#hasOAuthMethods}} + setOauthBasePath(basePath); + {{/hasOAuthMethods}} + return this; + } + + /** + *

Getter for the field servers.

+ * + * @return a {@link java.util.List} of servers. + */ + public List getServers() { + return servers; + } + + /** + *

Setter for the field servers.

+ * + * @param servers a {@link java.util.List} of servers. + * @return a {@link ApiClient} object. + */ + public ApiClient setServers(List servers) { + this.servers = servers; + updateBasePath(); + return this; + } + + /** + *

Getter for the field serverIndex.

+ * + * @return a {@link java.lang.Integer} object. + */ + public Integer getServerIndex() { + return serverIndex; + } + + /** + *

Setter for the field serverIndex.

+ * + * @param serverIndex the server index + * @return a {@link ApiClient} object. + */ + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + updateBasePath(); + return this; + } + + /** + *

Getter for the field serverVariables.

+ * + * @return a {@link java.util.Map} of server variables. + */ + public Map getServerVariables() { + return serverVariables; + } + + /** + *

Setter for the field serverVariables.

+ * + * @param serverVariables a {@link java.util.Map} of server variables. + * @return a {@link ApiClient} object. + */ + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + updateBasePath(); + return this; + } + + private void updateBasePath() { + if (serverIndex != null) { + setBasePath(servers.get(serverIndex).URL(serverVariables)); + } + } + + {{#hasOAuthMethods}} + private void setOauthBasePath(String basePath) { + for(Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setBasePath(basePath); + } + } + } + + {{/hasOAuthMethods}} + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication object + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + * @return a {@link ApiClient} object. + */ + public ApiClient setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return this; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + * @return a {@link ApiClient} object. + */ + public ApiClient setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return this; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * + * @param apiKey API key + * @return a {@link ApiClient} object. + */ + public ApiClient setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return this; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to configure authentications which respects aliases of API keys. + * + * @param secrets Hash map from authentication name to its secret. + * @return a {@link ApiClient} object. + */ + public ApiClient configureApiKeys(Map secrets) { + for (Map.Entry authEntry : authentications.entrySet()) { + Authentication auth = authEntry.getValue(); + if (auth instanceof ApiKeyAuth) { + String name = authEntry.getKey(); + // respect x-auth-id-alias property + name = authenticationLookup.getOrDefault(name, name); + String secret = secrets.get(name); + if (secret != null) { + ((ApiKeyAuth) auth).setApiKey(secret); + } + } + } + return this; + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + * @return a {@link ApiClient} object. + */ + public ApiClient setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return this; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set bearer token for the first Bearer authentication. + * + * @param bearerToken Bearer token + * @return a {@link ApiClient} object. + */ + public ApiClient setBearerToken(String bearerToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(bearerToken); + return this; + } + } + throw new RuntimeException("No Bearer authentication configured!"); + } + + {{#hasOAuthMethods}} + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + * @return a {@link ApiClient} object. + */ + public ApiClient setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set the credentials for the first OAuth2 authentication. + * + * @param clientId the client ID + * @param clientSecret the client secret + * @return a {@link ApiClient} object. + */ + public ApiClient setOauthCredentials(String clientId, String clientSecret) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setCredentials(clientId, clientSecret, isDebugging()); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set the credentials of a public client for the first OAuth2 authentication. + * + * @param clientId the client ID + * @return a {@link ApiClient} object. + */ + public ApiClient setOauthCredentialsForPublicClient(String clientId) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setCredentialsForPublicClient(clientId, isDebugging()); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set the password flow for the first OAuth2 authentication. + * + * @param username the user name + * @param password the user password + * @return a {@link ApiClient} object. + */ + public ApiClient setOauthPasswordFlow(String username, String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).usePasswordFlow(username, password); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set the authorization code flow for the first OAuth2 authentication. + * + * @param code the authorization code + * @return a {@link ApiClient} object. + */ + public ApiClient setOauthAuthorizationCodeFlow(String code) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).useAuthorizationCodeFlow(code); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set the scopes for the first OAuth2 authentication. + * + * @param scope the oauth scope + * @return a {@link ApiClient} object. + */ + public ApiClient setOauthScope(String scope) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setScope(scope); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + {{/hasOAuthMethods}} + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent Http user agent + * @return a {@link ApiClient} object. + */ + public ApiClient setUserAgent(String userAgent) { + this.userAgent = userAgent; + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Get the User-Agent header's value. + * + * @return User-Agent string + */ + public String getUserAgent(){ + return userAgent; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return a {@link ApiClient} object. + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return a {@link ApiClient} object. + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Gets the client config. + * + * @return Client config + */ + public ClientConfig getClientConfig() { + return clientConfig; + } + + /** + * Set the client config. + * + * @param clientConfig Set the client config + * @return a {@link ApiClient} object. + */ + public ApiClient setClientConfig(ClientConfig clientConfig) { + this.clientConfig = clientConfig; + // Rebuild HTTP Client according to the new "clientConfig" value. + this.httpClient = buildHttpClient(); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is switched on + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return a {@link ApiClient} object. + */ + public ApiClient setDebugging(boolean debugging) { + this.debugging = debugging; + // Rebuild HTTP Client according to the new "debugging" value. + this.httpClient = buildHttpClient(); + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default temporary folder. + * + * @return Temp folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set temp folder path + * + * @param tempFolderPath Temp folder path + * @return a {@link ApiClient} object. + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Connect timeout (in milliseconds). + * + * @return Connection timeout + */ + public int getConnectTimeout() { + return connectionTimeout; + } + + /** + * Set the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param connectionTimeout Connection timeout in milliseconds + * @return a {@link ApiClient} object. + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + this.connectionTimeout = connectionTimeout; + httpClient.property(ClientProperties.CONNECT_TIMEOUT, connectionTimeout); + return this; + } + + /** + * read timeout (in milliseconds). + * + * @return Read timeout + */ + public int getReadTimeout() { + return readTimeout; + } + + /** + * Set the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param readTimeout Read timeout in milliseconds + * @return a {@link ApiClient} object. + */ + public ApiClient setReadTimeout(int readTimeout) { + this.readTimeout = readTimeout; + httpClient.property(ClientProperties.READ_TIMEOUT, readTimeout); + return this; + } + + /** + * Get the date format used to parse/format date parameters. + * + * @return Date format + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + * Set the date format used to parse/format date parameters. + * + * @param dateFormat Date format + * @return a {@link ApiClient} object. + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + // also set the date format for model (de)serialization with Date properties + this.json.setDateFormat((DateFormat) dateFormat.clone()); + return this; + } + + /** + * Parse the given string into Date object. + * + * @param str String + * @return Date + */ + public Date parseDate(String str) { + try { + return dateFormat.parse(str); + } catch (java.text.ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * Format the given Date object into string. + * + * @param date Date + * @return Date in string format + */ + public String formatDate(Date date) { + return dateFormat.format(date); + } + + /** + * Format the given parameter object into string. + * + * @param param Object + * @return Object in string format + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date) { + return formatDate((Date) param); + } {{#jsr310}}else if (param instanceof OffsetDateTime) { + return formatOffsetDateTime((OffsetDateTime) param); + } {{/jsr310}}else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for(Object o : (Collection)param) { + if(b.length() > 0) { + b.append(','); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /* + * Format to {@code Pair} objects. + * + * @param collectionFormat Collection format + * @param name Name + * @param value Value + * @return List of pairs + */ + public List parameterToPairs(String collectionFormat, String name, Object value){ + List params = new ArrayList<>(); + + // preconditions + if (name == null || name.isEmpty() || value == null) return params; + + Collection valueCollection; + if (value instanceof Collection) { + valueCollection = (Collection) value; + } else { + params.add(new Pair(name, parameterToString(value))); + return params; + } + + if (valueCollection.isEmpty()){ + return params; + } + + // get the collection format (default: csv) + String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); + + // create the params based on the collection format + if ("multi".equals(format)) { + for (Object item : valueCollection) { + params.add(new Pair(name, parameterToString(item))); + } + + return params; + } + + String delimiter = ","; + + if ("csv".equals(format)) { + delimiter = ","; + } else if ("ssv".equals(format)) { + delimiter = " "; + } else if ("tsv".equals(format)) { + delimiter = "\t"; + } else if ("pipes".equals(format)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : valueCollection) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + params.add(new Pair(name, sb.substring(1))); + + return params; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "*{@literal /}*" is also considered JSON by this method. + * + * @param mime MIME + * @return True if the MIME type is JSON + */ + public boolean isJsonMime(String mime) { + return mime != null && (mime.equals("*/*") || JSON_MIME_PATTERN.matcher(mime).matches()); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String... accepts) { + if (accepts == null || accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * JSON will be used. + */ + public String selectHeaderContentType(String... contentTypes) { + if (contentTypes == null || contentTypes.length == 0) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str String + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Serialize the given Java object into string entity according the given + * Content-Type (only JSON is supported for now). + * + * @param obj Object + * @param formParams Form parameters + * @param contentType Context type + * @return Entity + * @throws ApiException API exception + */ + public Entity serialize(Object obj, Map formParams, String contentType, boolean isBodyNullable) throws ApiException { + Entity entity; + if (contentType.startsWith("multipart/form-data")) { + MultiPart multiPart = new MultiPart(); + for (Entry param: formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()) + .fileName(file.getName()).size(file.length()).build(); + + // Attempt to probe the content type for the file so that the form part is more correctly + // and precisely identified, but fall back to application/octet-stream if that fails. + MediaType type; + try { + type = MediaType.valueOf(Files.probeContentType(file.toPath())); + } catch (IOException | IllegalArgumentException e) { + type = MediaType.APPLICATION_OCTET_STREAM_TYPE; + } + + multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, type)); + } else { + FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build(); + multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(param.getValue()))); + } + } + entity = Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE); + } else if (contentType.startsWith("application/x-www-form-urlencoded")) { + Form form = new Form(); + for (Entry param: formParams.entrySet()) { + form.param(param.getKey(), parameterToString(param.getValue())); + } + entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); + } else { + // We let jersey handle the serialization + if (isBodyNullable) { // payload is nullable + if (obj instanceof String) { + entity = Entity.entity(obj == null ? "null" : "\"" + ((String)obj).replaceAll("\"", Matcher.quoteReplacement("\\\"")) + "\"", contentType); + } else { + entity = Entity.entity(obj == null ? "null" : obj, contentType); + } + } else { + if (obj instanceof String) { + entity = Entity.entity(obj == null ? "" : "\"" + ((String)obj).replaceAll("\"", Matcher.quoteReplacement("\\\"")) + "\"", contentType); + } else { + entity = Entity.entity(obj == null ? "" : obj, contentType); + } + } + } + return entity; + } + + /** + * Serialize the given Java object into string according the given + * Content-Type (only JSON, HTTP form is supported for now). + * + * @param obj Object + * @param formParams Form parameters + * @param contentType Context type + * @param isBodyNullable True if the body is nullable + * @return String + * @throws ApiException API exception + */ + public String serializeToString(Object obj, Map formParams, String contentType, boolean isBodyNullable) throws ApiException { + try { + if (contentType.startsWith("multipart/form-data")) { + throw new ApiException("multipart/form-data not yet supported for serializeToString (http signature authentication)"); + } else if (contentType.startsWith("application/x-www-form-urlencoded")) { + String formString = ""; + for (Entry param : formParams.entrySet()) { + formString = param.getKey() + "=" + URLEncoder.encode(parameterToString(param.getValue()), "UTF-8") + "&"; + } + + if (formString.length() == 0) { // empty string + return formString; + } else { + return formString.substring(0, formString.length() - 1); + } + } else { + if (isBodyNullable) { + return obj == null ? "null" : json.getMapper().writeValueAsString(obj); + } else { + return obj == null ? "" : json.getMapper().writeValueAsString(obj); + } + } + } catch (Exception ex) { + throw new ApiException("Failed to perform serializeToString: " + ex.toString()); + } + } + + /** + * Deserialize response body to Java object according to the Content-Type. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Deserialize object + * @throws ApiException API exception + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, GenericType returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + return (T) response.readEntity(byte[].class); + } else if (returnType.getRawType() == File.class) { + // Handle file downloading. + T file = (T) downloadFileFromResponse(response); + return file; + } + + // read the entity stream multiple times + response.bufferEntity(); + + return response.readEntity(returnType); + } + + /** + * Download file from the given response. + * + * @param response Response + * @return File + * @throws ApiException If fail to read file content from response and write to disk + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + *

Prepare the file for download from the response.

+ * + * @param response a {@link {{javaxPackage}}.ws.rs.core.Response} object. + * @return a {@link java.io.File} object. + * @throws java.io.IOException if any. + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = (String) response.getHeaders().getFirst("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) + filename = matcher.group(1); + } + + String prefix; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf('.'); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * Invoke API by sending HTTP request with the given options. + * + * @param Type + * @param operation The qualified name of the operation + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE" + * @param queryParams The query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param accept The request's Accept header + * @param contentType The request's Content-Type header + * @param authNames The authentications to apply + * @param returnType The return type into which to deserialize the response + * @param isBodyNullable True if the body is nullable + * @return The response body in type of string + * @throws ApiException API exception + */ + public ApiResponse invokeAPI( + String operation, + String path, + String method, + List queryParams, + Object body, + Map headerParams, + Map cookieParams, + Map formParams, + String accept, + String contentType, + String[] authNames, + GenericType returnType, + boolean isBodyNullable) + throws ApiException { + + String targetURL; + List serverConfigurations; + if (serverIndex != null && (serverConfigurations = operationServers.get(operation)) != null) { + int index = operationServerIndex.getOrDefault(operation, serverIndex).intValue(); + Map variables = operationServerVariables.getOrDefault(operation, serverVariables); + if (index < 0 || index >= serverConfigurations.size()) { + throw new ArrayIndexOutOfBoundsException( + String.format( + "Invalid index %d when selecting the host settings. Must be less than %d", + index, serverConfigurations.size())); + } + targetURL = serverConfigurations.get(index).URL(variables) + path; + } else { + targetURL = this.basePath + path; + } + // Not using `.target(targetURL).path(path)` below, + // to support (constant) query string in `path`, e.g. "/posts?draft=1" + WebTarget target = httpClient.target(targetURL); + + if (queryParams != null) { + for (Pair queryParam : queryParams) { + if (queryParam.getValue() != null) { + target = target.queryParam(queryParam.getName(), escapeString(queryParam.getValue())); + } + } + } + + Invocation.Builder invocationBuilder = target.request(); + + if (accept != null) { + invocationBuilder = invocationBuilder.accept(accept); + } + + for (Entry entry : cookieParams.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.cookie(entry.getKey(), value); + } + } + + for (Entry entry : defaultCookieMap.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.cookie(entry.getKey(), value); + } + } + + Entity entity = serialize(body, formParams, contentType, isBodyNullable); + + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + {{#hasHttpSignatureMethods}} + serializeToString(body, formParams, contentType, isBodyNullable), + {{/hasHttpSignatureMethods}} + {{^hasHttpSignatureMethods}} + null, + {{/hasHttpSignatureMethods}} + method, + target.getUri()); + } + + for (Entry entry : allHeaderParams.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.header(entry.getKey(), value); + } + } + + Response response = null; + + try { + response = sendRequest(method, invocationBuilder, entity); + + final int statusCode = response.getStatusInfo().getStatusCode(); + + {{#hasOAuthMethods}} + // If OAuth is used and a status 401 is received, renew the access token and retry the request + if (authNames != null && statusCode == Status.UNAUTHORIZED.getStatusCode()) { + for (String authName : authNames) { + Authentication authentication = authentications.get(authName); + if (authentication instanceof OAuth) { + OAuth2AccessToken accessToken = ((OAuth) authentication).renewAccessToken(); + if (accessToken != null) { + invocationBuilder.header("Authorization", null); + invocationBuilder.header("Authorization", "Bearer " + accessToken.getAccessToken()); + response = sendRequest(method, invocationBuilder, entity); + } + break; + } + } + } + + {{/hasOAuthMethods}} + Map> responseHeaders = buildResponseHeaders(response); + + if (statusCode == Status.NO_CONTENT.getStatusCode()) { + return new ApiResponse(statusCode, responseHeaders); + } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { + if (returnType == null) { + return new ApiResponse(statusCode, responseHeaders); + } else { + return new ApiResponse(statusCode, responseHeaders, deserialize(response, returnType)); + } + } else { + String message = "error"; + String respBody = null; + if (response.hasEntity()) { + try { + respBody = String.valueOf(response.readEntity(String.class)); + message = respBody; + } catch (RuntimeException e) { + // e.printStackTrace(); + } + } + throw new ApiException( + response.getStatus(), message, buildResponseHeaders(response), respBody); + } + } finally { + try { + response.close(); + } catch (Exception e) { + // it's not critical, since the response object is local in method invokeAPI; that's fine, + // just continue + } + } + } + + private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity entity) { + Response response; + if ("POST".equals(method)) { + response = invocationBuilder.post(entity); + } else if ("PUT".equals(method)) { + response = invocationBuilder.put(entity); + } else if ("DELETE".equals(method)) { + response = invocationBuilder.method("DELETE", entity); + } else if ("PATCH".equals(method)) { + response = invocationBuilder.method("PATCH", entity); + } else { + response = invocationBuilder.method(method); + } + return response; + } + + /** + * @deprecated Add qualified name of the operation as a first parameter. + */ + @Deprecated + public ApiResponse invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType, boolean isBodyNullable) throws ApiException { + return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType, isBodyNullable); + } + + /** + * Build the Client used to make HTTP requests. + * + * @return Client + */ + protected Client buildHttpClient() { + // recreate the client config to pickup changes + clientConfig = getDefaultClientConfig(); + + ClientBuilder clientBuilder = ClientBuilder.newBuilder(); + clientBuilder = clientBuilder.withConfig(clientConfig); + customizeClientBuilder(clientBuilder); + return clientBuilder.build(); + } + + /** + * Get the default client config. + * + * @return Client config + */ + public ClientConfig getDefaultClientConfig() { + ClientConfig clientConfig = new ClientConfig(); + clientConfig.register(MultiPartFeature.class); + clientConfig.register(json); + clientConfig.register(JacksonFeature.class); + clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); + // turn off compliance validation to be able to send payloads with DELETE calls + clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + if (debugging) { + clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); + clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); + // Set logger to ALL + java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME).setLevel(java.util.logging.Level.ALL); + } else { + // suppress warnings for payloads with DELETE calls: + java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); + } + + return clientConfig; + } + + /** + * Customize the client builder. + * + * This method can be overridden to customize the API client. For example, this can be used to: + * 1. Set the hostname verifier to be used by the client to verify the endpoint's hostname + * against its identification information. + * 2. Set the client-side key store. + * 3. Set the SSL context that will be used when creating secured transport connections to + * server endpoints from web targets created by the client instance that is using this SSL context. + * 4. Set the client-side trust store. + * + * To completely disable certificate validation (at your own risk), you can + * override this method and invoke disableCertificateValidation(clientBuilder). + * + * @param clientBuilder a {@link {{javaxPackage}}.ws.rs.client.ClientBuilder} object. + */ + protected void customizeClientBuilder(ClientBuilder clientBuilder) { + // No-op extension point + } + + /** + * Disable X.509 certificate validation in TLS connections. + * + * Please note that trusting all certificates is extremely risky. + * This may be useful in a development environment with self-signed certificates. + * + * @param clientBuilder a {@link {{javaxPackage}}.ws.rs.client.ClientBuilder} object. + * @throws java.security.KeyManagementException if any. + * @throws java.security.NoSuchAlgorithmException if any. + */ + protected void disableCertificateValidation(ClientBuilder clientBuilder) throws KeyManagementException, NoSuchAlgorithmException { + TrustManager[] trustAllCerts = new X509TrustManager[] { + new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) { + } + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) { + } + } + }; + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(null, trustAllCerts, new SecureRandom()); + clientBuilder.sslContext(sslContext); + } + + /** + *

Build the response headers.

+ * + * @param response a {@link {{javaxPackage}}.ws.rs.core.Response} object. + * @return a {@link java.util.Map} of response headers. + */ + protected Map> buildResponseHeaders(Response response) { + Map> responseHeaders = new HashMap<>(); + for (Entry> entry: response.getHeaders().entrySet()) { + List values = entry.getValue(); + List headers = new ArrayList<>(); + for (Object o : values) { + headers.add(String.valueOf(o)); + } + responseHeaders.put(entry.getKey(), headers); + } + return responseHeaders; + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + * @param method HTTP method (e.g. POST) + * @param uri HTTP URI + */ + protected void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, + Map cookieParams, String payload, String method, URI uri) throws ApiException { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + continue; + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } +} diff --git a/templates/libraries/okhttp-gson-nextgen/ApiResponse.mustache b/templates/libraries/jersey3/ApiResponse.mustache similarity index 79% rename from templates/libraries/okhttp-gson-nextgen/ApiResponse.mustache rename to templates/libraries/jersey3/ApiResponse.mustache index cecbaac..86c889b 100644 --- a/templates/libraries/okhttp-gson-nextgen/ApiResponse.mustache +++ b/templates/libraries/jersey3/ApiResponse.mustache @@ -11,15 +11,15 @@ import java.util.TreeMap; /** * API response returned by API call. + * + * @param The type of data that is deserialized from response body */ public class ApiResponse { - final private int statusCode; - final private Map> headers; - final private T data; + private final int statusCode; + private final Map> headers; + private final T data; /** - *

Constructor for ApiResponse.

- * * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response */ @@ -28,8 +28,6 @@ public class ApiResponse { } /** - *

Constructor for ApiResponse.

- * * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response * @param data The object deserialized from response bod @@ -47,27 +45,27 @@ public class ApiResponse { } /** - *

Get the status code.

+ * Get the status code * - * @return the status code + * @return status code */ public int getStatusCode() { return statusCode; } /** - *

Get the headers.

+ * Get the headers * - * @return a {@link java.util.Map} of headers + * @return map of headers */ public Map> getHeaders() { return headers; } /** - *

Get the data.

+ * Get the data * - * @return the data + * @return data */ public T getData() { return data; diff --git a/templates/libraries/jersey3/JSON.mustache b/templates/libraries/jersey3/JSON.mustache new file mode 100644 index 0000000..97cee63 --- /dev/null +++ b/templates/libraries/jersey3/JSON.mustache @@ -0,0 +1,263 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; +{{#openApiNullable}} +import org.openapitools.jackson.nullable.JsonNullableModule; +{{/openApiNullable}} +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +{{#joda}} +import com.fasterxml.jackson.datatype.joda.JodaModule; +{{/joda}} +{{#models.0}} +import {{modelPackage}}.*; +{{/models.0}} + +import java.text.DateFormat; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import {{javaxPackage}}.ws.rs.core.GenericType; +import {{javaxPackage}}.ws.rs.ext.ContextResolver; + +{{>generatedAnnotation}} +public class JSON implements ContextResolver { + private ObjectMapper mapper; + + public JSON() { + mapper = JsonMapper.builder() + .serializationInclusion(JsonInclude.Include.NON_NULL) + .configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false) + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true) + .configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) + .enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING) + .defaultDateFormat(new RFC3339DateFormat()) + .addModule(new JavaTimeModule()) + {{#joda}} + .addModule(new JodaModule()) + {{/joda}} + {{#openApiNullable}} + .addModule(new JsonNullableModule()) + {{/openApiNullable}} + .build(); + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + * @param dateFormat Date format + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + @Override + public ObjectMapper getContext(Class type) { + return mapper; + } + + /** + * Get the object mapper + * + * @return object mapper + */ + public ObjectMapper getMapper() { return mapper; } + + /** + * Returns the target model class that should be used to deserialize the input data. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param modelClass The class that contains the discriminator mappings. + */ + public static Class getClassForElement(JsonNode node, Class modelClass) { + ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); + if (cdm != null) { + return cdm.getClassForElement(node, new HashSet<>()); + } + return null; + } + + /** + * Helper class to register the discriminator mappings. + */ + private static class ClassDiscriminatorMapping { + // The model class name. + Class modelClass; + // The name of the discriminator property. + String discriminatorName; + // The discriminator mappings for a model class. + Map> discriminatorMappings; + + // Constructs a new class discriminator. + ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { + modelClass = cls; + discriminatorName = propertyName; + discriminatorMappings = new HashMap<>(); + if (mappings != null) { + discriminatorMappings.putAll(mappings); + } + } + + // Return the name of the discriminator property for this model class. + String getDiscriminatorPropertyName() { + return discriminatorName; + } + + // Return the discriminator value or null if the discriminator is not + // present in the payload. + String getDiscriminatorValue(JsonNode node) { + // Determine the value of the discriminator property in the input data. + if (discriminatorName != null) { + // Get the value of the discriminator property, if present in the input payload. + node = node.get(discriminatorName); + if (node != null && node.isValueNode()) { + String discrValue = node.asText(); + if (discrValue != null) { + return discrValue; + } + } + } + return null; + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * This function can be invoked for anyOf/oneOf composed models with discriminator mappings. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param visitedClasses The set of classes that have already been visited. + */ + Class getClassForElement(JsonNode node, Set> visitedClasses) { + if (visitedClasses.contains(modelClass)) { + // Class has already been visited. + return null; + } + // Determine the value of the discriminator property in the input data. + String discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + return null; + } + Class cls = discriminatorMappings.get(discrValue); + // It may not be sufficient to return this cls directly because that target class + // may itself be a composed schema, possibly with its own discriminator. + visitedClasses.add(modelClass); + for (Class childClass : discriminatorMappings.values()) { + ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass); + if (childCdm == null) { + continue; + } + if (!discriminatorName.equals(childCdm.discriminatorName)) { + discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + continue; + } + } + if (childCdm != null) { + // Recursively traverse the discriminator mappings. + Class childDiscr = childCdm.getClassForElement(node, visitedClasses); + if (childDiscr != null) { + return childDiscr; + } + } + } + return cls; + } + } + + /** + * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy. + * + * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy, + * so it's not possible to use the instanceof keyword. + * + * @param modelClass A OpenAPI model class. + * @param inst The instance object. + */ + public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { + if (modelClass.isInstance(inst)) { + // This handles the 'allOf' use case with single parent inheritance. + return true; + } + if (visitedClasses.contains(modelClass)) { + // This is to prevent infinite recursion when the composed schemas have + // a circular dependency. + return false; + } + visitedClasses.add(modelClass); + + // Traverse the oneOf/anyOf composed schemas. + Map> descendants = modelDescendants.get(modelClass); + if (descendants != null) { + for (GenericType childType : descendants.values()) { + if (isInstanceOf(childType.getRawType(), inst, visitedClasses)) { + return true; + } + } + } + return false; + } + + /** + * A map of discriminators for all model classes. + */ + private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<>(); + + /** + * A map of oneOf/anyOf descendants for each model class. + */ + private static Map, Map>> modelDescendants = new HashMap<>(); + + /** + * Register a model class discriminator. + * + * @param modelClass the model class + * @param discriminatorPropertyName the name of the discriminator property + * @param mappings a map with the discriminator mappings. + */ + public static void registerDiscriminator(Class modelClass, String discriminatorPropertyName, Map> mappings) { + ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings); + modelDiscriminators.put(modelClass, m); + } + + /** + * Register the oneOf/anyOf descendants of the modelClass. + * + * @param modelClass the model class + * @param descendants a map of oneOf/anyOf descendants. + */ + public static void registerDescendants(Class modelClass, Map> descendants) { + modelDescendants.put(modelClass, descendants); + } + + private static JSON json; + + static + { + json = new JSON(); + } + + /** + * Get the default JSON instance. + * + * @return the default JSON instance + */ + public static JSON getDefault() { + return json; + } + + /** + * Set the default JSON instance. + * + * @param json JSON instance to be used + */ + public static void setDefault(JSON json) { + JSON.json = json; + } +} diff --git a/templates/libraries/jersey3/additional_properties.mustache b/templates/libraries/jersey3/additional_properties.mustache new file mode 100644 index 0000000..2955e93 --- /dev/null +++ b/templates/libraries/jersey3/additional_properties.mustache @@ -0,0 +1,39 @@ +{{#additionalPropertiesType}} + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + */ + @JsonAnySetter + public {{classname}} putAdditionalProperty(String key, {{{.}}} value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public {{{.}}} getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } +{{/additionalPropertiesType}} diff --git a/templates/libraries/jersey3/anyof_model.mustache b/templates/libraries/jersey3/anyof_model.mustache new file mode 100644 index 0000000..d480667 --- /dev/null +++ b/templates/libraries/jersey3/anyof_model.mustache @@ -0,0 +1,202 @@ +import {{javaxPackage}}.ws.rs.core.GenericType; +import {{javaxPackage}}.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import {{invokerPackage}}.JSON; + +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} +@JsonDeserialize(using={{classname}}.{{classname}}Deserializer.class) +@JsonSerialize(using = {{classname}}.{{classname}}Serializer.class) +public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}} implements {{{.}}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-implements}} { + private static final Logger log = Logger.getLogger({{classname}}.class.getName()); + + public static class {{classname}}Serializer extends StdSerializer<{{classname}}> { + public {{classname}}Serializer(Class<{{classname}}> t) { + super(t); + } + + public {{classname}}Serializer() { + this(null); + } + + @Override + public void serialize({{classname}} value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class {{classname}}Deserializer extends StdDeserializer<{{classname}}> { + public {{classname}}Deserializer() { + this({{classname}}.class); + } + + public {{classname}}Deserializer(Class vc) { + super(vc); + } + + @Override + public {{classname}} deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + + Object deserialized = null; + {{#discriminator}} + Class cls = JSON.getClassForElement(tree, new {{classname}}().getClass()); + if (cls != null) { + // When the OAS schema includes a discriminator, use the discriminator value to + // discriminate the anyOf schemas. + // Get the discriminator mapping value to get the class. + deserialized = tree.traverse(jp.getCodec()).readValueAs(cls); + {{classname}} ret = new {{classname}}(); + ret.setActualInstance(deserialized); + return ret; + } + {{/discriminator}} + {{#anyOf}} + // deserialize {{{.}}} + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs({{{.}}}.class); + {{classname}} ret = new {{classname}}(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match '{{classname}}'", e); + } + + {{/anyOf}} + throw new IOException(String.format("Failed deserialization for {{classname}}: no match found")); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public {{classname}} getNullValue(DeserializationContext ctxt) throws JsonMappingException { + {{#isNullable}} + return null; + {{/isNullable}} + {{^isNullable}} + throw new JsonMappingException(ctxt.getParser(), "{{classname}} cannot be null"); + {{/isNullable}} + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public {{classname}}() { + super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); + } +{{> libraries/jersey2/additional_properties }} + {{#additionalPropertiesType}} + /** + * Return true if this {{name}} object is equal to o. + */ + @Override + public boolean equals(Object o) { + return super.equals(o) && Objects.equals(this.additionalProperties, (({{classname}})o).additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); + } + {{/additionalPropertiesType}} + {{#anyOf}} + public {{classname}}({{{.}}} o) { + super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); + setActualInstance(o); + } + + {{/anyOf}} + static { + {{#anyOf}} + schemas.put("{{{.}}}", new GenericType<{{{.}}}>() { + }); + {{/anyOf}} + JSON.registerDescendants({{classname}}.class, Collections.unmodifiableMap(schemas)); + {{#discriminator}} + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + {{#mappedModels}} + mappings.put("{{mappingName}}", {{modelName}}.class); + {{/mappedModels}} + mappings.put("{{name}}", {{classname}}.class); + JSON.registerDiscriminator({{classname}}.class, "{{propertyBaseName}}", mappings); + {{/discriminator}} + } + + @Override + public Map> getSchemas() { + return {{classname}}.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}} + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + {{#isNullable}} + if (instance == null) { + super.setActualInstance(instance); + return; + } + + {{/isNullable}} + {{#anyOf}} + if (JSON.isInstanceOf({{{.}}}.class, instance, new HashSet<>())) { + super.setActualInstance(instance); + return; + } + + {{/anyOf}} + throw new RuntimeException("Invalid instance type. Must be {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}"); + } + + /** + * Get the actual instance, which can be the following: + * {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}} + * + * @return The actual instance ({{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + {{#anyOf}} + /** + * Get the actual instance of `{{{.}}}`. If the actual instance is not `{{{.}}}`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `{{{.}}}` + * @throws ClassCastException if the instance is not `{{{.}}}` + */ + public {{{.}}} get{{{.}}}() throws ClassCastException { + return ({{{.}}})super.getActualInstance(); + } + + {{/anyOf}} +} diff --git a/templates/libraries/jersey3/api.mustache b/templates/libraries/jersey3/api.mustache new file mode 100644 index 0000000..8d3e62f --- /dev/null +++ b/templates/libraries/jersey3/api.mustache @@ -0,0 +1,292 @@ +package {{package}}; + +import {{invokerPackage}}.ApiException; +import {{invokerPackage}}.ApiClient; +import {{invokerPackage}}.ApiResponse; +import {{invokerPackage}}.Configuration; +import {{invokerPackage}}.Pair; + +import {{javaxPackage}}.ws.rs.core.GenericType; + +{{#imports}}import {{import}}; +{{/imports}} + +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +{{>generatedAnnotation}} +{{#operations}} +public class {{classname}} { + private ApiClient apiClient; + + public {{classname}}() { + this(Configuration.getDefaultApiClient()); + } + + public {{classname}}(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + {{#operation}} + {{^vendorExtensions.x-group-parameters}} + /** + * {{summary}} + * {{notes}} + {{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + {{/allParams}} + {{#returnType}} + * @return {{.}} + {{/returnType}} + * @throws ApiException if fails to make API call + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + {{#returnType}}return {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}}.getData(){{/returnType}}; + } + {{/vendorExtensions.x-group-parameters}} + + {{^vendorExtensions.x-group-parameters}} + /** + * {{summary}} + * {{notes}} + {{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + {{/allParams}} + * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> + * @throws ApiException if fails to make API call + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + {{#hasRequiredParams}} + // Check required parameters + {{#allParams}} + {{#required}} + if ({{paramName}} == null) { + throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}"); + } + {{/required}} + {{/allParams}} + + {{/hasRequiredParams}} + {{#hasPathParams}} + // Path parameters + String localVarPath = "{{{path}}}"{{#pathParams}} + .replaceAll({{=% %=}}"\\{%baseName%}"%={{ }}=%, apiClient.escapeString({{{paramName}}}.toString())){{/pathParams}}; + + {{/hasPathParams}} + {{#queryParams}} + {{#-first}} + // Query parameters + List localVarQueryParams = new ArrayList<>( + apiClient.parameterToPairs("{{{collectionFormat}}}", "{{baseName}}", {{paramName}}) + ); + {{/-first}} + {{^-first}} + localVarQueryParams.addAll(apiClient.parameterToPairs("{{{collectionFormat}}}", "{{baseName}}", {{paramName}})); + {{/-first}} + {{#-last}} + + {{/-last}} + {{/queryParams}} + {{#headerParams}} + {{#-first}} + // Header parameters + Map localVarHeaderParams = new LinkedHashMap<>(); + {{/-first}} + {{^required}}if ({{paramName}} != null) { + {{/required}}localVarHeaderParams.put("{{baseName}}", apiClient.parameterToString({{paramName}}));{{^required}} + }{{/required}} + {{#-last}} + + {{/-last}} + {{/headerParams}} + {{#cookieParams}} + {{#-first}} + // Cookie parameters + Map localVarCookieParams = new LinkedHashMap<>(); + {{/-first}} + {{^required}}if ({{paramName}} != null) { + {{/required}}localVarCookieParams.put("{{baseName}}", apiClient.parameterToString({{paramName}}));{{^required}} + }{{/required}} + {{#-last}} + + {{/-last}} + {{/cookieParams}} + {{#formParams}} + {{#-first}} + // Form parameters + Map localVarFormParams = new LinkedHashMap<>(); + {{/-first}} + {{^required}}if ({{paramName}} != null) { + {{/required}}localVarFormParams.put("{{baseName}}", {{paramName}});{{^required}} + }{{/required}} + {{#-last}} + + {{/-last}} + {{/formParams}} + String localVarAccept = apiClient.selectHeaderAccept({{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}); + String localVarContentType = apiClient.selectHeaderContentType({{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}); + {{#hasAuthMethods}} + String[] localVarAuthNames = {{=% %=}}new String[] {%#authMethods%"%name%"%^-last%, %/-last%%/authMethods%};%={{ }}=% + {{/hasAuthMethods}} + {{#returnType}} + GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {}; + {{/returnType}} + return apiClient.invokeAPI("{{classname}}.{{operationId}}", {{#hasPathParams}}localVarPath{{/hasPathParams}}{{^hasPathParams}}"{{path}}"{{/hasPathParams}}, "{{httpMethod}}", {{#queryParams}}{{#-first}}localVarQueryParams{{/-first}}{{/queryParams}}{{^queryParams}}new ArrayList<>(){{/queryParams}}, {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}, + {{#headerParams}}{{#-first}}localVarHeaderParams{{/-first}}{{/headerParams}}{{^headerParams}}new LinkedHashMap<>(){{/headerParams}}, {{#cookieParams}}{{#-first}}localVarCookieParams{{/-first}}{{/cookieParams}}{{^cookieParams}}new LinkedHashMap<>(){{/cookieParams}}, {{#formParams}}{{#-first}}localVarFormParams{{/-first}}{{/formParams}}{{^formParams}}new LinkedHashMap<>(){{/formParams}}, localVarAccept, localVarContentType, + {{#hasAuthMethods}}localVarAuthNames{{/hasAuthMethods}}{{^hasAuthMethods}}null{{/hasAuthMethods}}, {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}}, {{#bodyParam}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/bodyParam}}{{^bodyParam}}false{{/bodyParam}}); + } + {{#vendorExtensions.x-group-parameters}} + + public class API{{operationId}}Request { + {{#allParams}} + private {{{dataType}}} {{paramName}}; + {{/allParams}} + + private API{{operationId}}Request({{#pathParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}) { + {{#pathParams}} + this.{{paramName}} = {{paramName}}; + {{/pathParams}} + } + {{#allParams}} + {{^isPathParam}} + + /** + * Set {{paramName}} + * @param {{paramName}} {{description}} ({{^required}}optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}{{/required}}{{#required}}required{{/required}}) + * @return API{{operationId}}Request + */ + public API{{operationId}}Request {{paramName}}({{{dataType}}} {{paramName}}) { + this.{{paramName}} = {{paramName}}; + return this; + } + {{/isPathParam}} + {{/allParams}} + + /** + * Execute {{operationId}} request + {{#returnType}}* @return {{.}}{{/returnType}} + * @throws ApiException if fails to make API call + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}}* @deprecated{{/isDeprecated}} + */ + {{#isDeprecated}}@Deprecated{{/isDeprecated}} + public {{{returnType}}}{{^returnType}}void{{/returnType}} execute() throws ApiException { + {{#returnType}}return {{/returnType}}this.executeWithHttpInfo().getData(); + } + + /** + * Execute {{operationId}} request with HTTP info returned + * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> + * @throws ApiException if fails to make API call + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated{{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException { + return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + } + } + + /** + * {{summary}} + * {{notes}}{{#pathParams}} + * @param {{paramName}} {{description}} (required){{/pathParams}} + * @return {{operationId}}Request + * @throws ApiException if fails to make API call + {{#isDeprecated}}* @deprecated{{/isDeprecated}} + {{#externalDocs}}* {{description}} + * @see {{summary}} Documentation{{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public API{{operationId}}Request {{operationId}}({{#pathParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}) throws ApiException { + return new API{{operationId}}Request({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}); + } + {{/vendorExtensions.x-group-parameters}} + {{/operation}} +} +{{/operations}} diff --git a/templates/libraries/okhttp-gson-nextgen/apiException.mustache b/templates/libraries/jersey3/apiException.mustache similarity index 54% rename from templates/libraries/okhttp-gson-nextgen/apiException.mustache rename to templates/libraries/jersey3/apiException.mustache index 59da3c5..d103223 100644 --- a/templates/libraries/okhttp-gson-nextgen/apiException.mustache +++ b/templates/libraries/jersey3/apiException.mustache @@ -9,52 +9,27 @@ import java.util.Map.Entry; import java.util.TreeMap; {{/caseInsensitiveResponseHeaders}} -import javax.ws.rs.core.GenericType; - /** - *

ApiException class.

+ * API Exception */ -@SuppressWarnings("serial") {{>generatedAnnotation}} public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ + private static final long serialVersionUID = 1L; + private int code = 0; private Map> responseHeaders = null; private String responseBody = null; - private {{{errorObjectType}}}{{^errorObjectType}}Object{{/errorObjectType}} errorObject = null; - private GenericType errorObjectType = null; - - /** - *

Constructor for ApiException.

- */ + public ApiException() {} - /** - *

Constructor for ApiException.

- * - * @param throwable a {@link java.lang.Throwable} object - */ public ApiException(Throwable throwable) { super(throwable); } - /** - *

Constructor for ApiException.

- * - * @param message the error message - */ public ApiException(String message) { super(message); } - /** - *

Constructor for ApiException.

- * - * @param message the error message - * @param throwable a {@link java.lang.Throwable} object - * @param code HTTP status code - * @param responseHeaders a {@link java.util.Map} of HTTP response headers - * @param responseBody the response body - */ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { super(message, throwable); this.code = code; @@ -68,60 +43,23 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us this.responseBody = responseBody; } - /** - *

Constructor for ApiException.

- * - * @param message the error message - * @param code HTTP status code - * @param responseHeaders a {@link java.util.Map} of HTTP response headers - * @param responseBody the response body - */ public ApiException(String message, int code, Map> responseHeaders, String responseBody) { this(message, (Throwable) null, code, responseHeaders, responseBody); } - /** - *

Constructor for ApiException.

- * - * @param message the error message - * @param throwable a {@link java.lang.Throwable} object - * @param code HTTP status code - * @param responseHeaders a {@link java.util.Map} of HTTP response headers - */ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { this(message, throwable, code, responseHeaders, null); } - /** - *

Constructor for ApiException.

- * - * @param code HTTP status code - * @param responseHeaders a {@link java.util.Map} of HTTP response headers - * @param responseBody the response body - */ public ApiException(int code, Map> responseHeaders, String responseBody) { this((String) null, (Throwable) null, code, responseHeaders, responseBody); } - /** - *

Constructor for ApiException.

- * - * @param code HTTP status code - * @param message a {@link java.lang.String} object - */ public ApiException(int code, String message) { super(message); this.code = code; } - /** - *

Constructor for ApiException.

- * - * @param code HTTP status code - * @param message the error message - * @param responseHeaders a {@link java.util.Map} of HTTP response headers - * @param responseBody the response body - */ public ApiException(int code, String message, Map> responseHeaders, String responseBody) { this(code, message); {{#caseInsensitiveResponseHeaders}} @@ -160,40 +98,4 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us public String getResponseBody() { return responseBody; } - - /** - * Get the error object type. - * - * @return Error object type - */ - public GenericType getErrorObjectType() { - return errorObjectType; - } - - /** - * Set the error object type. - * - * @param errorObjectType object type - */ - public void setErrorObjectType(GenericType errorObjectType) { - this.errorObjectType = errorObjectType; - } - - /** - * Get the error object. - * - * @return Error object - */ - public {{{errorObjectType}}}{{^errorObjectType}}Object{{/errorObjectType}} getErrorObject() { - return errorObject; - } - - /** - * Get the error object. - * - * @param errorObject Error object - */ - public void setErrorObject({{{errorObjectType}}}{{^errorObjectType}}Object{{/errorObjectType}} errorObject) { - this.errorObject = errorObject; - } } diff --git a/templates/libraries/jersey3/api_doc.mustache b/templates/libraries/jersey3/api_doc.mustache new file mode 100644 index 0000000..26c9850 --- /dev/null +++ b/templates/libraries/jersey3/api_doc.mustache @@ -0,0 +1,124 @@ +# {{classname}}{{#description}} + +{{.}}{{/description}} + +All URIs are relative to *{{basePath}}* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +{{#operations}}{{#operation}}| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} | +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} + +## {{operationId}} + +{{^vendorExtensions.x-group-parameters}} +> {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) +{{/vendorExtensions.x-group-parameters}} +{{#vendorExtensions.x-group-parameters}} +> {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}}.execute(); +{{/vendorExtensions.x-group-parameters}} + +{{summary}}{{#notes}} + +{{{unescapedNotes}}}{{/notes}} + +### Example + +```java +{{#vendorExtensions.x-java-import}} +import {{.}}; +{{/vendorExtensions.x-java-import}} +// Import classes: +import {{{invokerPackage}}}.ApiClient; +import {{{invokerPackage}}}.ApiException; +import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}} +import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}} +import {{{invokerPackage}}}.model.*; +import {{{package}}}.{{{classname}}}; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("{{{basePath}}}"); + {{#hasAuthMethods}} + {{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + // Configure HTTP basic authorization: {{{name}}} + HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setUsername("YOUR USERNAME"); + {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}} + // Configure HTTP bearer authorization: {{{name}}} + HttpBearerAuth {{{name}}} = (HttpBearerAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} + // Configure API key authorization: {{{name}}} + ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} + // Configure OAuth2 access token for authorization: {{{name}}} + OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}} + {{/authMethods}} + {{/hasAuthMethods}} + + {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); + {{#allParams}} + {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} + {{/allParams}} + try { + {{^vendorExtensions.x-group-parameters}} + {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}); + {{/vendorExtensions.x-group-parameters}} + {{#vendorExtensions.x-group-parameters}} + {{#returnType}}{{{.}}} result = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}){{#allParams}}{{^isPathParam}} + .{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}} + .execute(); + {{/vendorExtensions.x-group-parameters}} + {{#returnType}} + System.out.println(result); + {{/returnType}} + } catch (ApiException e) { + System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------|{{/-last}}{{/allParams}} +{{#allParams}}| **{{paramName}}** | {{#isContainer}}{{#isArray}}{{#items}}{{#isModel}}{{^isFile}}[{{/isFile}}{{/isModel}}**List<{{dataType}}>**{{#isModel}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isModel}}{{/items}}{{/isArray}}{{#isMap}}{{#items}}{{#isModel}}{{^isFile}}[{{/isFile}}{{/isModel}}**Map<String,{{dataType}}>**{{#isModel}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isModel}}{{/items}}{{/isMap}}{{/isContainer}}{{^isContainer}}{{#isModel}}{{^isFile}}[{{/isFile}}{{/isModel}}**{{dataType}}**{{#isModel}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isModel}}{{/isContainer}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} | +{{/allParams}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}null (empty response body){{/returnType}} + +### Authorization + +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}} + +### HTTP request headers + +- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} +- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} + +{{#responses.0}} +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +{{#responses}} +| **{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}} | +{{/responses}} +{{/responses.0}} + +{{/operation}} +{{/operations}} diff --git a/templates/libraries/jersey3/api_test.mustache b/templates/libraries/jersey3/api_test.mustache new file mode 100644 index 0000000..7b8214b --- /dev/null +++ b/templates/libraries/jersey3/api_test.mustache @@ -0,0 +1,62 @@ +{{>licenseInfo}} + +package {{package}}; + +import {{invokerPackage}}.*; +import {{invokerPackage}}.auth.*; +{{#imports}}import {{import}}; +{{/imports}} + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} +/** + * API tests for {{classname}} + */ +public class {{classname}}Test { + + private final {{classname}} api = new {{classname}}(); + + {{#operations}} + {{#operation}} + /** + {{#summary}} + * {{summary}} + * + {{/summary}} + {{#notes}} + * {{notes}} + * + {{/notes}} + * @throws ApiException if the Api call fails + */ + @Test + public void {{operationId}}Test() throws ApiException { + {{#allParams}} + //{{{dataType}}} {{paramName}} = null; + {{/allParams}} + {{^vendorExtensions.x-group-parameters}} + //{{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + {{/vendorExtensions.x-group-parameters}} + {{#vendorExtensions.x-group-parameters}} + //{{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}){{#allParams}}{{^isPathParam}} + // .{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}} + // .execute(); + {{/vendorExtensions.x-group-parameters}} + // TODO: test validations + } + + {{/operation}} + {{/operations}} +} diff --git a/templates/libraries/okhttp-gson-nextgen/auth/ApiKeyAuth.mustache b/templates/libraries/jersey3/auth/ApiKeyAuth.mustache similarity index 90% rename from templates/libraries/okhttp-gson-nextgen/auth/ApiKeyAuth.mustache rename to templates/libraries/jersey3/auth/ApiKeyAuth.mustache index a0dda66..1731f93 100644 --- a/templates/libraries/okhttp-gson-nextgen/auth/ApiKeyAuth.mustache +++ b/templates/libraries/jersey3/auth/ApiKeyAuth.mustache @@ -2,8 +2,8 @@ package {{invokerPackage}}.auth; -import {{invokerPackage}}.ApiException; import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; import java.net.URI; import java.util.Map; @@ -47,8 +47,7 @@ public class ApiKeyAuth implements Authentication { } @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams, - String payload, String method, URI uri) throws ApiException { + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { if (apiKey == null) { return; } diff --git a/templates/libraries/okhttp-gson-nextgen/auth/Authentication.mustache b/templates/libraries/jersey3/auth/Authentication.mustache similarity index 80% rename from templates/libraries/okhttp-gson-nextgen/auth/Authentication.mustache rename to templates/libraries/jersey3/auth/Authentication.mustache index c4ad338..46d9c1a 100644 --- a/templates/libraries/okhttp-gson-nextgen/auth/Authentication.mustache +++ b/templates/libraries/jersey3/auth/Authentication.mustache @@ -16,10 +16,7 @@ public interface Authentication { * @param queryParams List of query parameters * @param headerParams Map of header parameters * @param cookieParams Map of cookie parameters - * @param payload HTTP request body - * @param method HTTP method - * @param uri URI - * @throws ApiException if failed to update the parameters */ void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; + } diff --git a/templates/libraries/jersey3/auth/HttpBasicAuth.mustache b/templates/libraries/jersey3/auth/HttpBasicAuth.mustache new file mode 100644 index 0000000..13cecfa --- /dev/null +++ b/templates/libraries/jersey3/auth/HttpBasicAuth.mustache @@ -0,0 +1,44 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import java.util.Base64; +import java.nio.charset.StandardCharsets; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +{{>generatedAnnotation}} +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { + if (username == null && password == null) { + return; + } + String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); + headerParams.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); + } +} diff --git a/templates/libraries/okhttp-gson-nextgen/auth/HttpBearerAuth.mustache b/templates/libraries/jersey3/auth/HttpBearerAuth.mustache similarity index 87% rename from templates/libraries/okhttp-gson-nextgen/auth/HttpBearerAuth.mustache rename to templates/libraries/jersey3/auth/HttpBearerAuth.mustache index c8a9fce..110a11e 100644 --- a/templates/libraries/okhttp-gson-nextgen/auth/HttpBearerAuth.mustache +++ b/templates/libraries/jersey3/auth/HttpBearerAuth.mustache @@ -2,8 +2,8 @@ package {{invokerPackage}}.auth; -import {{invokerPackage}}.ApiException; import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; import java.net.URI; import java.util.Map; @@ -37,9 +37,8 @@ public class HttpBearerAuth implements Authentication { } @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams, - String payload, String method, URI uri) throws ApiException { - if (bearerToken == null) { + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { + if(bearerToken == null) { return; } diff --git a/templates/libraries/jersey3/auth/HttpSignatureAuth.mustache b/templates/libraries/jersey3/auth/HttpSignatureAuth.mustache new file mode 100644 index 0000000..ac0a77d --- /dev/null +++ b/templates/libraries/jersey3/auth/HttpSignatureAuth.mustache @@ -0,0 +1,269 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import java.net.URI; +import java.net.URLEncoder; +import java.security.MessageDigest; +import java.security.Key; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Calendar; +import java.util.Date; +import java.util.Locale; +import java.util.Map; +import java.util.List; +import java.util.TimeZone; +import java.security.spec.AlgorithmParameterSpec; +import java.security.InvalidKeyException; + +import org.tomitribe.auth.signatures.Algorithm; +import org.tomitribe.auth.signatures.Signer; +import org.tomitribe.auth.signatures.Signature; +import org.tomitribe.auth.signatures.SigningAlgorithm; + +/** + * A Configuration object for the HTTP message signature security scheme. + */ +public class HttpSignatureAuth implements Authentication { + + private Signer signer; + + // An opaque string that the server can use to look up the component they need to validate the signature. + private String keyId; + + // The HTTP signature algorithm. + private SigningAlgorithm signingAlgorithm; + + // The HTTP cryptographic algorithm. + private Algorithm algorithm; + + // The cryptographic parameters. + private AlgorithmParameterSpec parameterSpec; + + // The list of HTTP headers that should be included in the HTTP signature. + private List headers; + + // The digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + private String digestAlgorithm; + + // The maximum validity duration of the HTTP signature. + private Long maxSignatureValidity; + + /** + * Construct a new HTTP signature auth configuration object. + * + * @param keyId An opaque string that the server can use to look up the component they need to validate the signature. + * @param signingAlgorithm The signature algorithm. + * @param algorithm The cryptographic algorithm. + * @param digestAlgorithm The digest algorithm. + * @param headers The list of HTTP headers that should be included in the HTTP signature. + * @param maxSignatureValidity The maximum validity duration of the HTTP signature. + * Used to set the '(expires)' field in the HTTP signature. + */ + public HttpSignatureAuth(String keyId, + SigningAlgorithm signingAlgorithm, + Algorithm algorithm, + String digestAlgorithm, + AlgorithmParameterSpec parameterSpec, + List headers, + Long maxSignatureValidity) { + this.keyId = keyId; + this.signingAlgorithm = signingAlgorithm; + this.algorithm = algorithm; + this.parameterSpec = parameterSpec; + this.digestAlgorithm = digestAlgorithm; + this.headers = headers; + this.maxSignatureValidity = maxSignatureValidity; + } + + /** + * Returns the opaque string that the server can use to look up the component they need to validate the signature. + * + * @return The keyId. + */ + public String getKeyId() { + return keyId; + } + + /** + * Set the HTTP signature key id. + * + * @param keyId An opaque string that the server can use to look up the component they need to validate the signature. + */ + public void setKeyId(String keyId) { + this.keyId = keyId; + } + + /** + * Returns the HTTP signature algorithm which is used to sign HTTP requests. + */ + public SigningAlgorithm getSigningAlgorithm() { + return signingAlgorithm; + } + + /** + * Sets the HTTP signature algorithm which is used to sign HTTP requests. + * + * @param signingAlgorithm The HTTP signature algorithm. + */ + public void setSigningAlgorithm(SigningAlgorithm signingAlgorithm) { + this.signingAlgorithm = signingAlgorithm; + } + + /** + * Returns the HTTP cryptographic algorithm which is used to sign HTTP requests. + */ + public Algorithm getAlgorithm() { + return algorithm; + } + + /** + * Sets the HTTP cryptographic algorithm which is used to sign HTTP requests. + * + * @param algorithm The HTTP signature algorithm. + */ + public void setAlgorithm(Algorithm algorithm) { + this.algorithm = algorithm; + } + + /** + * Returns the cryptographic parameters which are used to sign HTTP requests. + */ + public AlgorithmParameterSpec getAlgorithmParameterSpec() { + return parameterSpec; + } + + /** + * Sets the cryptographic parameters which are used to sign HTTP requests. + * + * @param parameterSpec The cryptographic parameters. + */ + public void setAlgorithmParameterSpec(AlgorithmParameterSpec parameterSpec) { + this.parameterSpec = parameterSpec; + } + + /** + * Returns the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + * + * @see java.security.MessageDigest + */ + public String getDigestAlgorithm() { + return digestAlgorithm; + } + + /** + * Sets the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + * + * The exact list of supported digest algorithms depends on the installed security providers. + * Every implementation of the Java platform is required to support "MD5", "SHA-1" and "SHA-256". + * Do not use "MD5" and "SHA-1", they are vulnerable to multiple known attacks. + * By default, "SHA-256" is used. + * + * @param digestAlgorithm The digest algorithm. + * + * @see java.security.MessageDigest + */ + public void setDigestAlgorithm(String digestAlgorithm) { + this.digestAlgorithm = digestAlgorithm; + } + + /** + * Returns the list of HTTP headers that should be included in the HTTP signature. + */ + public List getHeaders() { + return headers; + } + + /** + * Sets the list of HTTP headers that should be included in the HTTP signature. + * + * @param headers The HTTP headers. + */ + public void setHeaders(List headers) { + this.headers = headers; + } + + /** + * Returns the maximum validity duration of the HTTP signature. + * @return The maximum validity duration of the HTTP signature. + */ + public Long getMaxSignatureValidity() { + return maxSignatureValidity; + } + + /** + * Returns the signer instance used to sign HTTP messages. + * + * @return the signer instance. + */ + public Signer getSigner() { + return signer; + } + + /** + * Sets the signer instance used to sign HTTP messages. + * + * @param signer The signer instance to set. + */ + public void setSigner(Signer signer) { + this.signer = signer; + } + + /** + * Set the private key used to sign HTTP requests using the HTTP signature scheme. + * + * @param key The private key. + * + * @throws InvalidKeyException Unable to parse the key, or the security provider for this key + * is not installed. + */ + public void setPrivateKey(Key key) throws InvalidKeyException, ApiException { + if (key == null) { + throw new ApiException("Private key (java.security.Key) cannot be null"); + } + signer = new Signer(key, new Signature(keyId, signingAlgorithm, algorithm, parameterSpec, null, headers, maxSignatureValidity)); + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + try { + if (headers.contains("host")) { + headerParams.put("host", uri.getHost()); + } + + if (headers.contains("date")) { + SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); + dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); + headerParams.put("date", dateFormat.format(Calendar.getInstance().getTime())); + } + + if (headers.contains("digest")) { + headerParams.put("digest", + this.digestAlgorithm + "=" + + new String(Base64.getEncoder().encode(MessageDigest.getInstance(this.digestAlgorithm).digest(payload.getBytes())))); + } + + if (signer == null) { + throw new ApiException("Signer cannot be null. Please call the method `setPrivateKey` to set it up correctly"); + } + + // construct the path with the URL-encoded path and query. + // Calling getRawPath and getRawQuery ensures the path is URL-encoded as it will be serialized + // on the wire. The HTTP signature must use the encode URL as it is sent on the wire. + String path = uri.getRawPath(); + if (uri.getRawQuery() != null && !"".equals(uri.getRawQuery())) { + path += "?" + uri.getRawQuery(); + } + + headerParams.put("Authorization", signer.sign(method, path, headerParams).toString()); + } catch (Exception ex) { + throw new ApiException("Failed to create signature in the HTTP request header: " + ex.toString()); + } + } +} diff --git a/templates/libraries/jersey3/auth/OAuth.mustache b/templates/libraries/jersey3/auth/OAuth.mustache new file mode 100644 index 0000000..6617522 --- /dev/null +++ b/templates/libraries/jersey3/auth/OAuth.mustache @@ -0,0 +1,195 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; +import com.github.scribejava.core.builder.ServiceBuilder; +import com.github.scribejava.core.builder.api.DefaultApi20; +import com.github.scribejava.core.exceptions.OAuthException; +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.oauth.OAuth20Service; + +import {{javaxPackage}}.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URI; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.logging.Level; +import java.util.logging.Logger; + +{{>generatedAnnotation}} +public class OAuth implements Authentication { + private static final Logger log = Logger.getLogger(OAuth.class.getName()); + + private String tokenUrl; + private String absoluteTokenUrl; + private OAuthFlow flow = OAuthFlow.APPLICATION; + private OAuth20Service service; + private DefaultApi20 authApi; + private String scope; + private String username; + private String password; + private String code; + private volatile OAuth2AccessToken accessToken; + + public OAuth(String basePath, String tokenUrl) { + this.tokenUrl = tokenUrl; + this.absoluteTokenUrl = createAbsoluteTokenUrl(basePath, tokenUrl); + authApi = new DefaultApi20() { + @Override + public String getAccessTokenEndpoint() { + return absoluteTokenUrl; + } + + @Override + protected String getAuthorizationBaseUrl() { + throw new UnsupportedOperationException("Shouldn't get there !"); + } + }; + } + + private static String createAbsoluteTokenUrl(String basePath, String tokenUrl) { + if (!URI.create(tokenUrl).isAbsolute()) { + try { + return UriBuilder.fromPath(basePath).path(tokenUrl).build().toURL().toString(); + } catch (MalformedURLException e) { + log.log(Level.SEVERE, "Couldn't create absolute token URL", e); + } + } + return tokenUrl; + } + + @Override + public void applyToParams( + List queryParams, + Map headerParams, + Map cookieParams, + String payload, + String method, + URI uri) + throws ApiException { + + if (accessToken == null) { + obtainAccessToken(null); + } + if (accessToken != null) { + headerParams.put("Authorization", "Bearer " + accessToken.getAccessToken()); + } + } + + public OAuth2AccessToken renewAccessToken() throws ApiException { + String refreshToken = null; + if (accessToken != null) { + refreshToken = accessToken.getRefreshToken(); + accessToken = null; + } + return obtainAccessToken(refreshToken); + } + + public synchronized OAuth2AccessToken obtainAccessToken(String refreshToken) throws ApiException { + if (service == null) { + log.log(Level.FINE, "service is null in obtainAccessToken."); + return null; + } + try { + if (refreshToken != null) { + return service.refreshAccessToken(refreshToken); + } + } catch (OAuthException | InterruptedException | ExecutionException | IOException e) { + throw new ApiException("Refreshing the access token using the refresh token failed: " + e.toString()); + } + try { + switch (flow) { + case PASSWORD: + if (username != null && password != null) { + accessToken = service.getAccessTokenPasswordGrant(username, password, scope); + } + break; + case ACCESS_CODE: + if (code != null) { + accessToken = service.getAccessToken(code); + code = null; + } + break; + case APPLICATION: + accessToken = service.getAccessTokenClientCredentialsGrant(scope); + break; + default: + log.log(Level.SEVERE, "Invalid flow in obtainAccessToken: " + flow); + } + } catch (OAuthException | InterruptedException | ExecutionException | IOException e) { + throw new ApiException(e); + } + return accessToken; + } + + public OAuth2AccessToken getAccessToken() { + return accessToken; + } + + public OAuth setAccessToken(OAuth2AccessToken accessToken) { + this.accessToken = accessToken; + return this; + } + + public OAuth setAccessToken(String accessToken) { + this.accessToken = new OAuth2AccessToken(accessToken); + return this; + } + + public OAuth setScope(String scope) { + this.scope = scope; + return this; + } + + public OAuth setCredentials(String clientId, String clientSecret, Boolean debug) { + if (Boolean.TRUE.equals(debug)) { + service = new ServiceBuilder(clientId) + .apiSecret(clientSecret).debug() + .build(authApi); + } else { + service = new ServiceBuilder(clientId) + .apiSecret(clientSecret) + .build(authApi); + } + return this; + } + + public OAuth setCredentialsForPublicClient(String clientId, Boolean debug) { + if (Boolean.TRUE.equals(debug)) { + service = new ServiceBuilder(clientId) + .apiSecretIsEmptyStringUnsafe().debug() + .build(authApi); + } else { + service = new ServiceBuilder(clientId) + .apiSecretIsEmptyStringUnsafe() + .build(authApi); + } + return this; + } + + public OAuth usePasswordFlow(String username, String password) { + this.flow = OAuthFlow.PASSWORD; + this.username = username; + this.password = password; + return this; + } + + public OAuth useAuthorizationCodeFlow(String code) { + this.flow = OAuthFlow.ACCESS_CODE; + this.code = code; + return this; + } + + public OAuth setFlow(OAuthFlow flow) { + this.flow = flow; + return this; + } + + public void setBasePath(String basePath) { + this.absoluteTokenUrl = createAbsoluteTokenUrl(basePath, tokenUrl); + } +} diff --git a/templates/libraries/jersey3/auth/OAuthFlow.mustache b/templates/libraries/jersey3/auth/OAuthFlow.mustache new file mode 100644 index 0000000..190781f --- /dev/null +++ b/templates/libraries/jersey3/auth/OAuthFlow.mustache @@ -0,0 +1,13 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +/** + * OAuth flows that are supported by this client + */ +public enum OAuthFlow { + ACCESS_CODE, + IMPLICIT, + PASSWORD, + APPLICATION +} diff --git a/templates/libraries/okhttp-gson-nextgen/build.gradle.mustache b/templates/libraries/jersey3/build.gradle.mustache similarity index 60% rename from templates/libraries/okhttp-gson-nextgen/build.gradle.mustache rename to templates/libraries/jersey3/build.gradle.mustache index c97cb87..42908c8 100644 --- a/templates/libraries/okhttp-gson-nextgen/build.gradle.mustache +++ b/templates/libraries/jersey3/build.gradle.mustache @@ -1,8 +1,5 @@ apply plugin: 'idea' apply plugin: 'eclipse' -{{#sourceFolder}} -apply plugin: 'java' -{{/sourceFolder}} apply plugin: 'com.diffplug.spotless' group = '{{groupId}}' @@ -14,20 +11,15 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' - classpath 'com.diffplug.spotless:spotless-plugin-gradle:5.17.1' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.3.0' } } repositories { mavenCentral() } -{{#sourceFolder}} -sourceSets { - main.java.srcDirs = ['{{sourceFolder}}'] -} -{{/sourceFolder}} if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -66,9 +58,9 @@ if(hasProperty('target') && target == 'android') { def task = project.tasks.create "jar${variant.name.capitalize()}", Jar task.description = "Create jar artifact for ${variant.name}" task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - task.destinationDir = project.file("${project.buildDir}/outputs/jar") - task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + task.from variant.javaCompile.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" artifacts.add('archives', task); } } @@ -86,7 +78,6 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven-publish' - sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -94,6 +85,7 @@ if(hasProperty('target') && target == 'android') { publications { maven(MavenPublication) { artifactId = '{{artifactId}}' + from components.java } } @@ -106,35 +98,61 @@ if(hasProperty('target') && target == 'android') { } ext { - jakarta_annotation_version = "1.3.5" + swagger_annotations_version = "1.6.5" + jackson_version = "2.17.1" + jackson_databind_version = "2.17.1" + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.6" + {{/openApiNullable}} + jakarta_annotation_version = "2.1.0" + {{#useBeanValidation}} + bean_validation_version = "3.0.2" + {{/useBeanValidation}} + jersey_version = "3.0.4" + junit_version = "5.8.2" + {{#hasOAuthMethods}} + scribejava_apis_version = "8.3.1" + {{/hasOAuthMethods}} + {{#hasHttpSignatureMethods}} + tomitribe_http_signatures_version = "1.7" + {{/hasHttpSignatureMethods}} } dependencies { - implementation 'io.swagger:swagger-annotations:1.5.24' + implementation "io.swagger:swagger-annotations:$swagger_annotations_version" implementation "com.google.code.findbugs:jsr305:3.0.2" - implementation 'com.squareup.okhttp3:okhttp:4.9.1' - implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1' - implementation 'com.google.code.gson:gson:2.8.6' - implementation 'io.gsonfire:gson-fire:1.8.4' + implementation "org.glassfish.jersey.core:jersey-client:$jersey_version" + implementation "org.glassfish.jersey.inject:jersey-hk2:$jersey_version" + implementation "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version" + implementation "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version" + implementation "org.glassfish.jersey.connectors:jersey-apache-connector:$jersey_version" + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" {{#openApiNullable}} - implementation 'org.openapitools:jackson-databind-nullable:0.2.1' + implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" {{/openApiNullable}} - {{#hasOAuthMethods}} - implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1' - {{/hasOAuthMethods}} - implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.10' {{#joda}} - implementation 'joda-time:joda-time:2.9.9' + implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" {{/joda}} - {{#threetenbp}} - implementation 'org.threeten:threetenbp:1.4.3' - {{/threetenbp}} - {{#dynamicOperations}} - implementation 'io.swagger.parser.v3:swagger-parser-v3:2.0.23' - {{/dynamicOperations}} + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + {{#hasOAuthMethods}} + implementation "com.github.scribejava:scribejava-apis:$scribejava_apis_version" + {{/hasOAuthMethods}} + {{#hasHttpSignatureMethods}} + implementation "org.tomitribe:tomitribe-http-signatures:$tomitribe_http_signatures_version" + {{/hasHttpSignatureMethods}} implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation 'junit:junit:4.13.1' - testImplementation 'org.mockito:mockito-core:3.11.2' + {{#useBeanValidation}} + implementation "jakarta.validation:jakarta.validation-api:$bean_validation_version" + {{/useBeanValidation}} + + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" +} + +test { + useJUnitPlatform() } javadoc { @@ -151,7 +169,6 @@ spotless { format 'misc', { // define the files (e.g. '*.gradle', '*.md') to apply `misc` to target '.gitignore' - // define the steps to apply to those files trimTrailingWhitespace() indentWithSpaces() // Takes an integer argument if you don't like 4 @@ -159,10 +176,8 @@ spotless { } java { // don't need to set target, it is inferred from java - // apply a specific flavor of google-java-format googleJavaFormat('1.8').aosp().reflowLongStrings() - removeUnusedImports() importOrder() } diff --git a/templates/libraries/jersey3/build.sbt.mustache b/templates/libraries/jersey3/build.sbt.mustache new file mode 100644 index 0000000..6e89375 --- /dev/null +++ b/templates/libraries/jersey3/build.sbt.mustache @@ -0,0 +1,38 @@ +lazy val root = (project in file(".")). + settings( + organization := "{{groupId}}", + name := "{{artifactId}}", + version := "{{artifactVersion}}", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + Compile / javacOptions ++= Seq("-Xlint:deprecation"), + Compile / packageDoc / publishArtifact := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "com.google.code.findbugs" % "jsr305" % "3.0.0", + "io.swagger" % "swagger-annotations" % "1.6.5", + "org.glassfish.jersey.core" % "jersey-client" % "3.0.4", + "org.glassfish.jersey.inject" % "jersey-hk2" % "3.0.4", + "org.glassfish.jersey.media" % "jersey-media-multipart" % "3.0.4", + "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "3.0.4", + "org.glassfish.jersey.connectors" % "jersey-apache-connector" % "3.0.4", + "com.fasterxml.jackson.core" % "jackson-core" % "2.17.1" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.17.1" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.17.1" % "compile", + {{#joda}} + "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.17.1" % "compile", + {{/joda}} + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.17.1" % "compile", + {{#openApiNullable}} + "org.openapitools" % "jackson-databind-nullable" % "0.2.6" % "compile", + {{/openApiNullable}} + {{#hasOAuthMethods}} + "com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile", + {{/hasOAuthMethods}} + {{#hasHttpSignatureMethods}} + "org.tomitribe" % "tomitribe-http-signatures" % "1.7" % "compile", + {{/hasHttpSignatureMethods}} + "jakarta.annotation" % "jakarta.annotation-api" % "2.1.0" % "compile", + "org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test" + ) + ) diff --git a/templates/libraries/jersey3/generatedAnnotation.mustache b/templates/libraries/jersey3/generatedAnnotation.mustache new file mode 100644 index 0000000..e05689d --- /dev/null +++ b/templates/libraries/jersey3/generatedAnnotation.mustache @@ -0,0 +1 @@ +@{{javaxPackage}}.annotation.Generated(value = "{{generatorClass}}"{{^hideGenerationTimestamp}}, date = "{{generatedDate}}"{{/hideGenerationTimestamp}}, comments = "Generator version: {{generatorVersion}}") \ No newline at end of file diff --git a/templates/libraries/okhttp-gson-nextgen/model.mustache b/templates/libraries/jersey3/model.mustache similarity index 59% rename from templates/libraries/okhttp-gson-nextgen/model.mustache rename to templates/libraries/jersey3/model.mustache index b6b0381..1904ee4 100644 --- a/templates/libraries/okhttp-gson-nextgen/model.mustache +++ b/templates/libraries/jersey3/model.mustache @@ -6,8 +6,19 @@ package {{package}}; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; {{/useReflectionEqualsHashCode}} +{{#models}} +{{#model}} +{{#additionalPropertiesType}} +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +{{/additionalPropertiesType}} +{{/model}} +{{/models}} import java.util.Objects; -import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; {{#imports}} import {{import}}; {{/imports}} @@ -16,7 +27,6 @@ import java.io.Serializable; {{/serializableModel}} {{#jackson}} import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; {{#withXml}} import com.fasterxml.jackson.dataformat.xml.annotation.*; {{/withXml}} @@ -25,37 +35,29 @@ import com.fasterxml.jackson.annotation.JsonCreator; {{/vendorExtensions.x-has-readonly-properties}} {{/jackson}} {{#withXml}} -import javax.xml.bind.annotation.*; +import {{javaxPackage}}.xml.bind.annotation.*; {{/withXml}} -{{#jsonb}} -import java.lang.reflect.Type; -import javax.json.bind.annotation.JsonbTypeDeserializer; -import javax.json.bind.annotation.JsonbTypeSerializer; -import javax.json.bind.serializer.DeserializationContext; -import javax.json.bind.serializer.JsonbDeserializer; -import javax.json.bind.serializer.JsonbSerializer; -import javax.json.bind.serializer.SerializationContext; -import javax.json.stream.JsonGenerator; -import javax.json.stream.JsonParser; -import javax.json.bind.annotation.JsonbProperty; -{{#vendorExtensions.x-has-readonly-properties}} -import javax.json.bind.annotation.JsonbCreator; -{{/vendorExtensions.x-has-readonly-properties}} -{{/jsonb}} {{#parcelableModel}} import android.os.Parcelable; import android.os.Parcel; {{/parcelableModel}} {{#useBeanValidation}} -import javax.validation.constraints.*; -import javax.validation.Valid; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; {{/useBeanValidation}} {{#performBeanValidation}} import org.hibernate.validator.constraints.*; {{/performBeanValidation}} +import {{invokerPackage}}.JSON; {{#models}} {{#model}} +{{#oneOf}} +{{#-first}} +import com.fasterxml.jackson.core.type.TypeReference; +{{/-first}} +{{/oneOf}} + {{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{#oneOf}}{{#-first}}{{>oneof_model}}{{/-first}}{{/oneOf}}{{^oneOf}}{{#anyOf}}{{#-first}}{{>anyof_model}}{{/-first}}{{/anyOf}}{{^anyOf}}{{>pojo}}{{/anyOf}}{{/oneOf}}{{/isEnum}} {{/model}} {{/models}} diff --git a/templates/libraries/jersey3/model_anyof_doc.mustache b/templates/libraries/jersey3/model_anyof_doc.mustache new file mode 100644 index 0000000..e360aa5 --- /dev/null +++ b/templates/libraries/jersey3/model_anyof_doc.mustache @@ -0,0 +1,38 @@ +# {{classname}} + +{{#description}} +{{&description}} + +{{/description}} +## anyOf schemas +{{#anyOf}} +* [{{{.}}}]({{{.}}}.md) +{{/anyOf}} + +{{#isNullable}} +NOTE: this class is nullable. + +{{/isNullable}} +## Example +```java +// Import classes: +import {{{package}}}.{{{classname}}}; +{{#anyOf}} +import {{{package}}}.{{{.}}}; +{{/anyOf}} + +public class Example { + public static void main(String[] args) { + {{classname}} example{{classname}} = new {{classname}}(); + {{#anyOf}} + + // create a new {{{.}}} + {{{.}}} example{{{.}}} = new {{{.}}}(); + // set {{{classname}}} to {{{.}}} + example{{classname}}.setActualInstance(example{{{.}}}); + // to get back the {{{.}}} set earlier + {{{.}}} test{{{.}}} = ({{{.}}}) example{{classname}}.getActualInstance(); + {{/anyOf}} + } +} +``` diff --git a/templates/libraries/jersey3/model_doc.mustache b/templates/libraries/jersey3/model_doc.mustache new file mode 100644 index 0000000..be1aedc --- /dev/null +++ b/templates/libraries/jersey3/model_doc.mustache @@ -0,0 +1,19 @@ +{{#models}}{{#model}} + +{{#isEnum}} +{{>enum_outer_doc}} +{{/isEnum}} +{{^isEnum}} +{{^oneOf.isEmpty}} +{{>model_oneof_doc}} +{{/oneOf.isEmpty}} +{{^anyOf.isEmpty}} +{{>model_anyof_doc}} +{{/anyOf.isEmpty}} +{{^anyOf}} +{{^oneOf}} +{{>pojo_doc}} +{{/oneOf}} +{{/anyOf}} +{{/isEnum}} +{{/model}}{{/models}} diff --git a/templates/libraries/jersey3/model_oneof_doc.mustache b/templates/libraries/jersey3/model_oneof_doc.mustache new file mode 100644 index 0000000..5fff76c --- /dev/null +++ b/templates/libraries/jersey3/model_oneof_doc.mustache @@ -0,0 +1,38 @@ +# {{classname}} + +{{#description}} +{{&description}} + +{{/description}} +## oneOf schemas +{{#oneOf}} +* [{{{.}}}]({{{.}}}.md) +{{/oneOf}} + +{{#isNullable}} +NOTE: this class is nullable. + +{{/isNullable}} +## Example +```java +// Import classes: +import {{{package}}}.{{{classname}}}; +{{#oneOf}} +import {{{package}}}.{{{.}}}; +{{/oneOf}} + +public class Example { + public static void main(String[] args) { + {{classname}} example{{classname}} = new {{classname}}(); + {{#oneOf}} + + // create a new {{{.}}} + {{{.}}} example{{{.}}} = new {{{.}}}(); + // set {{{classname}}} to {{{.}}} + example{{classname}}.setActualInstance(example{{{.}}}); + // to get back the {{{.}}} set earlier + {{{.}}} test{{{.}}} = ({{{.}}}) example{{classname}}.getActualInstance(); + {{/oneOf}} + } +} +``` diff --git a/templates/libraries/jersey3/model_test.mustache b/templates/libraries/jersey3/model_test.mustache new file mode 100644 index 0000000..acd659b --- /dev/null +++ b/templates/libraries/jersey3/model_test.mustache @@ -0,0 +1,44 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for {{classname}} + */ +public class {{classname}}Test { + {{#models}} + {{#model}} + {{^vendorExtensions.x-is-one-of-interface}} + {{^isEnum}} + private final {{classname}} model = new {{classname}}(); + + {{/isEnum}} + /** + * Model tests for {{classname}} + */ + @Test + public void test{{classname}}() { + // TODO: test {{classname}} + } + + {{#allVars}} + /** + * Test the property '{{name}}' + */ + @Test + public void {{name}}Test() { + // TODO: test {{name}} + } + + {{/allVars}} + {{/vendorExtensions.x-is-one-of-interface}} + {{/model}} + {{/models}} +} diff --git a/templates/libraries/jersey3/oneof_model.mustache b/templates/libraries/jersey3/oneof_model.mustache new file mode 100644 index 0000000..09906d7 --- /dev/null +++ b/templates/libraries/jersey3/oneof_model.mustache @@ -0,0 +1,289 @@ +import {{javaxPackage}}.ws.rs.core.GenericType; +import {{javaxPackage}}.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import {{invokerPackage}}.JSON; + +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} +@JsonDeserialize(using = {{classname}}.{{classname}}Deserializer.class) +@JsonSerialize(using = {{classname}}.{{classname}}Serializer.class) +public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}} implements {{{.}}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-implements}} { + private static final Logger log = Logger.getLogger({{classname}}.class.getName()); + + public static class {{classname}}Serializer extends StdSerializer<{{classname}}> { + public {{classname}}Serializer(Class<{{classname}}> t) { + super(t); + } + + public {{classname}}Serializer() { + this(null); + } + + @Override + public void serialize({{classname}} value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class {{classname}}Deserializer extends StdDeserializer<{{classname}}> { + public {{classname}}Deserializer() { + this({{classname}}.class); + } + + public {{classname}}Deserializer(Class vc) { + super(vc); + } + + @Override + public {{classname}} deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + {{#useOneOfDiscriminatorLookup}} + {{#discriminator}} + {{classname}} new{{classname}} = new {{classname}}(); + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String)result2.get("{{{propertyBaseName}}}"); + switch (discriminatorValue) { + {{#mappedModels}} + case "{{{mappingName}}}": + deserialized = tree.traverse(jp.getCodec()).readValueAs({{{modelName}}}.class); + new{{classname}}.setActualInstance(deserialized); + return new{{classname}}; + {{/mappedModels}} + default: + log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", discriminatorValue)); + } + + {{/discriminator}} + {{/useOneOfDiscriminatorLookup}} + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + {{#composedSchemas}} + {{#oneOf}} + // deserialize {{{dataType}}}{{#isNullable}} (nullable){{/isNullable}} + try { + {{^isArray}} + boolean attemptParsing = true; + {{#isPrimitiveType}} + attemptParsing = typeCoercion; //respect type coercion setting + if (!attemptParsing) { + {{#isString}} + attemptParsing |= (token == JsonToken.VALUE_STRING); + {{/isString}} + {{#isInteger}} + attemptParsing |= (token == JsonToken.VALUE_NUMBER_INT); + {{/isInteger}} + {{#isLong}} + attemptParsing |= (token == JsonToken.VALUE_NUMBER_INT); + {{/isLong}} + {{#isShort}} + attemptParsing |= (token == JsonToken.VALUE_NUMBER_INT); + {{/isShort}} + {{#isFloat}} + attemptParsing |= (token == JsonToken.VALUE_NUMBER_FLOAT); + {{/isFloat}} + {{#isDouble}} + attemptParsing |= (token == JsonToken.VALUE_NUMBER_FLOAT); + {{/isDouble}} + {{#isNumber}} + attemptParsing |= (token == JsonToken.VALUE_NUMBER_FLOAT); + {{/isNumber}} + {{#isDecimal}} + attemptParsing |= (token == JsonToken.VALUE_NUMBER_FLOAT); + {{/isDecimal}} + {{#isBoolean}} + attemptParsing |= (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + {{/isBoolean}} + {{#isNullable}} + attemptParsing |= (token == JsonToken.VALUE_NULL); + {{/isNullable}} + } + {{/isPrimitiveType}} + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs({{{dataType}}}.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema '{{{dataType}}}'"); + } + {{/isArray}} + {{#isArray}} + if (token == JsonToken.START_ARRAY) { + final TypeReference<{{{dataType}}}> ref = new TypeReference<{{{dataType}}}>(){}; + deserialized = tree.traverse(jp.getCodec()).readValueAs(ref); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema '{{{dataType}}}'"); + } + {{/isArray}} + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema '{{{dataType}}}'", e); + } + + {{/oneOf}} + {{/composedSchemas}} + if (match == 1) { + {{classname}} ret = new {{classname}}(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for {{classname}}: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public {{classname}} getNullValue(DeserializationContext ctxt) throws JsonMappingException { + {{#isNullable}} + return null; + {{/isNullable}} + {{^isNullable}} + throw new JsonMappingException(ctxt.getParser(), "{{classname}} cannot be null"); + {{/isNullable}} + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public {{classname}}() { + super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); + } +{{> libraries/jersey2/additional_properties }} + {{#additionalPropertiesType}} + /** + * Return true if this {{name}} object is equal to o. + */ + @Override + public boolean equals(Object o) { + return super.equals(o) && Objects.equals(this.additionalProperties, (({{classname}})o).additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); + } + {{/additionalPropertiesType}} + {{#composedSchemas}} + {{#oneOf}} + {{^vendorExtensions.x-duplicated-data-type}} + public {{classname}}({{{baseType}}} o) { + super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); + setActualInstance(o); + } + {{/vendorExtensions.x-duplicated-data-type}} + + {{/oneOf}} + {{/composedSchemas}} + static { + {{#oneOf}} + schemas.put("{{{.}}}", new GenericType<{{{.}}}>() { + }); + {{/oneOf}} + JSON.registerDescendants({{classname}}.class, Collections.unmodifiableMap(schemas)); + {{#discriminator}} + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + {{#mappedModels}} + mappings.put("{{mappingName}}", {{modelName}}.class); + {{/mappedModels}} + mappings.put("{{name}}", {{classname}}.class); + JSON.registerDiscriminator({{classname}}.class, "{{propertyBaseName}}", mappings); + {{/discriminator}} + } + + @Override + public Map> getSchemas() { + return {{classname}}.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}} + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + {{#isNullable}} + if (instance == null) { + super.setActualInstance(instance); + return; + } + + {{/isNullable}} + {{#composedSchemas}} + {{#oneOf}} + {{^vendorExtensions.x-duplicated-data-type}} + if (JSON.isInstanceOf({{{baseType}}}.class, instance, new HashSet<>())) { + super.setActualInstance(instance); + return; + } + + {{/vendorExtensions.x-duplicated-data-type}} + {{/oneOf}} + {{/composedSchemas}} + throw new RuntimeException("Invalid instance type. Must be {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}"); + } + + /** + * Get the actual instance, which can be the following: + * {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}} + * + * @return The actual instance ({{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + {{#composedSchemas}} + {{#oneOf}} + /** + * Get the actual instance of `{{{dataType}}}`. If the actual instance is not `{{{dataType}}}`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `{{{dataType}}}` + * @throws ClassCastException if the instance is not `{{{dataType}}}` + */ + {{^isArray}} + public {{{dataType}}} get{{{dataType}}}() throws ClassCastException { + return ({{{dataType}}})super.getActualInstance(); + } + {{/isArray}} + {{#isArray}} + public {{{dataType}}} get{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}() throws ClassCastException { + return ({{{dataType}}})super.getActualInstance(); + } + {{/isArray}} + + {{/oneOf}} + {{/composedSchemas}} +} diff --git a/templates/libraries/jersey3/pojo.mustache b/templates/libraries/jersey3/pojo.mustache new file mode 100644 index 0000000..06be4dd --- /dev/null +++ b/templates/libraries/jersey3/pojo.mustache @@ -0,0 +1,421 @@ +/** + * {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} + * @deprecated{{/isDeprecated}} + */{{#isDeprecated}} +@Deprecated{{/isDeprecated}} +{{#swagger1AnnotationLibrary}} +{{#description}} +@ApiModel(description = "{{{.}}}") +{{/description}} +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} +{{#description}} +@Schema(description = "{{{.}}}") +{{/description}} +{{/swagger2AnnotationLibrary}} +{{#jackson}} +@JsonPropertyOrder({ +{{#vars}} + {{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}} +{{/vars}} +}) +{{#isClassnameSanitized}} +@JsonTypeName("{{name}}") +{{/isClassnameSanitized}} +{{/jackson}} +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} +{{#vendorExtensions.x-class-extra-annotation}} +{{{vendorExtensions.x-class-extra-annotation}}} +{{/vendorExtensions.x-class-extra-annotation}} +public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ +{{#serializableModel}} + private static final long serialVersionUID = 1L; + +{{/serializableModel}} + {{#vars}} + {{#isEnum}} + {{^isContainer}} + {{^vendorExtensions.x-enum-as-string}} +{{>modelInnerEnum}} + {{/vendorExtensions.x-enum-as-string}} + {{/isContainer}} + {{#isContainer}} + {{#mostInnerItems}} +{{>modelInnerEnum}} + {{/mostInnerItems}} + {{/isContainer}} + {{/isEnum}} + {{#gson}} + public static final String SERIALIZED_NAME_{{nameInSnakeCase}} = "{{baseName}}"; + {{/gson}} + {{#jackson}} + public static final String JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}"; + {{/jackson}} + {{#withXml}} + @Xml{{#isXmlAttribute}}Attribute{{/isXmlAttribute}}{{^isXmlAttribute}}Element{{/isXmlAttribute}}(name = "{{items.xmlName}}{{^items.xmlName}}{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}{{/items.xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{#isXmlWrapped}} + @XmlElementWrapper(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{/isXmlWrapped}} + {{/withXml}} + {{#gson}} + @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) + {{/gson}} + {{#vendorExtensions.x-field-extra-annotation}} + {{{vendorExtensions.x-field-extra-annotation}}} + {{/vendorExtensions.x-field-extra-annotation}} + {{#vendorExtensions.x-is-jackson-optional-nullable}} + {{#isContainer}} + {{#deprecated}} + @Deprecated + {{/deprecated}} + private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); + {{/isContainer}} + {{^isContainer}} + {{#deprecated}} + @Deprecated + {{/deprecated}} + private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}}; + {{/isContainer}} + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{#deprecated}} + @Deprecated + {{/deprecated}} + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + + {{/vars}} + public {{classname}}() { {{#parent}}{{#parcelableModel}} + super();{{/parcelableModel}}{{/parent}}{{#gson}}{{#discriminator}} + this.{{{discriminatorName}}} = this.getClass().getSimpleName();{{/discriminator}}{{/gson}} + }{{#vendorExtensions.x-has-readonly-properties}}{{^withXml}}{{#jackson}} + + @JsonCreator + public {{classname}}( + {{#readOnlyVars}} + {{#jackson}}@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}){{/jackson}} {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}} + {{/readOnlyVars}} + ) { + this(); + {{#readOnlyVars}} + this.{{name}} = {{#vendorExtensions.x-is-jackson-optional-nullable}}{{name}} == null ? JsonNullable.<{{{datatypeWithEnum}}}>undefined() : JsonNullable.of({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{name}}{{/vendorExtensions.x-is-jackson-optional-nullable}}; + {{/readOnlyVars}} + }{{/jackson}}{{/withXml}}{{/vendorExtensions.x-has-readonly-properties}} + {{#vars}} + + {{^isReadOnly}} + {{#vendorExtensions.x-enum-as-string}} + public static final Set {{{nameInSnakeCase}}}_VALUES = new HashSet<>(Arrays.asList( + {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}} + )); + + {{/vendorExtensions.x-enum-as-string}} + {{#deprecated}} + @Deprecated + {{/deprecated}} + public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-enum-as-string}} + if (!{{{nameInSnakeCase}}}_VALUES.contains({{name}})) { + throw new IllegalArgumentException({{name}} + " is invalid. Possible values for {{name}}: " + String.join(", ", {{{nameInSnakeCase}}}_VALUES)); + } + + {{/vendorExtensions.x-enum-as-string}} + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + return this; + } + {{#isArray}} + + public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if (this.{{name}} == null || !this.{{name}}.isPresent()) { + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}); + } + try { + this.{{name}}.get().add({{name}}Item); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}; + } + this.{{name}}.add({{name}}Item); + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{/isArray}} + {{#isMap}} + + public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if (this.{{name}} == null || !this.{{name}}.isPresent()) { + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}); + } + try { + this.{{name}}.get().put(key, {{name}}Item); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}; + } + this.{{name}}.put(key, {{name}}Item); + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{/isMap}} + + {{/isReadOnly}} + /** + {{#description}} + * {{.}} + {{/description}} + {{^description}} + * Get {{name}} + {{/description}} + {{#minimum}} + * minimum: {{.}} + {{/minimum}} + {{#maximum}} + * maximum: {{.}} + {{/maximum}} + * @return {{name}} + {{#deprecated}} + * @deprecated + {{/deprecated}} + */ +{{#deprecated}} + @Deprecated +{{/deprecated}} +{{#required}} +{{#isNullable}} + @{{javaxPackage}}.annotation.Nullable +{{/isNullable}} +{{^isNullable}} + @{{javaxPackage}}.annotation.Nonnull +{{/isNullable}} +{{/required}} +{{^required}} + @{{javaxPackage}}.annotation.Nullable +{{/required}} +{{#useBeanValidation}} +{{>beanValidation}} +{{/useBeanValidation}} +{{#swagger1AnnotationLibrary}} + @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} + @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}") +{{/swagger2AnnotationLibrary}} +{{#vendorExtensions.x-extra-annotation}} + {{{vendorExtensions.x-extra-annotation}}} +{{/vendorExtensions.x-extra-annotation}} +{{#vendorExtensions.x-is-jackson-optional-nullable}} + {{!unannotated, Jackson would pick this up automatically and add it *in addition* to the _JsonNullable getter field}} + @JsonIgnore +{{/vendorExtensions.x-is-jackson-optional-nullable}} +{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#jackson}}{{> jackson_annotations}}{{/jackson}}{{/vendorExtensions.x-is-jackson-optional-nullable}} + public {{{datatypeWithEnum}}} {{getter}}() { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + {{#isReadOnly}}{{! A readonly attribute doesn't have setter => jackson will set null directly if explicitly returned by API, so make sure we have an empty JsonNullable}} + if ({{name}} == null) { + {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}}; + } + {{/isReadOnly}} + return {{name}}.orElse(null); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + return {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + + {{#vendorExtensions.x-is-jackson-optional-nullable}} +{{> jackson_annotations}} + public JsonNullable<{{{datatypeWithEnum}}}> {{getter}}_JsonNullable() { + return {{name}}; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}}{{#vendorExtensions.x-is-jackson-optional-nullable}} + @JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}) + {{#isReadOnly}}private{{/isReadOnly}}{{^isReadOnly}}public{{/isReadOnly}} void {{setter}}_JsonNullable(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) { + {{! For getters/setters that have name differing from attribute name, we must include setter (albeit private) for jackson to be able to set the attribute}} + this.{{name}} = {{name}}; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}} + + {{^isReadOnly}} + {{#deprecated}} + @Deprecated + {{/deprecated}} +{{#vendorExtensions.x-setter-extra-annotation}} {{{vendorExtensions.x-setter-extra-annotation}}} +{{/vendorExtensions.x-setter-extra-annotation}}{{#jackson}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{> jackson_annotations}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{/jackson}} public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-enum-as-string}} + if (!{{{nameInSnakeCase}}}_VALUES.contains({{name}})) { + throw new IllegalArgumentException({{name}} + " is invalid. Possible values for {{name}}: " + String.join(", ", {{{nameInSnakeCase}}}_VALUES)); + } + + {{/vendorExtensions.x-enum-as-string}} + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{/isReadOnly}} + + {{/vars}} +{{>libraries/jersey2/additional_properties}} + /** + * Return true if this {{name}} object is equal to o. + */ + @Override + public boolean equals(Object o) { + {{#useReflectionEqualsHashCode}} + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + }{{#hasVars}} + {{classname}} {{classVarName}} = ({{classname}}) o; + return {{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}equalsNullable(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}} && + {{/-last}}{{/vars}}{{#additionalPropertiesType}}&& + Objects.equals(this.additionalProperties, {{classVarName}}.additionalProperties){{/additionalPropertiesType}}{{#parent}} && + super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} + return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}} + {{/useReflectionEqualsHashCode}} + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + + @Override + public int hashCode() { + {{#useReflectionEqualsHashCode}} + return HashCodeBuilder.reflectionHashCode(this); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}{{#additionalPropertiesType}}{{#hasVars}}, {{/hasVars}}{{^hasVars}}{{#parent}}, {{/parent}}{{/hasVars}}additionalProperties{{/additionalPropertiesType}}); + {{/useReflectionEqualsHashCode}} + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class {{classname}} {\n"); + {{#parent}} + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + {{/parent}} + {{#vars}} + sb.append(" {{name}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{name}}){{/isPassword}}).append("\n"); + {{/vars}} + {{#additionalPropertiesType}} + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + {{/additionalPropertiesType}} + sb.append("}"); + return sb.toString(); + } + + /** + * 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 "); + } + +{{#parcelableModel}} + + public void writeToParcel(Parcel out, int flags) { +{{#model}} +{{#isArray}} + out.writeList(this); +{{/isArray}} +{{^isArray}} +{{#parent}} + super.writeToParcel(out, flags); +{{/parent}} +{{#vars}} + out.writeValue({{name}}); +{{/vars}} +{{/isArray}} +{{/model}} + } + + {{classname}}(Parcel in) { +{{#isArray}} + in.readTypedList(this, {{arrayModelType}}.CREATOR); +{{/isArray}} +{{^isArray}} +{{#parent}} + super(in); +{{/parent}} +{{#vars}} +{{#isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue(null); +{{/isPrimitiveType}} +{{^isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue({{complexType}}.class.getClassLoader()); +{{/isPrimitiveType}} +{{/vars}} +{{/isArray}} + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator<{{classname}}> CREATOR = new Parcelable.Creator<>() { + public {{classname}} createFromParcel(Parcel in) { +{{#model}} +{{#isArray}} + {{classname}} result = new {{classname}}(); + result.addAll(in.readArrayList({{arrayModelType}}.class.getClassLoader())); + return result; +{{/isArray}} +{{^isArray}} + return new {{classname}}(in); +{{/isArray}} +{{/model}} + } + public {{classname}}[] newArray(int size) { + return new {{classname}}[size]; + } + }; +{{/parcelableModel}} +{{#discriminator}} + static { + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + {{#mappedModels}} + mappings.put("{{mappingName}}", {{modelName}}.class); + {{/mappedModels}} + mappings.put("{{name}}", {{classname}}.class); + JSON.registerDiscriminator({{classname}}.class, "{{propertyBaseName}}", mappings); + } +{{/discriminator}} +} diff --git a/templates/libraries/okhttp-gson-nextgen/pom.mustache b/templates/libraries/jersey3/pom.mustache similarity index 73% rename from templates/libraries/okhttp-gson-nextgen/pom.mustache rename to templates/libraries/jersey3/pom.mustache index 10dfc15..d2f1345 100644 --- a/templates/libraries/okhttp-gson-nextgen/pom.mustache +++ b/templates/libraries/jersey3/pom.mustache @@ -40,20 +40,6 @@ - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - true - 128m - 512m - - -Xlint:all - -J-Xss4m - - - org.apache.maven.plugins maven-enforcer-plugin @@ -79,15 +65,16 @@ maven-surefire-plugin 3.0.0-M5 - + loggerPath conf/log4j.properties - + -Xms512m -Xmx1500m methods 10 + false @@ -108,7 +95,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.2.0 + 3.2.2 @@ -122,7 +109,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.2.0 + 3.3.0 add_sources @@ -132,7 +119,7 @@ - {{{sourceFolder}}} + src/main/java @@ -150,10 +137,26 @@ + + org.apache.maven.plugins + maven-compiler-plugin + 3.10.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + org.apache.maven.plugins maven-javadoc-plugin - 3.3.1 + 3.3.2 attach-javadocs @@ -164,6 +167,7 @@ none + 1.8 http.response.details @@ -221,10 +225,8 @@ true - - @@ -256,70 +258,107 @@ + {{#swagger1AnnotationLibrary}} io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} + + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + + io.swagger.core.v3 + swagger-annotations + ${swagger-annotations-version} + {{/swagger2AnnotationLibrary}} + com.google.code.findbugs jsr305 3.0.2 + + - com.squareup.okhttp3 - okhttp - ${okhttp-version} + org.glassfish.jersey.core + jersey-client + ${jersey-version} - com.squareup.okhttp3 - logging-interceptor - ${okhttp-version} + org.glassfish.jersey.inject + jersey-hk2 + ${jersey-version} - com.google.code.gson - gson - ${gson-version} + org.glassfish.jersey.media + jersey-media-multipart + ${jersey-version} - io.gsonfire - gson-fire - ${gson-fire-version} + org.glassfish.jersey.media + jersey-media-json-jackson + ${jersey-version} - {{#hasOAuthMethods}} + + - org.apache.oltu.oauth2 - org.apache.oltu.oauth2.client - 1.0.1 + com.fasterxml.jackson.core + jackson-core + ${jackson-version} - {{/hasOAuthMethods}} - org.apache.commons - commons-lang3 - ${commons-lang3-version} + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} + + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind-version} + + {{#openApiNullable}} + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + {{/openApiNullable}} + {{#withXml}} + + + org.glassfish.jersey.media + jersey-media-jaxb + ${jersey-version} + + {{/withXml}} {{#joda}} - joda-time - joda-time - ${jodatime-version} + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-version} {{/joda}} - {{#threetenbp}} - org.threeten - threetenbp - ${threetenbp-version} + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + {{#hasHttpSignatureMethods}} + + org.tomitribe + tomitribe-http-signatures + ${http-signature-version} - {{/threetenbp}} - {{#dynamicOperations}} + {{/hasHttpSignatureMethods}} + {{#hasOAuthMethods}} - io.swagger.parser.v3 - swagger-parser-v3 - 2.0.28 + com.github.scribejava + scribejava-apis + ${scribejava-apis-version} - {{/dynamicOperations}} + {{/hasOAuthMethods}} {{#useBeanValidation}} @@ -329,92 +368,48 @@ provided {{/useBeanValidation}} - {{#performBeanValidation}} - - - org.hibernate - hibernate-validator - 5.4.3.Final - - - jakarta.el - jakarta.el-api - ${jakarta.el-version} - - {{/performBeanValidation}} - {{#parcelableModel}} - - - com.google.android - android - 4.1.1.4 - provided - - {{/parcelableModel}} jakarta.annotation jakarta.annotation-api ${jakarta-annotation-version} provided - {{#openApiNullable}} - org.openapitools - jackson-databind-nullable - ${jackson-databind-nullable-version} - - {{/openApiNullable}} - - javax.ws.rs - jsr311-api - 1.1.1 - - - javax.ws.rs - javax.ws.rs-api - 2.0 + org.glassfish.jersey.connectors + jersey-apache-connector + ${jersey-version} - junit - junit + org.junit.jupiter + junit-jupiter-api ${junit-version} test - - org.mockito - mockito-core - 3.12.4 - test - - 1.8 - ${java.version} - ${java.version} - 1.8.5 - 1.6.3 - 4.9.2 - 2.8.8 - 3.12.0 - {{#openApiNullable}} - 0.2.2 - {{/openApiNullable}} - {{#joda}} - 2.10.9 - {{/joda}} - {{#threetenbp}} - 1.5.0 - {{/threetenbp}} - 1.3.5 -{{#performBeanValidation}} - 3.0.3 -{{/performBeanValidation}} -{{#useBeanValidation}} - 2.0.2 -{{/useBeanValidation}} - 4.13.2 UTF-8 - 2.17.3 + {{#swagger1AnnotationLibrary}} + 1.6.6 + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + 2.2.15 + {{/swagger2AnnotationLibrary}} + 3.1.1 + 2.17.1 + 2.17.1 + 0.2.6 + 2.1.1 + {{#useBeanValidation}} + 3.0.2 + {{/useBeanValidation}} + 5.10.0 + {{#hasHttpSignatureMethods}} + 1.8 + {{/hasHttpSignatureMethods}} + {{#hasOAuthMethods}} + 8.3.3 + {{/hasOAuthMethods}} + 2.21.0 diff --git a/templates/libraries/microprofile/README.mustache b/templates/libraries/microprofile/README.mustache index 58d2d5f..377dfc2 100644 --- a/templates/libraries/microprofile/README.mustache +++ b/templates/libraries/microprofile/README.mustache @@ -1,10 +1,19 @@ -# {{appName}} - MicroProfile Rest Client +# {{appName}} - MicroProfile Rest Client & MicroProfile Server {{#appDescriptionWithNewLines}} {{{.}}} {{/appDescriptionWithNewLines}} +{{^microprofileServer}} ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. [MicroProfile Rest Client](https://github.com/eclipse/microprofile-rest-client) is a type-safe way of calling REST services. The generated client contains an interface which acts as the client, you can inject it into dependent classes. +{{/microprofileServer}} + +{{#microprofileServer}} +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. +The generated server contains an interface which acts as the server, you can inject it into the controller class. +This module is intended to provide additional server features, like accessing an operations response object, when multiple responses where specified. +{{/microprofileServer}} \ No newline at end of file diff --git a/templates/libraries/microprofile/api.mustache b/templates/libraries/microprofile/api.mustache index 119494e..6e25c1f 100644 --- a/templates/libraries/microprofile/api.mustache +++ b/templates/libraries/microprofile/api.mustache @@ -9,12 +9,20 @@ import java.io.OutputStream; import java.util.List; import java.util.Map; import java.util.Set; -import javax.ws.rs.*; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.MediaType; +import {{rootJavaEEPackage}}.ws.rs.*; +import {{rootJavaEEPackage}}.ws.rs.core.Response; +import {{rootJavaEEPackage}}.ws.rs.core.MediaType; {{^disableMultipart}} import org.apache.cxf.jaxrs.ext.multipart.*; {{/disableMultipart}} +{{#microprofileMutiny}} +import io.smallrye.mutiny.Uni; +{{/microprofileMutiny}} + +{{#useBeanValidation}} +import {{rootJavaEEPackage}}.validation.constraints.*; +import {{rootJavaEEPackage}}.validation.Valid; +{{/useBeanValidation}} import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; @@ -30,7 +38,9 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; */ {{/appName}} -@RegisterRestClient{{#configKey}}(configKey="{{configKey}}"){{/configKey}} +{{^microprofileServer}} +@RegisterRestClient{{#configKey}}(configKey="{{configKey}}"){{/configKey}}{{#configKeyFromClassName}}{{#operations}}(configKey="{{configKey}}"){{/operations}}{{/configKeyFromClassName}} +{{/microprofileServer}} @RegisterProvider(ApiExceptionMapper.class) @Path("{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}{{commonPath}}") public interface {{classname}} { @@ -61,7 +71,50 @@ public interface {{classname}} { {{#hasProduces}} @Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }) {{/hasProduces}} - public {{{returnType}}}{{^returnType}}void{{/returnType}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException, ProcessingException; +{{^useSingleRequestParameter}} + {{^vendorExtensions.x-java-is-response-void}}{{#microprofileServer}}{{> server_operation}}{{/microprofileServer}}{{^microprofileServer}}{{> client_operation}}{{/microprofileServer}}{{/vendorExtensions.x-java-is-response-void}}{{#vendorExtensions.x-java-is-response-void}}{{#microprofileMutiny}}Uni{{/microprofileMutiny}}{{^microprofileMutiny}}void{{/microprofileMutiny}}{{/vendorExtensions.x-java-is-response-void}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException, ProcessingException; +{{/useSingleRequestParameter}} +{{#useSingleRequestParameter}} + {{^vendorExtensions.x-java-is-response-void}}{{#microprofileMutiny}}Uni<{{{returnType}}}>{{/microprofileMutiny}}{{^microprofileMutiny}}{{{returnType}}}{{/microprofileMutiny}}{{/vendorExtensions.x-java-is-response-void}}{{#vendorExtensions.x-java-is-response-void}}{{#microprofileMutiny}}Uni{{/microprofileMutiny}}{{^microprofileMutiny}}void{{/microprofileMutiny}}{{/vendorExtensions.x-java-is-response-void}} {{nickname}}({{#hasNonBodyParams}}@BeanParam {{operationIdCamelCase}}Request request{{/hasNonBodyParams}}{{#bodyParams}}{{#hasNonBodyParams}}, {{/hasNonBodyParams}}{{>bodyParams}}{{/bodyParams}}) throws ApiException, ProcessingException; + {{#hasNonBodyParams}} + public class {{operationIdCamelCase}}Request { + + {{#queryParams}} + private {{>queryParams}}; + {{/queryParams}} + {{#headerParams}} + private {{>headerParams}}; + {{/headerParams}} + {{#pathParams}} + private {{>pathParams}}; + {{/pathParams}} + {{#formParams}} + private {{>formParams}}; + {{/formParams}} + + private {{operationIdCamelCase}}Request() { + } + + public static {{operationIdCamelCase}}Request newInstance() { + return new {{operationIdCamelCase}}Request(); + } + + {{#allParams}} + {{^isBodyParam}} + /** + * Set {{paramName}}{{>formParamsNameSuffix}} + * @param {{paramName}}{{>formParamsNameSuffix}} {{description}} ({{^required}}optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}{{/required}}{{#required}}required{{/required}}) + * @return {{operationIdCamelCase}}Request + */ + public {{operationIdCamelCase}}Request {{paramName}}{{>formParamsNameSuffix}}({{>queryParamsImpl}}{{>pathParamsImpl}}{{>headerParamsImpl}}{{>formParamsImpl}}) { + this.{{paramName}}{{>formParamsNameSuffix}} = {{paramName}}{{>formParamsNameSuffix}}; + return this; + } + {{/isBodyParam}} + {{/allParams}} + } + {{/hasNonBodyParams}} +{{/useSingleRequestParameter}} {{/operation}} } {{/operations}} diff --git a/templates/libraries/microprofile/api_exception.mustache b/templates/libraries/microprofile/api_exception.mustache index fc5c5e5..63a2186 100644 --- a/templates/libraries/microprofile/api_exception.mustache +++ b/templates/libraries/microprofile/api_exception.mustache @@ -1,9 +1,9 @@ {{>licenseInfo}} package {{apiPackage}}; -import javax.ws.rs.core.Response; +import {{rootJavaEEPackage}}.ws.rs.core.Response; -public class ApiException extends Exception { +public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ private static final long serialVersionUID = 1L; private Response response; diff --git a/templates/libraries/microprofile/api_exception_mapper.mustache b/templates/libraries/microprofile/api_exception_mapper.mustache index 9c59884..12988f5 100644 --- a/templates/libraries/microprofile/api_exception_mapper.mustache +++ b/templates/libraries/microprofile/api_exception_mapper.mustache @@ -1,9 +1,9 @@ {{>licenseInfo}} package {{apiPackage}}; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.Provider; +import {{rootJavaEEPackage}}.ws.rs.core.MultivaluedMap; +import {{rootJavaEEPackage}}.ws.rs.core.Response; +import {{rootJavaEEPackage}}.ws.rs.ext.Provider; import org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper; @Provider diff --git a/templates/libraries/microprofile/api_test.mustache b/templates/libraries/microprofile/api_test.mustache index a53acad..d9af877 100644 --- a/templates/libraries/microprofile/api_test.mustache +++ b/templates/libraries/microprofile/api_test.mustache @@ -4,23 +4,23 @@ package {{package}}; {{#imports}}import {{import}}; {{/imports}} -import org.junit.Test; -import org.junit.Before; -import static org.junit.Assert.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Assertions; +{{#generateSpringBootApplication}} +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.test.context.junit.jupiter.SpringExtension; +{{/generateSpringBootApplication}} import org.eclipse.microprofile.rest.client.RestClientBuilder; import java.net.URL; import java.net.MalformedURLException; -{{^fullJavaUtil}} import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; -{{/fullJavaUtil}} - - /** {{#appName}} @@ -30,7 +30,7 @@ import java.util.Set; * API tests for {{classname}} */ {{#generateSpringBootApplication}} -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SpringApplicationConfiguration(classes = SpringBootApplication.class) @WebAppConfiguration @IntegrationTest("server.port=0") @@ -40,12 +40,17 @@ public class {{classname}}Test { private {{classname}} client; private String baseUrl = "http://localhost:9080"; - @Before + @BeforeEach public void setup() throws MalformedURLException { + {{#microprofile3}} + // TODO initialize the client + {{/microprofile3}} + {{^microprofile3}} client = RestClientBuilder.newBuilder() .baseUrl(new URL(baseUrl)) .register(ApiException.class) .build({{classname}}.class); + {{/microprofile3}} } {{#operations}}{{#operation}} @@ -67,8 +72,8 @@ public class {{classname}}Test { {{#allParams}} {{^isFile}}{{{dataType}}} {{paramName}} = null;{{/isFile}}{{#isFile}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/isFile}} {{/allParams}} - //{{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); - //{{#returnType}}assertNotNull(response);{{/returnType}} + //{{^vendorExtensions.x-java-is-response-void}}{{#microprofileMutiny}}Uni<{{{returnType}}}>{{/microprofileMutiny}}{{^microprofileMutiny}}{{{returnType}}}{{/microprofileMutiny}} response = {{/vendorExtensions.x-java-is-response-void}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + //{{#returnType}}Assertions.assertNotNull(response);{{/returnType}} } diff --git a/templates/libraries/microprofile/beanValidation.mustache b/templates/libraries/microprofile/beanValidation.mustache index c8c6946..f8724b2 100644 --- a/templates/libraries/microprofile/beanValidation.mustache +++ b/templates/libraries/microprofile/beanValidation.mustache @@ -1,4 +1,6 @@ {{#required}} +{{^isReadOnly}} @NotNull +{{/isReadOnly}} {{/required}} {{>beanValidationCore}} \ No newline at end of file diff --git a/templates/libraries/microprofile/client_operation.mustache b/templates/libraries/microprofile/client_operation.mustache new file mode 100644 index 0000000..403918d --- /dev/null +++ b/templates/libraries/microprofile/client_operation.mustache @@ -0,0 +1 @@ +{{#microprofileMutiny}}Uni<{{{returnType}}}>{{/microprofileMutiny}}{{^microprofileMutiny}}{{{returnType}}}{{/microprofileMutiny}} \ No newline at end of file diff --git a/templates/libraries/microprofile/enumClass.mustache b/templates/libraries/microprofile/enumClass.mustache index 38127a6..cb8539b 100644 --- a/templates/libraries/microprofile/enumClass.mustache +++ b/templates/libraries/microprofile/enumClass.mustache @@ -3,8 +3,10 @@ @XmlEnum({{dataType}}.class) {{/withXml}} {{^withXml}} + {{#jsonb}} @JsonbTypeSerializer({{datatypeWithEnum}}.Serializer.class) @JsonbTypeDeserializer({{datatypeWithEnum}}.Deserializer.class) + {{/jsonb}} {{/withXml}} {{>additionalEnumTypeAnnotations}}public enum {{datatypeWithEnum}} { @@ -13,7 +15,7 @@ {{#enumVars}}@XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) {{name}}({{dataType}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}} {{/withXml}} {{^withXml}} - {{#enumVars}}{{name}}({{dataType}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}} + {{#enumVars}}{{name}}({{^isUri}}{{dataType}}.valueOf({{/isUri}}{{{value}}}{{^isUri}}){{/isUri}}){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}} {{/withXml}} {{/allowableValues}} @@ -24,6 +26,9 @@ value = v; } + {{#jackson}} + @JsonValue + {{/jackson}} public {{dataType}} value() { return value; } @@ -44,6 +49,7 @@ } {{/withXml}} {{^withXml}} + {{#jsonb}} public static final class Deserializer implements JsonbDeserializer<{{datatypeWithEnum}}> { @Override public {{datatypeWithEnum}} deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) { @@ -59,8 +65,20 @@ public static final class Serializer implements JsonbSerializer<{{datatypeWithEnum}}> { @Override public void serialize({{datatypeWithEnum}} obj, JsonGenerator generator, SerializationContext ctx) { - generator.write(obj.value); + generator.write(obj.value{{#isUri}}.toASCIIString(){{/isUri}}); } } + {{/jsonb}} + {{#jackson}} + @JsonCreator + public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) { + for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (b.value.equals(value)) { + return b; + } + } + {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/isNullable}} + } + {{/jackson}} {{/withXml}} } diff --git a/templates/libraries/microprofile/enumOuterClass.mustache b/templates/libraries/microprofile/enumOuterClass.mustache index 894ce95..2539064 100644 --- a/templates/libraries/microprofile/enumOuterClass.mustache +++ b/templates/libraries/microprofile/enumOuterClass.mustache @@ -2,10 +2,17 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; {{/jackson}} +{{#isUri}} +import java.net.URI; +{{/isUri}} /** * {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}} */ +{{#jsonb}} +@JsonbTypeSerializer({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.Serializer.class) +@JsonbTypeDeserializer({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.Deserializer.class) +{{/jsonb}} {{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}}{{#enumVars}} @@ -33,6 +40,22 @@ import com.fasterxml.jackson.annotation.JsonValue; return String.valueOf(value); } +{{#jsonb}} + public static final class Deserializer implements JsonbDeserializer<{{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}> { + @Override + public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) { + return fromValue(parser.getString()); + } + } + + public static final class Serializer implements JsonbSerializer<{{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}> { + @Override + public void serialize({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} obj, JsonGenerator generator, SerializationContext ctx) { + generator.write(obj.value{{#isUri}}.toASCIIString(){{/isUri}}); + } + } + +{{/jsonb}} {{#jackson}} @JsonCreator {{/jackson}} @@ -44,5 +67,4 @@ import com.fasterxml.jackson.annotation.JsonValue; } {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}} } - } diff --git a/templates/libraries/microprofile/formParamsNameSuffix.mustache b/templates/libraries/microprofile/formParamsNameSuffix.mustache new file mode 100644 index 0000000..a44f6d7 --- /dev/null +++ b/templates/libraries/microprofile/formParamsNameSuffix.mustache @@ -0,0 +1 @@ +{{#isFormParam}}{{#isFile}}Detail{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/templates/libraries/microprofile/generatedAnnotation.mustache b/templates/libraries/microprofile/generatedAnnotation.mustache index 875d7b9..cf058a0 100644 --- a/templates/libraries/microprofile/generatedAnnotation.mustache +++ b/templates/libraries/microprofile/generatedAnnotation.mustache @@ -1 +1 @@ -@javax.annotation.Generated(value = "{{generatorClass}}"{{^hideGenerationTimestamp}}, date = "{{generatedDate}}"{{/hideGenerationTimestamp}}) \ No newline at end of file +@{{rootJavaEEPackage}}.annotation.Generated(value = "{{generatorClass}}"{{^hideGenerationTimestamp}}, date = "{{generatedDate}}"{{/hideGenerationTimestamp}}, comments = "Generator version: {{generatorVersion}}") \ No newline at end of file diff --git a/templates/libraries/microprofile/kumuluzee.pom.mustache b/templates/libraries/microprofile/kumuluzee.pom.mustache index ac235b7..195aa9d 100644 --- a/templates/libraries/microprofile/kumuluzee.pom.mustache +++ b/templates/libraries/microprofile/kumuluzee.pom.mustache @@ -18,7 +18,7 @@ 1.2.3 1.4.1 3.2.6 - 4.13 + 5.10.2 2.28 @@ -70,8 +70,8 @@ ${cxf-rt-rs-extension-providers.version} - junit - junit + org.junit.jupiter + junit-jupiter-api ${junit-version} test diff --git a/templates/libraries/microprofile/model.mustache b/templates/libraries/microprofile/model.mustache index 5272ff0..e10e68d 100644 --- a/templates/libraries/microprofile/model.mustache +++ b/templates/libraries/microprofile/model.mustache @@ -6,9 +6,38 @@ package {{package}}; {{#serializableModel}} import java.io.Serializable; {{/serializableModel}} +{{#jackson}} +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +{{#withXml}} +import com.fasterxml.jackson.dataformat.xml.annotation.*; +{{/withXml}} +{{#vendorExtensions.x-has-readonly-properties}} +import com.fasterxml.jackson.annotation.JsonCreator; +{{/vendorExtensions.x-has-readonly-properties}} +{{/jackson}} +{{#withXml}} +import {{rootJavaEEPackage}}.xml.bind.annotation.*; +import {{rootJavaEEPackage}}.xml.bind.annotation.adapters.*; +{{/withXml}} +{{#jsonb}} +import java.lang.reflect.Type; +import {{rootJavaEEPackage}}.json.bind.annotation.JsonbTypeDeserializer; +import {{rootJavaEEPackage}}.json.bind.annotation.JsonbTypeSerializer; +import {{rootJavaEEPackage}}.json.bind.serializer.DeserializationContext; +import {{rootJavaEEPackage}}.json.bind.serializer.JsonbDeserializer; +import {{rootJavaEEPackage}}.json.bind.serializer.JsonbSerializer; +import {{rootJavaEEPackage}}.json.bind.serializer.SerializationContext; +import {{rootJavaEEPackage}}.json.stream.JsonGenerator; +import {{rootJavaEEPackage}}.json.stream.JsonParser; +import {{rootJavaEEPackage}}.json.bind.annotation.JsonbProperty; +{{#vendorExtensions.x-has-readonly-properties}} +import {{rootJavaEEPackage}}.json.bind.annotation.JsonbCreator; +{{/vendorExtensions.x-has-readonly-properties}} +{{/jsonb}} {{#useBeanValidation}} -import javax.validation.constraints.*; -import javax.validation.Valid; +import {{rootJavaEEPackage}}.validation.constraints.*; +import {{rootJavaEEPackage}}.validation.Valid; {{/useBeanValidation}} {{#models}} @@ -20,4 +49,4 @@ import javax.validation.Valid; {{>pojo}} {{/isEnum}} {{/model}} -{{/models}} +{{/models}} \ No newline at end of file diff --git a/templates/libraries/microprofile/pojo.mustache b/templates/libraries/microprofile/pojo.mustache index f2f269a..afad09a 100644 --- a/templates/libraries/microprofile/pojo.mustache +++ b/templates/libraries/microprofile/pojo.mustache @@ -1,57 +1,55 @@ {{#withXml}} -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -{{/withXml}} -{{^withXml}} -import java.lang.reflect.Type; -import javax.json.bind.annotation.JsonbTypeDeserializer; -import javax.json.bind.annotation.JsonbTypeSerializer; -import javax.json.bind.serializer.DeserializationContext; -import javax.json.bind.serializer.JsonbDeserializer; -import javax.json.bind.serializer.JsonbSerializer; -import javax.json.bind.serializer.SerializationContext; -import javax.json.stream.JsonGenerator; -import javax.json.stream.JsonParser; -import javax.json.bind.annotation.JsonbProperty; -{{#vendorExtensions.x-has-readonly-properties}} -import javax.json.bind.annotation.JsonbCreator; -{{/vendorExtensions.x-has-readonly-properties}} -{{/withXml}} - -{{#withXml}} -@XmlAccessorType(XmlAccessType.FIELD) -{{#hasVars}} @XmlType(name = "{{classname}}", propOrder = - { {{#vars}}"{{name}}"{{^-last}}, {{/-last}}{{/vars}} -}){{/hasVars}} +{{#hasVars}}@XmlType(name = "{{classname}}", propOrder = + { {{#vars}}"{{name}}"{{^-last}}, {{/-last}}{{/vars}} } +){{/hasVars}} {{^hasVars}}@XmlType(name = "{{classname}}"){{/hasVars}} -{{^parent}}@XmlRootElement(name="{{classname}}"){{/parent}} +{{> xmlAnnotation }} {{/withXml}} +{{#jackson}} +@JsonPropertyOrder({ +{{#vars}} + {{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}} +{{/vars}} +}) +{{#isClassnameSanitized}} +{{^hasDiscriminatorWithNonEmptyMapping}} +@JsonTypeName("{{name}}") +{{/hasDiscriminatorWithNonEmptyMapping}} +{{/isClassnameSanitized}} +{{/jackson}} {{#description}} /** * {{{.}}} - **/ + */ {{/description}} {{>additionalModelTypeAnnotations}} -public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#serializableModel}} implements Serializable{{/serializableModel}} { +{{#vendorExtensions.x-class-extra-annotation}} +{{{vendorExtensions.x-class-extra-annotation}}} +{{/vendorExtensions.x-class-extra-annotation}} +public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensions.x-implements}}{{#-first}} implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { {{#vars}}{{#isEnum}}{{^isContainer}} {{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}} {{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}} +{{#jackson}} + public static final String JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}"; +{{/jackson}} {{#withXml}} - @XmlElement(name="{{baseName}}"{{#required}}, required = {{required}}{{/required}}) + @Xml{{#isXmlAttribute}}Attribute{{/isXmlAttribute}}{{^isXmlAttribute}}Element{{/isXmlAttribute}}(name = "{{items.xmlName}}{{^items.xmlName}}{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}{{/items.xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{#isXmlWrapped}} + @XmlElementWrapper(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{/isXmlWrapped}} {{/withXml}} {{#description}} /** - * {{{.}}} - **/ + * {{{.}}} + */ {{/description}} {{^withXml}} - @JsonbProperty("{{baseName}}") + {{#jsonb}}@JsonbProperty("{{baseName}}"){{/jsonb}} {{/withXml}} +{{#vendorExtensions.x-field-extra-annotation}} +{{{vendorExtensions.x-field-extra-annotation}}} +{{/vendorExtensions.x-field-extra-annotation}} {{#isContainer}} private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; {{/isContainer}} @@ -63,10 +61,10 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#serializableM public {{classname}}() { } - @JsonbCreator + {{#jsonb}}@JsonbCreator{{/jsonb}}{{#jackson}}@JsonCreator{{/jackson}} public {{classname}}( {{#readOnlyVars}} - @JsonbProperty("{{baseName}}") {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}} + {{#jsonb}}@JsonbProperty(value = "{{baseName}}"{{^required}}, nillable = true{{/required}}){{/jsonb}}{{#jackson}}@JsonProperty(value = JSON_PROPERTY_{{nameInSnakeCase}}{{#required}}, required = true{{/required}}){{/jackson}} {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}} {{/readOnlyVars}} ) { {{#readOnlyVars}} @@ -75,7 +73,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#serializableM } {{/withXml}}{{/vendorExtensions.x-has-readonly-properties}} {{#vars}} - /** + /** {{#description}} * {{.}} {{/description}} @@ -92,14 +90,14 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#serializableM {{#deprecated}} * @deprecated {{/deprecated}} - **/ + **/ {{#deprecated}} @Deprecated {{/deprecated}} {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} {{/vendorExtensions.x-extra-annotation}} -{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} {{#withXml}}{{#isEnum}}{{^isArray}}{{^isMap}}public {{dataType}} {{getter}}() { +{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}}{{#jackson}}{{> jackson_annotations}}{{/jackson}} {{#withXml}}{{#isEnum}}{{^isArray}}{{^isMap}} public {{dataType}} {{getter}}() { if ({{name}} == null) { return null; } @@ -116,10 +114,10 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#serializableM {{^isReadOnly}} /** - * Set {{name}} - **/ - {{#vendorExtensions.x-setter-extra-annotation}} {{{vendorExtensions.x-setter-extra-annotation}}} - {{/vendorExtensions.x-setter-extra-annotation}}public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { + * Set {{name}} + */ +{{#vendorExtensions.x-setter-extra-annotation}} {{{vendorExtensions.x-setter-extra-annotation}}} +{{/vendorExtensions.x-setter-extra-annotation}}{{#jackson}}{{> jackson_annotations}}{{/jackson}} public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { this.{{name}} = {{name}}; } @@ -129,14 +127,20 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#serializableM } {{#isArray}} - public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}; + } this.{{name}}.add({{name}}Item); return this; } {{/isArray}} {{#isMap}} - public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}; + } this.{{name}}.put(key, {{name}}Item); return this; } @@ -146,14 +150,14 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#serializableM {{/vars}} /** - * Create a string representation of this pojo. - **/ + * Create a string representation of this pojo. + */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class {{classname}} {\n"); {{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}} - {{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); + {{#vars}}sb.append(" {{name}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{name}}){{/isPassword}}).append("\n"); {{/vars}}sb.append("}"); return sb.toString(); } diff --git a/templates/libraries/microprofile/pom.mustache b/templates/libraries/microprofile/pom.mustache index 3d5f941..f814d4c 100644 --- a/templates/libraries/microprofile/pom.mustache +++ b/templates/libraries/microprofile/pom.mustache @@ -14,7 +14,7 @@ org.jboss.jandex jandex-maven-plugin - 1.1.0 + ${jandex.maven.plugin.version} make-index @@ -26,7 +26,7 @@ maven-failsafe-plugin - 2.6 + ${maven.failsafe.plugin.version} @@ -39,7 +39,7 @@ org.codehaus.mojo build-helper-maven-plugin - 1.9.1 + ${build.helper.maven.plugin.version} add-source @@ -58,10 +58,10 @@ - - junit - junit - ${junit-version} + + org.junit.jupiter + junit-jupiter-api + ${junit.version} test {{#useBeanValidation}} @@ -69,7 +69,7 @@ jakarta.validation jakarta.validation-api - ${beanvalidation-version} + ${beanvalidation.version} provided {{/useBeanValidation}} @@ -77,95 +77,125 @@ org.eclipse.microprofile.rest.client microprofile-rest-client-api - 1.4.1 + ${microprofile.rest.client.api.version} jakarta.ws.rs jakarta.ws.rs-api - ${jakarta.ws.rs-version} + ${jakarta.ws.rs.version} provided io.smallrye smallrye-rest-client - 1.2.1 + ${smallrye.rest.client.version} test io.smallrye smallrye-config - 1.3.5 + ${smallrye.config.version} test {{^disableMultipart}} org.apache.cxf cxf-rt-rs-extension-providers - 3.2.6 + ${cxf.rt.rs.extension.providers.version} {{/disableMultipart}} + {{#jsonb}} jakarta.json.bind jakarta.json.bind-api - ${jakarta.json.bind-version} + ${jakarta.json.bind.version} jakarta.json jakarta.json-api - ${jakarta.json-version} + ${jakarta.json.version} jakarta.xml.bind jakarta.xml.bind-api - ${jakarta.xml.bind-version} + ${jakarta.xml.bind.version} com.sun.xml.bind jaxb-core - 2.2.11 + ${jaxb.core.version} com.sun.xml.bind jaxb-impl - 2.2.11 + ${jaxb.impl.version} + + {{/jsonb}} + {{#jackson}} + + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + {{#withXml}} + + + jakarta.xml.bind + jakarta.xml.bind-api + ${jakarta.xml.bind.version} + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson.version} + + {{/withXml}} + {{/jackson}} jakarta.activation jakarta.activation-api - ${jakarta.activation-version} + ${jakarta.activation.version} - -{{#java8}} com.fasterxml.jackson.datatype jackson-datatype-jsr310 - ${jackson-jaxrs-version} + ${jackson.jaxrs.version} -{{/java8}} -{{^java8}} - - com.fasterxml.jackson.datatype - jackson-datatype-joda - ${jackson-jaxrs-version} - -{{/java8}} {{#useBeanValidationFeature}} org.hibernate hibernate-validator - 5.2.2.Final + ${hibernate.validator.version} {{/useBeanValidationFeature}} jakarta.annotation jakarta.annotation-api - ${jakarta-annotation-version} + ${jakarta.annotation.version} provided +{{#microprofileMutiny}} + + io.smallrye.reactive + mutiny + ${mutiny.version} + +{{/microprofileMutiny}} @@ -180,21 +210,37 @@ 1.8 ${java.version} ${java.version} - 1.5.18 - 9.2.9.v20150224 - 4.13.1 - 1.2.0 + 1.5.18 + 9.2.9.v20150224 + 5.10.2 + 1.4.14 {{#useBeanValidation}} - 2.0.2 + 3.0.2 {{/useBeanValidation}} - 3.2.7 - 2.9.7 - 1.2.2 - 1.3.5 - 1.0.2 - 1.1.6 - 2.1.6 - 2.3.3 + 3.2.7 + 2.17.1 +{{#jackson}} + 2.17.1 +{{/jackson}} + 1.2.2 + 1.3.5 + 1.0.2 + 1.1.6 + 2.1.6 + 2.3.3 + {{microprofileRestClientVersion}} + 1.2.1 + 1.3.5 + 3.2.6 + 2.2.11 + 2.2.11 + 5.2.2.Final + 1.1.0 + 2.6 + 1.9.1 UTF-8 +{{#microprofileMutiny}} + 1.2.0 +{{/microprofileMutiny}} diff --git a/templates/libraries/microprofile/pom_3.0.mustache b/templates/libraries/microprofile/pom_3.0.mustache new file mode 100644 index 0000000..7accc4c --- /dev/null +++ b/templates/libraries/microprofile/pom_3.0.mustache @@ -0,0 +1,236 @@ + + 4.0.0 + {{groupId}} + {{artifactId}} + jar + {{artifactId}} + {{#appDescription}} + {{.}} + {{/appDescription}} + {{artifactVersion}} + + src/main/java + + + org.jboss.jandex + jandex-maven-plugin + ${jandex.maven.plugin.version} + + + make-index + + jandex + + + + + + maven-failsafe-plugin + ${maven.failsafe.plugin.version} + + + + integration-test + verify + + + + + + org.codehaus.mojo + build-helper-maven-plugin + ${build.helper.maven.plugin.version} + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + + + + org.junit.jupiter + junit-jupiter-api + ${junit.version} + test + +{{#useBeanValidation}} + + + jakarta.validation + jakarta.validation-api + ${beanvalidation.version} + provided + +{{/useBeanValidation}} + + + org.eclipse.microprofile.rest.client + microprofile-rest-client-api + ${microprofile.rest.client.api.version} + + + + + jakarta.ws.rs + jakarta.ws.rs-api + ${jakarta.ws.rs.version} + provided + + + + org.glassfish.jersey.ext.microprofile + jersey-mp-rest-client + ${jersey.mp.rest.client.version} + test + + + org.apache.geronimo.config + geronimo-config-impl + ${geronimo.config.impl.version} + test + + + {{^disableMultipart}} + + org.apache.cxf + cxf-rt-rs-extension-providers + ${cxf.rt.rs.extension.providers.version} + + {{/disableMultipart}} + {{#jsonb}} + + jakarta.json.bind + jakarta.json.bind-api + ${jakarta.json.bind.version} + + + jakarta.json + jakarta.json-api + ${jakarta.json.version} + + + jakarta.xml.bind + jakarta.xml.bind-api + ${jakarta.xml.bind.version} + + + com.sun.xml.bind + jaxb-core + ${jaxb.core.version} + + + com.sun.xml.bind + jaxb-impl + ${jaxb.impl.version} + + {{/jsonb}} + {{#jackson}} + + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + {{#withXml}} + + + jakarta.xml.bind + jakarta.xml.bind-api + ${jakarta.xml.bind.version} + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson.version} + + {{/withXml}} + {{/jackson}} + + jakarta.activation + jakarta.activation-api + ${jakarta.activation.version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson.jaxrs.version} + +{{#useBeanValidationFeature}} + + org.hibernate + hibernate-validator + ${hibernate.validator.version} + +{{/useBeanValidationFeature}} + + jakarta.annotation + jakarta.annotation-api + ${jakarta.annotation.version} + provided + + + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + + 11 + ${java.version} + ${java.version} + 1.5.18 + 9.2.9.v20150224 + 5.10.2 + 1.4.14 +{{#useBeanValidation}} + 3.0.1 +{{/useBeanValidation}} + 3.2.7 + 2.17.1 +{{#jackson}} + 2.17.1 +{{/jackson}} + 2.1.0 + 2.0.0 + 2.0.0 + 2.0.1 + 3.0.0 + 3.0.1 + {{microprofileRestClientVersion}} + 3.0.4 + 1.2.3 + 3.5.1 + 3.0.2 + 3.0.2 + 7.0.4.Final + 1.1.0 + 2.6 + 1.9.1 + UTF-8 + + diff --git a/templates/libraries/microprofile/returnTypes.mustache b/templates/libraries/microprofile/returnTypes.mustache deleted file mode 100644 index 32f96a9..0000000 --- a/templates/libraries/microprofile/returnTypes.mustache +++ /dev/null @@ -1,4 +0,0 @@ -{{#useGenericResponse}}Response{{/useGenericResponse}}{{! non-generic response: -}}{{^useGenericResponse}}{{! -}}{{{returnType}}}{{! -}}{{/useGenericResponse}} \ No newline at end of file diff --git a/templates/libraries/microprofile/server_operation.mustache b/templates/libraries/microprofile/server_operation.mustache new file mode 100644 index 0000000..d6fa905 --- /dev/null +++ b/templates/libraries/microprofile/server_operation.mustache @@ -0,0 +1 @@ +{{#vendorExtensions.x-multiple-2xx-response-operation}}{{#microprofileMutiny}}Uni{{/microprofileMutiny}}{{^microprofileMutiny}}Response{{/microprofileMutiny}}{{/vendorExtensions.x-multiple-2xx-response-operation}}{{^vendorExtensions.x-multiple-2xx-response-operation}}{{#microprofileMutiny}}Uni<{{{returnType}}}>{{/microprofileMutiny}}{{^microprofileMutiny}}{{{returnType}}}{{/microprofileMutiny}}{{/vendorExtensions.x-multiple-2xx-response-operation}} \ No newline at end of file diff --git a/templates/libraries/native/AbstractOpenApiSchema.mustache b/templates/libraries/native/AbstractOpenApiSchema.mustache index 19bf0a6..f196a13 100644 --- a/templates/libraries/native/AbstractOpenApiSchema.mustache +++ b/templates/libraries/native/AbstractOpenApiSchema.mustache @@ -2,7 +2,6 @@ package {{modelPackage}}; -import {{invokerPackage}}.ApiException; import java.util.Objects; import java.lang.reflect.Type; import java.util.Map; @@ -12,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonValue; /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}} +{{>generatedAnnotation}} public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/templates/libraries/native/ApiClient.mustache b/templates/libraries/native/ApiClient.mustache index 03fe2a4..a641525 100644 --- a/templates/libraries/native/ApiClient.mustache +++ b/templates/libraries/native/ApiClient.mustache @@ -14,13 +14,12 @@ import java.io.InputStream; import java.net.URI; import java.net.URLEncoder; import java.net.http.HttpClient; +import java.net.http.HttpConnectTimeoutException; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.time.Duration; -{{#java8}} import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; -{{/java8}} import java.util.Collection; import java.util.Collections; import java.util.List; @@ -56,16 +55,15 @@ public class ApiClient { private Consumer> responseInterceptor; private Consumer> asyncResponseInterceptor; private Duration readTimeout; + private Duration connectTimeout; - private static String valueToString(Object value) { + public static String valueToString(Object value) { if (value == null) { return ""; } - {{#java8}} if (value instanceof OffsetDateTime) { return ((OffsetDateTime) value).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME); } - {{/java8}} return value.toString(); } @@ -154,7 +152,7 @@ public class ApiClient { } /** - * Ctor. + * Create an instance of ApiClient. */ public ApiClient() { this.builder = createDefaultHttpClientBuilder(); @@ -162,12 +160,17 @@ public class ApiClient { updateBaseUri(getDefaultBaseUri()); interceptor = null; readTimeout = null; + connectTimeout = null; responseInterceptor = null; asyncResponseInterceptor = null; } /** - * Ctor. + * Create an instance of ApiClient. + * + * @param builder Http client builder. + * @param mapper Object mapper. + * @param baseUri Base URI */ public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri) { this.builder = builder; @@ -175,6 +178,7 @@ public class ApiClient { updateBaseUri(baseUri != null ? baseUri : getDefaultBaseUri()); interceptor = null; readTimeout = null; + connectTimeout = null; responseInterceptor = null; asyncResponseInterceptor = null; } @@ -411,4 +415,35 @@ public class ApiClient { public Duration getReadTimeout() { return readTimeout; } + /** + * Sets the connect timeout (in milliseconds) for the http client. + * + *

In the case where a new connection needs to be established, if + * the connection cannot be established within the given {@code + * duration}, then {@link HttpClient#send(HttpRequest,BodyHandler) + * HttpClient::send} throws an {@link HttpConnectTimeoutException}, or + * {@link HttpClient#sendAsync(HttpRequest,BodyHandler) + * HttpClient::sendAsync} completes exceptionally with an + * {@code HttpConnectTimeoutException}. If a new connection does not + * need to be established, for example if a connection can be reused + * from a previous request, then this timeout duration has no effect. + * + * @param connectTimeout connection timeout in milliseconds + * + * @return This object. + */ + public ApiClient setConnectTimeout(Duration connectTimeout) { + this.connectTimeout = connectTimeout; + this.builder.connectTimeout(connectTimeout); + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public Duration getConnectTimeout() { + return connectTimeout; + } } diff --git a/templates/libraries/native/ApiResponse.mustache b/templates/libraries/native/ApiResponse.mustache index 1e27731..e2f8f6c 100644 --- a/templates/libraries/native/ApiResponse.mustache +++ b/templates/libraries/native/ApiResponse.mustache @@ -14,6 +14,7 @@ import java.util.TreeMap; * * @param The type of data that is deserialized from response body */ +{{>generatedAnnotation}} public class ApiResponse { final private int statusCode; final private Map> headers; diff --git a/templates/libraries/native/JSON.mustache b/templates/libraries/native/JSON.mustache index 961f23b..813bb79 100644 --- a/templates/libraries/native/JSON.mustache +++ b/templates/libraries/native/JSON.mustache @@ -1,22 +1,17 @@ +{{>licenseInfo}} + package {{invokerPackage}}; -{{#threetenbp}} -import org.threeten.bp.*; -{{/threetenbp}} import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; {{#openApiNullable}} import org.openapitools.jackson.nullable.JsonNullableModule; {{/openApiNullable}} -{{#java8}} import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -{{/java8}} {{#joda}} import com.fasterxml.jackson.datatype.joda.JodaModule; {{/joda}} -{{#threetenbp}} -import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; -{{/threetenbp}} {{#models.0}} import {{modelPackage}}.*; {{/models.0}} @@ -32,28 +27,20 @@ public class JSON { private ObjectMapper mapper; public JSON() { - mapper = new ObjectMapper(); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); - mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); - mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); - mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); - mapper.setDateFormat(new RFC3339DateFormat()); - {{#java8}} - mapper.registerModule(new JavaTimeModule()); - {{/java8}} + mapper = JsonMapper.builder() + .serializationInclusion(JsonInclude.Include.NON_NULL) + .disable(MapperFeature.ALLOW_COERCION_OF_SCALARS) + .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) + .enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING) + .defaultDateFormat(new RFC3339DateFormat()) + .addModule(new JavaTimeModule()) + .build(); {{#joda}} mapper.registerModule(new JodaModule()); {{/joda}} - {{#threetenbp}} - ThreeTenModule module = new ThreeTenModule(); - module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); - module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); - module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); - mapper.registerModule(module); - {{/threetenbp}} {{#openApiNullable}} JsonNullableModule jnm = new JsonNullableModule(); mapper.registerModule(jnm); @@ -62,6 +49,7 @@ public class JSON { /** * Set the date format for JSON (de)serialization with Date properties. + * * @param dateFormat Date format */ public void setDateFormat(DateFormat dateFormat) { @@ -81,6 +69,8 @@ public class JSON { * * @param node The input data. * @param modelClass The class that contains the discriminator mappings. + * + * @return the target model class. */ public static Class getClassForElement(JsonNode node, Class modelClass) { ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); @@ -93,6 +83,7 @@ public class JSON { /** * Helper class to register the discriminator mappings. */ + {{>generatedAnnotation}} private static class ClassDiscriminatorMapping { // The model class name. Class modelClass; @@ -140,6 +131,8 @@ public class JSON { * * @param node The input data. * @param visitedClasses The set of classes that have already been visited. + * + * @return the target model class. */ Class getClassForElement(JsonNode node, Set> visitedClasses) { if (visitedClasses.contains(modelClass)) { @@ -186,6 +179,9 @@ public class JSON { * * @param modelClass A OpenAPI model class. * @param inst The instance object. + * @param visitedClasses The set of classes that have already been visited. + * + * @return true if inst is an instance of modelClass in the OpenAPI model hierarchy. */ public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { if (modelClass.isInstance(inst)) { diff --git a/templates/libraries/native/README.mustache b/templates/libraries/native/README.mustache index ef15f37..fd7d490 100644 --- a/templates/libraries/native/README.mustache +++ b/templates/libraries/native/README.mustache @@ -8,6 +8,8 @@ - Build date: {{generatedDate}} {{/hideGenerationTimestamp}} +- Generator version: {{generatorVersion}} + {{{appDescriptionWithNewLines}}} {{#infoUrl}} @@ -139,11 +141,14 @@ Class | Method | HTTP request | Description {{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md) {{/model}}{{/models}} + ## Documentation for Authorization -{{^authMethods}}All endpoints do not require authorization. -{{/authMethods}}Authentication schemes defined for the API: -{{#authMethods}}### {{name}} +{{^authMethods}}Endpoints do not require authorization.{{/authMethods}} +{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}} +{{#authMethods}} + +### {{name}} {{#isApiKey}} @@ -151,10 +156,18 @@ Class | Method | HTTP request | Description - **API key parameter name**: {{keyParamName}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} {{/isApiKey}} -{{#isBasic}} +{{#isBasicBasic}} - **Type**: HTTP basic authentication -{{/isBasic}} +{{/isBasicBasic}} +{{#isBasicBearer}} + +- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} +{{/isBasicBearer}} +{{#isHttpSignature}} + +- **Type**: HTTP signature authentication +{{/isHttpSignature}} {{#isOAuth}} - **Type**: OAuth diff --git a/templates/libraries/native/additional_properties.mustache b/templates/libraries/native/additional_properties.mustache index 61973dc..8e71827 100644 --- a/templates/libraries/native/additional_properties.mustache +++ b/templates/libraries/native/additional_properties.mustache @@ -9,6 +9,9 @@ /** * Set the additional (undeclared) property with the specified name and value. * If the property does not already exist, create it otherwise replace it. + * @param key the name of the property + * @param value the value of the property + * @return self reference */ @JsonAnySetter public {{classname}} putAdditionalProperty(String key, {{{.}}} value) { @@ -20,7 +23,8 @@ } /** - * Return the additional (undeclared) property. + * Return the additional (undeclared) properties. + * @return the additional (undeclared) properties */ @JsonAnyGetter public Map getAdditionalProperties() { @@ -29,6 +33,8 @@ /** * Return the additional (undeclared) property with the specified name. + * @param key the name of the property + * @return the additional (undeclared) property with the specified name */ public {{{.}}} getAdditionalProperty(String key) { if (this.additionalProperties == null) { diff --git a/templates/libraries/native/anyof_model.mustache b/templates/libraries/native/anyof_model.mustache index c87c932..dfb6464 100644 --- a/templates/libraries/native/anyof_model.mustache +++ b/templates/libraries/native/anyof_model.mustache @@ -21,7 +21,7 @@ import {{invokerPackage}}.JSON; {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} @JsonDeserialize(using={{classname}}.{{classname}}Deserializer.class) @JsonSerialize(using = {{classname}}.{{classname}}Serializer.class) -public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} { +public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}} implements {{{.}}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-implements}} { private static final Logger log = Logger.getLogger({{classname}}.class.getName()); public static class {{classname}}Serializer extends StdSerializer<{{classname}}> { @@ -54,7 +54,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im Object deserialized = null; {{#discriminator}} - Class cls = JSON.getClassForElement(tree, {{classname}}.class); + Class cls = JSON.getClassForElement(tree, new {{classname}}().getClass()); if (cls != null) { // When the OAS schema includes a discriminator, use the discriminator value to // discriminate the anyOf schemas. @@ -195,4 +195,168 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im } {{/anyOf}} + +{{#supportUrlQuery}} + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + {{#composedSchemas.oneOf}} + {{^vendorExtensions.x-duplicated-data-type}} + if (getActualInstance() instanceof {{{dataType}}}) { + {{#isArray}} + {{#items.isPrimitiveType}} + {{#uniqueItems}} + if (getActualInstance() != null) { + int i = 0; + for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(_item), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if (getActualInstance() != null) { + for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(getActualInstance().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + } + {{/uniqueItems}} + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + {{#items.isModel}} + {{#uniqueItems}} + if (getActualInstance() != null) { + int i = 0; + for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) { + if (_item != null) { + joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if (getActualInstance() != null) { + for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) { + if ((({{{dataType}}})getActualInstance()).get(i) != null) { + joiner.add((({{{items.dataType}}})getActualInstance()).get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{^items.isModel}} + {{#uniqueItems}} + if (getActualInstance() != null) { + int i = 0; + for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) { + if (_item != null) { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(_item), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + i++; + } + } + {{/uniqueItems}} + {{^uniqueItems}} + if (getActualInstance() != null) { + for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) { + if (getActualInstance().get(i) != null) { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf((({{{dataType}}})getActualInstance()).get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{/items.isPrimitiveType}} + {{/isArray}} + {{^isArray}} + {{#isMap}} + {{#items.isPrimitiveType}} + if (getActualInstance() != null) { + for (String _key : (({{{dataType}}})getActualInstance()).keySet()) { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix), + getActualInstance().get(_key), URLEncoder.encode(String.valueOf((({{{dataType}}})getActualInstance()).get(_key)), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + } + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + if (getActualInstance() != null) { + for (String _key : (({{{dataType}}})getActualInstance()).keySet()) { + if ((({{{dataType}}})getActualInstance()).get(_key) != null) { + joiner.add((({{{items.dataType}}})getActualInstance()).get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix)))); + } + } + } + {{/items.isPrimitiveType}} + {{/isMap}} + {{^isMap}} + {{#isPrimitiveType}} + if (getActualInstance() != null) { + joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getActualInstance()), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isModel}} + if (getActualInstance() != null) { + joiner.add((({{{dataType}}})getActualInstance()).toUrlQueryString(prefix + "{{{baseName}}}" + suffix)); + } + {{/isModel}} + {{^isModel}} + if (getActualInstance() != null) { + joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getActualInstance()), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + {{/isModel}} + {{/isPrimitiveType}} + {{/isMap}} + {{/isArray}} + return joiner.toString(); + } + {{/vendorExtensions.x-duplicated-data-type}} + {{/composedSchemas.oneOf}} + return null; + } +{{/supportUrlQuery}} + } diff --git a/templates/libraries/native/api.mustache b/templates/libraries/native/api.mustache index 86fb8dd..a80dcba 100644 --- a/templates/libraries/native/api.mustache +++ b/templates/libraries/native/api.mustache @@ -13,22 +13,40 @@ import {{import}}; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} +{{#hasFormParamsInSpec}} +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; + +{{/hasFormParamsInSpec}} import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.time.Duration; -import java.util.function.Consumer; -{{^fullJavaUtil}} import java.util.ArrayList; import java.util.StringJoiner; import java.util.List; import java.util.Map; import java.util.Set; -{{/fullJavaUtil}} +import java.util.function.Consumer; {{#asyncNative}} import java.util.concurrent.CompletableFuture; @@ -91,6 +109,11 @@ public class {{classname}} { {{#returnType}} * @return {{#asyncNative}}CompletableFuture<{{/asyncNative}}{{returnType}}{{#asyncNative}}>{{/asyncNative}} {{/returnType}} + {{^returnType}} + {{#asyncNative}} + * @return CompletableFuture<Void> + {{/asyncNative}} + {{/returnType}} * @throws ApiException if fails to make API call {{#isDeprecated}} * @deprecated @@ -140,11 +163,16 @@ public class {{classname}} { * {{summary}} * {{notes}} {{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/isContainer}}{{/required}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} {{/allParams}} {{#returnType}} * @return {{#asyncNative}}CompletableFuture<{{/asyncNative}}{{returnType}}{{#asyncNative}}>{{/asyncNative}} {{/returnType}} + {{^returnType}} + {{#asyncNative}} + * @return CompletableFuture<Void> + {{/asyncNative}} + {{/returnType}} * @throws ApiException if fails to make API call {{#isDeprecated}} * @deprecated @@ -175,8 +203,9 @@ public class {{classname}} { } {{#returnType}} try { + String responseBody = localVarResponse.body(); return CompletableFuture.completedFuture( - memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {}) + responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<{{{returnType}}}>() {}) ); } catch (IOException e) { return CompletableFuture.failedFuture(new ApiException(e)); @@ -197,7 +226,7 @@ public class {{classname}} { * {{summary}} * {{notes}} {{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/isContainer}}{{/required}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} {{/allParams}} * @return {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} * @throws ApiException if fails to make API call @@ -226,12 +255,33 @@ public class {{classname}} { if (localVarResponse.statusCode()/ 100 != 2) { throw getApiException("{{operationId}}", localVarResponse); } + {{#vendorExtensions.x-java-text-plain-string}} + // for plain text response + if (localVarResponse.headers().map().containsKey("Content-Type") && + "text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) { + java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A"); + String responseBodyText = s.hasNext() ? s.next() : ""; + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBodyText + ); + } else { + throw new RuntimeException("Error! The response Content-Type is supposed to be `text/plain` but it's not: " + localVarResponse); + } + {{/vendorExtensions.x-java-text-plain-string}} + {{^vendorExtensions.x-java-text-plain-string}} return new ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>( localVarResponse.statusCode(), localVarResponse.headers().map(), - {{#returnType}}memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {}) // closes the InputStream{{/returnType}} - {{^returnType}}null{{/returnType}} + {{#returnType}} + localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {}) // closes the InputStream + {{/returnType}} + {{^returnType}} + null + {{/returnType}} ); + {{/vendorExtensions.x-java-text-plain-string}} } finally { {{^returnType}} // Drain the InputStream @@ -263,11 +313,12 @@ public class {{classname}} { } {{#returnType}} try { + String responseBody = localVarResponse.body(); return CompletableFuture.completedFuture( new ApiResponse<{{{returnType}}}>( localVarResponse.statusCode(), localVarResponse.headers().map(), - memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {})) + responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<{{{returnType}}}>() {})) ); } catch (IOException e) { return CompletableFuture.failedFuture(new ApiException(e)); @@ -304,28 +355,64 @@ public class {{classname}} { .replace({{=<% %>=}}"{<%baseName%>}"<%={{ }}=%>, ApiClient.urlEncode({{{paramName}}}.toString())){{/pathParams}}; {{#hasQueryParams}} - {{javaUtilPrefix}}List localVarQueryParams = new {{javaUtilPrefix}}ArrayList<>(); + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; {{#queryParams}} + localVarQueryParameterBaseName = "{{{baseName}}}"; {{#collectionFormat}} localVarQueryParams.addAll(ApiClient.parameterToPairs("{{{collectionFormat}}}", "{{baseName}}", {{paramName}})); {{/collectionFormat}} {{^collectionFormat}} {{#isDeepObject}} if ({{paramName}} != null) { - {{#items.vars}} - localVarQueryParams.addAll(ApiClient.parameterToPairs("{{baseName}}", {{paramName}}.{{getter}}())); - {{/items.vars}} + {{#isArray}} + for (int i=0; i < {{paramName}}.size(); i++) { + localVarQueryStringJoiner.add({{paramName}}.get(i).toUrlQueryString(String.format("{{baseName}}[%d]", i))); + } + {{/isArray}} + {{^isArray}} + String queryString = {{paramName}}.toUrlQueryString("{{baseName}}"); + if (!queryString.isBlank()) { + localVarQueryStringJoiner.add(queryString); + } + {{/isArray}} } {{/isDeepObject}} {{^isDeepObject}} + {{#isExplode}} + {{#hasVars}} + {{#vars}} + {{#isArray}} + localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "{{baseName}}", {{paramName}}.{{getter}}())); + {{/isArray}} + {{^isArray}} + localVarQueryParams.addAll(ApiClient.parameterToPairs("{{baseName}}", {{paramName}}.{{getter}}())); + {{/isArray}} + {{/vars}} + {{/hasVars}} + {{^hasVars}} + {{#isModel}} + localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString()); + {{/isModel}} + {{^isModel}} localVarQueryParams.addAll(ApiClient.parameterToPairs("{{baseName}}", {{paramName}})); + {{/isModel}} + {{/hasVars}} + {{/isExplode}} + {{^isExplode}} + localVarQueryParams.addAll(ApiClient.parameterToPairs("{{baseName}}", {{paramName}})); + {{/isExplode}} {{/isDeepObject}} {{/collectionFormat}} {{/queryParams}} - if (!localVarQueryParams.isEmpty()) { - {{javaUtilPrefix}}StringJoiner queryJoiner = new StringJoiner("&"); + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); } else { localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); @@ -341,20 +428,113 @@ public class {{classname}} { } {{/headerParams}} {{#bodyParam}} - localVarRequestBuilder.header("Content-Type", "{{#hasConsumes}}{{#consumes}}{{#-first}}{{mediaType}}{{/-first}}{{/consumes}}{{/hasConsumes}}{{#hasConsumes}}{{^consumes}}application/json{{/consumes}}{{/hasConsumes}}{{^hasConsumes}}application/json{{/hasConsumes}}"); + localVarRequestBuilder.header("Content-Type", "{{#hasConsumes}}{{#consumes}}{{#-first}}{{{mediaType}}}{{/-first}}{{/consumes}}{{/hasConsumes}}{{#hasConsumes}}{{^consumes}}application/json{{/consumes}}{{/hasConsumes}}{{^hasConsumes}}application/json{{/hasConsumes}}"); {{/bodyParam}} - localVarRequestBuilder.header("Accept", "{{#hasProduces}}{{#produces}}{{mediaType}}{{^-last}}, {{/-last}}{{/produces}}{{/hasProduces}}{{#hasProduces}}{{^produces}}application/json{{/produces}}{{/hasProduces}}{{^hasProduces}}application/json{{/hasProduces}}"); + localVarRequestBuilder.header("Accept", "{{#hasProduces}}{{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{/hasProduces}}{{#hasProduces}}{{^produces}}application/json{{/produces}}{{/hasProduces}}{{^hasProduces}}application/json{{/hasProduces}}"); {{#bodyParam}} + {{#isString}} + localVarRequestBuilder.method("{{httpMethod}}", HttpRequest.BodyPublishers.ofString({{paramName}})); + {{/isString}} + {{^isString}} try { byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes({{paramName}}); localVarRequestBuilder.method("{{httpMethod}}", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); } catch (IOException e) { throw new ApiException(e); } + {{/isString}} {{/bodyParam}} {{^bodyParam}} + {{#hasFormParams}} + {{#isMultipart}} + MultipartEntityBuilder multiPartBuilder = MultipartEntityBuilder.create(); + boolean hasFiles = false; + {{#formParams}} + {{#isArray}} + for (int i=0; i < {{paramName}}.size(); i++) { + {{#isFile}} + multiPartBuilder.addBinaryBody("{{{baseName}}}", {{paramName}}.get(i)); + hasFiles = true; + {{/isFile}} + {{^isFile}} + multiPartBuilder.addTextBody("{{{baseName}}}", {{paramName}}.get(i).toString()); + {{/isFile}} + } + {{/isArray}} + {{^isArray}} + {{#isFile}} + multiPartBuilder.addBinaryBody("{{{baseName}}}", {{paramName}}); + hasFiles = true; + {{/isFile}} + {{^isFile}} + multiPartBuilder.addTextBody("{{{baseName}}}", {{paramName}}.toString()); + {{/isFile}} + {{/isArray}} + {{/formParams}} + HttpEntity entity = multiPartBuilder.build(); + HttpRequest.BodyPublisher formDataPublisher; + if (hasFiles) { + Pipe pipe; + try { + pipe = Pipe.open(); + } catch (IOException e) { + throw new RuntimeException(e); + } + new Thread(() -> { + try (OutputStream outputStream = Channels.newOutputStream(pipe.sink())) { + entity.writeTo(outputStream); + } catch (IOException e) { + e.printStackTrace(); + } + }).start(); + formDataPublisher = HttpRequest.BodyPublishers.ofInputStream(() -> Channels.newInputStream(pipe.source())); + } else { + ByteArrayOutputStream formOutputStream = new ByteArrayOutputStream(); + try { + entity.writeTo(formOutputStream); + } catch (IOException e) { + throw new RuntimeException(e); + } + formDataPublisher = HttpRequest.BodyPublishers + .ofInputStream(() -> new ByteArrayInputStream(formOutputStream.toByteArray())); + } + localVarRequestBuilder + .header("Content-Type", entity.getContentType().getValue()) + .method("{{httpMethod}}", formDataPublisher); + {{/isMultipart}} + {{^isMultipart}} + List formValues = new ArrayList<>(); + {{#formParams}} + {{#isArray}} + for (int i=0; i < {{paramName}}.size(); i++) { + if ({{paramName}}.get(i) != null) { + formValues.add(new BasicNameValuePair("{{{baseName}}}", {{paramName}}.get(i).toString())); + } + } + {{/isArray}} + {{^isArray}} + if ({{paramName}} != null) { + formValues.add(new BasicNameValuePair("{{{baseName}}}", {{paramName}}.toString())); + } + {{/isArray}} + {{/formParams}} + HttpEntity entity = new UrlEncodedFormEntity(formValues, java.nio.charset.StandardCharsets.UTF_8); + ByteArrayOutputStream formOutputStream = new ByteArrayOutputStream(); + try { + entity.writeTo(formOutputStream); + } catch (IOException e) { + throw new RuntimeException(e); + } + localVarRequestBuilder + .header("Content-Type", entity.getContentType().getValue()) + .method("{{httpMethod}}", HttpRequest.BodyPublishers + .ofInputStream(() -> new ByteArrayInputStream(formOutputStream.toByteArray()))); + {{/isMultipart}} + {{/hasFormParams}} + {{^hasFormParams}} localVarRequestBuilder.method("{{httpMethod}}", HttpRequest.BodyPublishers.noBody()); + {{/hasFormParams}} {{/bodyParam}} if (memberVarReadTimeout != null) { localVarRequestBuilder.timeout(memberVarReadTimeout); @@ -364,6 +544,7 @@ public class {{classname}} { } return localVarRequestBuilder; } + {{#vendorExtensions.x-group-parameters}} {{#hasParams}} @@ -372,7 +553,7 @@ public class {{classname}} { private {{{dataType}}} {{paramName}}; // {{description}} (required) {{/requiredParams}} {{#optionalParams}} - private {{{dataType}}} {{paramName}}; // {{description}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/isContainer}} + private {{{dataType}}} {{paramName}}; // {{description}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}) {{/optionalParams}} private API{{operationId}}Request(Builder builder) { diff --git a/templates/libraries/native/apiException.mustache b/templates/libraries/native/apiException.mustache index 3d0eee4..9596b73 100644 --- a/templates/libraries/native/apiException.mustache +++ b/templates/libraries/native/apiException.mustache @@ -6,6 +6,8 @@ import java.net.http.HttpHeaders; {{>generatedAnnotation}} public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ + private static final long serialVersionUID = 1L; + private int code = 0; private HttpHeaders responseHeaders = null; private String responseBody = null; diff --git a/templates/libraries/native/api_doc.mustache b/templates/libraries/native/api_doc.mustache index 3af38b3..2b125e1 100644 --- a/templates/libraries/native/api_doc.mustache +++ b/templates/libraries/native/api_doc.mustache @@ -4,10 +4,10 @@ All URIs are relative to *{{basePath}}* -Method | HTTP request | Description -------------- | ------------- | ------------- -{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} -[**{{operationId}}WithHttpInfo**]({{classname}}.md#{{operationId}}WithHttpInfo) | **{{httpMethod}}** {{path}} | {{summary}} +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +{{#operations}}{{#operation}}| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} | +| [**{{operationId}}WithHttpInfo**]({{classname}}.md#{{operationId}}WithHttpInfo) | **{{httpMethod}}** {{path}} | {{summary}} | {{/operation}}{{/operations}} {{#operations}} @@ -98,9 +98,9 @@ public class Example { ### Parameters {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{^vendorExtensions.x-group-parameters}}{{#allParams}}{{#-last}} -Name | Type | Description | Notes -------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------|{{/-last}}{{/allParams}} +{{#allParams}}| **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} | {{/allParams}} {{/vendorExtensions.x-group-parameters}} {{#vendorExtensions.x-group-parameters}} @@ -230,9 +230,9 @@ public class Example { ### Parameters {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{^vendorExtensions.x-group-parameters}}{{#allParams}}{{#-last}} -Name | Type | Description | Notes -------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------|{{/-last}}{{/allParams}} +{{#allParams}}| **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} | {{/allParams}} {{/vendorExtensions.x-group-parameters}} {{#vendorExtensions.x-group-parameters}} @@ -266,13 +266,13 @@ Name | Type | Description | Notes {{/responses.0}} {{#vendorExtensions.x-group-parameters}}{{#hasParams}} - + ## API{{operationId}}Request ### Properties {{#allParams}}{{#-last}} | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | -------------|{{/-last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} +{{#allParams}}| **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} | {{/allParams}} {{/hasParams}}{{/vendorExtensions.x-group-parameters}} diff --git a/templates/libraries/native/api_test.mustache b/templates/libraries/native/api_test.mustache index ffcf05e..497bd53 100644 --- a/templates/libraries/native/api_test.mustache +++ b/templates/libraries/native/api_test.mustache @@ -5,25 +5,28 @@ package {{package}}; import {{invokerPackage}}.ApiException; {{#imports}}import {{import}}; {{/imports}} -import org.junit.Test; -import org.junit.Ignore; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -{{^fullJavaUtil}} import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; -{{/fullJavaUtil}} {{#asyncNative}} import java.util.concurrent.CompletableFuture; {{/asyncNative}} +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} /** * API tests for {{classname}} */ -@Ignore +@Disabled public class {{classname}}Test { private final {{classname}} api = new {{classname}}(); diff --git a/templates/libraries/native/build.gradle.mustache b/templates/libraries/native/build.gradle.mustache index 03d303d..24ea4fe 100644 --- a/templates/libraries/native/build.gradle.mustache +++ b/templates/libraries/native/build.gradle.mustache @@ -1,5 +1,6 @@ apply plugin: 'idea' apply plugin: 'eclipse' +apply plugin: 'com.diffplug.spotless' group = '{{groupId}}' version = '{{artifactVersion}}' @@ -8,6 +9,9 @@ buildscript { repositories { mavenCentral() } + dependencies { + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0' + } } repositories { @@ -62,17 +66,27 @@ artifacts { ext { - swagger_annotations_version = "1.5.22" - jackson_version = "2.10.4" + {{#swagger1AnnotationLibrary}} + swagger_annotations_version = "1.6.9" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + swagger_annotations_version = "2.2.9" + {{/swagger2AnnotationLibrary}} + jackson_version = "2.17.1" jakarta_annotation_version = "1.3.5" - junit_version = "4.13.1" - {{#threetenbp}} - threetenbp_version = "2.9.10" - {{/threetenbp}} + junit_version = "5.10.2" + {{#hasFormParamsInSpec}} + httpmime_version = "4.5.13" + {{/hasFormParamsInSpec}} } dependencies { + {{#swagger1AnnotationLibrary}} implementation "io.swagger:swagger-annotations:$swagger_annotations_version" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version" + {{/swagger2AnnotationLibrary}} implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" @@ -80,8 +94,31 @@ dependencies { implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" implementation "org.openapitools:jackson-databind-nullable:0.2.1" implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - {{#threetenbp}} - implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version" - {{/threetenbp}} - testImplementation "junit:junit:$junit_version" + {{#hasFormParamsInSpec}} + implementation "org.apache.httpcomponents:httpmime:$httpmime_version" + {{/hasFormParamsInSpec}} + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" +} + +// Use spotless plugin to automatically format code, remove unused import, etc +// To apply changes directly to the file, run `gradlew spotlessApply` +// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle +spotless { + // comment out below to run spotless as part of the `check` task + enforceCheck false + format 'misc', { + // define the files (e.g. '*.gradle', '*.md') to apply `misc` to + target '.gitignore' + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithSpaces() // Takes an integer argument if you don't like 4 + endWithNewline() + } + java { + // don't need to set target, it is inferred from java + // apply a specific flavor of google-java-format + googleJavaFormat('1.8').aosp().reflowLongStrings() + removeUnusedImports() + importOrder() + } } diff --git a/templates/libraries/native/generatedAnnotation.mustache b/templates/libraries/native/generatedAnnotation.mustache index baf5ff0..e05689d 100644 --- a/templates/libraries/native/generatedAnnotation.mustache +++ b/templates/libraries/native/generatedAnnotation.mustache @@ -1 +1 @@ -@javax.annotation.processing.Generated(value = "{{generatorClass}}"{{^hideGenerationTimestamp}}, date = "{{generatedDate}}"{{/hideGenerationTimestamp}}) \ No newline at end of file +@{{javaxPackage}}.annotation.Generated(value = "{{generatorClass}}"{{^hideGenerationTimestamp}}, date = "{{generatedDate}}"{{/hideGenerationTimestamp}}, comments = "Generator version: {{generatorVersion}}") \ No newline at end of file diff --git a/templates/libraries/native/model.mustache b/templates/libraries/native/model.mustache index 6f2436c..cd2a85a 100644 --- a/templates/libraries/native/model.mustache +++ b/templates/libraries/native/model.mustache @@ -16,8 +16,12 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; {{/additionalPropertiesType}} {{/model}} {{/models}} +{{#supportUrlQuery}} +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +{{/supportUrlQuery}} import java.util.Objects; -import java.util.Arrays; import java.util.Map; import java.util.HashMap; {{#imports}} @@ -36,15 +40,15 @@ import com.fasterxml.jackson.annotation.JsonCreator; {{/vendorExtensions.x-has-readonly-properties}} {{/jackson}} {{#withXml}} -import javax.xml.bind.annotation.*; +import {{javaxPackage}}.xml.bind.annotation.*; {{/withXml}} {{#parcelableModel}} import android.os.Parcelable; import android.os.Parcel; {{/parcelableModel}} {{#useBeanValidation}} -import javax.validation.constraints.*; -import javax.validation.Valid; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; {{/useBeanValidation}} {{#performBeanValidation}} import org.hibernate.validator.constraints.*; diff --git a/templates/libraries/native/modelEnum.mustache b/templates/libraries/native/modelEnum.mustache new file mode 100644 index 0000000..5f22f75 --- /dev/null +++ b/templates/libraries/native/modelEnum.mustache @@ -0,0 +1,120 @@ +{{#jackson}} +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +{{/jackson}} +{{#gson}} +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +{{/gson}} +{{#isUri}} +import java.net.URI; +{{/isUri}} + +/** + * {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}} + */ +{{#gson}} +@JsonAdapter({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.Adapter.class) +{{/gson}} +{{#jsonb}} +@JsonbTypeSerializer({{datatypeWithEnum}}.Serializer.class) +@JsonbTypeDeserializer({{datatypeWithEnum}}.Deserializer.class) +{{/jsonb}} +{{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { + {{#allowableValues}}{{#enumVars}} + {{#enumDescription}} + /** + * {{.}} + */ + {{/enumDescription}} + {{#withXml}} + @XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) + {{/withXml}} + {{{name}}}({{{value}}}){{^-last}}, + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + + private {{{dataType}}} value; + + {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) { + this.value = value; + } + +{{#jackson}} + @JsonValue +{{/jackson}} + public {{{dataType}}} getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + +{{#jackson}} + @JsonCreator +{{/jackson}} + public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) { + for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (b.value.{{^isString}}equals{{/isString}}{{#isString}}{{#useEnumCaseInsensitive}}equalsIgnoreCase{{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}equals{{/useEnumCaseInsensitive}}{{/isString}}(value)) { + return b; + } + } + {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}return {{{name}}};{{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/enumUnknownDefaultCase}}{{/isNullable}} + } +{{#supportUrlQuery}} + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + if (prefix == null) { + prefix = ""; + } + + return String.format("%s=%s", prefix, this.toString()); + } +{{/supportUrlQuery}} + +{{#gson}} + + public static class Adapter extends TypeAdapter<{{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}> { + @Override + public void write(final JsonWriter jsonWriter, final {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException { + {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{^isNumber}}{{^isInteger}}next{{{dataType}}}(){{/isInteger}}{{/isNumber}}; + return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + } + } +{{/gson}} +{{#jsonb}} + public static final class Deserializer implements JsonbDeserializer<{{datatypeWithEnum}}> { + @Override + public {{datatypeWithEnum}} deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) { + for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (String.valueOf(b.value).equals(parser.getString())) { + return b; + } + } + {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + parser.getString() + "'");{{/useNullForUnknownEnumValue}} + } + } + + public static final class Serializer implements JsonbSerializer<{{datatypeWithEnum}}> { + @Override + public void serialize({{datatypeWithEnum}} obj, JsonGenerator generator, SerializationContext ctx) { + generator.write(obj.value); + } + } +{{/jsonb}} +} diff --git a/templates/libraries/native/oneof_model.mustache b/templates/libraries/native/oneof_model.mustache index 993961a..8aa2ef0 100644 --- a/templates/libraries/native/oneof_model.mustache +++ b/templates/libraries/native/oneof_model.mustache @@ -23,7 +23,7 @@ import {{invokerPackage}}.JSON; {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} @JsonDeserialize(using = {{classname}}.{{classname}}Deserializer.class) @JsonSerialize(using = {{classname}}.{{classname}}Serializer.class) -public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} { +public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}} implements {{{.}}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-implements}} { private static final Logger log = Logger.getLogger({{classname}}.class.getName()); public static class {{classname}}Serializer extends StdSerializer<{{classname}}> { @@ -60,12 +60,12 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); String discriminatorValue = (String)result2.get("{{{propertyBaseName}}}"); switch (discriminatorValue) { - {{#mappedModels}} + {{#mappedModels}} case "{{{mappingName}}}": deserialized = tree.traverse(jp.getCodec()).readValueAs({{{modelName}}}.class); new{{classname}}.setActualInstance(deserialized); return new{{classname}}; - {{/mappedModels}} + {{/mappedModels}} default: log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", discriminatorValue)); } @@ -228,4 +228,168 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im } {{/oneOf}} + +{{#supportUrlQuery}} + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + {{#composedSchemas.oneOf}} + {{^vendorExtensions.x-duplicated-data-type}} + if (getActualInstance() instanceof {{{dataType}}}) { + {{#isArray}} + {{#items.isPrimitiveType}} + {{#uniqueItems}} + if (getActualInstance() != null) { + int i = 0; + for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(_item), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if (getActualInstance() != null) { + for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(getActualInstance().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + } + {{/uniqueItems}} + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + {{#items.isModel}} + {{#uniqueItems}} + if (getActualInstance() != null) { + int i = 0; + for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) { + if (_item != null) { + joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if (getActualInstance() != null) { + for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) { + if ((({{{dataType}}})getActualInstance()).get(i) != null) { + joiner.add((({{{items.dataType}}})getActualInstance()).get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{^items.isModel}} + {{#uniqueItems}} + if (getActualInstance() != null) { + int i = 0; + for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) { + if (_item != null) { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(_item), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + i++; + } + } + {{/uniqueItems}} + {{^uniqueItems}} + if (getActualInstance() != null) { + for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) { + if (getActualInstance().get(i) != null) { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf((({{{dataType}}})getActualInstance()).get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{/items.isPrimitiveType}} + {{/isArray}} + {{^isArray}} + {{#isMap}} + {{#items.isPrimitiveType}} + if (getActualInstance() != null) { + for (String _key : (({{{dataType}}})getActualInstance()).keySet()) { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix), + getActualInstance().get(_key), URLEncoder.encode(String.valueOf((({{{dataType}}})getActualInstance()).get(_key)), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + } + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + if (getActualInstance() != null) { + for (String _key : (({{{dataType}}})getActualInstance()).keySet()) { + if ((({{{dataType}}})getActualInstance()).get(_key) != null) { + joiner.add((({{{items.dataType}}})getActualInstance()).get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix)))); + } + } + } + {{/items.isPrimitiveType}} + {{/isMap}} + {{^isMap}} + {{#isPrimitiveType}} + if (getActualInstance() != null) { + joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getActualInstance()), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isModel}} + if (getActualInstance() != null) { + joiner.add((({{{dataType}}})getActualInstance()).toUrlQueryString(prefix + "{{{baseName}}}" + suffix)); + } + {{/isModel}} + {{^isModel}} + if (getActualInstance() != null) { + joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getActualInstance()), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + {{/isModel}} + {{/isPrimitiveType}} + {{/isMap}} + {{/isArray}} + return joiner.toString(); + } + {{/vendorExtensions.x-duplicated-data-type}} + {{/composedSchemas.oneOf}} + return null; + } +{{/supportUrlQuery}} + } diff --git a/templates/libraries/native/pojo.mustache b/templates/libraries/native/pojo.mustache index 5f0c036..1250a71 100644 --- a/templates/libraries/native/pojo.mustache +++ b/templates/libraries/native/pojo.mustache @@ -1,12 +1,24 @@ {{#discriminator}} import {{invokerPackage}}.JSON; {{/discriminator}} +{{#supportUrlQuery}} +import {{invokerPackage}}.ApiClient; +{{/supportUrlQuery}} /** * {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} * @deprecated{{/isDeprecated}} */{{#isDeprecated}} -@Deprecated{{/isDeprecated}}{{#description}} -@ApiModel(description = "{{{.}}}"){{/description}} +@Deprecated{{/isDeprecated}} +{{#swagger1AnnotationLibrary}} +{{#description}} +@ApiModel(description = "{{{.}}}") +{{/description}} +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} +{{#description}} +@Schema(description = "{{{.}}}") +{{/description}} +{{/swagger2AnnotationLibrary}} {{#jackson}} @JsonPropertyOrder({ {{#vars}} @@ -15,6 +27,9 @@ import {{invokerPackage}}.JSON; }) {{/jackson}} {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} +{{#vendorExtensions.x-class-extra-annotation}} +{{{vendorExtensions.x-class-extra-annotation}}} +{{/vendorExtensions.x-class-extra-annotation}} public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ {{#serializableModel}} private static final long serialVersionUID = 1L; @@ -40,29 +55,17 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens public static final String JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}"; {{/jackson}} {{#withXml}} - {{#isXmlAttribute}} - @XmlAttribute(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/isXmlAttribute}} - {{^isXmlAttribute}} - {{^isContainer}} - @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/isContainer}} - {{#isContainer}} - // Is a container wrapped={{isXmlWrapped}} - {{#items}} - // items.name={{name}} items.baseName={{baseName}} items.xmlName={{xmlName}} items.xmlNamespace={{xmlNamespace}} - // items.example={{example}} items.type={{dataType}} - @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/items}} - {{#isXmlWrapped}} - @XmlElementWrapper({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/isXmlWrapped}} - {{/isContainer}} - {{/isXmlAttribute}} + @Xml{{#isXmlAttribute}}Attribute{{/isXmlAttribute}}{{^isXmlAttribute}}Element{{/isXmlAttribute}}(name = "{{items.xmlName}}{{^items.xmlName}}{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}{{/items.xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{#isXmlWrapped}} + @XmlElementWrapper(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{/isXmlWrapped}} {{/withXml}} {{#gson}} @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) {{/gson}} + {{#vendorExtensions.x-field-extra-annotation}} + {{{vendorExtensions.x-field-extra-annotation}}} + {{/vendorExtensions.x-field-extra-annotation}} {{#vendorExtensions.x-is-jackson-optional-nullable}} {{#isContainer}} private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); @@ -72,12 +75,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/isContainer}} {{/vendorExtensions.x-is-jackson-optional-nullable}} {{^vendorExtensions.x-is-jackson-optional-nullable}} - {{#isContainer}} - private {{{datatypeWithEnum}}} {{name}}{{#required}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/required}}{{^required}} = null{{/required}}; - {{/isContainer}} - {{^isContainer}} private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; - {{/isContainer}} {{/vendorExtensions.x-is-jackson-optional-nullable}} {{/vars}} @@ -94,7 +92,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens ) { this(); {{#readOnlyVars}} - this.{{name}} = {{name}}; + this.{{name}} = {{#vendorExtensions.x-is-jackson-optional-nullable}}{{name}} == null ? JsonNullable.<{{{datatypeWithEnum}}}>undefined() : JsonNullable.of({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{name}}{{/vendorExtensions.x-is-jackson-optional-nullable}}; {{/readOnlyVars}} }{{/withXml}}{{/vendorExtensions.x-has-readonly-properties}} {{#vars}} @@ -123,10 +121,10 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens } {{#isArray}} - public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} if (this.{{name}} == null || !this.{{name}}.isPresent()) { - this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}); } try { this.{{name}}.get().add({{name}}Item); @@ -136,11 +134,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens return this; {{/vendorExtensions.x-is-jackson-optional-nullable}} {{^vendorExtensions.x-is-jackson-optional-nullable}} - {{^required}} if (this.{{name}} == null) { - this.{{name}} = {{{defaultValue}}}; + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}; } - {{/required}} this.{{name}}.add({{name}}Item); return this; {{/vendorExtensions.x-is-jackson-optional-nullable}} @@ -148,10 +144,10 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/isArray}} {{#isMap}} - public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} if (this.{{name}} == null || !this.{{name}}.isPresent()) { - this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}); } try { this.{{name}}.get().put(key, {{name}}Item); @@ -161,11 +157,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens return this; {{/vendorExtensions.x-is-jackson-optional-nullable}} {{^vendorExtensions.x-is-jackson-optional-nullable}} - {{^required}} if (this.{{name}} == null) { - this.{{name}} = {{{defaultValue}}}; + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}; } - {{/required}} this.{{name}}.put(key, {{name}}Item); return this; {{/vendorExtensions.x-is-jackson-optional-nullable}} @@ -173,7 +167,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/isMap}} {{/isReadOnly}} - /** + /** {{#description}} * {{.}} {{/description}} @@ -190,22 +184,30 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{#deprecated}} * @deprecated {{/deprecated}} - **/ + */ {{#deprecated}} @Deprecated {{/deprecated}} {{#required}} {{#isNullable}} - @javax.annotation.Nullable + @{{javaxPackage}}.annotation.Nullable {{/isNullable}} {{^isNullable}} - @javax.annotation.Nonnull + @{{javaxPackage}}.annotation.Nonnull {{/isNullable}} {{/required}} {{^required}} - @javax.annotation.Nullable + @{{javaxPackage}}.annotation.Nullable {{/required}} -{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{#useBeanValidation}} +{{>beanValidation}} +{{/useBeanValidation}} +{{#swagger1AnnotationLibrary}} + @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} + @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}") +{{/swagger2AnnotationLibrary}} {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} {{/vendorExtensions.x-extra-annotation}} @@ -213,8 +215,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{!unannotated, Jackson would pick this up automatically and add it *in addition* to the _JsonNullable getter field}} @JsonIgnore {{/vendorExtensions.x-is-jackson-optional-nullable}} -{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#jackson}}{{> jackson_annotations}}{{/jackson}}{{/vendorExtensions.x-is-jackson-optional-nullable}} - public {{{datatypeWithEnum}}} {{getter}}() { +{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#jackson}}{{> jackson_annotations}}{{/jackson}}{{/vendorExtensions.x-is-jackson-optional-nullable}} public {{{datatypeWithEnum}}} {{getter}}() { {{#vendorExtensions.x-is-jackson-optional-nullable}} {{#isReadOnly}}{{! A readonly attribute doesn't have setter => jackson will set null directly if explicitly returned by API, so make sure we have an empty JsonNullable}} if ({{name}} == null) { @@ -261,6 +262,23 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/vars}} {{>libraries/native/additional_properties}} + {{#parent}} + {{#allVars}} + {{#isOverridden}} + @Override + public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.{{setter}}(JsonNullable.<{{{datatypeWithEnum}}}>of({{name}})); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + this.{{setter}}({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + return this; + } + + {{/isOverridden}} + {{/allVars}} + {{/parent}} /** * Return true if this {{name}} object is equal to o. */ @@ -314,7 +332,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens sb.append(" ").append(toIndentedString(super.toString())).append("\n"); {{/parent}} {{#vars}} - sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); + sb.append(" {{name}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{name}}){{/isPassword}}).append("\n"); {{/vars}} {{#additionalPropertiesType}} sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); @@ -333,7 +351,165 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens } return o.toString().replace("\n", "\n "); } +{{#supportUrlQuery}} + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + {{#allVars}} + // add `{{baseName}}` to the URL query string + {{#isArray}} + {{#items.isPrimitiveType}} + {{#uniqueItems}} + if ({{getter}}() != null) { + int i = 0; + for ({{{items.dataType}}} _item : {{getter}}()) { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(ApiClient.valueToString(_item), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if ({{getter}}() != null) { + for (int i = 0; i < {{getter}}().size(); i++) { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(ApiClient.valueToString({{getter}}().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + } + {{/uniqueItems}} + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + {{#items.isModel}} + {{#uniqueItems}} + if ({{getter}}() != null) { + int i = 0; + for ({{{items.dataType}}} _item : {{getter}}()) { + if (_item != null) { + joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if ({{getter}}() != null) { + for (int i = 0; i < {{getter}}().size(); i++) { + if ({{getter}}().get(i) != null) { + joiner.add({{getter}}().get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{^items.isModel}} + {{#uniqueItems}} + if ({{getter}}() != null) { + int i = 0; + for ({{{items.dataType}}} _item : {{getter}}()) { + if (_item != null) { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(ApiClient.valueToString(_item), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + i++; + } + } + {{/uniqueItems}} + {{^uniqueItems}} + if ({{getter}}() != null) { + for (int i = 0; i < {{getter}}().size(); i++) { + if ({{getter}}().get(i) != null) { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(ApiClient.valueToString({{getter}}().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{/items.isPrimitiveType}} + {{/isArray}} + {{^isArray}} + {{#isMap}} + {{^items.isModel}} + if ({{getter}}() != null) { + for (String _key : {{getter}}().keySet()) { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix), + {{getter}}().get(_key), URLEncoder.encode(ApiClient.valueToString({{getter}}().get(_key)), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + } + {{/items.isModel}} + {{#items.isModel}} + if ({{getter}}() != null) { + for (String _key : {{getter}}().keySet()) { + if ({{getter}}().get(_key) != null) { + joiner.add({{getter}}().get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix)))); + } + } + } + {{/items.isModel}} + {{/isMap}} + {{^isMap}} + {{#isPrimitiveType}} + if ({{getter}}() != null) { + joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString({{{getter}}}()), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isModel}} + if ({{getter}}() != null) { + joiner.add({{getter}}().toUrlQueryString(prefix + "{{{baseName}}}" + suffix)); + } + {{/isModel}} + {{^isModel}} + if ({{getter}}() != null) { + joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString({{{getter}}}()), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + {{/isModel}} + {{/isPrimitiveType}} + {{/isMap}} + {{/isArray}} + + {{/allVars}} + return joiner.toString(); + } +{{/supportUrlQuery}} {{#parcelableModel}} public void writeToParcel(Parcel out, int flags) { @@ -404,4 +580,8 @@ static { JSON.registerDiscriminator({{classname}}.class, "{{propertyBaseName}}", mappings); } {{/discriminator}} +{{#generateBuilders}} + + {{>javaBuilder}} +{{/generateBuilders}} } diff --git a/templates/libraries/native/pom.mustache b/templates/libraries/native/pom.mustache index c0c151c..8ed8277 100644 --- a/templates/libraries/native/pom.mustache +++ b/templates/libraries/native/pom.mustache @@ -42,7 +42,7 @@ maven-enforcer-plugin - 3.0.0-M1 + 3.1.0 enforce-maven @@ -64,7 +64,7 @@ maven-surefire-plugin - 3.0.0-M3 + 3.2.5 conf/log4j.properties @@ -76,7 +76,7 @@ maven-dependency-plugin - 3.1.1 + 3.3.0 package @@ -94,7 +94,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.1.2 + 3.3.0 @@ -107,12 +107,12 @@ maven-compiler-plugin - 3.8.1 + 3.10.1 org.apache.maven.plugins maven-javadoc-plugin - 3.1.0 + 3.4.1 attach-javadocs @@ -124,7 +124,7 @@ maven-source-plugin - 3.1.0 + 3.2.1 attach-sources @@ -134,6 +134,46 @@ + + + com.diffplug.spotless + spotless-maven-plugin + ${spotless.version} + + + + + + + .gitignore + + + + + + true + 4 + + + + + + + + + + 1.8 + + true + + + + + + @@ -144,7 +184,7 @@ maven-gpg-plugin - 1.6 + 3.0.1 sign-artifacts @@ -161,11 +201,20 @@ + {{#swagger1AnnotationLibrary}} io.swagger swagger-annotations ${swagger-annotations-version} + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + + io.swagger.core.v3 + swagger-annotations + ${swagger-annotations-version} + + {{/swagger2AnnotationLibrary}} @@ -193,13 +242,6 @@ jackson-databind-nullable ${jackson-databind-nullable-version} - {{#threetenbp}} - - com.github.joschi.jackson - jackson-datatype-threetenbp - ${threetenbp-version} - - {{/threetenbp}} @@ -213,11 +255,27 @@ ${jakarta-annotation-version} provided + {{#useBeanValidation}} + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + {{/useBeanValidation}} + {{#hasFormParamsInSpec}} + + org.apache.httpcomponents + httpmime + ${httpmime-version} + + {{/hasFormParamsInSpec}} - junit - junit + org.junit.jupiter + junit-jupiter-api ${junit-version} test @@ -225,15 +283,29 @@ UTF-8 - 1.5.22 + {{#swagger1AnnotationLibrary}} + 1.6.9 + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + 2.2.15 + {{/swagger2AnnotationLibrary}} 11 11 - 2.10.4 - 0.2.2 + 2.17.1 + 0.2.6 + {{#useJakartaEe}} + 2.1.1 + {{/useJakartaEe}} + {{^useJakartaEe}} 1.3.5 - {{#threetenbp}} - 2.9.10 - {{/threetenbp}} - 4.13.1 + {{/useJakartaEe}} + {{#useBeanValidation}} + 3.0.2 + {{/useBeanValidation}} + {{#hasFormParamsInSpec}} + 4.5.14 + {{/hasFormParamsInSpec}} + 5.10.2 + 2.27.2 diff --git a/templates/libraries/okhttp-gson-nextgen/ApiCallback.mustache b/templates/libraries/okhttp-gson-nextgen/ApiCallback.mustache deleted file mode 100644 index 53b6a7b..0000000 --- a/templates/libraries/okhttp-gson-nextgen/ApiCallback.mustache +++ /dev/null @@ -1,51 +0,0 @@ -{{>licenseInfo}} - -package {{invokerPackage}}; - -import java.io.IOException; - -import java.util.Map; -import java.util.List; - -/** - * Callback for asynchronous API call. - * - * @param The return type - */ -public interface ApiCallback { - /** - * This is called when the API call fails. - * - * @param e The exception causing the failure - * @param statusCode Status code of the response if available, otherwise it would be 0 - * @param responseHeaders Headers of the response if available, otherwise it would be null - */ - void onFailure(ApiException e, int statusCode, Map> responseHeaders); - - /** - * This is called when the API call succeeded. - * - * @param result The result deserialized from response - * @param statusCode Status code of the response - * @param responseHeaders Headers of the response - */ - void onSuccess(T result, int statusCode, Map> responseHeaders); - - /** - * This is called when the API upload processing. - * - * @param bytesWritten bytes Written - * @param contentLength content length of request body - * @param done write end - */ - void onUploadProgress(long bytesWritten, long contentLength, boolean done); - - /** - * This is called when the API download processing. - * - * @param bytesRead bytes Read - * @param contentLength content length of the response - * @param done Read end - */ - void onDownloadProgress(long bytesRead, long contentLength, boolean done); -} diff --git a/templates/libraries/okhttp-gson-nextgen/ApiClient.mustache b/templates/libraries/okhttp-gson-nextgen/ApiClient.mustache deleted file mode 100644 index de8ac25..0000000 --- a/templates/libraries/okhttp-gson-nextgen/ApiClient.mustache +++ /dev/null @@ -1,1738 +0,0 @@ -{{>licenseInfo}} - -package {{invokerPackage}}; - -{{#dynamicOperations}} -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.Operation; -import io.swagger.v3.oas.models.PathItem; -import io.swagger.v3.oas.models.parameters.Parameter; -import io.swagger.v3.oas.models.parameters.Parameter.StyleEnum; -import io.swagger.v3.parser.OpenAPIV3Parser; -{{/dynamicOperations}} -import okhttp3.*; -import okhttp3.internal.http.HttpMethod; -import okhttp3.internal.tls.OkHostnameVerifier; -import okhttp3.logging.HttpLoggingInterceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import okio.Buffer; -import okio.BufferedSink; -import okio.Okio; -{{#joda}} -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.joda.time.format.DateTimeFormatter; -{{/joda}} -{{#threetenbp}} -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; -{{/threetenbp}} -{{#hasOAuthMethods}} -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; -import org.apache.oltu.oauth2.common.message.types.GrantType; -{{/hasOAuthMethods}} - -import javax.net.ssl.*; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Type; -import java.net.URI; -import java.net.URLConnection; -import java.net.URLEncoder; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.security.GeneralSecurityException; -import java.security.KeyStore; -import java.security.SecureRandom; -import java.security.cert.Certificate; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.text.DateFormat; -{{#java8}} -import java.time.LocalDate; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -{{/java8}} -import java.util.*; -import java.util.Map.Entry; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import {{invokerPackage}}.auth.Authentication; -import {{invokerPackage}}.auth.HttpBasicAuth; -import {{invokerPackage}}.auth.HttpBearerAuth; -import {{invokerPackage}}.auth.ApiKeyAuth; -{{#hasOAuthMethods}} -import {{invokerPackage}}.auth.OAuth; -import {{invokerPackage}}.auth.RetryingOAuth; -import {{invokerPackage}}.auth.OAuthFlow; -{{/hasOAuthMethods}} - -/** - *

ApiClient class.

- */ -public class ApiClient { - - private String basePath = "{{{basePath}}}"; - private boolean debugging = false; - private Map defaultHeaderMap = new HashMap(); - private Map defaultCookieMap = new HashMap(); - private String tempFolderPath = null; - - private Map authentications; - - private DateFormat dateFormat; - private DateFormat datetimeFormat; - private boolean lenientDatetimeFormat; - private int dateLength; - - private InputStream sslCaCert; - private boolean verifyingSsl; - private KeyManager[] keyManagers; - - private OkHttpClient httpClient; - private JSON json; - - private HttpLoggingInterceptor loggingInterceptor; - - {{#dynamicOperations}} - private Map operationLookupMap = new HashMap<>(); - - {{/dynamicOperations}} - /** - * Basic constructor for ApiClient - */ - public ApiClient() { - init(); - initHttpClient(); - - // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} - authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} - authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} - authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } - - /** - * Basic constructor with custom OkHttpClient - * - * @param client a {@link okhttp3.OkHttpClient} object - */ - public ApiClient(OkHttpClient client) { - init(); - - httpClient = client; - - // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} - authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} - authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} - authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } - - {{#hasOAuthMethods}} - {{#oauthMethods}} - {{#-first}} - /** - * Constructor for ApiClient to support access token retry on 401/403 configured with client ID - * - * @param clientId client ID - */ - public ApiClient(String clientId) { - this(clientId, null, null); - } - - /** - * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters - * - * @param clientId client ID - * @param parameters a {@link java.util.Map} of parameters - */ - public ApiClient(String clientId, Map parameters) { - this(clientId, null, parameters); - } - - /** - * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters - * - * @param clientId client ID - * @param clientSecret client secret - * @param parameters a {@link java.util.Map} of parameters - */ - public ApiClient(String clientId, String clientSecret, Map parameters) { - this(null, clientId, clientSecret, parameters); - } - - /** - * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters - * - * @param basePath base path - * @param clientId client ID - * @param clientSecret client secret - * @param parameters a {@link java.util.Map} of parameters - */ - public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { - init(); - if (basePath != null) { - this.basePath = basePath; - } - -{{#hasOAuthMethods}} - String tokenUrl = "{{tokenUrl}}"; - if (!"".equals(tokenUrl) && !URI.create(tokenUrl).isAbsolute()) { - URI uri = URI.create(getBasePath()); - tokenUrl = uri.getScheme() + ":" + - (uri.getAuthority() != null ? "//" + uri.getAuthority() : "") + - tokenUrl; - if (!URI.create(tokenUrl).isAbsolute()) { - throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL"); - } - } - RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.{{flow}}, clientSecret, parameters); - authentications.put( - "{{name}}", - retryingOAuth - ); - initHttpClient(Collections.singletonList(retryingOAuth)); -{{/hasOAuthMethods}} - // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} - authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} - authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{/authMethods}} - - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } - - {{/-first}} - {{/oauthMethods}} - {{/hasOAuthMethods}} - private void initHttpClient() { - initHttpClient(Collections.emptyList()); - } - - private void initHttpClient(List interceptors) { - OkHttpClient.Builder builder = new OkHttpClient.Builder(); - builder.addNetworkInterceptor(getProgressInterceptor()); - for (Interceptor interceptor: interceptors) { - builder.addInterceptor(interceptor); - } - {{#useGzipFeature}} - // Enable gzip request compression - builder.addInterceptor(new GzipRequestInterceptor()); - {{/useGzipFeature}} - - httpClient = builder.build(); - } - - private void init() { - verifyingSsl = true; - - json = new JSON(); - - // Set default User-Agent. - setUserAgent("{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}"); - - authentications = new HashMap(); - {{#dynamicOperations}} - - OpenAPI openAPI = new OpenAPIV3Parser().read("openapi/openapi.yaml"); - createOperationLookupMap(openAPI); - {{/dynamicOperations}} - } - - /** - * Get base path - * - * @return Base path - */ - public String getBasePath() { - return basePath; - } - - /** - * Set base path - * - * @param basePath Base path of the URL (e.g {{{basePath}}} - * @return An instance of OkHttpClient - */ - public ApiClient setBasePath(String basePath) { - this.basePath = basePath; - return this; - } - - /** - * Get HTTP client - * - * @return An instance of OkHttpClient - */ - public OkHttpClient getHttpClient() { - return httpClient; - } - - /** - * Set HTTP client, which must never be null. - * - * @param newHttpClient An instance of OkHttpClient - * @return Api Client - * @throws java.lang.NullPointerException when newHttpClient is null - */ - public ApiClient setHttpClient(OkHttpClient newHttpClient) { - this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); - return this; - } - - /** - * Get JSON - * - * @return JSON object - */ - public JSON getJSON() { - return json; - } - - /** - * Set JSON - * - * @param json JSON object - * @return Api client - */ - public ApiClient setJSON(JSON json) { - this.json = json; - return this; - } - - /** - * True if isVerifyingSsl flag is on - * - * @return True if isVerifySsl flag is on - */ - public boolean isVerifyingSsl() { - return verifyingSsl; - } - - /** - * Configure whether to verify certificate and hostname when making https requests. - * Default to true. - * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. - * - * @param verifyingSsl True to verify TLS/SSL connection - * @return ApiClient - */ - public ApiClient setVerifyingSsl(boolean verifyingSsl) { - this.verifyingSsl = verifyingSsl; - applySslSettings(); - return this; - } - - /** - * Get SSL CA cert. - * - * @return Input stream to the SSL CA cert - */ - public InputStream getSslCaCert() { - return sslCaCert; - } - - /** - * Configure the CA certificate to be trusted when making https requests. - * Use null to reset to default. - * - * @param sslCaCert input stream for SSL CA cert - * @return ApiClient - */ - public ApiClient setSslCaCert(InputStream sslCaCert) { - this.sslCaCert = sslCaCert; - applySslSettings(); - return this; - } - - /** - *

Getter for the field keyManagers.

- * - * @return an array of {@link javax.net.ssl.KeyManager} objects - */ - public KeyManager[] getKeyManagers() { - return keyManagers; - } - - /** - * Configure client keys to use for authorization in an SSL session. - * Use null to reset to default. - * - * @param managers The KeyManagers to use - * @return ApiClient - */ - public ApiClient setKeyManagers(KeyManager[] managers) { - this.keyManagers = managers; - applySslSettings(); - return this; - } - - /** - *

Getter for the field dateFormat.

- * - * @return a {@link java.text.DateFormat} object - */ - public DateFormat getDateFormat() { - return dateFormat; - } - - /** - *

Setter for the field dateFormat.

- * - * @param dateFormat a {@link java.text.DateFormat} object - * @return a {@link org.openapitools.client.ApiClient} object - */ - public ApiClient setDateFormat(DateFormat dateFormat) { - this.json.setDateFormat(dateFormat); - return this; - } - - /** - *

Set SqlDateFormat.

- * - * @param dateFormat a {@link java.text.DateFormat} object - * @return a {@link org.openapitools.client.ApiClient} object - */ - public ApiClient setSqlDateFormat(DateFormat dateFormat) { - this.json.setSqlDateFormat(dateFormat); - return this; - } - - {{#joda}} - public ApiClient setDateTimeFormat(DateTimeFormatter dateFormat) { - this.json.setDateTimeFormat(dateFormat); - return this; - } - - public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { - this.json.setLocalDateFormat(dateFormat); - return this; - } - - {{/joda}} - {{#jsr310}} - /** - *

Set OffsetDateTimeFormat.

- * - * @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object - * @return a {@link org.openapitools.client.ApiClient} object - */ - public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { - this.json.setOffsetDateTimeFormat(dateFormat); - return this; - } - - /** - *

Set LocalDateFormat.

- * - * @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object - * @return a {@link org.openapitools.client.ApiClient} object - */ - public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { - this.json.setLocalDateFormat(dateFormat); - return this; - } - - {{/jsr310}} - /** - *

Set LenientOnJson.

- * - * @param lenientOnJson a boolean - * @return a {@link org.openapitools.client.ApiClient} object - */ - public ApiClient setLenientOnJson(boolean lenientOnJson) { - this.json.setLenientOnJson(lenientOnJson); - return this; - } - - /** - * Get authentications (key: authentication name, value: authentication). - * - * @return Map of authentication objects - */ - public Map getAuthentications() { - return authentications; - } - - /** - * Get authentication for the given name. - * - * @param authName The authentication name - * @return The authentication, null if not found - */ - public Authentication getAuthentication(String authName) { - return authentications.get(authName); - } - - {{#hasHttpBearerMethods}} - /** - * Helper method to set access token for the first Bearer authentication. - * @param bearerToken Bearer token - */ - public void setBearerToken(String bearerToken) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBearerAuth) { - ((HttpBearerAuth) auth).setBearerToken(bearerToken); - return; - } - } - throw new RuntimeException("No Bearer authentication configured!"); - } - {{/hasHttpBearerMethods}} - - /** - * Helper method to set username for the first HTTP basic authentication. - * - * @param username Username - */ - public void setUsername(String username) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setUsername(username); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set password for the first HTTP basic authentication. - * - * @param password Password - */ - public void setPassword(String password) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setPassword(password); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set API key value for the first API key authentication. - * - * @param apiKey API key - */ - public void setApiKey(String apiKey) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKey(apiKey); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set API key prefix for the first API key authentication. - * - * @param apiKeyPrefix API key prefix - */ - public void setApiKeyPrefix(String apiKeyPrefix) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set access token for the first OAuth2 authentication. - * - * @param accessToken Access token - */ - public void setAccessToken(String accessToken) { - {{#hasOAuthMethods}} - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setAccessToken(accessToken); - return; - } - } - {{/hasOAuthMethods}} - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - /** - * Set the User-Agent header's value (by adding to the default header map). - * - * @param userAgent HTTP request's user agent - * @return ApiClient - */ - public ApiClient setUserAgent(String userAgent) { - addDefaultHeader("User-Agent", userAgent); - return this; - } - - /** - * Add a default header. - * - * @param key The header's key - * @param value The header's value - * @return ApiClient - */ - public ApiClient addDefaultHeader(String key, String value) { - defaultHeaderMap.put(key, value); - return this; - } - - /** - * Add a default cookie. - * - * @param key The cookie's key - * @param value The cookie's value - * @return ApiClient - */ - public ApiClient addDefaultCookie(String key, String value) { - defaultCookieMap.put(key, value); - return this; - } - - /** - * Check that whether debugging is enabled for this API client. - * - * @return True if debugging is enabled, false otherwise. - */ - public boolean isDebugging() { - return debugging; - } - - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - * @return ApiClient - */ - public ApiClient setDebugging(boolean debugging) { - if (debugging != this.debugging) { - if (debugging) { - loggingInterceptor = new HttpLoggingInterceptor(); - loggingInterceptor.setLevel(Level.BODY); - httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); - } else { - final OkHttpClient.Builder builder = httpClient.newBuilder(); - builder.interceptors().remove(loggingInterceptor); - httpClient = builder.build(); - loggingInterceptor = null; - } - } - this.debugging = debugging; - return this; - } - - /** - * The path of temporary folder used to store downloaded files from endpoints - * with file response. The default value is null, i.e. using - * the system's default temporary folder. - * - * @see createTempFile - * @return Temporary folder path - */ - public String getTempFolderPath() { - return tempFolderPath; - } - - /** - * Set the temporary folder path (for downloading files) - * - * @param tempFolderPath Temporary folder path - * @return ApiClient - */ - public ApiClient setTempFolderPath(String tempFolderPath) { - this.tempFolderPath = tempFolderPath; - return this; - } - - /** - * Get connection timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getConnectTimeout() { - return httpClient.connectTimeoutMillis(); - } - - /** - * Sets the connect timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link java.lang.Integer#MAX_VALUE}. - * - * @param connectionTimeout connection timeout in milliseconds - * @return Api client - */ - public ApiClient setConnectTimeout(int connectionTimeout) { - httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); - return this; - } - - /** - * Get read timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getReadTimeout() { - return httpClient.readTimeoutMillis(); - } - - /** - * Sets the read timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link java.lang.Integer#MAX_VALUE}. - * - * @param readTimeout read timeout in milliseconds - * @return Api client - */ - public ApiClient setReadTimeout(int readTimeout) { - httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); - return this; - } - - /** - * Get write timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getWriteTimeout() { - return httpClient.writeTimeoutMillis(); - } - - /** - * Sets the write timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link java.lang.Integer#MAX_VALUE}. - * - * @param writeTimeout connection timeout in milliseconds - * @return Api client - */ - public ApiClient setWriteTimeout(int writeTimeout) { - httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); - return this; - } - - {{#hasOAuthMethods}} - /** - * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * - * @return Token request builder - */ - public TokenRequestBuilder getTokenEndPoint() { - for (Authentication apiAuth : authentications.values()) { - if (apiAuth instanceof RetryingOAuth) { - RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; - return retryingOAuth.getTokenRequestBuilder(); - } - } - return null; - } - {{/hasOAuthMethods}} - - /** - * Format the given parameter object into string. - * - * @param param Parameter - * @return String representation of the parameter - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if (param instanceof Date {{#joda}}|| param instanceof DateTime || param instanceof LocalDate{{/joda}}{{#jsr310}}|| param instanceof OffsetDateTime || param instanceof LocalDate{{/jsr310}}) { - //Serialize to json string and remove the " enclosing characters - String jsonStr = json.serialize(param); - return jsonStr.substring(1, jsonStr.length() - 1); - } else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for (Object o : (Collection) param) { - if (b.length() > 0) { - b.append(","); - } - b.append(String.valueOf(o)); - } - return b.toString(); - } else { - return String.valueOf(param); - } - } - - /** - * Formats the specified query parameter to a list containing a single {@code Pair} object. - * - * Note that {@code value} must not be a collection. - * - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list containing a single {@code Pair} object. - */ - public List parameterToPair(String name, Object value) { - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null || value instanceof Collection) { - return params; - } - - params.add(new Pair(name, parameterToString(value))); - return params; - } - - {{^dynamicOperations}} - /** - * Formats the specified collection query parameters to a list of {@code Pair} objects. - * - * Note that the values of each of the returned Pair objects are percent-encoded. - * - * @param collectionFormat The collection format of the parameter. - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list of {@code Pair} objects. - */ - public List parameterToPairs(String collectionFormat, String name, Collection value) { - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null || value.isEmpty()) { - return params; - } - - // create the params based on the collection format - if ("multi".equals(collectionFormat)) { - for (Object item : value) { - params.add(new Pair(name, escapeString(parameterToString(item)))); - } - return params; - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - // escape all delimiters except commas, which are URI reserved - // characters - if ("ssv".equals(collectionFormat)) { - delimiter = escapeString(" "); - } else if ("tsv".equals(collectionFormat)) { - delimiter = escapeString("\t"); - } else if ("pipes".equals(collectionFormat)) { - delimiter = escapeString("|"); - } - - StringBuilder sb = new StringBuilder(); - for (Object item : value) { - sb.append(delimiter); - sb.append(escapeString(parameterToString(item))); - } - - params.add(new Pair(name, sb.substring(delimiter.length()))); - - return params; - } - {{/dynamicOperations}} - {{#dynamicOperations}} - public List parameterToPairs(Parameter param, Collection value) { - List params = new ArrayList(); - - // preconditions - if (param == null || param.getName() == null || param.getName().isEmpty() || value == null) { - return params; - } - - // create the params based on the collection format - if (StyleEnum.FORM.equals(param.getStyle()) && Boolean.TRUE.equals(param.getExplode())) { - for (Object item : value) { - params.add(new Pair(param.getName(), escapeString(parameterToString(item)))); - } - return params; - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - // escape all delimiters except commas, which are URI reserved - // characters - if (StyleEnum.SPACEDELIMITED.equals(param.getStyle())) { - delimiter = escapeString(" "); - } else if (StyleEnum.PIPEDELIMITED.equals(param.getStyle())) { - delimiter = escapeString("|"); - } - - StringBuilder sb = new StringBuilder(); - for (Object item : value) { - sb.append(delimiter); - sb.append(escapeString(parameterToString(item))); - } - - params.add(new Pair(param.getName(), sb.substring(delimiter.length()))); - - return params; - } - {{/dynamicOperations}} - - /** - * Formats the specified collection path parameter to a string value. - * - * @param collectionFormat The collection format of the parameter. - * @param value The value of the parameter. - * @return String representation of the parameter - */ - public String collectionPathParameterToString(String collectionFormat, Collection value) { - // create the value based on the collection format - if ("multi".equals(collectionFormat)) { - // not valid for path params - return parameterToString(value); - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - if ("ssv".equals(collectionFormat)) { - delimiter = " "; - } else if ("tsv".equals(collectionFormat)) { - delimiter = "\t"; - } else if ("pipes".equals(collectionFormat)) { - delimiter = "|"; - } - - StringBuilder sb = new StringBuilder() ; - for (Object item : value) { - sb.append(delimiter); - sb.append(parameterToString(item)); - } - - return sb.substring(delimiter.length()); - } - - /** - * Sanitize filename by removing path. - * e.g. ../../sun.gif becomes sun.gif - * - * @param filename The filename to be sanitized - * @return The sanitized filename - */ - public String sanitizeFilename(String filename) { - return filename.replaceAll(".*[/\\\\]", ""); - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * "* / *" is also default to JSON - * @param mime MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public boolean isJsonMime(String mime) { - String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); - } - - /** - * Select the Accept header's value from the given accepts array: - * if JSON exists in the given array, use it; - * otherwise use all of them (joining into a string) - * - * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, - * null will be returned (not to set the Accept header explicitly). - */ - public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) { - return null; - } - for (String accept : accepts) { - if (isJsonMime(accept)) { - return accept; - } - } - return StringUtil.join(accepts, ","); - } - - /** - * Select the Content-Type header's value from the given array: - * if JSON exists in the given array, use it; - * otherwise use the first one of the array. - * - * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, - * returns null. If it matches "any", JSON will be used. - */ - public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0) { - return null; - } - - if (contentTypes[0].equals("*/*")) { - return "application/json"; - } - - for (String contentType : contentTypes) { - if (isJsonMime(contentType)) { - return contentType; - } - } - - return contentTypes[0]; - } - - /** - * Escape the given string to be used as URL query value. - * - * @param str String to be escaped - * @return Escaped string - */ - public String escapeString(String str) { - try { - return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - return str; - } - } - - /** - * Deserialize response body to Java object, according to the return type and - * the Content-Type response header. - * - * @param Type - * @param response HTTP response - * @param returnType The type of the Java object - * @return The deserialized Java object - * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body - * or the Content-Type of the response is not supported. - */ - @SuppressWarnings("unchecked") - public T deserialize(Response response, Type returnType) throws ApiException { - if (response == null || returnType == null) { - return null; - } - - if ("byte[]".equals(returnType.toString())) { - // Handle binary response (byte array). - try { - return (T) response.body().bytes(); - } catch (IOException e) { - throw new ApiException(e); - } - } else if (returnType.equals(File.class)) { - // Handle file downloading. - return (T) downloadFileFromResponse(response); - } - - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { - return null; - } - - String contentType = response.headers().get("Content-Type"); - if (contentType == null) { - // ensuring a default content type - contentType = "application/json"; - } - if (isJsonMime(contentType)) { - return json.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( - "Content type \"" + contentType + "\" is not supported for type: " + returnType, - response.code(), - response.headers().toMultimap(), - respBody); - } - } - - /** - * Serialize the given Java object into request body according to the object's - * class and the request Content-Type. - * - * @param obj The Java object - * @param contentType The request Content-Type - * @return The serialized request body - * @throws org.openapitools.client.ApiException If fail to serialize the given object - */ - public RequestBody serialize(Object obj, String contentType) throws ApiException { - if (obj instanceof byte[]) { - // Binary (byte array) body parameter support. - return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); - } else if (obj instanceof File) { - // File body parameter support. - return RequestBody.create((File) obj, MediaType.parse(contentType)); - } else if (isJsonMime(contentType)) { - String content; - if (obj != null) { - content = json.serialize(obj); - } else { - content = null; - } - return RequestBody.create(content, MediaType.parse(contentType)); - } else { - throw new ApiException("Content type \"" + contentType + "\" is not supported"); - } - } - - /** - * Download file from the given response. - * - * @param response An instance of the Response object - * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk - * @return Downloaded file - */ - public File downloadFileFromResponse(Response response) throws ApiException { - try { - File file = prepareDownloadFile(response); - BufferedSink sink = Okio.buffer(Okio.sink(file)); - sink.writeAll(response.body().source()); - sink.close(); - return file; - } catch (IOException e) { - throw new ApiException(e); - } - } - - /** - * Prepare file for download - * - * @param response An instance of the Response object - * @return Prepared file for the download - * @throws java.io.IOException If fail to prepare file for download - */ - public File prepareDownloadFile(Response response) throws IOException { - String filename = null; - String contentDisposition = response.header("Content-Disposition"); - if (contentDisposition != null && !"".equals(contentDisposition)) { - // Get filename from the Content-Disposition header. - Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); - Matcher matcher = pattern.matcher(contentDisposition); - if (matcher.find()) { - filename = sanitizeFilename(matcher.group(1)); - } - } - - String prefix = null; - String suffix = null; - if (filename == null) { - prefix = "download-"; - suffix = ""; - } else { - int pos = filename.lastIndexOf("."); - if (pos == -1) { - prefix = filename + "-"; - } else { - prefix = filename.substring(0, pos) + "-"; - suffix = filename.substring(pos); - } - // Files.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) - prefix = "download-"; - } - - if (tempFolderPath == null) - return Files.createTempFile(prefix, suffix).toFile(); - else - return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); - } - - /** - * {@link #execute(Call, Type)} - * - * @param Type - * @param call An instance of the Call object - * @return ApiResponse<T> - * @throws org.openapitools.client.ApiException If fail to execute the call - */ - public ApiResponse execute(Call call) throws ApiException { - return execute(call, null); - } - - /** - * Execute HTTP call and deserialize the HTTP response body into the given return type. - * - * @param returnType The return type used to deserialize HTTP response body - * @param The return type corresponding to (same with) returnType - * @param call Call - * @return ApiResponse object containing response status, headers and - * data, which is a Java object deserialized from response body and would be null - * when returnType is null. - * @throws org.openapitools.client.ApiException If fail to execute the call - */ - public ApiResponse execute(Call call, Type returnType) throws ApiException { - try { - Response response = call.execute(); - T data = handleResponse(response, returnType); - return new ApiResponse(response.code(), response.headers().toMultimap(), data); - } catch (IOException e) { - throw new ApiException(e); - } - } - - {{#supportStreaming}} - /** - *

Execute stream.

- * - * @param call a {@link okhttp3.Call} object - * @param returnType a {@link java.lang.reflect.Type} object - * @return a {@link java.io.InputStream} object - * @throws org.openapitools.client.ApiException if any. - */ - public InputStream executeStream(Call call, Type returnType) throws ApiException { - try { - Response response = call.execute(); - if (!response.isSuccessful()) { - throw new ApiException(response.code(), response.message()); - } - if (response.body() == null) { - return null; - } - return response.body().byteStream(); - } catch (IOException e) { - throw new ApiException(e); - } - } - - {{/supportStreaming}} - /** - * {@link #executeAsync(Call, Type, ApiCallback)} - * - * @param Type - * @param call An instance of the Call object - * @param callback ApiCallback<T> - */ - public void executeAsync(Call call, ApiCallback callback) { - executeAsync(call, null, callback); - } - - /** - * Execute HTTP call asynchronously. - * - * @param Type - * @param call The callback to be executed when the API call finishes - * @param returnType Return type - * @param callback ApiCallback - * @see #execute(Call, Type) - */ - @SuppressWarnings("unchecked") - public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { - call.enqueue(new Callback() { - @Override - public void onFailure(Call call, IOException e) { - callback.onFailure(new ApiException(e), 0, null); - } - - @Override - public void onResponse(Call call, Response response) throws IOException { - T result; - try { - result = (T) handleResponse(response, returnType); - } catch (ApiException e) { - callback.onFailure(e, response.code(), response.headers().toMultimap()); - return; - } catch (Exception e) { - callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); - return; - } - callback.onSuccess(result, response.code(), response.headers().toMultimap()); - } - }); - } - - /** - * Handle the given response, return the deserialized object when the response is successful. - * - * @param Type - * @param response Response - * @param returnType Return type - * @return Type - * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or - * fail to deserialize the response body - */ - public T handleResponse(Response response, Type returnType) throws ApiException { - if (response.isSuccessful()) { - if (returnType == null || response.code() == 204) { - // returning null if the returnType is not defined, - // or the status code is 204 (No Content) - if (response.body() != null) { - try { - response.body().close(); - } catch (Exception e) { - throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); - } - } - return null; - } else { - return deserialize(response, returnType); - } - } else { - String respBody = null; - if (response.body() != null) { - try { - respBody = response.body().string(); - } catch (IOException e) { - throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); - } - } - throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); - } - } - - /** - * Build HTTP call with the given options. - * - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param cookieParams The cookie parameters - * @param formParams The form parameters - * @param authNames The authentications to apply - * @param callback Callback for upload/download progress - * @return The HTTP call - * @throws org.openapitools.client.ApiException If fail to serialize the request body object - */ - public Call buildCall(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); - - return httpClient.newCall(request); - } - - /** - * Build an HTTP request with the given options. - * - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param cookieParams The cookie parameters - * @param formParams The form parameters - * @param authNames The authentications to apply - * @param callback Callback for upload/download progress - * @return The HTTP request - * @throws org.openapitools.client.ApiException If fail to serialize the request body object - */ - public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - - final String url = buildUrl(path, queryParams, collectionQueryParams); - - // prepare HTTP request body - RequestBody reqBody; - String contentType = headerParams.get("Content-Type"); - - if (!HttpMethod.permitsRequestBody(method)) { - reqBody = null; - } else if ("application/x-www-form-urlencoded".equals(contentType)) { - reqBody = buildRequestBodyFormEncoding(formParams); - } else if ("multipart/form-data".equals(contentType)) { - reqBody = buildRequestBodyMultipart(formParams); - } else if (body == null) { - if ("DELETE".equals(method)) { - // allow calling DELETE without sending a request body - reqBody = null; - } else { - // use an empty request body (for POST, PUT and PATCH) - reqBody = RequestBody.create("", MediaType.parse(contentType)); - } - } else { - reqBody = serialize(body, contentType); - } - - // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - - final Request.Builder reqBuilder = new Request.Builder().url(url); - processHeaderParams(headerParams, reqBuilder); - processCookieParams(cookieParams, reqBuilder); - - // Associate callback with request (if not null) so interceptor can - // access it when creating ProgressResponseBody - reqBuilder.tag(callback); - - Request request = null; - - if (callback != null && reqBody != null) { - ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); - request = reqBuilder.method(method, progressRequestBody).build(); - } else { - request = reqBuilder.method(method, reqBody).build(); - } - - return request; - } - - /** - * Build full URL by concatenating base path, the given sub path and query parameters. - * - * @param path The sub path - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @return The full URL - */ - public String buildUrl(String path, List queryParams, List collectionQueryParams) { - final StringBuilder url = new StringBuilder(); - url.append(basePath).append(path); - - if (queryParams != null && !queryParams.isEmpty()) { - // support (constant) query string in `path`, e.g. "/posts?draft=1" - String prefix = path.contains("?") ? "&" : "?"; - for (Pair param : queryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - url.append(escapeString(param.getName())).append("=").append(escapeString(value)); - } - } - } - - if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { - String prefix = url.toString().contains("?") ? "&" : "?"; - for (Pair param : collectionQueryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - // collection query parameter value already escaped as part of parameterToPairs - url.append(escapeString(param.getName())).append("=").append(value); - } - } - } - - return url.toString(); - } - - /** - * Set header parameters to the request builder, including default headers. - * - * @param headerParams Header parameters in the form of Map - * @param reqBuilder Request.Builder - */ - public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { - for (Entry param : headerParams.entrySet()) { - reqBuilder.header(param.getKey(), parameterToString(param.getValue())); - } - for (Entry header : defaultHeaderMap.entrySet()) { - if (!headerParams.containsKey(header.getKey())) { - reqBuilder.header(header.getKey(), parameterToString(header.getValue())); - } - } - } - - /** - * Set cookie parameters to the request builder, including default cookies. - * - * @param cookieParams Cookie parameters in the form of Map - * @param reqBuilder Request.Builder - */ - public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { - for (Entry param : cookieParams.entrySet()) { - reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); - } - for (Entry param : defaultCookieMap.entrySet()) { - if (!cookieParams.containsKey(param.getKey())) { - reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); - } - } - } - - /** - * Update query and header parameters based on authentication settings. - * - * @param authNames The authentications to apply - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - * @param cookieParams Map of cookie parameters - * @param payload HTTP request body - * @param method HTTP method - * @param uri URI - * @throws org.openapitools.client.ApiException If fails to update the parameters - */ - public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, - Map cookieParams, String payload, String method, URI uri) throws ApiException { - for (String authName : authNames) { - Authentication auth = authentications.get(authName); - if (auth == null) { - throw new RuntimeException("Authentication undefined: " + authName); - } - auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); - } - } - - /** - * Build a form-encoding request body with the given form parameters. - * - * @param formParams Form parameters in the form of Map - * @return RequestBody - */ - public RequestBody buildRequestBodyFormEncoding(Map formParams) { - okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); - for (Entry param : formParams.entrySet()) { - formBuilder.add(param.getKey(), parameterToString(param.getValue())); - } - return formBuilder.build(); - } - - /** - * Build a multipart (file uploading) request body with the given form parameters, - * which could contain text fields and file fields. - * - * @param formParams Form parameters in the form of Map - * @return RequestBody - */ - public RequestBody buildRequestBodyMultipart(Map formParams) { - MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); - for (Entry param : formParams.entrySet()) { - if (param.getValue() instanceof File) { - File file = (File) param.getValue(); - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); - MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); - mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); - } else { - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); - mpBuilder.addPart(partHeaders, RequestBody.create(parameterToString(param.getValue()), null)); - } - } - return mpBuilder.build(); - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - public String guessContentTypeFromFile(File file) { - String contentType = URLConnection.guessContentTypeFromName(file.getName()); - if (contentType == null) { - return "application/octet-stream"; - } else { - return contentType; - } - } - - /** - * Get network interceptor to add it to the httpClient to track download progress for - * async requests. - */ - private Interceptor getProgressInterceptor() { - return new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - final Request request = chain.request(); - final Response originalResponse = chain.proceed(request); - if (request.tag() instanceof ApiCallback) { - final ApiCallback callback = (ApiCallback) request.tag(); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), callback)) - .build(); - } - return originalResponse; - } - }; - } - - /** - * Apply SSL related settings to httpClient according to the current values of - * verifyingSsl and sslCaCert. - */ - private void applySslSettings() { - try { - TrustManager[] trustManagers; - HostnameVerifier hostnameVerifier; - if (!verifyingSsl) { - trustManagers = new TrustManager[]{ - new X509TrustManager() { - @Override - public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { - } - - @Override - public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { - } - - @Override - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return new java.security.cert.X509Certificate[]{}; - } - } - }; - hostnameVerifier = new HostnameVerifier() { - @Override - public boolean verify(String hostname, SSLSession session) { - return true; - } - }; - } else { - TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - - if (sslCaCert == null) { - trustManagerFactory.init((KeyStore) null); - } else { - char[] password = null; // Any password will work. - CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); - Collection certificates = certificateFactory.generateCertificates(sslCaCert); - if (certificates.isEmpty()) { - throw new IllegalArgumentException("expected non-empty set of trusted certificates"); - } - KeyStore caKeyStore = newEmptyKeyStore(password); - int index = 0; - for (Certificate certificate : certificates) { - String certificateAlias = "ca" + Integer.toString(index++); - caKeyStore.setCertificateEntry(certificateAlias, certificate); - } - trustManagerFactory.init(caKeyStore); - } - trustManagers = trustManagerFactory.getTrustManagers(); - hostnameVerifier = OkHostnameVerifier.INSTANCE; - } - - SSLContext sslContext = SSLContext.getInstance("TLS"); - sslContext.init(keyManagers, trustManagers, new SecureRandom()); - httpClient = httpClient.newBuilder() - .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) - .hostnameVerifier(hostnameVerifier) - .build(); - } catch (GeneralSecurityException e) { - throw new RuntimeException(e); - } - } - - private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { - try { - KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); - keyStore.load(null, password); - return keyStore; - } catch (IOException e) { - throw new AssertionError(e); - } - } - {{#dynamicOperations}} - - public ApiClient createOperationLookupMap(OpenAPI openAPI) { - operationLookupMap = new HashMap<>(); - for (Map.Entry pathItemEntry : openAPI.getPaths().entrySet()) { - String path = pathItemEntry.getKey(); - PathItem pathItem = pathItemEntry.getValue(); - addOperationLookupEntry(path, "GET", pathItem.getGet()); - addOperationLookupEntry(path, "PUT", pathItem.getPut()); - addOperationLookupEntry(path, "POST", pathItem.getPost()); - addOperationLookupEntry(path, "DELETE", pathItem.getDelete()); - addOperationLookupEntry(path, "OPTIONS", pathItem.getOptions()); - addOperationLookupEntry(path, "HEAD", pathItem.getHead()); - addOperationLookupEntry(path, "PATCH", pathItem.getPatch()); - addOperationLookupEntry(path, "TRACE", pathItem.getTrace()); - } - return this; - } - - private void addOperationLookupEntry(String path, String method, Operation operation) { - if ( operation != null && operation.getOperationId() != null) { - operationLookupMap.put( - operation.getOperationId(), - new ApiOperation(path, method, operation)); - } - } - - public Map getOperationLookupMap() { - return operationLookupMap; - } - - public String fillParametersFromOperation( - Operation operation, - Map paramMap, - String path, - List queryParams, - List collectionQueryParams, - Map headerParams, - Map cookieParams - ) { - for (Map.Entry entry : paramMap.entrySet()) { - Object value = entry.getValue(); - for (Parameter param : operation.getParameters()) { - if (entry.getKey().equals(param.getName())) { - switch (param.getIn()) { - case "path": - path = path.replaceAll("\\{" + param.getName() + "\\}", escapeString(value.toString())); - break; - case "query": - if (value instanceof Collection) { - collectionQueryParams.addAll(parameterToPairs(param, (Collection) value)); - } else { - queryParams.addAll(parameterToPair(param.getName(), value)); - } - break; - case "header": - headerParams.put(param.getName(), parameterToString(value)); - break; - case "cookie": - cookieParams.put(param.getName(), parameterToString(value)); - break; - default: - throw new IllegalStateException("Unexpected param in: " + param.getIn()); - } - - } - } - } - return path; - } - {{/dynamicOperations}} - - /** - * Convert the HTTP request body to a string. - * - * @param request The HTTP request object - * @return The string representation of the HTTP request body - * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string - */ - private String requestBodyToString(RequestBody requestBody) throws ApiException { - if (requestBody != null) { - try { - final Buffer buffer = new Buffer(); - requestBody.writeTo(buffer); - return buffer.readUtf8(); - } catch (final IOException e) { - throw new ApiException(e); - } - } - - // empty http request body - return ""; - } -} diff --git a/templates/libraries/okhttp-gson-nextgen/GzipRequestInterceptor.mustache b/templates/libraries/okhttp-gson-nextgen/GzipRequestInterceptor.mustache deleted file mode 100644 index b633aa8..0000000 --- a/templates/libraries/okhttp-gson-nextgen/GzipRequestInterceptor.mustache +++ /dev/null @@ -1,74 +0,0 @@ -{{>licenseInfo}} - -package {{invokerPackage}}; - -import okhttp3.*; -import okio.Buffer; -import okio.BufferedSink; -import okio.GzipSink; -import okio.Okio; - -import java.io.IOException; - -/** - * Encodes request bodies using gzip. - * - * Taken from https://github.com/square/okhttp/issues/350 - */ -class GzipRequestInterceptor implements Interceptor { - @Override - public Response intercept(Chain chain) throws IOException { - Request originalRequest = chain.request(); - if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { - return chain.proceed(originalRequest); - } - - Request compressedRequest = originalRequest.newBuilder() - .header("Content-Encoding", "gzip") - .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) - .build(); - return chain.proceed(compressedRequest); - } - - private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { - final Buffer buffer = new Buffer(); - requestBody.writeTo(buffer); - return new RequestBody() { - @Override - public MediaType contentType() { - return requestBody.contentType(); - } - - @Override - public long contentLength() { - return buffer.size(); - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - sink.write(buffer.snapshot()); - } - }; - } - - private RequestBody gzip(final RequestBody body) { - return new RequestBody() { - @Override - public MediaType contentType() { - return body.contentType(); - } - - @Override - public long contentLength() { - return -1; // We don't know the compressed length in advance! - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); - body.writeTo(gzipSink); - gzipSink.close(); - } - }; - } -} diff --git a/templates/libraries/okhttp-gson-nextgen/ProgressRequestBody.mustache b/templates/libraries/okhttp-gson-nextgen/ProgressRequestBody.mustache deleted file mode 100644 index 71e1e2b..0000000 --- a/templates/libraries/okhttp-gson-nextgen/ProgressRequestBody.mustache +++ /dev/null @@ -1,62 +0,0 @@ -{{>licenseInfo}} - -package {{invokerPackage}}; - -import okhttp3.MediaType; -import okhttp3.RequestBody; - -import java.io.IOException; - -import okio.Buffer; -import okio.BufferedSink; -import okio.ForwardingSink; -import okio.Okio; -import okio.Sink; - -public class ProgressRequestBody extends RequestBody { - - private final RequestBody requestBody; - - private final ApiCallback callback; - - public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { - this.requestBody = requestBody; - this.callback = callback; - } - - @Override - public MediaType contentType() { - return requestBody.contentType(); - } - - @Override - public long contentLength() throws IOException { - return requestBody.contentLength(); - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - BufferedSink bufferedSink = Okio.buffer(sink(sink)); - requestBody.writeTo(bufferedSink); - bufferedSink.flush(); - } - - private Sink sink(Sink sink) { - return new ForwardingSink(sink) { - - long bytesWritten = 0L; - long contentLength = 0L; - - @Override - public void write(Buffer source, long byteCount) throws IOException { - super.write(source, byteCount); - if (contentLength == 0) { - contentLength = contentLength(); - } - - bytesWritten += byteCount; - callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); - } - }; - } -} diff --git a/templates/libraries/okhttp-gson-nextgen/ProgressResponseBody.mustache b/templates/libraries/okhttp-gson-nextgen/ProgressResponseBody.mustache deleted file mode 100644 index 4511594..0000000 --- a/templates/libraries/okhttp-gson-nextgen/ProgressResponseBody.mustache +++ /dev/null @@ -1,59 +0,0 @@ -{{>licenseInfo}} - -package {{invokerPackage}}; - -import okhttp3.MediaType; -import okhttp3.ResponseBody; - -import java.io.IOException; - -import okio.Buffer; -import okio.BufferedSource; -import okio.ForwardingSource; -import okio.Okio; -import okio.Source; - -public class ProgressResponseBody extends ResponseBody { - - private final ResponseBody responseBody; - private final ApiCallback callback; - private BufferedSource bufferedSource; - - public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { - this.responseBody = responseBody; - this.callback = callback; - } - - @Override - public MediaType contentType() { - return responseBody.contentType(); - } - - @Override - public long contentLength() { - return responseBody.contentLength(); - } - - @Override - public BufferedSource source() { - if (bufferedSource == null) { - bufferedSource = Okio.buffer(source(responseBody.source())); - } - return bufferedSource; - } - - private Source source(Source source) { - return new ForwardingSource(source) { - long totalBytesRead = 0L; - - @Override - public long read(Buffer sink, long byteCount) throws IOException { - long bytesRead = super.read(sink, byteCount); - // read() returns the number of bytes read, or -1 if this source is exhausted. - totalBytesRead += bytesRead != -1 ? bytesRead : 0; - callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); - return bytesRead; - } - }; - } -} diff --git a/templates/libraries/okhttp-gson-nextgen/README.mustache b/templates/libraries/okhttp-gson-nextgen/README.mustache deleted file mode 100644 index a1a142b..0000000 --- a/templates/libraries/okhttp-gson-nextgen/README.mustache +++ /dev/null @@ -1,183 +0,0 @@ -# {{artifactId}} - -{{appName}} -- API version: {{appVersion}} -{{^hideGenerationTimestamp}} - - Build date: {{generatedDate}} -{{/hideGenerationTimestamp}} - -{{{appDescriptionWithNewLines}}} - -{{#infoUrl}} - For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) -{{/infoUrl}} - -*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* - - -## Requirements - -Building the API client library requires: -1. Java {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}+ -2. Maven (3.8.3+)/Gradle (7.2+) - -## Installation - -To install the API client library to your local Maven repository, simply execute: - -```shell -mvn clean install -``` - -To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: - -```shell -mvn clean deploy -``` - -Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. - -### Maven users - -Add this dependency to your project's POM: - -```xml - - {{{groupId}}} - {{{artifactId}}} - {{{artifactVersion}}} - compile - -``` - -### Gradle users - -Add this dependency to your project's build file: - -```groovy - repositories { - mavenCentral() // Needed if the '{{{artifactId}}}' jar has been published to maven central. - mavenLocal() // Needed if the '{{{artifactId}}}' jar has been published to the local maven repo. - } - - dependencies { - implementation "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" - } -``` - -### Others - -At first generate the JAR by executing: - -```shell -mvn clean package -``` - -Then manually install the following JARs: - -* `target/{{{artifactId}}}-{{{artifactVersion}}}.jar` -* `target/lib/*.jar` - -## Getting Started - -Please follow the [installation](#installation) instruction and execute the following Java code: - -```java -{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} -// Import classes: -import {{{invokerPackage}}}.ApiClient; -import {{{invokerPackage}}}.ApiException; -import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}} -import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}} -import {{{invokerPackage}}}.models.*; -import {{{package}}}.{{{classname}}}; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("{{{basePath}}}"); - {{#hasAuthMethods}} - {{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - // Configure HTTP basic authorization: {{{name}}} - HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setUsername("YOUR USERNAME"); - {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}} - // Configure HTTP bearer authorization: {{{name}}} - HttpBearerAuth {{{name}}} = (HttpBearerAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} - // Configure API key authorization: {{{name}}} - ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} - // Configure OAuth2 access token for authorization: {{{name}}} - OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}} - {{/authMethods}} - {{/hasAuthMethods}} - - {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); - {{#allParams}} - {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} - {{/allParams}} - try { - {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} - .{{{paramName}}}({{{paramName}}}){{/optionalParams}} - .execute();{{/vendorExtensions.x-group-parameters}}{{#returnType}} - System.out.println(result);{{/returnType}} - } catch (ApiException e) { - System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} -``` - -## Documentation for API Endpoints - -All URIs are relative to *{{basePath}}* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} -{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} - -## Documentation for Models - -{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md) -{{/model}}{{/models}} - -## Documentation for Authorization - -{{^authMethods}}All endpoints do not require authorization. -{{/authMethods}}Authentication schemes defined for the API: -{{#authMethods}}### {{name}} - -{{#isApiKey}}- **Type**: API key -- **API key parameter name**: {{keyParamName}} -- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} -{{/isApiKey}} -{{#isBasic}}- **Type**: HTTP basic authentication -{{/isBasic}} -{{#isOAuth}}- **Type**: OAuth -- **Flow**: {{flow}} -- **Authorization URL**: {{authorizationUrl}} -- **Scopes**: {{^scopes}}N/A{{/scopes}} -{{#scopes}} - {{scope}}: {{description}} -{{/scopes}} -{{/isOAuth}} - -{{/authMethods}} - -## Recommendation - -It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. - -## Author - -{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} -{{/-last}}{{/apis}}{{/apiInfo}} diff --git a/templates/libraries/okhttp-gson-nextgen/anyof_model.mustache b/templates/libraries/okhttp-gson-nextgen/anyof_model.mustache deleted file mode 100644 index fae56fd..0000000 --- a/templates/libraries/okhttp-gson-nextgen/anyof_model.mustache +++ /dev/null @@ -1,236 +0,0 @@ -import javax.ws.rs.core.GenericType; - -import java.io.IOException; -import java.lang.reflect.Type; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.HashMap; -import java.util.Map; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.JsonPrimitive; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; - -import {{invokerPackage}}.JSON; - -{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} -public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} { - private static final Logger log = Logger.getLogger({{classname}}.class.getName()); - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!{{classname}}.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes '{{classname}}' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - {{#anyOf}} - final TypeAdapter<{{.}}> adapter{{.}} = gson.getDelegateAdapter(this, TypeToken.get({{.}}.class)); - {{/anyOf}} - - return (TypeAdapter) new TypeAdapter<{{classname}}>() { - @Override - public void write(JsonWriter out, {{classname}} value) throws IOException { - if (value == null || value.getActualInstance() == null) { - elementAdapter.write(out, null); - return; - } - - {{#anyOf}} - // check if the actual instance is of the type `{{.}}` - if (value.getActualInstance() instanceof {{.}}) { - JsonObject obj = adapter{{.}}.toJsonTree(({{.}})value.getActualInstance()).getAsJsonObject(); - elementAdapter.write(out, obj); - return; - } - - {{/anyOf}} - throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}"); - } - - @Override - public {{classname}} read(JsonReader in) throws IOException { - Object deserialized = null; - JsonObject jsonObject = elementAdapter.read(in).getAsJsonObject(); - - {{#useOneOfDiscriminatorLookup}} - {{#discriminator}} - // use discriminator value for faster anyOf lookup - {{classname}} new{{classname}} = new {{classname}}(); - String discriminatorValue = elementAdapter.read(in).getAsJsonObject().get("{{{propertyBaseName}}}").getAsString(); - switch (discriminatorValue) { - {{#mappedModels}} - case "{{{mappingName}}}": - deserialized = adapter{{modelName}}.fromJsonTree(jsonObject); - new{{classname}}.setActualInstance(deserialized); - return new{{classname}}; - {{/mappedModels}} - default: - log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", discriminatorValue)); - } - - {{/discriminator}} - {{/useOneOfDiscriminatorLookup}} - {{#anyOf}} - // deserialize {{{.}}} - try { - // validate the JSON object to see if any excpetion is thrown - {{.}}.validateJsonObject(jsonObject); - log.log(Level.FINER, "Input data matches schema '{{{.}}}'"); - {{classname}} ret = new {{classname}}(); - ret.setActualInstance(adapter{{.}}.fromJsonTree(jsonObject)); - return ret; - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema '{{{.}}}'", e); - } - - {{/anyOf}} - - throw new IOException(String.format("Failed deserialization for {{classname}}: no class matched. JSON: %s", jsonObject.toString())); - } - }.nullSafe(); - } - } - - // store a list of schema names defined in anyOf - public static final Map schemas = new HashMap(); - - public {{classname}}() { - super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); - } - - {{#anyOf}} - public {{classname}}({{{.}}} o) { - super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); - setActualInstance(o); - } - - {{/anyOf}} - static { - {{#anyOf}} - schemas.put("{{{.}}}", new GenericType<{{{.}}}>() { - }); - {{/anyOf}} - } - - @Override - public Map getSchemas() { - return {{classname}}.schemas; - } - - /** - * Set the instance that matches the anyOf child schema, check - * the instance parameter is valid against the anyOf child schemas: - * {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}} - * - * It could be an instance of the 'anyOf' schemas. - * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). - */ - @Override - public void setActualInstance(Object instance) { - {{#isNullable}} - if (instance == null) { - super.setActualInstance(instance); - return; - } - - {{/isNullable}} - {{#anyOf}} - if (instance instanceof {{{.}}}) { - super.setActualInstance(instance); - return; - } - - {{/anyOf}} - throw new RuntimeException("Invalid instance type. Must be {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}"); - } - - /** - * Get the actual instance, which can be the following: - * {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}} - * - * @return The actual instance ({{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}) - */ - @Override - public Object getActualInstance() { - return super.getActualInstance(); - } - - {{#anyOf}} - /** - * Get the actual instance of `{{{.}}}`. If the actual instance is not `{{{.}}}`, - * the ClassCastException will be thrown. - * - * @return The actual instance of `{{{.}}}` - * @throws ClassCastException if the instance is not `{{{.}}}` - */ - public {{{.}}} get{{{.}}}() throws ClassCastException { - return ({{{.}}})super.getActualInstance(); - } - - {{/anyOf}} - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to {{classname}} - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - // validate anyOf schemas one by one - int validCount = 0; - {{#anyOf}} - // validate the json string with {{{.}}} - try { - {{{.}}}.validateJsonObject(jsonObj); - return; // return earlier as at least one schema is valid with respect to the Json object - //validCount++; - } catch (Exception e) { - // continue to the next one - } - {{/anyOf}} - if (validCount == 0) { - throw new IOException(String.format("The JSON string is invalid for {{classname}} with anyOf schemas: {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}. JSON: %s", jsonObj.toString())); - } - } - - /** - * Create an instance of {{classname}} given an JSON string - * - * @param jsonString JSON string - * @return An instance of {{classname}} - * @throws IOException if the JSON string is invalid with respect to {{classname}} - */ - public static {{{classname}}} fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, {{{classname}}}.class); - } - - /** - * Convert an instance of {{classname}} to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} diff --git a/templates/libraries/okhttp-gson-nextgen/api.mustache b/templates/libraries/okhttp-gson-nextgen/api.mustache deleted file mode 100644 index 943e694..0000000 --- a/templates/libraries/okhttp-gson-nextgen/api.mustache +++ /dev/null @@ -1,520 +0,0 @@ -{{>licenseInfo}} - -package {{package}}; - -import {{invokerPackage}}.ApiCallback; -import {{invokerPackage}}.ApiClient; -import {{invokerPackage}}.ApiException; -{{#dynamicOperations}} -import {{invokerPackage}}.ApiOperation; -{{/dynamicOperations}} -import {{invokerPackage}}.ApiResponse; -import {{invokerPackage}}.Configuration; -import {{invokerPackage}}.Pair; -import {{invokerPackage}}.ProgressRequestBody; -import {{invokerPackage}}.ProgressResponseBody; -{{#performBeanValidation}} -import {{invokerPackage}}.BeanValidationException; -{{/performBeanValidation}} - -import com.google.gson.reflect.TypeToken; -{{#dynamicOperations}} -import io.swagger.v3.oas.models.Operation; -import io.swagger.v3.oas.models.parameters.Parameter; -{{/dynamicOperations}} - -import java.io.IOException; - -{{#useBeanValidation}} -import javax.validation.constraints.*; -{{/useBeanValidation}} -{{#performBeanValidation}} -import javax.validation.ConstraintViolation; -import javax.validation.Validation; -import javax.validation.ValidatorFactory; -import javax.validation.executable.ExecutableValidator; -import java.util.Set; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -{{/performBeanValidation}} - -{{#imports}}import {{import}}; -{{/imports}} - -import java.lang.reflect.Type; -{{^fullJavaUtil}} -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -{{#supportStreaming}} -import java.io.InputStream; -{{/supportStreaming}} -{{/fullJavaUtil}} -import javax.ws.rs.core.GenericType; - -{{#operations}} -public class {{classname}} { - private ApiClient localVarApiClient; - - public {{classname}}() { - this(Configuration.getDefaultApiClient()); - } - - public {{classname}}(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public ApiClient getApiClient() { - return localVarApiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - {{#operation}} - {{^vendorExtensions.x-group-parameters}}/** - * Build call for {{operationId}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - {{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation - {{/externalDocs}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { - Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; - - // create path and map variables - {{^dynamicOperations}} - String localVarPath = "{{{path}}}"{{#pathParams}} - .replaceAll("\\{" + "{{baseName}}" + "\\}", localVarApiClient.escapeString({{#collectionFormat}}localVarApiClient.collectionPathParameterToString("{{{collectionFormat}}}", {{{paramName}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}.toString(){{/collectionFormat}})){{/pathParams}}; - {{/dynamicOperations}} - {{#dynamicOperations}} - ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("{{{operationId}}}"); - if (apiOperation == null) { - throw new ApiException("Operation not found in OAS"); - } - Operation operation = apiOperation.getOperation(); - String localVarPath = apiOperation.getPath(); - Map paramMap = new HashMap<>(); - {{#allParams}} - {{^isFormParam}} - {{^isBodyParam}} - paramMap.put("{{baseName}}", {{paramName}}); - {{/isBodyParam}} - {{/isFormParam}} - {{/allParams}} - {{/dynamicOperations}} - - {{javaUtilPrefix}}List localVarQueryParams = new {{javaUtilPrefix}}ArrayList(); - {{javaUtilPrefix}}List localVarCollectionQueryParams = new {{javaUtilPrefix}}ArrayList(); - {{javaUtilPrefix}}Map localVarHeaderParams = new {{javaUtilPrefix}}HashMap(); - {{javaUtilPrefix}}Map localVarCookieParams = new {{javaUtilPrefix}}HashMap(); - {{javaUtilPrefix}}Map localVarFormParams = new {{javaUtilPrefix}}HashMap(); - - {{#formParams}} - if ({{paramName}} != null) { - localVarFormParams.put("{{baseName}}", {{paramName}}); - } - - {{/formParams}} - {{^dynamicOperations}} - {{#queryParams}} - if ({{paramName}} != null) { - {{#collectionFormat}}localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("{{{.}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(localVarApiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); - } - - {{/queryParams}} - {{#headerParams}} - if ({{paramName}} != null) { - localVarHeaderParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); - } - - {{/headerParams}} - {{#cookieParams}} - if ({{paramName}} != null) { - localVarCookieParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); - } - - {{/cookieParams}} - {{/dynamicOperations}} - {{#dynamicOperations}} - localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); - - {{/dynamicOperations}} - final String[] localVarAccepts = { - {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; - return localVarApiClient.buildCall(localVarPath, {{^dynamicOperations}}"{{httpMethod}}"{{/dynamicOperations}}{{#dynamicOperations}}apiOperation.getMethod(){{/dynamicOperations}}, localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - @SuppressWarnings("rawtypes") - private okhttp3.Call {{operationId}}ValidateBeforeCall({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { - {{^performBeanValidation}} - {{#allParams}}{{#required}} - // verify the required parameter '{{paramName}}' is set - if ({{paramName}} == null) { - throw new ApiException("Missing the required parameter '{{paramName}}' when calling {{operationId}}(Async)"); - } - {{/required}}{{/allParams}} - - okhttp3.Call localVarCall = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); - return localVarCall; - - {{/performBeanValidation}} - {{#performBeanValidation}} - try { - ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); - ExecutableValidator executableValidator = factory.getValidator().forExecutables(); - - Object[] parameterValues = { {{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }; - Method method = this.getClass().getMethod("{{operationId}}WithHttpInfo"{{#allParams}}, {{#isArray}}java.util.List{{/isArray}}{{#isMap}}java.util.Map{{/isMap}}{{^isArray}}{{^isMap}}{{{dataType}}}{{/isMap}}{{/isArray}}.class{{/allParams}}); - Set> violations = executableValidator.validateParameters(this, method, - parameterValues); - - if (violations.size() == 0) { - okhttp3.Call localVarCall = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); - return localVarCall; - - } else { - throw new BeanValidationException((Set) violations); - } - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new ApiException(e.getMessage()); - } catch (SecurityException e) { - e.printStackTrace(); - throw new ApiException(e.getMessage()); - } - - {{/performBeanValidation}} - } - - {{^vendorExtensions.x-group-parameters}} - /** - * {{summary}} - * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}{{#returnType}} - * @return {{.}}{{/returnType}} - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - {{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation - {{/externalDocs}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - {{#vendorExtensions.x-streaming}} - public {{#returnType}}InputStream {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { - {{#returnType}}InputStream localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} - return localVarResp;{{/returnType}} - } - {{/vendorExtensions.x-streaming}} - {{^vendorExtensions.x-streaming}} - public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { - {{#returnType}}ApiResponse<{{{.}}}> localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} - return localVarResp.getData();{{/returnType}} - } - {{/vendorExtensions.x-streaming}} - {{/vendorExtensions.x-group-parameters}} - - {{^vendorExtensions.x-group-parameters}}/** - * {{summary}} - * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} - * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - {{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation - {{/externalDocs}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-streaming}} InputStream {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { - okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); - {{#returnType}} - try { - Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); - return localVarApiClient.executeStream(localVarCall, localVarReturnType); - } catch (ApiException e) { - e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<{{{errorObjectType}}}{{^errorObjectType}}{{{returnType}}}{{/errorObjectType}}>(){}.getType())); - e.setErrorObjectType(new GenericType<{{{errorObjectType}}}{{^errorObjectType}}{{{returnType}}}{{/errorObjectType}}>(){}); - throw e; - } - {{/returnType}} - } - {{/vendorExtensions.x-streaming}}{{^vendorExtensions.x-streaming}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { - okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); - {{^returnType}} - return localVarApiClient.execute(localVarCall); - {{/returnType}} - {{#returnType}} - try { - Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } catch (ApiException e) { - e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<{{{errorObjectType}}}{{^errorObjectType}}{{{returnType}}}{{/errorObjectType}}>(){}.getType())); - e.setErrorObjectType(new GenericType<{{{errorObjectType}}}{{^errorObjectType}}{{{returnType}}}{{/errorObjectType}}>(){}); - throw e; - } - {{/returnType}} - } - {{/vendorExtensions.x-streaming}} - - {{^vendorExtensions.x-group-parameters}}/** - * {{summary}} (asynchronously) - * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - {{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation - {{/externalDocs}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> _callback) throws ApiException { - - okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}_callback); - {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);{{/returnType}}{{^returnType}}localVarApiClient.executeAsync(localVarCall, _callback);{{/returnType}} - return localVarCall; - } - {{#vendorExtensions.x-group-parameters}} - - public class API{{operationId}}Request { - {{#requiredParams}} - private final {{{dataType}}} {{paramName}}; - {{/requiredParams}} - {{#optionalParams}} - private {{{dataType}}} {{paramName}}; - {{/optionalParams}} - - private API{{operationId}}Request({{#requiredParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) { - {{#requiredParams}} - this.{{paramName}} = {{paramName}}; - {{/requiredParams}} - } - - {{#optionalParams}} - /** - * Set {{paramName}} - * @param {{paramName}} {{description}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}) - * @return API{{operationId}}Request - */ - public API{{operationId}}Request {{paramName}}({{{dataType}}} {{paramName}}) { - this.{{paramName}} = {{paramName}}; - return this; - } - - {{/optionalParams}} - /** - * Build call for {{operationId}} - * @param _callback ApiCallback API callback - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { - return {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); - } - - /** - * Execute {{operationId}} request{{#returnType}} - * @return {{.}}{{/returnType}} - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public {{{returnType}}}{{^returnType}}void{{/returnType}} execute() throws ApiException { - {{#returnType}}ApiResponse<{{{.}}}> localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} - return localVarResp.getData();{{/returnType}} - } - - /** - * Execute {{operationId}} request with HTTP info returned - * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException { - return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); - } - - /** - * Execute {{operationId}} request (asynchronously) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public okhttp3.Call executeAsync(final ApiCallback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> _callback) throws ApiException { - return {{operationId}}Async({{#allParams}}{{paramName}}, {{/allParams}}_callback); - } - } - - /** - * {{summary}} - * {{notes}}{{#requiredParams}} - * @param {{paramName}} {{description}} (required){{/requiredParams}} - * @return API{{operationId}}Request - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - {{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation - {{/externalDocs}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public API{{operationId}}Request {{operationId}}({{#requiredParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) { - return new API{{operationId}}Request({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}); - } - {{/vendorExtensions.x-group-parameters}} - {{/operation}} -} -{{/operations}} diff --git a/templates/libraries/okhttp-gson-nextgen/api_doc.mustache b/templates/libraries/okhttp-gson-nextgen/api_doc.mustache deleted file mode 100644 index 616ad65..0000000 --- a/templates/libraries/okhttp-gson-nextgen/api_doc.mustache +++ /dev/null @@ -1,118 +0,0 @@ -# {{classname}}{{#description}} -{{.}}{{/description}} - -All URIs are relative to *{{basePath}}* - -Method | HTTP request | Description -------------- | ------------- | ------------- -{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} -{{/operation}}{{/operations}} - -{{#operations}} -{{#operation}} - -# **{{operationId}}**{{^vendorExtensions.x-group-parameters}} -> {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}){{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}} -> {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}}.{{paramName}}({{paramName}}){{/optionalParams}}.execute();{{/vendorExtensions.x-group-parameters}} - -{{summary}}{{#notes}} - -{{.}}{{/notes}} - -### Example -```java -// Import classes: -import {{{invokerPackage}}}.ApiClient; -import {{{invokerPackage}}}.ApiException; -import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}} -import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}} -import {{{invokerPackage}}}.models.*; -import {{{package}}}.{{{classname}}}; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("{{{basePath}}}"); - {{#hasAuthMethods}} - {{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - // Configure HTTP basic authorization: {{{name}}} - HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setUsername("YOUR USERNAME"); - {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}} - // Configure HTTP bearer authorization: {{{name}}} - HttpBearerAuth {{{name}}} = (HttpBearerAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} - // Configure API key authorization: {{{name}}} - ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} - // Configure OAuth2 access token for authorization: {{{name}}} - OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}} - {{/authMethods}} - {{/hasAuthMethods}} - - {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); - {{#allParams}} - {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} - {{/allParams}} - try { - {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} - .{{{paramName}}}({{{paramName}}}){{/optionalParams}} - .execute();{{/vendorExtensions.x-group-parameters}}{{#returnType}} - System.out.println(result);{{/returnType}} - } catch (ApiException e) { - {{=< >=}} - <#errorObjectSubtype> - <^-first>} else if (e.getErrorObject() instanceof <&.>) { - // do something here - <#-last> - } else { - // something else happened - System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - - - <={{ }}=> - - } - } -} -``` - -### Parameters -{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} -Name | Type | Description | Notes -------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} -{{/allParams}} - -### Return type - -{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}null (empty response body){{/returnType}} - -### Authorization - -{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}} - -### HTTP request headers - - - **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} - - **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} - -{{#responses.0}} -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -{{#responses}} -**{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}} | -{{/responses}} -{{/responses.0}} - -{{/operation}} -{{/operations}} diff --git a/templates/libraries/okhttp-gson-nextgen/api_test.mustache b/templates/libraries/okhttp-gson-nextgen/api_test.mustache deleted file mode 100644 index 98a30a6..0000000 --- a/templates/libraries/okhttp-gson-nextgen/api_test.mustache +++ /dev/null @@ -1,56 +0,0 @@ -{{>licenseInfo}} - -package {{package}}; - -import {{invokerPackage}}.ApiException; -{{#imports}}import {{import}}; -{{/imports}} -import org.junit.Test; -import org.junit.Ignore; - -{{^fullJavaUtil}} -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -{{#supportStreaming}} -import java.io.InputStream; -{{/supportStreaming}} -{{/fullJavaUtil}} - -/** - * API tests for {{classname}} - */ -@Ignore -public class {{classname}}Test { - - private final {{classname}} api = new {{classname}}(); - - {{#operations}}{{#operation}} - /** - * {{summary}} - * - * {{notes}} - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void {{operationId}}Test() throws ApiException { - {{#allParams}} - {{{dataType}}} {{paramName}} = null; - {{/allParams}} - {{#vendorExtensions.x-streaming}} - InputStream response = api.{{operationId}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} - .{{paramName}}({{paramName}}){{/optionalParams}} - .execute();{{/vendorExtensions.x-group-parameters}} - {{/vendorExtensions.x-streaming}} - {{^vendorExtensions.x-streaming}} - {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} - .{{paramName}}({{paramName}}){{/optionalParams}} - .execute();{{/vendorExtensions.x-group-parameters}} - {{/vendorExtensions.x-streaming}} - // TODO: test validations - } - {{/operation}}{{/operations}} -} diff --git a/templates/libraries/okhttp-gson-nextgen/auth/HttpBasicAuth.mustache b/templates/libraries/okhttp-gson-nextgen/auth/HttpBasicAuth.mustache deleted file mode 100644 index 417a89e..0000000 --- a/templates/libraries/okhttp-gson-nextgen/auth/HttpBasicAuth.mustache +++ /dev/null @@ -1,46 +0,0 @@ -{{>licenseInfo}} - -package {{invokerPackage}}.auth; - -import {{invokerPackage}}.Pair; -import {{invokerPackage}}.ApiException; - -import okhttp3.Credentials; - -import java.net.URI; -import java.util.Map; -import java.util.List; - -import java.io.UnsupportedEncodingException; - -public class HttpBasicAuth implements Authentication { - private String username; - private String password; - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams, - String payload, String method, URI uri) throws ApiException { - if (username == null && password == null) { - return; - } - headerParams.put("Authorization", Credentials.basic( - username == null ? "" : username, - password == null ? "" : password)); - } -} diff --git a/templates/libraries/okhttp-gson-nextgen/auth/OAuth.mustache b/templates/libraries/okhttp-gson-nextgen/auth/OAuth.mustache deleted file mode 100644 index 34d3598..0000000 --- a/templates/libraries/okhttp-gson-nextgen/auth/OAuth.mustache +++ /dev/null @@ -1,31 +0,0 @@ -{{>licenseInfo}} - -package {{invokerPackage}}.auth; - -import {{invokerPackage}}.Pair; -import {{invokerPackage}}.ApiException; - -import java.net.URI; -import java.util.Map; -import java.util.List; - -{{>generatedAnnotation}} -public class OAuth implements Authentication { - private String accessToken; - - public String getAccessToken() { - return accessToken; - } - - public void setAccessToken(String accessToken) { - this.accessToken = accessToken; - } - - @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams, - String payload, String method, URI uri) throws ApiException { - if (accessToken != null) { - headerParams.put("Authorization", "Bearer " + accessToken); - } - } -} diff --git a/templates/libraries/okhttp-gson-nextgen/auth/OAuthOkHttpClient.mustache b/templates/libraries/okhttp-gson-nextgen/auth/OAuthOkHttpClient.mustache deleted file mode 100644 index cb0e825..0000000 --- a/templates/libraries/okhttp-gson-nextgen/auth/OAuthOkHttpClient.mustache +++ /dev/null @@ -1,70 +0,0 @@ -{{#hasOAuthMethods}} -package {{invokerPackage}}.auth; - -import okhttp3.OkHttpClient; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -import org.apache.oltu.oauth2.client.HttpClient; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest; -import org.apache.oltu.oauth2.client.response.OAuthClientResponse; -import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; -import org.apache.oltu.oauth2.common.exception.OAuthProblemException; -import org.apache.oltu.oauth2.common.exception.OAuthSystemException; - -import java.io.IOException; -import java.util.Map; -import java.util.Map.Entry; - -public class OAuthOkHttpClient implements HttpClient { - private OkHttpClient client; - - public OAuthOkHttpClient() { - this.client = new OkHttpClient(); - } - - public OAuthOkHttpClient(OkHttpClient client) { - this.client = client; - } - - @Override - public T execute(OAuthClientRequest request, Map headers, - String requestMethod, Class responseClass) - throws OAuthSystemException, OAuthProblemException { - - MediaType mediaType = MediaType.parse("application/json"); - Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); - - if(headers != null) { - for (Entry entry : headers.entrySet()) { - if (entry.getKey().equalsIgnoreCase("Content-Type")) { - mediaType = MediaType.parse(entry.getValue()); - } else { - requestBuilder.addHeader(entry.getKey(), entry.getValue()); - } - } - } - - RequestBody body = request.getBody() != null ? RequestBody.create(request.getBody(), mediaType) : null; - requestBuilder.method(requestMethod, body); - - try { - Response response = client.newCall(requestBuilder.build()).execute(); - return OAuthClientResponseFactory.createCustomResponse( - response.body().string(), - response.body().contentType().toString(), - response.code(), - responseClass); - } catch (IOException e) { - throw new OAuthSystemException(e); - } - } - - @Override - public void shutdown() { - // Nothing to do here - } -} -{{/hasOAuthMethods}} diff --git a/templates/libraries/okhttp-gson-nextgen/auth/RetryingOAuth.mustache b/templates/libraries/okhttp-gson-nextgen/auth/RetryingOAuth.mustache deleted file mode 100644 index 43d58ce..0000000 --- a/templates/libraries/okhttp-gson-nextgen/auth/RetryingOAuth.mustache +++ /dev/null @@ -1,213 +0,0 @@ -{{#hasOAuthMethods}} -package {{invokerPackage}}.auth; - -import {{invokerPackage}}.ApiException; -import {{invokerPackage}}.Pair; - -import okhttp3.Interceptor; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; - -import org.apache.oltu.oauth2.client.OAuthClient; -import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; -import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; -import org.apache.oltu.oauth2.common.exception.OAuthProblemException; -import org.apache.oltu.oauth2.common.exception.OAuthSystemException; -import org.apache.oltu.oauth2.common.message.types.GrantType; - -import java.io.IOException; -import java.net.HttpURLConnection; -import java.net.URI; -import java.util.Map; -import java.util.List; - -public class RetryingOAuth extends OAuth implements Interceptor { - private OAuthClient oAuthClient; - - private TokenRequestBuilder tokenRequestBuilder; - - /** - * @param client An OkHttp client - * @param tokenRequestBuilder A token request builder - */ - public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { - this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); - this.tokenRequestBuilder = tokenRequestBuilder; - } - - /** - * @param tokenRequestBuilder A token request builder - */ - public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { - this(new OkHttpClient(), tokenRequestBuilder); - } - - /** - * @param tokenUrl The token URL to be used for this OAuth2 flow. - * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". - * The value must be an absolute URL. - * @param clientId The OAuth2 client ID for the "clientCredentials" flow. - * @param flow OAuth flow. - * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. - * @param parameters A map of string. - */ - public RetryingOAuth( - String tokenUrl, - String clientId, - OAuthFlow flow, - String clientSecret, - Map parameters - ) { - this(OAuthClientRequest.tokenLocation(tokenUrl) - .setClientId(clientId) - .setClientSecret(clientSecret)); - setFlow(flow); - if (parameters != null) { - for (String paramName : parameters.keySet()) { - tokenRequestBuilder.setParameter(paramName, parameters.get(paramName)); - } - } - } - - /** - * Set the OAuth flow - * - * @param flow The OAuth flow. - */ - public void setFlow(OAuthFlow flow) { - switch(flow) { - case accessCode: - tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); - break; - case implicit: - tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); - break; - case password: - tokenRequestBuilder.setGrantType(GrantType.PASSWORD); - break; - case application: - tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); - break; - default: - break; - } - } - - @Override - public Response intercept(Chain chain) throws IOException { - return retryingIntercept(chain, true); - } - - private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { - Request request = chain.request(); - - // If the request already has an authorization (e.g. Basic auth), proceed with the request as is - if (request.header("Authorization") != null) { - return chain.proceed(request); - } - - // Get the token if it has not yet been acquired - if (getAccessToken() == null) { - updateAccessToken(null); - } - - OAuthClientRequest oAuthRequest; - if (getAccessToken() != null) { - // Build the request - Request.Builder requestBuilder = request.newBuilder(); - - String requestAccessToken = getAccessToken(); - try { - oAuthRequest = - new OAuthBearerClientRequest(request.url().toString()). - setAccessToken(requestAccessToken). - buildHeaderMessage(); - } catch (OAuthSystemException e) { - throw new IOException(e); - } - - Map headers = oAuthRequest.getHeaders(); - for (String headerName : headers.keySet()) { - requestBuilder.addHeader(headerName, headers.get(headerName)); - } - requestBuilder.url(oAuthRequest.getLocationUri()); - - // Execute the request - Response response = chain.proceed(requestBuilder.build()); - - // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row - if ( - response != null && - ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || - response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && - updateTokenAndRetryOnAuthorizationFailure - ) { - try { - if (updateAccessToken(requestAccessToken)) { - response.body().close(); - return retryingIntercept(chain, false); - } - } catch (Exception e) { - response.body().close(); - throw e; - } - } - return response; - } - else { - return chain.proceed(chain.request()); - } - } - - /** - * Returns true if the access token has been updated - * - * @param requestAccessToken the request access token - * @return True if the update is successful - * @throws java.io.IOException If fail to update the access token - */ - public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { - if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { - try { - OAuthJSONAccessTokenResponse accessTokenResponse = - oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); - if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { - setAccessToken(accessTokenResponse.getAccessToken()); - } - } catch (OAuthSystemException | OAuthProblemException e) { - throw new IOException(e); - } - } - return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); - } - - /** - * Gets the token request builder - * - * @return A token request builder - * @throws java.io.IOException If fail to update the access token - */ - public TokenRequestBuilder getTokenRequestBuilder() { - return tokenRequestBuilder; - } - - /** - * Sets the token request builder - * - * @param tokenRequestBuilder Token request builder - */ - public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { - this.tokenRequestBuilder = tokenRequestBuilder; - } - - // Applying authorization to parameters is performed in the retryingIntercept method - @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams, - String payload, String method, URI uri) throws ApiException { - // No implementation necessary - } -} -{{/hasOAuthMethods}} diff --git a/templates/libraries/okhttp-gson-nextgen/build.sbt.mustache b/templates/libraries/okhttp-gson-nextgen/build.sbt.mustache deleted file mode 100644 index 5e0c74c..0000000 --- a/templates/libraries/okhttp-gson-nextgen/build.sbt.mustache +++ /dev/null @@ -1,39 +0,0 @@ -lazy val root = (project in file(".")). - settings( - organization := "{{groupId}}", - name := "{{artifactId}}", - version := "{{artifactVersion}}", - scalaVersion := "2.11.4", - scalacOptions ++= Seq("-feature"), - javacOptions in compile ++= Seq("-Xlint:deprecation"), - publishArtifact in (Compile, packageDoc) := false, - resolvers += Resolver.mavenLocal, - libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.24", - "com.squareup.okhttp3" % "okhttp" % "4.9.1", - "com.squareup.okhttp3" % "logging-interceptor" % "4.9.1", - "com.google.code.gson" % "gson" % "2.8.6", - "org.apache.commons" % "commons-lang3" % "3.10", - {{#openApiNullable}} - "org.openapitools" % "jackson-databind-nullable" % "0.2.2", - {{/openApiNullable}} - {{#hasOAuthMethods}} - "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1", - {{/hasOAuthMethods}} - {{#joda}} - "joda-time" % "joda-time" % "2.9.9" % "compile", - {{/joda}} - {{#threetenbp}} - "org.threeten" % "threetenbp" % "1.4.3" % "compile", - {{/threetenbp}} - {{#dynamicOperations}} - "io.swagger.parser.v3" % "swagger-parser-v3" "2.0.23" % "compile" - {{/dynamicOperations}} - "io.gsonfire" % "gson-fire" % "1.8.3" % "compile", - "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", - "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "junit" % "junit" % "4.13.1" % "test", - "com.novocode" % "junit-interface" % "0.10" % "test" - ) - ) diff --git a/templates/libraries/okhttp-gson-nextgen/oneof_model.mustache b/templates/libraries/okhttp-gson-nextgen/oneof_model.mustache deleted file mode 100644 index ce88e9a..0000000 --- a/templates/libraries/okhttp-gson-nextgen/oneof_model.mustache +++ /dev/null @@ -1,242 +0,0 @@ -import javax.ws.rs.core.GenericType; - -import java.io.IOException; -import java.lang.reflect.Type; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.HashMap; -import java.util.Map; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.JsonPrimitive; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; - -import {{invokerPackage}}.JSON; - -{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} -public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} { - private static final Logger log = Logger.getLogger({{classname}}.class.getName()); - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!{{classname}}.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes '{{classname}}' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - {{#oneOf}} - final TypeAdapter<{{.}}> adapter{{.}} = gson.getDelegateAdapter(this, TypeToken.get({{.}}.class)); - {{/oneOf}} - - return (TypeAdapter) new TypeAdapter<{{classname}}>() { - @Override - public void write(JsonWriter out, {{classname}} value) throws IOException { - if (value == null || value.getActualInstance() == null) { - elementAdapter.write(out, null); - return; - } - - {{#oneOf}} - // check if the actual instance is of the type `{{.}}` - if (value.getActualInstance() instanceof {{.}}) { - JsonObject obj = adapter{{.}}.toJsonTree(({{.}})value.getActualInstance()).getAsJsonObject(); - elementAdapter.write(out, obj); - return; - } - - {{/oneOf}} - throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}"); - } - - @Override - public {{classname}} read(JsonReader in) throws IOException { - Object deserialized = null; - JsonObject jsonObject = elementAdapter.read(in).getAsJsonObject(); - - {{#useOneOfDiscriminatorLookup}} - {{#discriminator}} - // use discriminator value for faster oneOf lookup - {{classname}} new{{classname}} = new {{classname}}(); - String discriminatorValue = elementAdapter.read(in).getAsJsonObject().get("{{{propertyBaseName}}}").getAsString(); - switch (discriminatorValue) { - {{#mappedModels}} - case "{{{mappingName}}}": - deserialized = adapter{{modelName}}.fromJsonTree(jsonObject); - new{{classname}}.setActualInstance(deserialized); - return new{{classname}}; - {{/mappedModels}} - default: - log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", discriminatorValue)); - } - - {{/discriminator}} - {{/useOneOfDiscriminatorLookup}} - int match = 0; - TypeAdapter actualAdapter = elementAdapter; - - {{#oneOf}} - // deserialize {{{.}}} - try { - // validate the JSON object to see if any excpetion is thrown - {{.}}.validateJsonObject(jsonObject); - actualAdapter = adapter{{.}}; - match++; - log.log(Level.FINER, "Input data matches schema '{{{.}}}'"); - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema '{{{.}}}'", e); - } - - {{/oneOf}} - if (match == 1) { - {{classname}} ret = new {{classname}}(); - ret.setActualInstance(actualAdapter.fromJsonTree(jsonObject)); - return ret; - } - - throw new IOException(String.format("Failed deserialization for {{classname}}: %d classes match result, expected 1. JSON: %s", match, jsonObject.toString())); - } - }.nullSafe(); - } - } - - // store a list of schema names defined in oneOf - public static final Map schemas = new HashMap(); - - public {{classname}}() { - super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); - } - - {{#oneOf}} - public {{classname}}({{{.}}} o) { - super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); - setActualInstance(o); - } - - {{/oneOf}} - static { - {{#oneOf}} - schemas.put("{{{.}}}", new GenericType<{{{.}}}>() { - }); - {{/oneOf}} - } - - @Override - public Map getSchemas() { - return {{classname}}.schemas; - } - - /** - * Set the instance that matches the oneOf child schema, check - * the instance parameter is valid against the oneOf child schemas: - * {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}} - * - * It could be an instance of the 'oneOf' schemas. - * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). - */ - @Override - public void setActualInstance(Object instance) { - {{#isNullable}} - if (instance == null) { - super.setActualInstance(instance); - return; - } - - {{/isNullable}} - {{#oneOf}} - if (instance instanceof {{{.}}}) { - super.setActualInstance(instance); - return; - } - - {{/oneOf}} - throw new RuntimeException("Invalid instance type. Must be {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}"); - } - - /** - * Get the actual instance, which can be the following: - * {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}} - * - * @return The actual instance ({{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}) - */ - @Override - public Object getActualInstance() { - return super.getActualInstance(); - } - - {{#oneOf}} - /** - * Get the actual instance of `{{{.}}}`. If the actual instance is not `{{{.}}}`, - * the ClassCastException will be thrown. - * - * @return The actual instance of `{{{.}}}` - * @throws ClassCastException if the instance is not `{{{.}}}` - */ - public {{{.}}} get{{{.}}}() throws ClassCastException { - return ({{{.}}})super.getActualInstance(); - } - - {{/oneOf}} - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to {{classname}} - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - // validate oneOf schemas one by one - int validCount = 0; - {{#oneOf}} - // validate the json string with {{{.}}} - try { - {{{.}}}.validateJsonObject(jsonObj); - validCount++; - } catch (Exception e) { - // continue to the next one - } - {{/oneOf}} - if (validCount != 1) { - throw new IOException(String.format("The JSON string is invalid for {{classname}} with oneOf schemas: {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}. %d class(es) match the result, expected 1. JSON: %s", validCount, jsonObj.toString())); - } - } - - /** - * Create an instance of {{classname}} given an JSON string - * - * @param jsonString JSON string - * @return An instance of {{classname}} - * @throws IOException if the JSON string is invalid with respect to {{classname}} - */ - public static {{{classname}}} fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, {{{classname}}}.class); - } - - /** - * Convert an instance of {{classname}} to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} diff --git a/templates/libraries/okhttp-gson-nextgen/AbstractOpenApiSchema.mustache b/templates/libraries/okhttp-gson/AbstractOpenApiSchema.mustache similarity index 94% rename from templates/libraries/okhttp-gson-nextgen/AbstractOpenApiSchema.mustache rename to templates/libraries/okhttp-gson/AbstractOpenApiSchema.mustache index 3ba02e4..8d11435 100644 --- a/templates/libraries/okhttp-gson-nextgen/AbstractOpenApiSchema.mustache +++ b/templates/libraries/okhttp-gson/AbstractOpenApiSchema.mustache @@ -6,14 +6,11 @@ import {{invokerPackage}}.ApiException; import java.util.Objects; import java.lang.reflect.Type; import java.util.Map; -import javax.ws.rs.core.GenericType; - -//import com.fasterxml.jackson.annotation.JsonValue; /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}} +{{>generatedAnnotation}} public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object @@ -35,7 +32,7 @@ public abstract class AbstractOpenApiSchema { * * @return an instance of the actual schema/object */ - public abstract Map getSchemas(); + public abstract Map> getSchemas(); /** * Get the actual instance diff --git a/templates/libraries/okhttp-gson/ApiClient.mustache b/templates/libraries/okhttp-gson/ApiClient.mustache index 421b778..c5e7ae2 100644 --- a/templates/libraries/okhttp-gson/ApiClient.mustache +++ b/templates/libraries/okhttp-gson/ApiClient.mustache @@ -23,11 +23,6 @@ import org.joda.time.DateTime; import org.joda.time.LocalDate; import org.joda.time.format.DateTimeFormatter; {{/joda}} -{{#threetenbp}} -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; -{{/threetenbp}} {{#hasOAuthMethods}} import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; import org.apache.oltu.oauth2.common.message.types.GrantType; @@ -52,14 +47,13 @@ import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.text.DateFormat; -{{#java8}} import java.time.LocalDate; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; -{{/java8}} import java.util.*; import java.util.Map.Entry; import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -72,6 +66,9 @@ import {{invokerPackage}}.auth.OAuth; import {{invokerPackage}}.auth.RetryingOAuth; import {{invokerPackage}}.auth.OAuthFlow; {{/hasOAuthMethods}} +{{#withAWSV4Signature}} +import {{invokerPackage}}.auth.AWS4Auth; +{{/withAWSV4Signature}} /** *

ApiClient class.

@@ -79,6 +76,33 @@ import {{invokerPackage}}.auth.OAuthFlow; public class ApiClient { private String basePath = "{{{basePath}}}"; + protected List servers = new ArrayList({{#servers}}{{#-first}}Arrays.asList( +{{/-first}} new ServerConfiguration( + "{{{url}}}", + "{{{description}}}{{^description}}No description provided{{/description}}", + new HashMap(){{#variables}}{{#-first}} {{ +{{/-first}} put("{{{name}}}", new ServerVariable( + "{{{description}}}{{^description}}No description provided{{/description}}", + "{{{defaultValue}}}", + new HashSet( + {{#enumValues}} + {{#-first}} + Arrays.asList( + {{/-first}} + "{{{.}}}"{{^-last}},{{/-last}} + {{#-last}} + ) + {{/-last}} + {{/enumValues}} + ) + )); + {{#-last}} + }}{{/-last}}{{/variables}} + ){{^-last}},{{/-last}} + {{#-last}} + ){{/-last}}{{/servers}}); + protected Integer serverIndex = 0; + protected Map serverVariables = null; private boolean debugging = false; private Map defaultHeaderMap = new HashMap(); private Map defaultCookieMap = new HashMap(); @@ -112,10 +136,11 @@ public class ApiClient { initHttpClient(); // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} - authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} + authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}} + authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} - authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} + authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}{{#withAWSV4Signature}} + authentications.put("AWS4Auth", new AWS4Auth());{{/withAWSV4Signature}} // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } @@ -131,10 +156,11 @@ public class ApiClient { httpClient = client; // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} - authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} + authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}} + authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} - authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} + authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}{{#withAWSV4Signature}} + authentications.put("AWS4Auth", new AWS4Auth());{{/withAWSV4Signature}} // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } @@ -186,8 +212,7 @@ public class ApiClient { this.basePath = basePath; } -{{#hasOAuthMethods}} - String tokenUrl = "{{tokenUrl}}"; + String tokenUrl = "{{{tokenUrl}}}"; if (!"".equals(tokenUrl) && !URI.create(tokenUrl).isAbsolute()) { URI uri = URI.create(getBasePath()); tokenUrl = uri.getScheme() + ":" + @@ -197,17 +222,17 @@ public class ApiClient { throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL"); } } - RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.{{flow}}, clientSecret, parameters); + RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.{{#lambda.uppercase}}{{#lambda.snakecase}}{{flow}}{{/lambda.snakecase}}{{/lambda.uppercase}}, clientSecret, parameters); authentications.put( "{{name}}", retryingOAuth ); initHttpClient(Collections.singletonList(retryingOAuth)); -{{/hasOAuthMethods}} // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} - authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} - authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{/authMethods}} + authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}} + authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} + authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{/authMethods}}{{#withAWSV4Signature}} + authentications.put("AWS4Auth", new AWS4Auth());{{/withAWSV4Signature}} // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); @@ -267,6 +292,34 @@ public class ApiClient { */ public ApiClient setBasePath(String basePath) { this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; return this; } @@ -391,10 +444,10 @@ public class ApiClient { *

Setter for the field dateFormat.

* * @param dateFormat a {@link java.text.DateFormat} object - * @return a {@link org.openapitools.client.ApiClient} object + * @return a {@link {{invokerPackage}}.ApiClient} object */ public ApiClient setDateFormat(DateFormat dateFormat) { - this.json.setDateFormat(dateFormat); + JSON.setDateFormat(dateFormat); return this; } @@ -402,21 +455,21 @@ public class ApiClient { *

Set SqlDateFormat.

* * @param dateFormat a {@link java.text.DateFormat} object - * @return a {@link org.openapitools.client.ApiClient} object + * @return a {@link {{invokerPackage}}.ApiClient} object */ public ApiClient setSqlDateFormat(DateFormat dateFormat) { - this.json.setSqlDateFormat(dateFormat); + JSON.setSqlDateFormat(dateFormat); return this; } {{#joda}} public ApiClient setDateTimeFormat(DateTimeFormatter dateFormat) { - this.json.setDateTimeFormat(dateFormat); + JSON.setDateTimeFormat(dateFormat); return this; } public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { - this.json.setLocalDateFormat(dateFormat); + JSON.setLocalDateFormat(dateFormat); return this; } @@ -425,22 +478,22 @@ public class ApiClient { /** *

Set OffsetDateTimeFormat.

* - * @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object - * @return a {@link org.openapitools.client.ApiClient} object + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link {{invokerPackage}}.ApiClient} object */ public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { - this.json.setOffsetDateTimeFormat(dateFormat); + JSON.setOffsetDateTimeFormat(dateFormat); return this; } /** *

Set LocalDateFormat.

* - * @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object - * @return a {@link org.openapitools.client.ApiClient} object + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link {{invokerPackage}}.ApiClient} object */ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { - this.json.setLocalDateFormat(dateFormat); + JSON.setLocalDateFormat(dateFormat); return this; } @@ -449,10 +502,10 @@ public class ApiClient { *

Set LenientOnJson.

* * @param lenientOnJson a boolean - * @return a {@link org.openapitools.client.ApiClient} object + * @return a {@link {{invokerPackage}}.ApiClient} object */ public ApiClient setLenientOnJson(boolean lenientOnJson) { - this.json.setLenientOnJson(lenientOnJson); + JSON.setLenientOnJson(lenientOnJson); return this; } @@ -476,14 +529,23 @@ public class ApiClient { } {{#hasHttpBearerMethods}} - /** - * Helper method to set access token for the first Bearer authentication. - * @param bearerToken Bearer token - */ + /** + * Helper method to set access token for the first Bearer authentication. + * @param bearerToken Bearer token + */ public void setBearerToken(String bearerToken) { + setBearerToken(() -> bearerToken); + } + + /** + * Helper method to set the supplier of access tokens for Bearer authentication. + * + * @param tokenSupplier The supplier of bearer tokens + */ + public void setBearerToken(Supplier tokenSupplier) { for (Authentication auth : authentications.values()) { if (auth instanceof HttpBearerAuth) { - ((HttpBearerAuth) auth).setBearerToken(bearerToken); + ((HttpBearerAuth) auth).setBearerToken(tokenSupplier); return; } } @@ -568,6 +630,51 @@ public class ApiClient { throw new RuntimeException("No OAuth2 authentication configured!"); } + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + {{#withAWSV4Signature}} + for (Authentication auth : authentications.values()) { + if (auth instanceof AWS4Auth) { + ((AWS4Auth) auth).setCredentials(accessKey, secretKey); + ((AWS4Auth) auth).setRegion(region); + ((AWS4Auth) auth).setService(service); + return; + } + } + {{/withAWSV4Signature}} + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + {{#withAWSV4Signature}} + for (Authentication auth : authentications.values()) { + if (auth instanceof AWS4Auth) { + ((AWS4Auth) auth).setCredentials(accessKey, secretKey, sessionToken); + ((AWS4Auth) auth).setRegion(region); + ((AWS4Auth) auth).setService(service); + return; + } + } + {{/withAWSV4Signature}} + throw new RuntimeException("No AWS4 authentication configured!"); + } + /** * Set the User-Agent header's value (by adding to the default header map). * @@ -752,7 +859,7 @@ public class ApiClient { return ""; } else if (param instanceof Date {{#joda}}|| param instanceof DateTime || param instanceof LocalDate{{/joda}}{{#jsr310}}|| param instanceof OffsetDateTime || param instanceof LocalDate{{/jsr310}}) { //Serialize to json string and remove the " enclosing characters - String jsonStr = json.serialize(param); + String jsonStr = JSON.serialize(param); return jsonStr.substring(1, jsonStr.length() - 1); } else if (param instanceof Collection) { StringBuilder b = new StringBuilder(); @@ -760,7 +867,7 @@ public class ApiClient { if (b.length() > 0) { b.append(","); } - b.append(String.valueOf(o)); + b.append(o); } return b.toString(); } else { @@ -845,7 +952,7 @@ public class ApiClient { List params = new ArrayList(); // preconditions - if (param == null || param.getName() == null || param.getName().isEmpty() || value == null) { + if (param == null || param.getName() == null || param.getName().isEmpty() || value == null || value.isEmpty()) { return params; } @@ -880,6 +987,30 @@ public class ApiClient { } {{/dynamicOperations}} + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + /** * Formats the specified collection path parameter to a string value. * @@ -1011,7 +1142,7 @@ public class ApiClient { * @param response HTTP response * @param returnType The type of the Java object * @return The deserialized Java object - * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * @throws {{invokerPackage}}.ApiException If fail to deserialize response body, i.e. cannot read response body * or the Content-Type of the response is not supported. */ @SuppressWarnings("unchecked") @@ -1052,7 +1183,7 @@ public class ApiClient { contentType = "application/json"; } if (isJsonMime(contentType)) { - return json.deserialize(respBody, returnType); + return JSON.deserialize(respBody, returnType); } else if (returnType.equals(String.class)) { // Expecting string, return the raw response body. return (T) respBody; @@ -1072,7 +1203,7 @@ public class ApiClient { * @param obj The Java object * @param contentType The request Content-Type * @return The serialized request body - * @throws org.openapitools.client.ApiException If fail to serialize the given object + * @throws {{invokerPackage}}.ApiException If fail to serialize the given object */ public RequestBody serialize(Object obj, String contentType) throws ApiException { if (obj instanceof byte[]) { @@ -1086,11 +1217,13 @@ public class ApiClient { } else if (isJsonMime(contentType)) { String content; if (obj != null) { - content = json.serialize(obj); + content = JSON.serialize(obj); } else { content = null; } return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); } else { throw new ApiException("Content type \"" + contentType + "\" is not supported"); } @@ -1100,7 +1233,7 @@ public class ApiClient { * Download file from the given response. * * @param response An instance of the Response object - * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @throws {{invokerPackage}}.ApiException If fail to read file content from response and write to disk * @return Downloaded file */ public File downloadFileFromResponse(Response response) throws ApiException { @@ -1164,7 +1297,7 @@ public class ApiClient { * @param Type * @param call An instance of the Call object * @return ApiResponse<T> - * @throws org.openapitools.client.ApiException If fail to execute the call + * @throws {{invokerPackage}}.ApiException If fail to execute the call */ public ApiResponse execute(Call call) throws ApiException { return execute(call, null); @@ -1179,7 +1312,7 @@ public class ApiClient { * @return ApiResponse object containing response status, headers and * data, which is a Java object deserialized from response body and would be null * when returnType is null. - * @throws org.openapitools.client.ApiException If fail to execute the call + * @throws {{invokerPackage}}.ApiException If fail to execute the call */ public ApiResponse execute(Call call, Type returnType) throws ApiException { try { @@ -1198,13 +1331,13 @@ public class ApiClient { * @param call a {@link okhttp3.Call} object * @param returnType a {@link java.lang.reflect.Type} object * @return a {@link java.io.InputStream} object - * @throws org.openapitools.client.ApiException if any. + * @throws {{invokerPackage}}.ApiException if any. */ public InputStream executeStream(Call call, Type returnType) throws ApiException { try { Response response = call.execute(); if (!response.isSuccessful()) { - throw new ApiException(response.code(), response.message()); + throw new ApiException(response.code(), response.message(), response.headers().toMultimap(), null); } if (response.body() == null) { return null; @@ -1268,7 +1401,7 @@ public class ApiClient { * @param response Response * @param returnType Return type * @return Type - * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * @throws {{invokerPackage}}.ApiException If the response has an unsuccessful status code or * fail to deserialize the response body */ public T handleResponse(Response response, Type returnType) throws ApiException { @@ -1303,6 +1436,7 @@ public class ApiClient { /** * Build HTTP call with the given options. * + * @param baseUrl The base URL * @param path The sub-path of the HTTP URL * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" * @param queryParams The query parameters @@ -1314,7 +1448,7 @@ public class ApiClient { * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP call - * @throws org.openapitools.client.ApiException If fail to serialize the request body object + * @throws {{invokerPackage}}.ApiException If fail to serialize the request body object */ public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); @@ -1325,6 +1459,7 @@ public class ApiClient { /** * Build an HTTP request with the given options. * + * @param baseUrl The base URL * @param path The sub-path of the HTTP URL * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" * @param queryParams The query parameters @@ -1336,24 +1471,23 @@ public class ApiClient { * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP request - * @throws org.openapitools.client.ApiException If fail to serialize the request body object + * @throws {{invokerPackage}}.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); // prepare HTTP request body RequestBody reqBody; String contentType = headerParams.get("Content-Type"); - + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } if (!HttpMethod.permitsRequestBody(method)) { reqBody = null; - } else if ("application/x-www-form-urlencoded".equals(contentType)) { + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { reqBody = buildRequestBodyFormEncoding(formParams); - } else if ("multipart/form-data".equals(contentType)) { + } else if ("multipart/form-data".equals(contentTypePure)) { reqBody = buildRequestBodyMultipart(formParams); } else if (body == null) { if ("DELETE".equals(method)) { @@ -1361,16 +1495,18 @@ public class ApiClient { reqBody = null; } else { // use an empty request body (for POST, PUT and PATCH) - reqBody = RequestBody.create("", MediaType.parse(contentType)); + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); } } else { reqBody = serialize(body, contentType); } + List updatedQueryParams = new ArrayList<>(queryParams); + // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - final Request.Builder reqBuilder = new Request.Builder().url(url); + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); processCookieParams(cookieParams, reqBuilder); @@ -1393,6 +1529,7 @@ public class ApiClient { /** * Build full URL by concatenating base path, the given sub path and query parameters. * + * @param baseUrl The base URL * @param path The sub path * @param queryParams The query parameters * @param collectionQueryParams The collection query parameters @@ -1403,7 +1540,18 @@ public class ApiClient { if (baseUrl != null) { url.append(baseUrl).append(path); } else { - url.append(basePath).append(path); + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); } if (queryParams != null && !queryParams.isEmpty()) { @@ -1487,6 +1635,7 @@ public class ApiClient { * @param payload HTTP request body * @param method HTTP method * @param uri URI + * @throws {{invokerPackage}}.ApiException If fails to update the parameters */ public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { @@ -1525,12 +1674,18 @@ public class ApiClient { for (Entry param : formParams.entrySet()) { if (param.getValue() instanceof File) { File file = (File) param.getValue(); - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); - MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); - mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } } else { - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); - mpBuilder.addPart(partHeaders, RequestBody.create(parameterToString(param.getValue()), null)); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); } } return mpBuilder.build(); @@ -1551,6 +1706,44 @@ public class ApiClient { } } + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = JSON.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + /** * Get network interceptor to add it to the httpClient to track download progress for * async requests. @@ -1618,7 +1811,7 @@ public class ApiClient { KeyStore caKeyStore = newEmptyKeyStore(password); int index = 0; for (Certificate certificate : certificates) { - String certificateAlias = "ca" + Integer.toString(index++); + String certificateAlias = "ca" + (index++); caKeyStore.setCertificateEntry(certificateAlias, certificate); } trustManagerFactory.init(caKeyStore); @@ -1693,7 +1886,7 @@ public class ApiClient { if (entry.getKey().equals(param.getName())) { switch (param.getIn()) { case "path": - path = path.replaceAll("\\{" + param.getName() + "\\}", escapeString(value.toString())); + path = path.replace("{" + param.getName() + "}", escapeString(value.toString())); break; case "query": if (value instanceof Collection) { @@ -1722,9 +1915,9 @@ public class ApiClient { /** * Convert the HTTP request body to a string. * - * @param request The HTTP request object + * @param requestBody The HTTP request object * @return The string representation of the HTTP request body - * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + * @throws {{invokerPackage}}.ApiException If fail to serialize the request body object into a string */ private String requestBodyToString(RequestBody requestBody) throws ApiException { if (requestBody != null) { diff --git a/templates/libraries/okhttp-gson-nextgen/JSON.mustache b/templates/libraries/okhttp-gson/JSON.mustache similarity index 93% rename from templates/libraries/okhttp-gson-nextgen/JSON.mustache rename to templates/libraries/okhttp-gson/JSON.mustache index 32bef19..6cf7ec7 100644 --- a/templates/libraries/okhttp-gson-nextgen/JSON.mustache +++ b/templates/libraries/okhttp-gson/JSON.mustache @@ -19,11 +19,6 @@ import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatterBuilder; import org.joda.time.format.ISODateTimeFormat; {{/joda}} -{{#threetenbp}} -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; -{{/threetenbp}} import okio.ByteString; @@ -33,11 +28,9 @@ import java.lang.reflect.Type; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; -{{#java8}} import java.time.LocalDate; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; -{{/java8}} import java.util.Date; import java.util.Locale; import java.util.Map; @@ -116,29 +109,29 @@ public class JSON { return clazz; } - { - gson = createGson() - .registerTypeAdapter(Date.class, dateTypeAdapter) - .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter) - {{#joda}} - .registerTypeAdapter(DateTime.class, dateTimeTypeAdapter) - .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) - {{/joda}} - {{#jsr310}} - .registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter) - .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) - {{/jsr310}} - .registerTypeAdapter(byte[].class, byteArrayAdapter) - {{#models}} - {{#model}} - {{^isEnum}} - {{^hasChildren}} - .registerTypeAdapterFactory(new {{modelPackage}}.{{{classname}}}.CustomTypeAdapterFactory()) - {{/hasChildren}} - {{/isEnum}} - {{/model}} - {{/models}} - .create(); + static { + GsonBuilder gsonBuilder = createGson(); + gsonBuilder.registerTypeAdapter(Date.class, dateTypeAdapter); + gsonBuilder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + {{#joda}} + gsonBuilder.registerTypeAdapter(DateTime.class, dateTimeTypeAdapter); + gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + {{/joda}} + {{#jsr310}} + gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + {{/jsr310}} + gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); + {{#models}} + {{#model}} + {{^isEnum}} + {{^hasChildren}} + gsonBuilder.registerTypeAdapterFactory(new {{modelPackage}}.{{{classname}}}.CustomTypeAdapterFactory()); + {{/hasChildren}} + {{/isEnum}} + {{/model}} + {{/models}} + gson = gsonBuilder.create(); } /** diff --git a/templates/libraries/okhttp-gson/README.mustache b/templates/libraries/okhttp-gson/README.mustache index a1a142b..8dbdf24 100644 --- a/templates/libraries/okhttp-gson/README.mustache +++ b/templates/libraries/okhttp-gson/README.mustache @@ -5,6 +5,7 @@ {{^hideGenerationTimestamp}} - Build date: {{generatedDate}} {{/hideGenerationTimestamp}} + - Generator version: {{generatorVersion}} {{{appDescriptionWithNewLines}}} @@ -18,7 +19,7 @@ ## Requirements Building the API client library requires: -1. Java {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}+ +1. Java 1.8+ 2. Maven (3.8.3+)/Gradle (7.2+) ## Installation @@ -96,6 +97,10 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("{{{basePath}}}"); + {{#withAWSV4Signature}} + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + {{/withAWSV4Signature}} {{#hasAuthMethods}} {{#authMethods}}{{#isBasic}}{{#isBasicBasic}} // Configure HTTP basic authorization: {{{name}}} @@ -151,18 +156,25 @@ Class | Method | HTTP request | Description {{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md) {{/model}}{{/models}} + ## Documentation for Authorization -{{^authMethods}}All endpoints do not require authorization. -{{/authMethods}}Authentication schemes defined for the API: -{{#authMethods}}### {{name}} +{{^authMethods}}Endpoints do not require authorization.{{/authMethods}} +{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}} +{{#authMethods}} + +### {{name}} {{#isApiKey}}- **Type**: API key - **API key parameter name**: {{keyParamName}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} {{/isApiKey}} -{{#isBasic}}- **Type**: HTTP basic authentication -{{/isBasic}} +{{#isBasicBasic}}- **Type**: HTTP basic authentication +{{/isBasicBasic}} +{{#isBasicBearer}}- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} +{{/isBasicBearer}} +{{#isHttpSignature}}- **Type**: HTTP signature authentication +{{/isHttpSignature}} {{#isOAuth}}- **Type**: OAuth - **Flow**: {{flow}} - **Authorization URL**: {{authorizationUrl}} diff --git a/templates/libraries/okhttp-gson/additional_properties.mustache b/templates/libraries/okhttp-gson/additional_properties.mustache new file mode 100644 index 0000000..bca54f8 --- /dev/null +++ b/templates/libraries/okhttp-gson/additional_properties.mustache @@ -0,0 +1,46 @@ +{{#isAdditionalPropertiesTrue}} + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the {{classname}} instance itself + */ + public {{classname}} putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } +{{/isAdditionalPropertiesTrue}} diff --git a/templates/libraries/okhttp-gson/anyof_model.mustache b/templates/libraries/okhttp-gson/anyof_model.mustache new file mode 100644 index 0000000..18447fc --- /dev/null +++ b/templates/libraries/okhttp-gson/anyof_model.mustache @@ -0,0 +1,398 @@ + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import {{invokerPackage}}.JSON; + +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} +public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}} implements {{{.}}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-implements}} { + private static final Logger log = Logger.getLogger({{classname}}.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!{{classname}}.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes '{{classname}}' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + {{#composedSchemas}} + {{#anyOf}} + {{^isArray}} + {{^vendorExtensions.x-duplicated-data-type}} + final TypeAdapter<{{{dataType}}}> adapter{{{dataType}}} = gson.getDelegateAdapter(this, TypeToken.get({{{dataType}}}.class)); + {{/vendorExtensions.x-duplicated-data-type}} + {{/isArray}} + {{#isArray}} + + final Type typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = new TypeToken<{{{dataType}}}>(){}.getType(); + final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = (TypeAdapter<{{{dataType}}}>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}})); + {{/isArray}} + {{/anyOf}} + {{/composedSchemas}} + + return (TypeAdapter) new TypeAdapter<{{classname}}>() { + @Override + public void write(JsonWriter out, {{classname}} value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + {{#composedSchemas}} + {{#anyOf}} + {{^vendorExtensions.x-duplicated-data-type}} + // check if the actual instance is of the type `{{{dataType}}}` + if (value.getActualInstance() instanceof {{#isArray}}List{{/isArray}}{{^isArray}}{{{dataType}}}{{/isArray}}) { + {{#isPrimitiveType}} + JsonPrimitive primitive = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}.toJsonTree(({{{dataType}}})value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isArray}} + List list = (List) value.getActualInstance(); + if (list.get(0) instanceof {{{items.dataType}}}) { + JsonArray array = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}.toJsonTree(({{{dataType}}})value.getActualInstance()).getAsJsonArray(); + elementAdapter.write(out, array); + return; + } + {{/isArray}} + {{/isPrimitiveType}} + {{^isArray}} + {{^isPrimitiveType}} + JsonElement element = adapter{{{dataType}}}.toJsonTree(({{{dataType}}})value.getActualInstance()); + elementAdapter.write(out, element); + return; + {{/isPrimitiveType}} + {{/isArray}} + } + {{/vendorExtensions.x-duplicated-data-type}} + {{/anyOf}} + {{/composedSchemas}} + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}"); + } + + @Override + public {{classname}} read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + {{#composedSchemas}} + {{#anyOf}} + {{^vendorExtensions.x-duplicated-data-type}} + {{^hasVars}} + // deserialize {{{dataType}}} + try { + // validate the JSON object to see if any exception is thrown + {{^isArray}} + {{#isNumber}} + if (!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}; + {{/isNumber}} + {{^isNumber}} + {{#isPrimitiveType}} + if (!jsonElement.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}; + {{/isPrimitiveType}} + {{/isNumber}} + {{^isNumber}} + {{^isPrimitiveType}} + {{{dataType}}}.validateJsonElement(jsonElement); + actualAdapter = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}; + {{/isPrimitiveType}} + {{/isNumber}} + {{/isArray}} + {{#isArray}} + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + + JsonArray array = jsonElement.getAsJsonArray(); + // validate array items + for(JsonElement element : array) { + {{#items}} + {{#isNumber}} + if (!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isNumber}} + {{^isNumber}} + {{#isPrimitiveType}} + if (!element.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) { + throw new IllegalArgumentException(String.format("Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isPrimitiveType}} + {{/isNumber}} + {{^isNumber}} + {{^isPrimitiveType}} + {{{dataType}}}.validateJsonElement(element); + {{/isPrimitiveType}} + {{/isNumber}} + {{/items}} + } + actualAdapter = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}; + {{/isArray}} + {{classname}} ret = new {{classname}}(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for {{{dataType}}} failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema '{{{dataType}}}'", e); + } + {{/hasVars}} + {{#hasVars}} + // deserialize {{{.}}} + try { + // validate the JSON object to see if any exception is thrown + {{.}}.validateJsonElement(jsonElement); + actualAdapter = adapter{{.}}; + {{classname}} ret = new {{classname}}(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for {{{.}}} failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema '{{{.}}}'", e); + } + {{/hasVars}} + {{/vendorExtensions.x-duplicated-data-type}} + {{/anyOf}} + {{/composedSchemas}} + + throw new IOException(String.format("Failed deserialization for {{classname}}: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public {{classname}}() { + super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); + } + + public {{classname}}(Object o) { + super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); + setActualInstance(o); + } + + static { + {{#composedSchemas}} + {{#anyOf}} + {{^vendorExtensions.x-duplicated-data-type}} + schemas.put("{{{dataType}}}", {{{baseType}}}.class); + {{/vendorExtensions.x-duplicated-data-type}} + {{/anyOf}} + {{/composedSchemas}} + } + + @Override + public Map> getSchemas() { + return {{classname}}.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}} + * + * It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + {{#isNullable}} + if (instance == null) { + super.setActualInstance(instance); + return; + } + + {{/isNullable}} + {{#composedSchemas}} + {{#anyOf}} + {{^vendorExtensions.x-duplicated-data-type}} + if (instance instanceof {{#isArray}}List{{/isArray}}{{^isArray}}{{{dataType}}}{{/isArray}}) { + {{#isArray}} + List list = (List) instance; + if (list.get(0) instanceof {{{items.dataType}}}) { + super.setActualInstance(instance); + return; + } + {{/isArray}} + {{^isArray}} + super.setActualInstance(instance); + return; + {{/isArray}} + } + + {{/vendorExtensions.x-duplicated-data-type}} + {{/anyOf}} + {{/composedSchemas}} + throw new RuntimeException("Invalid instance type. Must be {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}"); + } + + /** + * Get the actual instance, which can be the following: + * {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}} + * + * @return The actual instance ({{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + {{#composedSchemas}} + {{#anyOf}} + {{^vendorExtensions.x-duplicated-data-type}} + /** + * Get the actual instance of `{{{dataType}}}`. If the actual instance is not `{{{dataType}}}`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `{{{dataType}}}` + * @throws ClassCastException if the instance is not `{{{dataType}}}` + */ + public {{{dataType}}} get{{#isArray}}{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}{{/isArray}}{{^isArray}}{{{dataType}}}{{/isArray}}() throws ClassCastException { + return ({{{dataType}}})super.getActualInstance(); + } + {{/vendorExtensions.x-duplicated-data-type}} + {{/anyOf}} + {{/composedSchemas}} + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to {{classname}} + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + {{#composedSchemas}} + {{#anyOf}} + {{^vendorExtensions.x-duplicated-data-type}} + // validate the json string with {{{dataType}}} + try { + {{^hasVars}} + {{^isArray}} + {{#isNumber}} + if (!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isNumber}} + {{^isNumber}} + {{#isPrimitiveType}} + if (!jsonElement.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isPrimitiveType}} + {{/isNumber}} + {{^isNumber}} + {{^isPrimitiveType}} + {{{dataType}}}.validateJsonElement(jsonElement); + {{/isPrimitiveType}} + {{/isNumber}} + {{/isArray}} + {{#isArray}} + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + JsonArray array = jsonElement.getAsJsonArray(); + // validate array items + for(JsonElement element : array) { + {{#items}} + {{#isNumber}} + if (!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isNumber}} + {{^isNumber}} + {{#isPrimitiveType}} + if (!element.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) { + throw new IllegalArgumentException(String.format("Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isPrimitiveType}} + {{/isNumber}} + {{^isNumber}} + {{^isPrimitiveType}} + {{{dataType}}}.validateJsonElement(element); + {{/isPrimitiveType}} + {{/isNumber}} + {{/items}} + } + {{/isArray}} + {{/hasVars}} + {{#hasVars}} + {{{.}}}.validateJsonElement(jsonElement); + return; + {{/hasVars}} + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for {{{dataType}}} failed with `%s`.", e.getMessage())); + // continue to the next one + } + {{/vendorExtensions.x-duplicated-data-type}} + {{/anyOf}} + {{/composedSchemas}} + throw new IOException(String.format("The JSON string is invalid for {{classname}} with anyOf schemas: {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of {{classname}} given an JSON string + * + * @param jsonString JSON string + * @return An instance of {{classname}} + * @throws IOException if the JSON string is invalid with respect to {{classname}} + */ + public static {{{classname}}} fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, {{{classname}}}.class); + } + + /** + * Convert an instance of {{classname}} to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/templates/libraries/okhttp-gson/api.mustache b/templates/libraries/okhttp-gson/api.mustache index e81f874..96757ed 100644 --- a/templates/libraries/okhttp-gson/api.mustache +++ b/templates/libraries/okhttp-gson/api.mustache @@ -26,13 +26,14 @@ import io.swagger.v3.oas.models.parameters.Parameter; import java.io.IOException; {{#useBeanValidation}} -import javax.validation.constraints.*; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; {{/useBeanValidation}} {{#performBeanValidation}} -import javax.validation.ConstraintViolation; -import javax.validation.Validation; -import javax.validation.ValidatorFactory; -import javax.validation.executable.ExecutableValidator; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Validation; +import jakarta.validation.ValidatorFactory; +import jakarta.validation.executable.ExecutableValidator; import java.util.Set; import java.lang.reflect.Method; import java.lang.reflect.Type; @@ -42,7 +43,6 @@ import java.lang.reflect.Type; {{/imports}} import java.lang.reflect.Type; -{{^fullJavaUtil}} import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -50,7 +50,6 @@ import java.util.Map; {{#supportStreaming}} import java.io.InputStream; {{/supportStreaming}} -{{/fullJavaUtil}} {{#operations}} public class {{classname}} { @@ -119,7 +118,6 @@ public class {{classname}} { {{/isDeprecated}} public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { {{#servers}}"{{{url}}}"{{^-last}}, {{/-last}}{{/servers}} }; @@ -137,7 +135,7 @@ public class {{classname}} { // create path and map variables {{^dynamicOperations}} String localVarPath = "{{{path}}}"{{#pathParams}} - .replaceAll("\\{" + "{{baseName}}" + "\\}", localVarApiClient.escapeString({{#collectionFormat}}localVarApiClient.collectionPathParameterToString("{{{collectionFormat}}}", {{{paramName}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}.toString(){{/collectionFormat}})){{/pathParams}}; + .replace("{" + "{{baseName}}" + "}", localVarApiClient.escapeString({{#collectionFormat}}localVarApiClient.collectionPathParameterToString("{{{collectionFormat}}}", {{{paramName}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}.toString(){{/collectionFormat}})){{/pathParams}}; {{/dynamicOperations}} {{#dynamicOperations}} ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("{{{operationId}}}"); @@ -156,11 +154,11 @@ public class {{classname}} { {{/allParams}} {{/dynamicOperations}} - {{javaUtilPrefix}}List localVarQueryParams = new {{javaUtilPrefix}}ArrayList(); - {{javaUtilPrefix}}List localVarCollectionQueryParams = new {{javaUtilPrefix}}ArrayList(); - {{javaUtilPrefix}}Map localVarHeaderParams = new {{javaUtilPrefix}}HashMap(); - {{javaUtilPrefix}}Map localVarCookieParams = new {{javaUtilPrefix}}HashMap(); - {{javaUtilPrefix}}Map localVarFormParams = new {{javaUtilPrefix}}HashMap(); + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); {{#formParams}} if ({{paramName}} != null) { @@ -171,29 +169,52 @@ public class {{classname}} { {{^dynamicOperations}} {{#queryParams}} if ({{paramName}} != null) { - {{#collectionFormat}}localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("{{{.}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(localVarApiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); + {{#isFreeFormObject}}localVarQueryParams.addAll(localVarApiClient.freeFormParameterToPairs({{paramName}}));{{/isFreeFormObject}}{{^isFreeFormObject}}{{#collectionFormat}}localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("{{{.}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(localVarApiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}}));{{/isFreeFormObject}} } {{/queryParams}} + {{#constantParams}} + {{#isQueryParam}} + // Set client side default value of Query Param "{{baseName}}". + localVarCollectionQueryParams.add(new Pair("{{baseName}}", {{#_enum}}"{{{.}}}"{{/_enum}})); + + {{/isQueryParam}} + {{/constantParams}} {{#headerParams}} if ({{paramName}} != null) { localVarHeaderParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); } {{/headerParams}} + {{#constantParams}} + {{#isHeaderParam}} + // Set client side default value of Header Param "{{baseName}}". + localVarHeaderParams.put("{{baseName}}", {{#_enum}}"{{{.}}}"{{/_enum}}); + + {{/isHeaderParam}} + {{/constantParams}} {{#cookieParams}} if ({{paramName}} != null) { localVarCookieParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); } {{/cookieParams}} + {{#constantParams}} + {{#isCookieParam}} + // Set client side default value of Cookie Param "{{baseName}}". + localVarCookieParams.put("{{baseName}}", {{#_enum}}"{{{.}}}"{{/_enum}}); + + {{/isCookieParam}} + {{/constantParams}} {{/dynamicOperations}} {{#dynamicOperations}} localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); {{/dynamicOperations}} final String[] localVarAccepts = { - {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} + {{#produces}} + "{{{mediaType}}}"{{^-last}},{{/-last}} + {{/produces}} }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -201,14 +222,16 @@ public class {{classname}} { } final String[] localVarContentTypes = { - {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} + {{#consumes}} + "{{{mediaType}}}"{{^-last}},{{/-last}} + {{/consumes}} }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; + String[] localVarAuthNames = new String[] { {{#withAWSV4Signature}}"AWS4Auth"{{/withAWSV4Signature}}{{#authMethods}}{{#-first}}{{#withAWSV4Signature}}, {{/withAWSV4Signature}}{{/-first}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; return localVarApiClient.buildCall(basePath, localVarPath, {{^dynamicOperations}}"{{httpMethod}}"{{/dynamicOperations}}{{#dynamicOperations}}apiOperation.getMethod(){{/dynamicOperations}}, localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -218,15 +241,16 @@ public class {{classname}} { @SuppressWarnings("rawtypes") private okhttp3.Call {{operationId}}ValidateBeforeCall({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { {{^performBeanValidation}} - {{#allParams}}{{#required}} + {{#allParams}} + {{#required}} // verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { throw new ApiException("Missing the required parameter '{{paramName}}' when calling {{operationId}}(Async)"); } - {{/required}}{{/allParams}} - okhttp3.Call localVarCall = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); - return localVarCall; + {{/required}} + {{/allParams}} + return {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); {{/performBeanValidation}} {{#performBeanValidation}} @@ -240,9 +264,7 @@ public class {{classname}} { parameterValues); if (violations.size() == 0) { - okhttp3.Call localVarCall = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); - return localVarCall; - + return {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); } else { throw new BeanValidationException((Set) violations); } @@ -253,7 +275,6 @@ public class {{classname}} { e.printStackTrace(); throw new ApiException(e.getMessage()); } - {{/performBeanValidation}} } @@ -326,13 +347,42 @@ public class {{classname}} { {{/isDeprecated}} public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-streaming}} InputStream {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); - {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); - return localVarApiClient.executeStream(localVarCall, localVarReturnType);{{/returnType}} + {{#returnType}} + {{#errorObjectType}} + try { + Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + return localVarApiClient.executeStream(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<{{{errorObjectType}}}>(){}.getType())); + throw e; + } + {{/errorObjectType}} + {{^errorObjectType}} + Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + return localVarApiClient.executeStream(localVarCall, localVarReturnType); + {{/errorObjectType}} + {{/returnType}} } {{/vendorExtensions.x-streaming}}{{^vendorExtensions.x-streaming}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); - {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType);{{/returnType}}{{^returnType}}return localVarApiClient.execute(localVarCall);{{/returnType}} + {{^returnType}} + return localVarApiClient.execute(localVarCall); + {{/returnType}} + {{#returnType}} + {{#errorObjectType}} + try { + Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<{{{errorObjectType}}}>(){}.getType())); + throw e; + } + {{/errorObjectType}} + {{^errorObjectType}} + Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + {{/errorObjectType}} + {{/returnType}} } {{/vendorExtensions.x-streaming}} @@ -443,10 +493,17 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} + {{^vendorExtensions.x-streaming}} public {{{returnType}}}{{^returnType}}void{{/returnType}} execute() throws ApiException { {{#returnType}}ApiResponse<{{{.}}}> localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} return localVarResp.getData();{{/returnType}} } + {{/vendorExtensions.x-streaming}} + {{#vendorExtensions.x-streaming}} + public InputStream execute() throws ApiException { + return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + } + {{/vendorExtensions.x-streaming}} /** * Execute {{operationId}} request with HTTP info returned @@ -468,9 +525,16 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} + {{^vendorExtensions.x-streaming}} public ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException { return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); } + {{/vendorExtensions.x-streaming}} + {{#vendorExtensions.x-streaming}} + public InputStream executeWithHttpInfo() throws ApiException { + return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + } + {{/vendorExtensions.x-streaming}} /** * Execute {{operationId}} request (asynchronously) diff --git a/templates/libraries/okhttp-gson/apiException.mustache b/templates/libraries/okhttp-gson/apiException.mustache index 4bec51d..3cd6eda 100644 --- a/templates/libraries/okhttp-gson/apiException.mustache +++ b/templates/libraries/okhttp-gson/apiException.mustache @@ -9,16 +9,22 @@ import java.util.Map.Entry; import java.util.TreeMap; {{/caseInsensitiveResponseHeaders}} + /** *

ApiException class.

*/ @SuppressWarnings("serial") {{>generatedAnnotation}} public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ + private static final long serialVersionUID = 1L; + private int code = 0; private Map> responseHeaders = null; private String responseBody = null; - + {{#errorObjectType}} + private {{{errorObjectType}}} errorObject = null; + {{/errorObjectType}} + /** *

Constructor for ApiException.

*/ @@ -96,7 +102,7 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us * @param responseBody the response body */ public ApiException(int code, Map> responseHeaders, String responseBody) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); } /** @@ -156,4 +162,34 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us public String getResponseBody() { return responseBody; } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format("Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } + {{#errorObjectType}} + + /** + * Get the error object. + * + * @return Error object + */ + public {{{errorObjectType}}} getErrorObject() { + return errorObject; + } + + /** + * Get the error object. + * + * @param errorObject Error object + */ + public void setErrorObject({{{errorObjectType}}} errorObject) { + this.errorObject = errorObject; + } + {{/errorObjectType}} } diff --git a/templates/libraries/okhttp-gson/api_doc.mustache b/templates/libraries/okhttp-gson/api_doc.mustache index 5a4e396..dea75bd 100644 --- a/templates/libraries/okhttp-gson/api_doc.mustache +++ b/templates/libraries/okhttp-gson/api_doc.mustache @@ -3,14 +3,14 @@ All URIs are relative to *{{basePath}}* -Method | HTTP request | Description -------------- | ------------- | ------------- -{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +{{#operations}}{{#operation}}| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} | {{/operation}}{{/operations}} {{#operations}} {{#operation}} - + # **{{operationId}}**{{^vendorExtensions.x-group-parameters}} > {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}){{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}} > {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}}.{{paramName}}({{paramName}}){{/optionalParams}}.execute();{{/vendorExtensions.x-group-parameters}} @@ -33,6 +33,10 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("{{{basePath}}}"); + {{#withAWSV4Signature}} + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + {{/withAWSV4Signature}} {{#hasAuthMethods}} {{#authMethods}}{{#isBasic}}{{#isBasicBasic}} // Configure HTTP basic authorization: {{{name}}} @@ -75,9 +79,9 @@ public class Example { ### Parameters {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} -Name | Type | Description | Notes -------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------|{{/-last}}{{/allParams}} +{{#allParams}}| **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} | {{/allParams}} ### Return type @@ -98,7 +102,7 @@ Name | Type | Description | Notes | Status code | Description | Response headers | |-------------|-------------|------------------| {{#responses}} -**{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}} | +| **{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}} | {{/responses}} {{/responses.0}} diff --git a/templates/libraries/okhttp-gson/api_test.mustache b/templates/libraries/okhttp-gson/api_test.mustache index 98a30a6..29f6826 100644 --- a/templates/libraries/okhttp-gson/api_test.mustache +++ b/templates/libraries/okhttp-gson/api_test.mustache @@ -5,10 +5,9 @@ package {{package}}; import {{invokerPackage}}.ApiException; {{#imports}}import {{import}}; {{/imports}} -import org.junit.Test; -import org.junit.Ignore; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -{{^fullJavaUtil}} import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -16,24 +15,32 @@ import java.util.Map; {{#supportStreaming}} import java.io.InputStream; {{/supportStreaming}} -{{/fullJavaUtil}} +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} /** * API tests for {{classname}} */ -@Ignore +@Disabled public class {{classname}}Test { private final {{classname}} api = new {{classname}}(); - {{#operations}}{{#operation}} + {{#operations}} + {{#operation}} /** + {{#summary}} * {{summary}} * + {{/summary}} + {{#notes}} * {{notes}} * - * @throws ApiException - * if the Api call fails + {{/notes}} + * @throws ApiException if the Api call fails */ @Test public void {{operationId}}Test() throws ApiException { @@ -41,16 +48,18 @@ public class {{classname}}Test { {{{dataType}}} {{paramName}} = null; {{/allParams}} {{#vendorExtensions.x-streaming}} - InputStream response = api.{{operationId}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} + InputStream response = api.{{operationId}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} .{{paramName}}({{paramName}}){{/optionalParams}} .execute();{{/vendorExtensions.x-group-parameters}} {{/vendorExtensions.x-streaming}} {{^vendorExtensions.x-streaming}} - {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} + {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} .{{paramName}}({{paramName}}){{/optionalParams}} .execute();{{/vendorExtensions.x-group-parameters}} {{/vendorExtensions.x-streaming}} // TODO: test validations } - {{/operation}}{{/operations}} + + {{/operation}} + {{/operations}} } diff --git a/templates/libraries/okhttp-gson/auth/AWS4Auth.mustache b/templates/libraries/okhttp-gson/auth/AWS4Auth.mustache new file mode 100644 index 0000000..24bfb4c --- /dev/null +++ b/templates/libraries/okhttp-gson/auth/AWS4Auth.mustache @@ -0,0 +1,104 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.charset.StandardCharsets; +import java.util.Map; +import java.util.List; +import java.util.stream.Collectors; + +import software.amazon.awssdk.auth.credentials.AnonymousCredentialsProvider; +import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; +import software.amazon.awssdk.auth.credentials.AwsSessionCredentials; +import software.amazon.awssdk.auth.credentials.AwsCredentials; +import software.amazon.awssdk.auth.signer.Aws4Signer; +import software.amazon.awssdk.auth.signer.params.Aws4SignerParams; +import software.amazon.awssdk.http.ContentStreamProvider; +import software.amazon.awssdk.http.SdkHttpFullRequest; +import software.amazon.awssdk.http.SdkHttpMethod; +import software.amazon.awssdk.regions.Region; + +import okio.Buffer; + +{{>generatedAnnotation}} +public class AWS4Auth implements Authentication { + + private AwsCredentials credentials; + private String region; + private String service; + + public AWS4Auth() { + this.credentials = AnonymousCredentialsProvider.create().resolveCredentials(); + } + + public void setCredentials(String accessKey, String secretKey) { + this.credentials = AwsBasicCredentials.create(accessKey, secretKey); + } + + public void setCredentials(String accessKey, String secretKey, String sessionToken) { + this.credentials = AwsSessionCredentials.create(accessKey, secretKey, sessionToken); + } + + public void setRegion(String region) { + this.region = region; + } + + public void setService(String service) { + this.service = service; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, + Map cookieParams, String payload, String method, URI uri) + throws ApiException { + + SdkHttpFullRequest.Builder requestBuilder = + SdkHttpFullRequest.builder().uri(uri).method(SdkHttpMethod.fromValue(method)); + + ContentStreamProvider provider = new ContentStreamProvider() { + @Override + public InputStream newStream() { + InputStream is = new ByteArrayInputStream(payload.getBytes(StandardCharsets.UTF_8)); + return is; + } + }; + + requestBuilder = requestBuilder.contentStreamProvider(provider); + + SdkHttpFullRequest signableRequest = sign(requestBuilder); + + Map headers = signableRequest.headers().entrySet().stream() + .collect(Collectors.toMap(s -> s.getKey(), e -> e.getValue().get(0))); + + headerParams.putAll(headers); + } + + /** + * AWS Signature Version 4 signing. + * + * @param request {@link SdkHttpFullRequest.Builder} + * @return {@link SdkHttpFullRequest} + */ + private SdkHttpFullRequest sign(final SdkHttpFullRequest.Builder request) { + + SdkHttpFullRequest req = request.build(); + + if (this.service != null && this.region != null && this.credentials != null) { + Aws4SignerParams params = Aws4SignerParams.builder().signingName(this.service) + .signingRegion(Region.of(this.region)).awsCredentials(this.credentials).build(); + + Aws4Signer signer = Aws4Signer.create(); + + req = signer.sign(req, params); + } + + return req; + } +} diff --git a/templates/libraries/okhttp-gson/auth/HttpBasicAuth.mustache b/templates/libraries/okhttp-gson/auth/HttpBasicAuth.mustache index 417a89e..41f3367 100644 --- a/templates/libraries/okhttp-gson/auth/HttpBasicAuth.mustache +++ b/templates/libraries/okhttp-gson/auth/HttpBasicAuth.mustache @@ -11,8 +11,6 @@ import java.net.URI; import java.util.Map; import java.util.List; -import java.io.UnsupportedEncodingException; - public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/templates/libraries/okhttp-gson/auth/HttpBearerAuth.mustache b/templates/libraries/okhttp-gson/auth/HttpBearerAuth.mustache index c8a9fce..abe1cb8 100644 --- a/templates/libraries/okhttp-gson/auth/HttpBearerAuth.mustache +++ b/templates/libraries/okhttp-gson/auth/HttpBearerAuth.mustache @@ -6,13 +6,15 @@ import {{invokerPackage}}.ApiException; import {{invokerPackage}}.Pair; import java.net.URI; -import java.util.Map; import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Supplier; {{>generatedAnnotation}} public class HttpBearerAuth implements Authentication { private final String scheme; - private String bearerToken; + private Supplier tokenSupplier; public HttpBearerAuth(String scheme) { this.scheme = scheme; @@ -24,7 +26,7 @@ public class HttpBearerAuth implements Authentication { * @return The bearer token */ public String getBearerToken() { - return bearerToken; + return tokenSupplier.get(); } /** @@ -33,12 +35,22 @@ public class HttpBearerAuth implements Authentication { * @param bearerToken The bearer token to send in the Authorization header */ public void setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; + this.tokenSupplier = () -> bearerToken; + } + + /** + * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header + */ + public void setBearerToken(Supplier tokenSupplier) { + this.tokenSupplier = tokenSupplier; } @Override public void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { + String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null); if (bearerToken == null) { return; } diff --git a/templates/libraries/okhttp-gson/auth/OAuthOkHttpClient.mustache b/templates/libraries/okhttp-gson/auth/OAuthOkHttpClient.mustache index cb0e825..67d7f72 100644 --- a/templates/libraries/okhttp-gson/auth/OAuthOkHttpClient.mustache +++ b/templates/libraries/okhttp-gson/auth/OAuthOkHttpClient.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + {{#hasOAuthMethods}} package {{invokerPackage}}.auth; @@ -56,6 +58,7 @@ public class OAuthOkHttpClient implements HttpClient { response.body().string(), response.body().contentType().toString(), response.code(), + response.headers().toMultimap(), responseClass); } catch (IOException e) { throw new OAuthSystemException(e); diff --git a/templates/libraries/okhttp-gson/auth/RetryingOAuth.mustache b/templates/libraries/okhttp-gson/auth/RetryingOAuth.mustache index 137e266..fbe73e7 100644 --- a/templates/libraries/okhttp-gson/auth/RetryingOAuth.mustache +++ b/templates/libraries/okhttp-gson/auth/RetryingOAuth.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + {{#hasOAuthMethods}} package {{invokerPackage}}.auth; @@ -29,22 +31,31 @@ public class RetryingOAuth extends OAuth implements Interceptor { private TokenRequestBuilder tokenRequestBuilder; + /** + * @param client An OkHttp client + * @param tokenRequestBuilder A token request builder + */ public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); this.tokenRequestBuilder = tokenRequestBuilder; } + /** + * @param tokenRequestBuilder A token request builder + */ public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { this(new OkHttpClient(), tokenRequestBuilder); } /** - @param tokenUrl The token URL to be used for this OAuth2 flow. - Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". - The value must be an absolute URL. - @param clientId The OAuth2 client ID for the "clientCredentials" flow. - @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. - */ + * @param tokenUrl The token URL to be used for this OAuth2 flow. + * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". + * The value must be an absolute URL. + * @param clientId The OAuth2 client ID for the "clientCredentials" flow. + * @param flow OAuth flow. + * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. + * @param parameters A map of string. + */ public RetryingOAuth( String tokenUrl, String clientId, @@ -57,24 +68,29 @@ public class RetryingOAuth extends OAuth implements Interceptor { .setClientSecret(clientSecret)); setFlow(flow); if (parameters != null) { - for (String paramName : parameters.keySet()) { - tokenRequestBuilder.setParameter(paramName, parameters.get(paramName)); + for (Map.Entry entry : parameters.entrySet()) { + tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); } } } + /** + * Set the OAuth flow + * + * @param flow The OAuth flow. + */ public void setFlow(OAuthFlow flow) { switch(flow) { - case accessCode: + case ACCESS_CODE: tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); break; - case implicit: + case IMPLICIT: tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); break; - case password: + case PASSWORD: tokenRequestBuilder.setGrantType(GrantType.PASSWORD); break; - case application: + case APPLICATION: tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); break; default: @@ -116,8 +132,8 @@ public class RetryingOAuth extends OAuth implements Interceptor { } Map headers = oAuthRequest.getHeaders(); - for (String headerName : headers.keySet()) { - requestBuilder.addHeader(headerName, headers.get(headerName)); + for (Map.Entry entry : headers.entrySet()) { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); } requestBuilder.url(oAuthRequest.getLocationUri()); @@ -148,8 +164,12 @@ public class RetryingOAuth extends OAuth implements Interceptor { } } - /* + /** * Returns true if the access token has been updated + * + * @param requestAccessToken the request access token + * @return True if the update is successful + * @throws java.io.IOException If fail to update the access token */ public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { @@ -166,10 +186,20 @@ public class RetryingOAuth extends OAuth implements Interceptor { return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); } + /** + * Gets the token request builder + * + * @return A token request builder + */ public TokenRequestBuilder getTokenRequestBuilder() { return tokenRequestBuilder; } + /** + * Sets the token request builder + * + * @param tokenRequestBuilder Token request builder + */ public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { this.tokenRequestBuilder = tokenRequestBuilder; } diff --git a/templates/libraries/okhttp-gson/build.gradle.mustache b/templates/libraries/okhttp-gson/build.gradle.mustache index c97cb87..eb67fc1 100644 --- a/templates/libraries/okhttp-gson/build.gradle.mustache +++ b/templates/libraries/okhttp-gson/build.gradle.mustache @@ -14,8 +14,8 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' - classpath 'com.diffplug.spotless:spotless-plugin-gradle:5.17.1' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0' } } @@ -66,10 +66,10 @@ if(hasProperty('target') && target == 'android') { def task = project.tasks.create "jar${variant.name.capitalize()}", Jar task.description = "Create jar artifact for ${variant.name}" task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - task.destinationDir = project.file("${project.buildDir}/outputs/jar") - task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" - artifacts.add('archives', task); + task.from variant.javaCompile.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task) } } @@ -110,31 +110,33 @@ ext { } dependencies { - implementation 'io.swagger:swagger-annotations:1.5.24' + implementation 'io.swagger:swagger-annotations:1.6.8' implementation "com.google.code.findbugs:jsr305:3.0.2" - implementation 'com.squareup.okhttp3:okhttp:4.9.1' - implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1' - implementation 'com.google.code.gson:gson:2.8.6' - implementation 'io.gsonfire:gson-fire:1.8.4' + implementation 'com.squareup.okhttp3:okhttp:4.12.0' + implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0' + implementation 'com.google.code.gson:gson:2.9.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + implementation 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6' {{#openApiNullable}} - implementation 'org.openapitools:jackson-databind-nullable:0.2.1' + implementation 'org.openapitools:jackson-databind-nullable:0.2.6' {{/openApiNullable}} + {{#withAWSV4Signature}} + implementation 'software.amazon.awssdk:auth:2.20.157' + {{/withAWSV4Signature}} {{#hasOAuthMethods}} - implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1' + implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2' {{/hasOAuthMethods}} - implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.10' + implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' {{#joda}} implementation 'joda-time:joda-time:2.9.9' {{/joda}} - {{#threetenbp}} - implementation 'org.threeten:threetenbp:1.4.3' - {{/threetenbp}} {{#dynamicOperations}} - implementation 'io.swagger.parser.v3:swagger-parser-v3:2.0.23' + implementation 'io.swagger.parser.v3:swagger-parser-v3:2.0.30' {{/dynamicOperations}} implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation 'junit:junit:4.13.1' - testImplementation 'org.mockito:mockito-core:3.11.2' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' } javadoc { @@ -167,3 +169,17 @@ spotless { importOrder() } } + +test { + // Enable JUnit 5 (Gradle 4.6+). + useJUnitPlatform() + + // Always run tests, even when nothing changed. + dependsOn 'cleanTest' + + // Show test results. + testLogging { + events "passed", "skipped", "failed" + } + +} diff --git a/templates/libraries/okhttp-gson/build.sbt.mustache b/templates/libraries/okhttp-gson/build.sbt.mustache index 5e0c74c..2045b84 100644 --- a/templates/libraries/okhttp-gson/build.sbt.mustache +++ b/templates/libraries/okhttp-gson/build.sbt.mustache @@ -9,31 +9,33 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.24", - "com.squareup.okhttp3" % "okhttp" % "4.9.1", - "com.squareup.okhttp3" % "logging-interceptor" % "4.9.1", - "com.google.code.gson" % "gson" % "2.8.6", - "org.apache.commons" % "commons-lang3" % "3.10", + "io.swagger" % "swagger-annotations" % "1.6.5", + "com.squareup.okhttp3" % "okhttp" % "4.12.0", + "com.squareup.okhttp3" % "logging-interceptor" % "4.12.0", + "com.google.code.gson" % "gson" % "2.9.1", + "org.apache.commons" % "commons-lang3" % "3.12.0", + "jakarta.ws.rs" % "jakarta.ws.rs-api" % "2.1.6", {{#openApiNullable}} - "org.openapitools" % "jackson-databind-nullable" % "0.2.2", + "org.openapitools" % "jackson-databind-nullable" % "0.2.6", {{/openApiNullable}} + {{#withAWSV4Signature}} + "software.amazon.awssdk" % "auth" % "2.20.157", + {{/withAWSV4Signature}} {{#hasOAuthMethods}} - "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1", + "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.2", {{/hasOAuthMethods}} {{#joda}} "joda-time" % "joda-time" % "2.9.9" % "compile", {{/joda}} - {{#threetenbp}} - "org.threeten" % "threetenbp" % "1.4.3" % "compile", - {{/threetenbp}} {{#dynamicOperations}} - "io.swagger.parser.v3" % "swagger-parser-v3" "2.0.23" % "compile" + "io.swagger.parser.v3" % "swagger-parser-v3" "2.0.30" % "compile" {{/dynamicOperations}} - "io.gsonfire" % "gson-fire" % "1.8.3" % "compile", + "io.gsonfire" % "gson-fire" % "1.9.0" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "junit" % "junit" % "4.13.1" % "test", - "com.novocode" % "junit-interface" % "0.10" % "test" + "org.junit.jupiter" % "junit-jupiter-api" % "5.10.3" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test", + "org.mockito" % "mockito-core" % "3.12.4" % "test" ) ) diff --git a/templates/libraries/okhttp-gson/model.mustache b/templates/libraries/okhttp-gson/model.mustache new file mode 100644 index 0000000..c82b0fb --- /dev/null +++ b/templates/libraries/okhttp-gson/model.mustache @@ -0,0 +1,35 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#useReflectionEqualsHashCode}} +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +{{/useReflectionEqualsHashCode}} +import java.util.Objects; +{{#imports}} +import {{import}}; +{{/imports}} +{{#serializableModel}} +import java.io.Serializable; +{{/serializableModel}} +{{#withXml}} +import {{javaxPackage}}.xml.bind.annotation.*; +{{/withXml}} +{{#parcelableModel}} +import android.os.Parcelable; +import android.os.Parcel; +{{/parcelableModel}} +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; +{{/useBeanValidation}} +{{#performBeanValidation}} +import org.hibernate.validator.constraints.*; +{{/performBeanValidation}} + +{{#models}} +{{#model}} +{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{#oneOf}}{{#-first}}{{>oneof_model}}{{/-first}}{{/oneOf}}{{^oneOf}}{{#anyOf}}{{#-first}}{{>anyof_model}}{{/-first}}{{/anyOf}}{{^anyOf}}{{>pojo}}{{/anyOf}}{{/oneOf}}{{/isEnum}} +{{/model}} +{{/models}} diff --git a/templates/libraries/okhttp-gson/modelEnum.mustache b/templates/libraries/okhttp-gson/modelEnum.mustache new file mode 100644 index 0000000..b955e53 --- /dev/null +++ b/templates/libraries/okhttp-gson/modelEnum.mustache @@ -0,0 +1,85 @@ +import java.io.IOException; +{{#isUri}} +import java.net.URI; +{{/isUri}} +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}} + */ +@JsonAdapter({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.Adapter.class) +{{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { + {{#allowableValues}}{{#enumVars}} + {{#enumDescription}} + /** + * {{.}} + */ + {{/enumDescription}} + {{#withXml}} + @XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) + {{/withXml}} + {{{name}}}({{{value}}}){{^-last}}, + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + + private {{{dataType}}} value; + + {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) { + this.value = value; + } + + public {{{dataType}}} getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) { + for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (b.value.{{^isString}}equals{{/isString}}{{#isString}}{{#useEnumCaseInsensitive}}equalsIgnoreCase{{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}equals{{/useEnumCaseInsensitive}}{{/isString}}(value)) { + return b; + } + } + {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}return {{{name}}};{{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/enumUnknownDefaultCase}}{{/isNullable}} + } + + public static class Adapter extends TypeAdapter<{{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}> { + @Override + public void write(final JsonWriter jsonWriter, final {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} enumeration) throws IOException { + jsonWriter.value(enumeration.getValue(){{#isUri}}.toASCIIString(){{/isUri}}); + } + + @Override + public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException { + {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isFloat}}(float){{/isFloat}}{{#isUri}}URI.create({{/isUri}}jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{#isUri}}nextString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}{{#isFloat}}nextDouble{{/isFloat}}{{^isFloat}}next{{{dataType}}}{{/isFloat}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; + return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isUri}}URI.create({{/isUri}}jsonElement.{{#isNumber}}getAsString(){{/isNumber}}{{#isInteger}}getAsInt(){{/isInteger}}{{#isUri}}getAsString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}getAs{{{dataType}}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; + {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + } +{{#supportUrlQuery}} + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + if (prefix == null) { + prefix = ""; + } + + return String.format("%s=%s", prefix, this.toString()); + } +{{/supportUrlQuery}} +} diff --git a/templates/libraries/okhttp-gson/modelInnerEnum.mustache b/templates/libraries/okhttp-gson/modelInnerEnum.mustache new file mode 100644 index 0000000..06912e9 --- /dev/null +++ b/templates/libraries/okhttp-gson/modelInnerEnum.mustache @@ -0,0 +1,66 @@ + /** + * {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}} + */ + @JsonAdapter({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.Adapter.class) +{{#withXml}} + @XmlType(name="{{datatypeWithEnum}}") + @XmlEnum({{dataType}}.class) +{{/withXml}} + {{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{#allowableValues}} + {{#enumVars}} + {{#enumDescription}} + /** + * {{.}} + */ + {{/enumDescription}} + {{#withXml}} + @XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) + {{/withXml}} + {{{name}}}({{{value}}}){{^-last}}, + {{/-last}}{{#-last}};{{/-last}} + {{/enumVars}} + {{/allowableValues}} + + private {{{dataType}}} value; + + {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{{dataType}}} value) { + this.value = value; + } + + public {{{dataType}}} getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) { + for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (b.value.{{^isString}}equals{{/isString}}{{#isString}}{{#useEnumCaseInsensitive}}equalsIgnoreCase{{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}equals{{/useEnumCaseInsensitive}}{{/isString}}(value)) { + return b; + } + } + {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}return {{{name}}};{{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/enumUnknownDefaultCase}}{{/isNullable}} + } + + public static class Adapter extends TypeAdapter<{{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}> { + @Override + public void write(final JsonWriter jsonWriter, final {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} enumeration) throws IOException { + jsonWriter.value(enumeration.getValue(){{#isUri}}.toASCIIString(){{/isUri}}); + } + + @Override + public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException { + {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isFloat}}(float){{/isFloat}} {{#isUri}}URI.create({{/isUri}}jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{#isUri}}nextString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}{{#isFloat}}nextDouble{{/isFloat}}{{^isFloat}}next{{{dataType}}}{{/isFloat}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; + return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isUri}}URI.create({{/isUri}}jsonElement.{{#isNumber}}getAsString(){{/isNumber}}{{#isInteger}}getAsInt(){{/isInteger}}{{#isUri}}getAsString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}getAs{{{dataType}}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; + {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + } + } diff --git a/templates/libraries/okhttp-gson/model_test.mustache b/templates/libraries/okhttp-gson/model_test.mustache new file mode 100644 index 0000000..040d319 --- /dev/null +++ b/templates/libraries/okhttp-gson/model_test.mustache @@ -0,0 +1,42 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for {{classname}} + */ +public class {{classname}}Test { + {{#models}} + {{#model}} + {{^vendorExtensions.x-is-one-of-interface}} + {{^isEnum}} + private final {{classname}} model = new {{classname}}(); + + {{/isEnum}} + /** + * Model tests for {{classname}} + */ + @Test + public void test{{classname}}() { + // TODO: test {{classname}} + } + + {{#allVars}} + /** + * Test the property '{{name}}' + */ + @Test + public void {{name}}Test() { + // TODO: test {{name}} + } + + {{/allVars}} + {{/vendorExtensions.x-is-one-of-interface}} + {{/model}} + {{/models}} +} diff --git a/templates/libraries/okhttp-gson/oneof_model.mustache b/templates/libraries/okhttp-gson/oneof_model.mustache new file mode 100644 index 0000000..31c6326 --- /dev/null +++ b/templates/libraries/okhttp-gson/oneof_model.mustache @@ -0,0 +1,512 @@ + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import {{invokerPackage}}.JSON; + +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} +public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}} implements {{{.}}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-implements}} { + private static final Logger log = Logger.getLogger({{classname}}.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!{{classname}}.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes '{{classname}}' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + {{#composedSchemas}} + {{#oneOf}} + {{^isArray}} + {{^isMap}} + {{^vendorExtensions.x-duplicated-data-type}} + final TypeAdapter<{{{dataType}}}> adapter{{{dataType}}} = gson.getDelegateAdapter(this, TypeToken.get({{{dataType}}}.class)); + {{/vendorExtensions.x-duplicated-data-type}} + {{/isMap}} + {{/isArray}} + {{#isArray}} + + final Type typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = new TypeToken<{{{dataType}}}>(){}.getType(); + final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = (TypeAdapter<{{{dataType}}}>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}})); + {{/isArray}} + {{#isMap}} + final Type typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = new TypeToken<{{{dataType}}}>(){}.getType(); + final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = (TypeAdapter<{{{dataType}}}>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}})); + {{/isMap}} + {{/oneOf}} + {{/composedSchemas}} + + return (TypeAdapter) new TypeAdapter<{{classname}}>() { + @Override + public void write(JsonWriter out, {{classname}} value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + {{#composedSchemas}} + {{#oneOf}} + {{^vendorExtensions.x-duplicated-data-type}} + // check if the actual instance is of the type `{{{dataType}}}` + if (value.getActualInstance() instanceof {{#isArray}}List{{/isArray}}{{#isMap}}Map{{/isMap}}{{^isMap}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isMap}}) { + {{#isPrimitiveType}} + {{^isMap}} + JsonPrimitive primitive = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}.toJsonTree(({{{dataType}}})value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + {{/isMap}} + {{#isMap}} + JsonObject object = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}.toJsonTree(({{{dataType}}})value.getActualInstance()).getAsJsonObject(); + elementAdapter.write(out, object); + return; + {{/isMap}} + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isArray}} + List list = (List) value.getActualInstance(); + if (list.get(0) instanceof {{{items.dataType}}}) { + JsonArray array = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}.toJsonTree(({{{dataType}}})value.getActualInstance()).getAsJsonArray(); + elementAdapter.write(out, array); + return; + } + {{/isArray}} + {{/isPrimitiveType}} + {{^isMap}} + {{^isArray}} + {{^isPrimitiveType}} + JsonElement element = adapter{{{dataType}}}.toJsonTree(({{{dataType}}})value.getActualInstance()); + elementAdapter.write(out, element); + return; + {{/isPrimitiveType}} + {{/isArray}} + {{/isMap}} + } + {{/vendorExtensions.x-duplicated-data-type}} + {{/oneOf}} + {{/composedSchemas}} + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}"); + } + + @Override + public {{classname}} read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + {{#useOneOfDiscriminatorLookup}} + {{#discriminator}} + JsonObject jsonObject = jsonElement.getAsJsonObject(); + + // use discriminator value for faster oneOf lookup + {{classname}} new{{classname}} = new {{classname}}(); + if (jsonObject.get("{{{propertyBaseName}}}") == null) { + log.log(Level.WARNING, "Failed to lookup discriminator value for {{classname}} as `{{{propertyBaseName}}}` was not found in the payload or the payload is empty."); + } else { + // look up the discriminator value in the field `{{{propertyBaseName}}}` + switch (jsonObject.get("{{{propertyBaseName}}}").getAsString()) { + {{#mappedModels}} + case "{{{mappingName}}}": + deserialized = adapter{{modelName}}.fromJsonTree(jsonObject); + new{{classname}}.setActualInstance(deserialized); + return new{{classname}}; + {{/mappedModels}} + default: + log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", jsonObject.get("{{{propertyBaseName}}}").getAsString())); + } + } + + {{/discriminator}} + {{/useOneOfDiscriminatorLookup}} + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + {{#composedSchemas}} + {{#oneOf}} + {{^vendorExtensions.x-duplicated-data-type}} + {{^hasVars}} + // deserialize {{{dataType}}} + try { + // validate the JSON object to see if any exception is thrown + {{^isArray}} + {{^isMap}} + {{#isNumber}} + if (!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}; + {{/isNumber}} + {{^isNumber}} + {{#isPrimitiveType}} + if (!jsonElement.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}; + {{/isPrimitiveType}} + {{/isNumber}} + {{^isNumber}} + {{^isPrimitiveType}} + {{{dataType}}}.validateJsonElement(jsonElement); + actualAdapter = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}; + {{/isPrimitiveType}} + {{/isNumber}} + {{/isMap}} + {{/isArray}} + {{#isArray}} + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + + JsonArray array = jsonElement.getAsJsonArray(); + // validate array items + for(JsonElement element : array) { + {{#items}} + {{#isNumber}} + if (!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isNumber}} + {{^isNumber}} + {{#isPrimitiveType}} + if (!element.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) { + throw new IllegalArgumentException(String.format("Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isPrimitiveType}} + {{/isNumber}} + {{^isNumber}} + {{^isPrimitiveType}} + {{{dataType}}}.validateJsonElement(element); + {{/isPrimitiveType}} + {{/isNumber}} + {{/items}} + } + actualAdapter = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}; + {{/isArray}} + {{#isMap}} + if (!jsonElement.isJsonObject()) { + throw new IllegalArgumentException(String.format("Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString())); + } + + {{^isFreeFormObject}} + Map map = jsonElement.getAsJsonObject().asMap(); + // validate map items + for(JsonElement element : map.values()) { + {{#items}} + {{#isNumber}} + if (!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isNumber}} + {{^isNumber}} + {{#isPrimitiveType}} + if (!element.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) { + throw new IllegalArgumentException(String.format("Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isPrimitiveType}} + {{/isNumber}} + {{^isNumber}} + {{^isPrimitiveType}} + {{{dataType}}}.validateJsonElement(element); + {{/isPrimitiveType}} + {{/isNumber}} + {{/items}} + } + {{/isFreeFormObject}} + actualAdapter = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}; + {{/isMap}} + match++; + log.log(Level.FINER, "Input data matches schema '{{{dataType}}}'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for {{{dataType}}} failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema '{{{dataType}}}'", e); + } + {{/hasVars}} + {{#hasVars}} + // deserialize {{{.}}} + try { + // validate the JSON object to see if any exception is thrown + {{.}}.validateJsonElement(jsonElement); + actualAdapter = adapter{{.}}; + match++; + log.log(Level.FINER, "Input data matches schema '{{{.}}}'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for {{{.}}} failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema '{{{.}}}'", e); + } + {{/hasVars}} + {{/vendorExtensions.x-duplicated-data-type}} + {{/oneOf}} + {{/composedSchemas}} + + if (match == 1) { + {{classname}} ret = new {{classname}}(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for {{classname}}: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public {{classname}}() { + super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); + } + + public {{classname}}(Object o) { + super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); + setActualInstance(o); + } + + static { + {{#composedSchemas}} + {{#oneOf}} + {{^vendorExtensions.x-duplicated-data-type}} + schemas.put("{{{dataType}}}", {{{baseType}}}.class); + {{/vendorExtensions.x-duplicated-data-type}} + {{/oneOf}} + {{/composedSchemas}} + } + + @Override + public Map> getSchemas() { + return {{classname}}.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}} + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + {{#isNullable}} + if (instance == null) { + super.setActualInstance(instance); + return; + } + + {{/isNullable}} + {{#composedSchemas}} + {{#oneOf}} + {{^vendorExtensions.x-duplicated-data-type}} + if (instance instanceof {{#isArray}}List{{/isArray}}{{#isMap}}Map{{/isMap}}{{^isMap}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isMap}}) { + {{#isArray}} + List list = (List) instance; + if (list.get(0) instanceof {{{items.dataType}}}) { + super.setActualInstance(instance); + return; + } + {{/isArray}} + {{^isArray}} + super.setActualInstance(instance); + return; + {{/isArray}} + } + + {{/vendorExtensions.x-duplicated-data-type}} + {{/oneOf}} + {{/composedSchemas}} + throw new RuntimeException("Invalid instance type. Must be {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}"); + } + + /** + * Get the actual instance, which can be the following: + * {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}} + * + * @return The actual instance ({{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + {{#composedSchemas}} + {{#oneOf}} + {{^vendorExtensions.x-duplicated-data-type}} + /** + * Get the actual instance of `{{{dataType}}}`. If the actual instance is not `{{{dataType}}}`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `{{{dataType}}}` + * @throws ClassCastException if the instance is not `{{{dataType}}}` + */ + public {{{dataType}}} get{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}() throws ClassCastException { + return ({{{dataType}}})super.getActualInstance(); + } + {{/vendorExtensions.x-duplicated-data-type}} + {{/oneOf}} + {{/composedSchemas}} + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to {{classname}} + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + {{#composedSchemas}} + {{#oneOf}} + {{^vendorExtensions.x-duplicated-data-type}} + // validate the json string with {{{dataType}}} + try { + {{^hasVars}} + {{^isMap}} + {{^isArray}} + {{#isNumber}} + if (!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isNumber}} + {{^isNumber}} + {{#isPrimitiveType}} + if (!jsonElement.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isPrimitiveType}} + {{/isNumber}} + {{^isNumber}} + {{^isPrimitiveType}} + {{{dataType}}}.validateJsonElement(jsonElement); + {{/isPrimitiveType}} + {{/isNumber}} + {{/isArray}} + {{/isMap}} + {{#isArray}} + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + JsonArray array = jsonElement.getAsJsonArray(); + // validate array items + for(JsonElement element : array) { + {{#items}} + {{#isNumber}} + if (!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isNumber}} + {{^isNumber}} + {{#isPrimitiveType}} + if (!element.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) { + throw new IllegalArgumentException(String.format("Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isPrimitiveType}} + {{/isNumber}} + {{^isNumber}} + {{^isPrimitiveType}} + {{{dataType}}}.validateJsonElement(element); + {{/isPrimitiveType}} + {{/isNumber}} + {{/items}} + } + {{/isArray}} + {{#isMap}} + if (!jsonElement.isJsonObject()) { + throw new IllegalArgumentException(String.format("Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString())); + } + + {{^isFreeFormObject}} + Map map = jsonElement.getAsJsonObject().asMap(); + // validate map items + for(JsonElement element : map.values()) { + {{#items}} + {{#isNumber}} + if (!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isNumber}} + {{^isNumber}} + {{#isPrimitiveType}} + if (!element.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) { + throw new IllegalArgumentException(String.format("Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isPrimitiveType}} + {{/isNumber}} + {{^isNumber}} + {{^isPrimitiveType}} + {{{dataType}}}.validateJsonElement(element); + {{/isPrimitiveType}} + {{/isNumber}} + {{/items}} + } + {{/isFreeFormObject}} + {{/isMap}} + {{/hasVars}} + {{#hasVars}} + {{{.}}}.validateJsonElement(jsonElement); + validCount++; + {{/hasVars}} + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for {{{dataType}}} failed with `%s`.", e.getMessage())); + // continue to the next one + } + {{/vendorExtensions.x-duplicated-data-type}} + {{/oneOf}} + {{/composedSchemas}} + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for {{classname}} with oneOf schemas: {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of {{classname}} given an JSON string + * + * @param jsonString JSON string + * @return An instance of {{classname}} + * @throws IOException if the JSON string is invalid with respect to {{classname}} + */ + public static {{{classname}}} fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, {{{classname}}}.class); + } + + /** + * Convert an instance of {{classname}} to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/templates/libraries/okhttp-gson/pojo.mustache b/templates/libraries/okhttp-gson/pojo.mustache new file mode 100644 index 0000000..0a32ef0 --- /dev/null +++ b/templates/libraries/okhttp-gson/pojo.mustache @@ -0,0 +1,591 @@ +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import {{invokerPackage}}.JSON; + +/** + * {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} + * @deprecated{{/isDeprecated}} + */{{#isDeprecated}} +@Deprecated{{/isDeprecated}} +{{#swagger1AnnotationLibrary}} +{{#description}} +@ApiModel(description = "{{{.}}}") +{{/description}} +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} +{{#description}} +@Schema(description = "{{{.}}}") +{{/description}} +{{/swagger2AnnotationLibrary}} +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} +{{#vendorExtensions.x-class-extra-annotation}} +{{{vendorExtensions.x-class-extra-annotation}}} +{{/vendorExtensions.x-class-extra-annotation}} +public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ +{{#serializableModel}} + private static final long serialVersionUID = 1L; + +{{/serializableModel}} + {{#vars}} + {{#isEnum}} + {{^isContainer}} +{{>modelInnerEnum}} + {{/isContainer}} + {{#isContainer}} + {{#mostInnerItems}} +{{>modelInnerEnum}} + {{/mostInnerItems}} + {{/isContainer}} + {{/isEnum}} + public static final String SERIALIZED_NAME_{{nameInSnakeCase}} = "{{baseName}}"; + {{#withXml}} + @Xml{{#isXmlAttribute}}Attribute{{/isXmlAttribute}}{{^isXmlAttribute}}Element{{/isXmlAttribute}}(name = "{{items.xmlName}}{{^items.xmlName}}{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}{{/items.xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{#isXmlWrapped}} + @XmlElementWrapper(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{/isXmlWrapped}} + {{/withXml}} + {{#deprecated}} + @Deprecated + {{/deprecated}} + @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) + {{#vendorExtensions.x-field-extra-annotation}} + {{{vendorExtensions.x-field-extra-annotation}}} + {{/vendorExtensions.x-field-extra-annotation}} + {{#isDiscriminator}}protected{{/isDiscriminator}}{{^isDiscriminator}}private{{/isDiscriminator}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; + + {{/vars}} + public {{classname}}() { + {{#parent}} + {{#parcelableModel}} + super(); + {{/parcelableModel}} + {{/parent}} + {{#discriminator}} + {{^discriminator.isEnum}} + this.{{{discriminatorName}}} = this.getClass().getSimpleName(); + {{/discriminator.isEnum}} + {{/discriminator}} + } + {{#vendorExtensions.x-has-readonly-properties}} + {{^withXml}} + + public {{classname}}( + {{#readOnlyVars}} + {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}} + {{/readOnlyVars}} + ) { + this(); + {{#readOnlyVars}} + this.{{name}} = {{name}}; + {{/readOnlyVars}} + } + {{/withXml}} + {{/vendorExtensions.x-has-readonly-properties}} + {{#vars}} + + {{^isReadOnly}} + {{#deprecated}} + @Deprecated + {{/deprecated}} + public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + this.{{name}} = {{name}}; + return this; + } + {{#isArray}} + + public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}; + } + this.{{name}}.add({{name}}Item); + return this; + } + {{/isArray}} + {{#isMap}} + + public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}; + } + this.{{name}}.put(key, {{name}}Item); + return this; + } + {{/isMap}} + + {{/isReadOnly}} + /** + {{#description}} + * {{.}} + {{/description}} + {{^description}} + * Get {{name}} + {{/description}} + {{#minimum}} + * minimum: {{.}} + {{/minimum}} + {{#maximum}} + * maximum: {{.}} + {{/maximum}} + * @return {{name}} + {{#deprecated}} + * @deprecated + {{/deprecated}} + */ +{{#deprecated}} + @Deprecated +{{/deprecated}} +{{#required}} +{{#isNullable}} + @{{javaxPackage}}.annotation.Nullable +{{/isNullable}} +{{^isNullable}} + @{{javaxPackage}}.annotation.Nonnull +{{/isNullable}} +{{/required}} +{{^required}} + @{{javaxPackage}}.annotation.Nullable +{{/required}} +{{#useBeanValidation}} +{{>beanValidation}} +{{/useBeanValidation}} +{{#swagger1AnnotationLibrary}} + @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} + @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}") +{{/swagger2AnnotationLibrary}} +{{#vendorExtensions.x-extra-annotation}} + {{{vendorExtensions.x-extra-annotation}}} +{{/vendorExtensions.x-extra-annotation}} + public {{{datatypeWithEnum}}} {{getter}}() { + return {{name}}; + } + + {{^isReadOnly}} +{{#vendorExtensions.x-setter-extra-annotation}} {{{vendorExtensions.x-setter-extra-annotation}}} +{{/vendorExtensions.x-setter-extra-annotation}}{{#deprecated}} @Deprecated +{{/deprecated}} public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { + this.{{name}} = {{name}}; + } + {{/isReadOnly}} + + {{/vars}} +{{>libraries/okhttp-gson/additional_properties}} + + @Override + public boolean equals(Object o) { + {{#useReflectionEqualsHashCode}} + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + }{{#hasVars}} + {{classname}} {{classVarName}} = ({{classname}}) o; + return {{#vars}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{^-last}} && + {{/-last}}{{/vars}}{{#isAdditionalPropertiesTrue}}&& + Objects.equals(this.additionalProperties, {{classVarName}}.additionalProperties){{/isAdditionalPropertiesTrue}}{{#parent}} && + super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} + return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}} + {{/useReflectionEqualsHashCode}} + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + + @Override + public int hashCode() { + {{#useReflectionEqualsHashCode}} + return HashCodeBuilder.reflectionHashCode(this); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + return Objects.hash({{#vars}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}{{#isAdditionalPropertiesTrue}}{{#hasVars}}, {{/hasVars}}{{^hasVars}}{{#parent}}, {{/parent}}{{/hasVars}}additionalProperties{{/isAdditionalPropertiesTrue}}); + {{/useReflectionEqualsHashCode}} + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class {{classname}} {\n"); + {{#parent}} + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + {{/parent}} + {{#vars}} + sb.append(" {{name}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{name}}){{/isPassword}}).append("\n"); + {{/vars}} +{{#isAdditionalPropertiesTrue}} + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); +{{/isAdditionalPropertiesTrue}} + sb.append("}"); + return sb.toString(); + } + + /** + * 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 "); + } + +{{#parcelableModel}} + + public void writeToParcel(Parcel out, int flags) { +{{#model}} +{{#isArray}} + out.writeList(this); +{{/isArray}} +{{^isArray}} +{{#parent}} + super.writeToParcel(out, flags); +{{/parent}} +{{#vars}} + out.writeValue({{name}}); +{{/vars}} +{{/isArray}} +{{/model}} + } + + {{classname}}(Parcel in) { +{{#isArray}} + in.readTypedList(this, {{arrayModelType}}.CREATOR); +{{/isArray}} +{{^isArray}} +{{#parent}} + super(in); +{{/parent}} +{{#vars}} +{{#isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue(null); +{{/isPrimitiveType}} +{{^isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue({{complexType}}.class.getClassLoader()); +{{/isPrimitiveType}} +{{/vars}} +{{/isArray}} + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator<{{classname}}> CREATOR = new Parcelable.Creator<{{classname}}>() { + public {{classname}} createFromParcel(Parcel in) { +{{#model}} +{{#isArray}} + {{classname}} result = new {{classname}}(); + result.addAll(in.readArrayList({{arrayModelType}}.class.getClassLoader())); + return result; +{{/isArray}} +{{^isArray}} + return new {{classname}}(in); +{{/isArray}} +{{/model}} + } + public {{classname}}[] newArray(int size) { + return new {{classname}}[size]; + } + }; +{{/parcelableModel}} + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + {{#allVars}} + openapiFields.add("{{baseName}}"); + {{/allVars}} + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + {{#requiredVars}} + openapiRequiredFields.add("{{baseName}}"); + {{/requiredVars}} + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to {{classname}} + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!{{classname}}.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in {{{classname}}} is not found in the empty JSON string", {{classname}}.openapiRequiredFields.toString())); + } + } + {{^hasChildren}} + {{^isAdditionalPropertiesTrue}} + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!{{classname}}.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `{{classname}}` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + {{/isAdditionalPropertiesTrue}} + {{#requiredVars}} + {{#-first}} + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : {{classname}}.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + {{/-first}} + {{/requiredVars}} + {{/hasChildren}} + {{^discriminator}} + {{#hasVars}} + JsonObject jsonObj = jsonElement.getAsJsonObject(); + {{/hasVars}} + {{#vars}} + {{#isArray}} + {{#items.isModel}} + {{#required}} + // ensure the json data is an array + if (!jsonObj.get("{{{baseName}}}").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + + JsonArray jsonArray{{name}} = jsonObj.getAsJsonArray("{{{baseName}}}"); + // validate the required field `{{{baseName}}}` (array) + for (int i = 0; i < jsonArray{{name}}.size(); i++) { + {{{items.dataType}}}.validateJsonElement(jsonArray{{name}}.get(i)); + }; + {{/required}} + {{^required}} + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) { + JsonArray jsonArray{{name}} = jsonObj.getAsJsonArray("{{{baseName}}}"); + if (jsonArray{{name}} != null) { + // ensure the json data is an array + if (!jsonObj.get("{{{baseName}}}").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + + // validate the optional field `{{{baseName}}}` (array) + for (int i = 0; i < jsonArray{{name}}.size(); i++) { + {{{items.dataType}}}.validateJsonElement(jsonArray{{name}}.get(i)); + }; + } + } + {{/required}} + {{/items.isModel}} + {{^items.isModel}} + {{^required}} + // ensure the optional json data is an array if present + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull() && !jsonObj.get("{{{baseName}}}").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + {{/required}} + {{#required}} + // ensure the required json array is present + if (jsonObj.get("{{{baseName}}}") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("{{{baseName}}}").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + {{/required}} + {{/items.isModel}} + {{/isArray}} + {{^isContainer}} + {{#isString}} + if ({{#notRequiredOrIsNullable}}(jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) && {{/notRequiredOrIsNullable}}!jsonObj.get("{{{baseName}}}").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be a primitive type in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + {{/isString}} + {{#isModel}} + {{#required}} + // validate the required field `{{{baseName}}}` + {{{dataType}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + {{/required}} + {{^required}} + // validate the optional field `{{{baseName}}}` + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) { + {{{dataType}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + } + {{/required}} + {{/isModel}} + {{#isEnum}} + {{#required}} + // validate the required field `{{{baseName}}}` + {{{datatypeWithEnum}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + {{/required}} + {{^required}} + // validate the optional field `{{{baseName}}}` + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) { + {{{datatypeWithEnum}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + } + {{/required}} + {{/isEnum}} + {{#isEnumRef}} + {{#required}} + // validate the required field `{{{baseName}}}` + {{{dataType}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + {{/required}} + {{^required}} + // validate the optional field `{{{baseName}}}` + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) { + {{{dataType}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + } + {{/required}} + {{/isEnumRef}} + {{/isContainer}} + {{/vars}} + {{/discriminator}} + {{#hasChildren}} + {{#discriminator}} + + String discriminatorValue = jsonElement.getAsJsonObject().get("{{{propertyBaseName}}}").getAsString(); + switch (discriminatorValue) { + {{#mappedModels}} + case "{{mappingName}}": + {{modelName}}.validateJsonElement(jsonElement); + break; + {{/mappedModels}} + default: + throw new IllegalArgumentException(String.format("The value of the `{{{propertyBaseName}}}` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + {{/discriminator}} + {{/hasChildren}} + } + +{{^hasChildren}} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!{{classname}}.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes '{{classname}}' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter<{{classname}}> thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get({{classname}}.class)); + + return (TypeAdapter) new TypeAdapter<{{classname}}>() { + @Override + public void write(JsonWriter out, {{classname}} value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + {{#isAdditionalPropertiesTrue}} + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + {{/isAdditionalPropertiesTrue}} + elementAdapter.write(out, obj); + } + + @Override + public {{classname}} read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + {{#isAdditionalPropertiesTrue}} + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + {{classname}} instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + {{/isAdditionalPropertiesTrue}} + {{^isAdditionalPropertiesTrue}} + return thisAdapter.fromJsonTree(jsonElement); + {{/isAdditionalPropertiesTrue}} + } + + }.nullSafe(); + } + } +{{/hasChildren}} + + /** + * Create an instance of {{classname}} given an JSON string + * + * @param jsonString JSON string + * @return An instance of {{classname}} + * @throws IOException if the JSON string is invalid with respect to {{classname}} + */ + public static {{{classname}}} fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, {{{classname}}}.class); + } + + /** + * Convert an instance of {{classname}} to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/templates/libraries/okhttp-gson/pom.mustache b/templates/libraries/okhttp-gson/pom.mustache index 94c057b..def53f2 100644 --- a/templates/libraries/okhttp-gson/pom.mustache +++ b/templates/libraries/okhttp-gson/pom.mustache @@ -57,7 +57,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0 + 3.4.1 enforce-maven @@ -77,21 +77,30 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M5 + 2.22.2 - + loggerPath conf/log4j.properties - + -Xms512m -Xmx1500m methods 10 + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + maven-dependency-plugin + 3.6.1 package @@ -108,7 +117,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.2.0 + 3.3.0 @@ -122,7 +131,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.2.0 + 3.5.0 add_sources @@ -153,7 +162,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.3.1 + 3.6.3 attach-javadocs @@ -176,7 +185,7 @@ org.apache.maven.plugins maven-source-plugin - 3.2.0 + 3.3.0 attach-sources @@ -239,7 +248,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.0.1 + 3.2.1 sign-artifacts @@ -256,11 +265,20 @@ + {{#swagger1AnnotationLibrary}} io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + + io.swagger.core.v3 + swagger-annotations + ${swagger-annotations-version} + + {{/swagger2AnnotationLibrary}} com.google.code.findbugs @@ -291,7 +309,7 @@ org.apache.oltu.oauth2 org.apache.oltu.oauth2.client - 1.0.1 + 1.0.2 {{/hasOAuthMethods}} @@ -306,18 +324,11 @@ ${jodatime-version} {{/joda}} - {{#threetenbp}} - - org.threeten - threetenbp - ${threetenbp-version} - - {{/threetenbp}} {{#dynamicOperations}} io.swagger.parser.v3 swagger-parser-v3 - 2.0.28 + 2.0.30 {{/dynamicOperations}} {{#useBeanValidation}} @@ -364,17 +375,29 @@ ${jackson-databind-nullable-version} {{/openApiNullable}} + {{#withAWSV4Signature}} + + software.amazon.awssdk + auth + 2.20.157 + + {{/withAWSV4Signature}} + + jakarta.ws.rs + jakarta.ws.rs-api + ${jakarta.ws.rs-api-version} + - junit - junit + org.junit.jupiter + junit-jupiter-engine ${junit-version} test - org.mockito - mockito-core - 3.12.4 + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} test @@ -382,29 +405,39 @@ 1.8 ${java.version} ${java.version} - 1.8.5 - 1.6.3 - 4.9.2 - 2.8.8 - 3.12.0 + 1.9.0 + {{#swagger1AnnotationLibrary}} + 1.6.6 + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + 2.2.15 + {{/swagger2AnnotationLibrary}} + 4.12.0 + 2.10.1 + 3.14.0 {{#openApiNullable}} - 0.2.2 + 0.2.6 {{/openApiNullable}} {{#joda}} - 2.10.9 + 2.12.0 {{/joda}} - {{#threetenbp}} - 1.5.0 - {{/threetenbp}} + {{#useJakartaEe}} + 2.1.1 + {{/useJakartaEe}} + {{^useJakartaEe}} 1.3.5 -{{#performBeanValidation}} + {{/useJakartaEe}} + {{#performBeanValidation}} 3.0.3 -{{/performBeanValidation}} -{{#useBeanValidation}} - 2.0.2 -{{/useBeanValidation}} - 4.13.2 + {{/performBeanValidation}} + {{#useBeanValidation}} + 3.0.2 + {{/useBeanValidation}} + 5.10.3 + 1.10.0 + 2.1.6 + 1.1.1 UTF-8 - 2.17.3 + 2.43.0 diff --git a/templates/libraries/rest-assured/ApiClient.mustache b/templates/libraries/rest-assured/ApiClient.mustache index 2a0f417..aa84b2b 100644 --- a/templates/libraries/rest-assured/ApiClient.mustache +++ b/templates/libraries/rest-assured/ApiClient.mustache @@ -6,7 +6,6 @@ import {{apiPackage}}.*; {{#imports}}import {{import}}; {{/imports}} -{{^fullJavaUtil}} import io.restassured.builder.RequestSpecBuilder; import java.util.function.Consumer; import java.util.function.Supplier; @@ -15,8 +14,6 @@ import static io.restassured.config.ObjectMapperConfig.objectMapperConfig; import static io.restassured.config.RestAssuredConfig.config; import static {{invokerPackage}}.{{#gson}}GsonObjectMapper.gson{{/gson}}{{#jackson}}JacksonObjectMapper.jackson{{/jackson}}; -{{/fullJavaUtil}} - public class ApiClient { {{#basePath}} public static final String BASE_URI = "{{.}}"; diff --git a/templates/libraries/rest-assured/JacksonObjectMapper.mustache b/templates/libraries/rest-assured/JacksonObjectMapper.mustache index 6af705a..8919eda 100644 --- a/templates/libraries/rest-assured/JacksonObjectMapper.mustache +++ b/templates/libraries/rest-assured/JacksonObjectMapper.mustache @@ -2,23 +2,15 @@ package {{invokerPackage}}; -{{#threetenbp}} -import org.threeten.bp.*; -{{/threetenbp}} import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; {{#openApiNullable}} import org.openapitools.jackson.nullable.JsonNullableModule; {{/openApiNullable}} -{{#java8}} import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -{{/java8}} {{#joda}} import com.fasterxml.jackson.datatype.joda.JodaModule; {{/joda}} -{{#threetenbp}} -import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; -{{/threetenbp}} import io.restassured.internal.mapping.Jackson2Mapper; import io.restassured.path.json.mapper.factory.Jackson2ObjectMapperFactory; @@ -41,19 +33,10 @@ public class JacksonObjectMapper extends Jackson2Mapper { mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); mapper.setDateFormat(new RFC3339DateFormat()); - {{#java8}} mapper.registerModule(new JavaTimeModule()); - {{/java8}} {{#joda}} mapper.registerModule(new JodaModule()); {{/joda}} - {{#threetenbp}} - ThreeTenModule module = new ThreeTenModule(); - module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); - module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); - module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); - mapper.registerModule(module); - {{/threetenbp}} {{#openApiNullable}} JsonNullableModule jnm = new JsonNullableModule(); mapper.registerModule(jnm); @@ -65,4 +48,4 @@ public class JacksonObjectMapper extends Jackson2Mapper { public static JacksonObjectMapper jackson() { return new JacksonObjectMapper(); } -} \ No newline at end of file +} diff --git a/templates/libraries/rest-assured/api.mustache b/templates/libraries/rest-assured/api.mustache index 8d46025..5ae6e50 100644 --- a/templates/libraries/rest-assured/api.mustache +++ b/templates/libraries/rest-assured/api.mustache @@ -8,7 +8,6 @@ import com.google.gson.reflect.TypeToken; {{#imports}}import {{import}}; {{/imports}} -{{^fullJavaUtil}} import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -22,19 +21,37 @@ import io.restassured.common.mapper.TypeRef; {{/jackson}} import io.restassured.http.Method; import io.restassured.response.Response; +{{#swagger1AnnotationLibrary}} import io.swagger.annotations.*; +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.enums.*; +import io.swagger.v3.oas.annotations.media.*; +import io.swagger.v3.oas.annotations.responses.*; +import io.swagger.v3.oas.annotations.security.*; +{{/swagger2AnnotationLibrary}} + +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; +{{/useBeanValidation}} import java.lang.reflect.Type; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; -{{/fullJavaUtil}} {{#gson}} import {{invokerPackage}}.JSON; {{/gson}} import static io.restassured.http.Method.*; +{{#swagger1AnnotationLibrary}} @Api(value = "{{{baseName}}}") +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} +@Tag(name = "{{{baseName}}}") +{{/swagger2AnnotationLibrary}} public class {{classname}} { private Supplier reqSpecSupplier; @@ -68,12 +85,22 @@ public class {{classname}} { {{#operations}} {{#operation}} +{{#swagger1AnnotationLibrary}} @ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", nickname = "{{{operationId}}}", tags = { {{#tags}}{{#name}}"{{{.}}}"{{/name}}{{^-last}}, {{/-last}}{{/tags}} }) @ApiResponses(value = { {{#responses}} @ApiResponse(code = {{{code}}}, message = "{{{message}}}") {{^-last}},{{/-last}}{{/responses}} }) +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} + @Operation(summary = "{{{summary}}}", + description = "{{{notes}}}", + operationId = "{{{operationId}}}", + tags = { {{#tags}}{{#name}}"{{{.}}}"{{/name}}{{^-last}}, {{/-last}}{{/tags}} }) + @ApiResponses(value = { {{#responses}} + @ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}") {{^-last}},{{/-last}}{{/responses}} }) +{{/swagger2AnnotationLibrary}} {{#isDeprecated}} @Deprecated {{/isDeprecated}} @@ -127,12 +154,10 @@ public class {{classname}} { public {{operationIdCamelCase}}Oper(RequestSpecBuilder reqSpec) { this.reqSpec = reqSpec; {{#vendorExtensions}} - {{#x-contentType}} - reqSpec.setContentType("{{x-contentType}}"); - {{/x-contentType}} - {{#x-accepts}} - reqSpec.setAccept("{{x-accepts}}"); - {{/x-accepts}} + {{#x-content-type}} + reqSpec.setContentType("{{x-content-type}}"); + {{/x-content-type}} + reqSpec.setAccept("{{#x-accepts}}{{.}}{{^-last}},{{/-last}}{{/x-accepts}}"); {{/vendorExtensions}} this.respSpec = new ResponseSpecBuilder(); } diff --git a/templates/libraries/rest-assured/api_doc.mustache b/templates/libraries/rest-assured/api_doc.mustache index c000bc9..42d223a 100644 --- a/templates/libraries/rest-assured/api_doc.mustache +++ b/templates/libraries/rest-assured/api_doc.mustache @@ -3,14 +3,14 @@ All URIs are relative to *{{basePath}}* -Method | HTTP request | Description -------------- | ------------- | ------------- -{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +{{#operations}}{{#operation}}| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} | {{/operation}}{{/operations}} {{#operations}} {{#operation}} - + # **{{operationId}}** > {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) @@ -40,9 +40,9 @@ api.{{operationId}}(){{#allParams}}{{#required}}{{#isPathParam}} ### Parameters {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} -Name | Type | Description | Notes -------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------|{{/-last}}{{/allParams}} +{{#allParams}}| **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} | {{/allParams}} ### Return type diff --git a/templates/libraries/rest-assured/api_test.mustache b/templates/libraries/rest-assured/api_test.mustache index 74a1c9f..d7d9dae 100644 --- a/templates/libraries/rest-assured/api_test.mustache +++ b/templates/libraries/rest-assured/api_test.mustache @@ -8,16 +8,22 @@ import {{invokerPackage}}.ApiClient; import {{apiPackage}}.{{classname}}; import io.restassured.builder.RequestSpecBuilder; import io.restassured.filter.log.ErrorLoggingFilter; -import org.junit.Before; -import org.junit.Test; -import org.junit.Ignore; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -{{^fullJavaUtil}} +import java.time.LocalDate; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} + +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} import static io.restassured.config.ObjectMapperConfig.objectMapperConfig; import static io.restassured.config.RestAssuredConfig.config; import static {{invokerPackage}}.{{#gson}}GsonObjectMapper.gson{{/gson}}{{#jackson}}JacksonObjectMapper.jackson{{/jackson}}; @@ -25,12 +31,12 @@ import static {{invokerPackage}}.{{#gson}}GsonObjectMapper.gson{{/gson}}{{#jacks /** * API tests for {{classname}} */ -@Ignore +@Disabled public class {{classname}}Test { private {{classname}} api; - @Before + @BeforeEach public void createApi() { api = ApiClient.api(ApiClient.Config.apiConfig().reqSpecSupplier( () -> new RequestSpecBuilder() @@ -63,4 +69,4 @@ public class {{classname}}Test { {{/responses}} {{/operation}} {{/operations}} -} \ No newline at end of file +} diff --git a/templates/libraries/rest-assured/build.gradle.mustache b/templates/libraries/rest-assured/build.gradle.mustache index e80ea18..3ddee45 100644 --- a/templates/libraries/rest-assured/build.gradle.mustache +++ b/templates/libraries/rest-assured/build.gradle.mustache @@ -57,9 +57,9 @@ if(hasProperty('target') && target == 'android') { def task = project.tasks.create "jar${variant.name.capitalize()}", Jar task.description = "Create jar artifact for ${variant.name}" task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - task.destinationDir = project.file("${project.buildDir}/outputs/jar") - task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + task.from variant.javaCompile.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" artifacts.add('archives', task); } } @@ -97,35 +97,39 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.21" - rest_assured_version = "4.3.0" - junit_version = "4.13.1" + {{#swagger1AnnotationLibrary}} + swagger_annotations_version = "1.6.6" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + swagger_annotations_version = "2.2.15" + {{/swagger2AnnotationLibrary}} + rest_assured_version = "5.3.2" + junit_version = "5.10.3" {{#jackson}} - jackson_version = "2.10.3" - jackson_databind_version = "2.10.3" + jackson_version = "2.17.1" + jackson_databind_version = "2.17.1" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.2" + jackson_databind_nullable_version = "0.2.6" {{/openApiNullable}} - jakarta_annotation_version = "1.3.5" - {{#threetenbp}} - jackson_threetenbp_version = "2.10.0" - {{/threetenbp}} {{/jackson}} {{#gson}} - gson_version = "2.8.6" - gson_fire_version = "1.8.4" + gson_version = "2.10.1" + gson_fire_version = "1.9.0" {{/gson}} {{#joda}} jodatime_version = "2.10.5" {{/joda}} -{{#threetenbp}} - threetenbp_version = "1.4.3" -{{/threetenbp}} - okio_version = "1.17.5" + okio_version = "3.6.0" + jakarta_annotation_version = "1.3.5" } dependencies { + {{#swagger1AnnotationLibrary}} implementation "io.swagger:swagger-annotations:$swagger_annotations_version" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version" + {{/swagger2AnnotationLibrary}} implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "io.rest-assured:rest-assured:$rest_assured_version" {{#jackson}} @@ -142,12 +146,7 @@ dependencies { {{#joda}} implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" {{/joda}} - {{#java8}} implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" - {{/java8}} - {{#threetenbp}} - implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threetenbp_version" - {{/threetenbp}} {{/jackson}} {{#gson}} implementation "io.gsonfire:gson-fire:$gson_fire_version" @@ -156,16 +155,13 @@ dependencies { {{#joda}} implementation "joda-time:joda-time:$jodatime_version" {{/joda}} -{{#threetenbp}} - implementation "org.threeten:threetenbp:$threetenbp_version" -{{/threetenbp}} implementation "com.squareup.okio:okio:$okio_version" {{#useBeanValidation}} - implementation "jakarta.validation:jakarta.validation-api:2.0.2" + implementation "jakarta.validation:jakarta.validation-api:3.0.2" {{/useBeanValidation}} {{#performBeanValidation}} implementation "org.hibernate:hibernate-validator:6.0.19.Final" {{/performBeanValidation}} implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation "junit:junit:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" } diff --git a/templates/libraries/rest-assured/build.sbt.mustache b/templates/libraries/rest-assured/build.sbt.mustache index 6a048b9..ce4037a 100644 --- a/templates/libraries/rest-assured/build.sbt.mustache +++ b/templates/libraries/rest-assured/build.sbt.mustache @@ -9,49 +9,41 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.21", - "io.rest-assured" % "rest-assured" % "4.3.0", - "io.rest-assured" % "scala-support" % "4.3.0", + "io.swagger" % "swagger-annotations" % "1.6.6", + "io.rest-assured" % "rest-assured" % "4.5.1", + "io.rest-assured" % "scala-support" % "4.5.1", "com.google.code.findbugs" % "jsr305" % "3.0.2", {{#jackson}} - "com.fasterxml.jackson.core" % "jackson-core" % "2.10.3", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3", + "com.fasterxml.jackson.core" % "jackson-core" % "2.13.4", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.4", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.4.2", {{#openApiNullable}} - "org.openapitools" % "jackson-databind-nullable" % "0.2.2", + "org.openapitools" % "jackson-databind-nullable" % "0.2.6", {{/openApiNullable}} {{#withXml}} - "com.fasterxml.jackson.dataformat" % "jackson-dataformat-xml" % "2.10.3", + "com.fasterxml.jackson.dataformat" % "jackson-dataformat-xml" % "2.13.4.1", {{/withXml}} {{#joda}} - "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.10.3", + "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.13.4.1", {{/joda}} - {{#java8}} - "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.10.3", - {{/java8}} - {{#threetenbp}} - "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.10.0", - {{/threetenbp}} + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.4.1", {{/jackson}} {{#gson}} - "com.google.code.gson" % "gson" % "2.8.6", - "io.gsonfire" % "gson-fire" % "1.8.4" % "compile", + "com.google.code.gson" % "gson" % "2.8.9", + "io.gsonfire" % "gson-fire" % "1.9.0" % "compile", {{/gson}} {{#joda}} "joda-time" % "joda-time" % "2.10.5" % "compile", {{/joda}} -{{#threetenbp}} - "org.threeten" % "threetenbp" % "1.4.3" % "compile", -{{/threetenbp}} "com.squareup.okio" % "okio" % "1.17.5" % "compile", {{#useBeanValidation}} - "jakarta.validation" % "jakarta.validation-api" % "2.0.2" % "compile", + "jakarta.validation" % "jakarta.validation-api" % "3.0.2" % "compile", {{/useBeanValidation}} {{#performBeanValidation}} "org.hibernate" % "hibernate-validator" % "6.0.19.Final" % "compile", {{/performBeanValidation}} "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "junit" % "junit" % "4.13.1" % "test", + "org.junit.jupiter" % "junit-jupiter-api" % "5.10.3" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) ) diff --git a/templates/libraries/rest-assured/pom.mustache b/templates/libraries/rest-assured/pom.mustache index c6e924e..396dd69 100644 --- a/templates/libraries/rest-assured/pom.mustache +++ b/templates/libraries/rest-assured/pom.mustache @@ -65,12 +65,12 @@ maven-surefire-plugin 2.22.2 - + loggerPath conf/log4j.properties - + false 1C @@ -150,7 +150,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.2.0 + 3.3.2 none 1.8 @@ -219,11 +219,20 @@ {{/jackson}} + {{#swagger1AnnotationLibrary}} io.swagger swagger-annotations ${swagger-annotations-version} + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + + io.swagger.core.v3 + swagger-annotations + ${swagger-annotations-version} + + {{/swagger2AnnotationLibrary}} com.google.code.findbugs @@ -255,13 +264,6 @@ ${jodatime-version} {{/joda}} - {{#threetenbp}} - - org.threeten - threetenbp - ${threetenbp-version} - - {{/threetenbp}} {{#gson}} io.gsonfire @@ -300,19 +302,10 @@ jackson-datatype-joda {{/joda}} - {{#java8}} com.fasterxml.jackson.datatype jackson-datatype-jsr310 - {{/java8}} - {{#threetenbp}} - - com.github.joschi.jackson - jackson-datatype-threetenbp - ${jackson-threetenbp-version} - - {{/threetenbp}} {{/jackson}} com.squareup.okio @@ -338,36 +331,41 @@ {{/performBeanValidation}} - junit - junit + org.junit.jupiter + junit-jupiter-api ${junit-version} test UTF-8 - 1.5.21 - 4.3.0 - 2.8.6 - 1.8.4 + {{#swagger1AnnotationLibrary}} + 1.6.6 + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + 2.2.15 + {{/swagger2AnnotationLibrary}} + 5.3.2 + 2.10.1 + 1.9.0 {{#joda}} 2.10.5 {{/joda}} - {{#threetenbp}} - 1.4.3 - {{/threetenbp}} {{#jackson}} - 2.10.3 - 0.2.2 - {{#threetenbp}} - 2.10.0 - {{/threetenbp}} + 2.17.1 + 2.17.1 + 0.2.6 {{/jackson}} + {{#useJakartaEe}} + 2.1.1 + {{/useJakartaEe}} + {{^useJakartaEe}} 1.3.5 -{{#useBeanValidation}} - 2.0.2 -{{/useBeanValidation}} - 1.17.5 - 4.13.1 + {{/useJakartaEe}} + {{#useBeanValidation}} + 3.0.2 + {{/useBeanValidation}} + 3.6.0 + 5.10.3 diff --git a/templates/libraries/restclient/ApiClient.mustache b/templates/libraries/restclient/ApiClient.mustache new file mode 100644 index 0000000..14b1af4 --- /dev/null +++ b/templates/libraries/restclient/ApiClient.mustache @@ -0,0 +1,756 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +{{#withXml}} +import com.fasterxml.jackson.dataformat.xml.XmlMapper; +import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator; +{{/withXml}} +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import java.util.function.Consumer; +{{#openApiNullable}} +import org.openapitools.jackson.nullable.JsonNullableModule; +{{/openApiNullable}} +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.InvalidMediaTypeException; +import org.springframework.http.MediaType; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +{{#withXml}} + import org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter; +{{/withXml}} +import org.springframework.util.CollectionUtils; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.util.StringUtils; +import org.springframework.web.client.RestClientException; +import org.springframework.web.util.UriComponentsBuilder; +import org.springframework.web.client.RestClient; +import org.springframework.web.client.RestClient.ResponseSpec; +import java.util.Optional; + +import java.text.DateFormat; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TimeZone; + +import {{javaxPackage}}.annotation.Nullable; + +{{#jsr310}} +import java.time.OffsetDateTime; +{{/jsr310}} + +import {{invokerPackage}}.auth.Authentication; +import {{invokerPackage}}.auth.HttpBasicAuth; +import {{invokerPackage}}.auth.HttpBearerAuth; +import {{invokerPackage}}.auth.ApiKeyAuth; +{{#hasOAuthMethods}} +import {{invokerPackage}}.auth.OAuth; +{{/hasOAuthMethods}} + +{{>generatedAnnotation}} +public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { + public enum CollectionFormat { + CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null); + + private final String separator; + CollectionFormat(String separator) { + this.separator = separator; + } + + private String collectionToString(Collection collection) { + return StringUtils.collectionToDelimitedString(collection, separator); + } + } + + private final HttpHeaders defaultHeaders = new HttpHeaders(); + private final MultiValueMap defaultCookies = new LinkedMultiValueMap<>(); + + private String basePath = "{{basePath}}"; + + private final RestClient restClient; + private final DateFormat dateFormat; + private final ObjectMapper objectMapper; + + private Map authentications; + + + public ApiClient() { + this.dateFormat = createDefaultDateFormat(); + this.objectMapper = createDefaultObjectMapper(this.dateFormat); + this.restClient = buildRestClient(this.objectMapper); + this.init(); + } + + public ApiClient(RestClient restClient) { + this(Optional.ofNullable(restClient).orElseGet(ApiClient::buildRestClient), createDefaultDateFormat()); + } + + public ApiClient(ObjectMapper mapper, DateFormat format) { + this(buildRestClient(mapper.copy()), format); + } + + public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) { + this(Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(mapper.copy())), format); + } + + private ApiClient(RestClient restClient, DateFormat format) { + this.restClient = restClient; + this.dateFormat = format; + this.objectMapper = createDefaultObjectMapper(format); + this.init(); + } + + public static DateFormat createDefaultDateFormat() { + DateFormat dateFormat = new RFC3339DateFormat(); + dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + return dateFormat; + } + + public static ObjectMapper createDefaultObjectMapper(@Nullable DateFormat dateFormat) { + if (null == dateFormat) { + dateFormat = createDefaultDateFormat(); + } + ObjectMapper mapper = new ObjectMapper(); + mapper.setDateFormat(dateFormat); + mapper.registerModule(new JavaTimeModule()); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + {{#openApiNullable}} + JsonNullableModule jnm = new JsonNullableModule(); + mapper.registerModule(jnm); + {{/openApiNullable}} + return mapper; + } + + protected void init() { + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap<>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}} + authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} + authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} + authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Build the RestClientBuilder used to make RestClient. + * @param mapper ObjectMapper used for serialize/deserialize + * @return RestClient + */ + public static RestClient.Builder buildRestClientBuilder(ObjectMapper mapper) { + {{#withXml}} + XmlMapper xmlMapper = new XmlMapper(); + xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true); + {{#openApiNullable}} + xmlMapper.registerModule(new JsonNullableModule()); + {{/openApiNullable}} + + {{/withXml}} + Consumer>> messageConverters = converters -> { + converters.add(new MappingJackson2HttpMessageConverter(mapper)); + {{#withXml}} + converters.add(new MappingJackson2XmlHttpMessageConverter(xmlMapper)); + {{/withXml}} + }; + + return RestClient.builder().messageConverters(messageConverters); + } + + /** + * Build the RestClientBuilder used to make RestClient. + * @return RestClient + */ + public static RestClient.Builder buildRestClientBuilder() { + return buildRestClientBuilder(createDefaultObjectMapper(null)); + } + + /** + * Build the RestClient used to make HTTP requests. + * @param mapper ObjectMapper used for serialize/deserialize + * @return RestClient + */ + public static RestClient buildRestClient(ObjectMapper mapper) { + return buildRestClientBuilder(mapper).build(); + } + + /** + * Build the RestClient used to make HTTP requests. + * @return RestClient + */ + public static RestClient buildRestClient() { + return buildRestClientBuilder(createDefaultObjectMapper(null)).build(); + } + + /** + * Get the current base path + * @return String the base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set the base path, which should include the host + * @param basePath the base path + * @return ApiClient this client + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * @return Map the currently configured authentication types + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set access token for the first Bearer authentication. + * @param bearerToken Bearer token + */ + public void setBearerToken(String bearerToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(bearerToken); + return; + } + } + throw new RuntimeException("No Bearer authentication configured!"); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * @param username the username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * @param password the password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * @param apiKey the API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * @param apiKeyPrefix the API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + {{#hasOAuthMethods}} + /** + * Helper method to set access token for the first OAuth2 authentication. + * @param accessToken the access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + {{/hasOAuthMethods}} + /** + * Set the User-Agent header's value (by adding to the default header map). + * @param userAgent the user agent string + * @return ApiClient this client + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param name The header's name + * @param value The header's value + * @return ApiClient this client + */ + public ApiClient addDefaultHeader(String name, String value) { + if (defaultHeaders.containsKey(name)) { + defaultHeaders.remove(name); + } + defaultHeaders.add(name, value); + return this; + } + + /** + * Add a default cookie. + * + * @param name The cookie's name + * @param value The cookie's value + * @return ApiClient this client + */ + public ApiClient addDefaultCookie(String name, String value) { + if (defaultCookies.containsKey(name)) { + defaultCookies.remove(name); + } + defaultCookies.add(name, value); + return this; + } + + /** + * Get the date format used to parse/format date parameters. + * @return DateFormat format + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + * Parse the given string into Date object. + */ + public Date parseDate(String str) { + try { + return dateFormat.parse(str); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * Format the given Date object into string. + */ + public String formatDate(Date date) { + return dateFormat.format(date); + } + + /** + * Get the ObjectMapper used to make HTTP requests. + * @return ObjectMapper objectMapper + */ + public ObjectMapper getObjectMapper() { + return objectMapper; + } + + /** + * Get the RestClient used to make HTTP requests. + * @return RestClient restClient + */ + public RestClient getRestClient() { + return restClient; + } + + /** + * Format the given parameter object into string. + * @param param the object to convert + * @return String the parameter represented as a String + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date) { + return formatDate( (Date) param); + } {{#jsr310}}else if (param instanceof OffsetDateTime) { + return formatOffsetDateTime((OffsetDateTime) param); + } {{/jsr310}}else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for(Object o : (Collection) param) { + if(b.length() > 0) { + b.append(","); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Converts a parameter to a {@link MultiValueMap} for use in REST requests + * @param collectionFormat The format to convert to + * @param name The name of the parameter + * @param value The parameter's value + * @return a Map containing the String value(s) of the input parameter + */ + public MultiValueMap parameterToMultiValueMap(CollectionFormat collectionFormat, String name, Object value) { + final MultiValueMap params = new LinkedMultiValueMap<>(); + + if (name == null || name.isEmpty() || value == null) { + return params; + } + + if(collectionFormat == null) { + collectionFormat = CollectionFormat.CSV; + } + + if (value instanceof Map) { + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + for (final Entry entry : valuesMap.entrySet()) { + params.add(entry.getKey(), parameterToString(entry.getValue())); + } + return params; + } + + Collection valueCollection = null; + if (value instanceof Collection) { + valueCollection = (Collection) value; + } else { + params.add(name, parameterToString(value)); + return params; + } + + if (valueCollection.isEmpty()){ + return params; + } + + if (collectionFormat.equals(CollectionFormat.MULTI)) { + for (Object item : valueCollection) { + params.add(name, parameterToString(item)); + } + return params; + } + + List values = new ArrayList<>(); + for(Object o : valueCollection) { + values.add(parameterToString(o)); + } + params.add(name, collectionFormat.collectionToString(values)); + + return params; + } + + /** + * Check if the given {@code String} is a JSON MIME. + * @param mediaType the input MediaType + * @return boolean true if the MediaType represents JSON, false otherwise + */ + public boolean isJsonMime(String mediaType) { + // "* / *" is default to JSON + if ("*/*".equals(mediaType)) { + return true; + } + + try { + return isJsonMime(MediaType.parseMediaType(mediaType)); + } catch (InvalidMediaTypeException e) { + } + return false; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * @param mediaType the input MediaType + * @return boolean true if the MediaType represents JSON, false otherwise + */ + public boolean isJsonMime(MediaType mediaType) { + return mediaType != null && (MediaType.APPLICATION_JSON.isCompatibleWith(mediaType) || mediaType.getSubtype().matches("^.*(\\+json|ndjson)[;]?\\s*$")); + } + + /** + * Check if the given {@code String} is a Problem JSON MIME (RFC-7807). + * @param mediaType the input MediaType + * @return boolean true if the MediaType represents Problem JSON, false otherwise + */ + public boolean isProblemJsonMime(String mediaType) { + return "application/problem+json".equalsIgnoreCase(mediaType); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return List The list of MediaTypes to use for the Accept header + */ + public List selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + MediaType mediaType = MediaType.parseMediaType(accept); + if (isJsonMime(mediaType) && !isProblemJsonMime(accept)) { + return Collections.singletonList(mediaType); + } + } + return MediaType.parseMediaTypes(StringUtils.arrayToCommaDelimitedString(accepts)); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return MediaType The Content-Type header to use. If the given array is empty, null will be returned. + */ + public MediaType selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + for (String contentType : contentTypes) { + MediaType mediaType = MediaType.parseMediaType(contentType); + if (isJsonMime(mediaType)) { + return mediaType; + } + } + return MediaType.parseMediaType(contentTypes[0]); + } + + /** + * Select the body to use for the request + * + * @param obj the body object + * @param formParams the form parameters + * @param contentType the content type of the request + * @return Object the selected body + */ + protected Object selectBody(Object obj, MultiValueMap formParams, MediaType contentType) { + boolean isForm = MediaType.MULTIPART_FORM_DATA.isCompatibleWith(contentType) || MediaType.APPLICATION_FORM_URLENCODED.isCompatibleWith(contentType); + return isForm ? formParams : obj; + } + + /** + * Invoke API by sending HTTP request with the given options. + * + * @param the return type to use + * @param path The sub-path of the HTTP URL + * @param method The request method + * @param pathParams The path parameters + * @param queryParams The query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param formParams The form parameters + * @param accept The request's Accept header + * @param contentType The request's Content-Type header + * @param authNames The authentications to apply + * @param returnType The return type into which to deserialize the response + * @return The response body in chosen type + */ + public ResponseSpec invokeAPI(String path, HttpMethod method, Map pathParams, MultiValueMap queryParams, Object body, HttpHeaders headerParams, MultiValueMap cookieParams, MultiValueMap formParams, List accept, MediaType contentType, String[] authNames, ParameterizedTypeReference returnType) throws RestClientException { + final RestClient.RequestBodySpec requestBuilder = prepareRequest(path, method, pathParams, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames); + return requestBuilder.retrieve(); + } + + /** + * Include queryParams in uriParams taking into account the paramName + * @param queryParams The query parameters + * @param uriParams The path parameters + * return templatized query string + */ + private String generateQueryUri(MultiValueMap queryParams, Map uriParams) { + StringBuilder queryBuilder = new StringBuilder(); + queryParams.forEach((name, values) -> { + if (CollectionUtils.isEmpty(values)) { + if (queryBuilder.length() != 0) { + queryBuilder.append('&'); + } + queryBuilder.append(name); + } else { + int valueItemCounter = 0; + for (Object value : values) { + if (queryBuilder.length() != 0) { + queryBuilder.append('&'); + } + queryBuilder.append(name); + if (value != null) { + String templatizedKey = name + valueItemCounter++; + uriParams.put(templatizedKey, value.toString()); + queryBuilder.append('=').append("{").append(templatizedKey).append("}"); + } + } + } + }); + return queryBuilder.toString(); + } + + private RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map pathParams, + MultiValueMap queryParams, Object body, HttpHeaders headerParams, + MultiValueMap cookieParams, MultiValueMap formParams, List accept, + MediaType contentType, String[] authNames) { + updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); + + final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(path); + + String finalUri = builder.build(false).toUriString(); + Map uriParams = new HashMap<>(); + uriParams.putAll(pathParams); + + if (queryParams != null && !queryParams.isEmpty()) { + //Include queryParams in uriParams taking into account the paramName + String queryUri = generateQueryUri(queryParams, uriParams); + //Append to finalUri the templatized query string like "?param1={param1Value}&....... + finalUri += "?" + queryUri; + } + + final RestClient.RequestBodySpec requestBuilder = restClient.method(method).uri(finalUri, uriParams); + + if (accept != null) { + requestBuilder.accept(accept.toArray(new MediaType[accept.size()])); + } + if(contentType != null) { + requestBuilder.contentType(contentType); + } + + addHeadersToRequest(headerParams, requestBuilder); + addHeadersToRequest(defaultHeaders, requestBuilder); + addCookiesToRequest(cookieParams, requestBuilder); + addCookiesToRequest(defaultCookies, requestBuilder); + + var selectedBody = selectBody(body, formParams, contentType); + if (selectedBody != null) { + requestBuilder.body(selectedBody); + } + + return requestBuilder; + } + + /** + * Add headers to the request that is being built + * @param headers The headers to add + * @param requestBuilder The current request + */ + protected void addHeadersToRequest(HttpHeaders headers, RestClient.RequestBodySpec requestBuilder) { + for (Entry> entry : headers.entrySet()) { + List values = entry.getValue(); + for(String value : values) { + if (value != null) { + requestBuilder.header(entry.getKey(), value); + } + } + } + } + + /** + * Add cookies to the request that is being built + * + * @param cookies The cookies to add + * @param requestBuilder The current request + */ + protected void addCookiesToRequest(MultiValueMap cookies, RestClient.RequestBodySpec requestBuilder) { + if (!cookies.isEmpty()) { + requestBuilder.header("Cookie", buildCookieHeader(cookies)); + } + } + + /** + * Build cookie header. Keeps a single value per cookie (as per + * RFC6265 section 5.3). + * + * @param cookies map all cookies + * @return header string for cookies. + */ + private String buildCookieHeader(MultiValueMap cookies) { + final StringBuilder cookieValue = new StringBuilder(); + String delimiter = ""; + for (final Map.Entry> entry : cookies.entrySet()) { + final String value = entry.getValue().get(entry.getValue().size() - 1); + cookieValue.append(String.format("%s%s=%s", delimiter, entry.getKey(), value)); + delimiter = "; "; + } + return cookieValue.toString(); + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams The query parameters + * @param headerParams The header parameters + * @param cookieParams the cookie parameters + */ + protected void updateParamsForAuth(String[] authNames, MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + throw new RestClientException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams); + } + } + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param values The values of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(CollectionFormat collectionFormat, Collection values) { + // create the value based on the collection format + if (CollectionFormat.MULTI.equals(collectionFormat)) { + // not valid for path params + return parameterToString(values); + } + + // collectionFormat is assumed to be "csv" by default + if(collectionFormat == null) { + collectionFormat = CollectionFormat.CSV; + } + + return collectionFormat.collectionToString(values); + } +} \ No newline at end of file diff --git a/templates/libraries/restclient/README.mustache b/templates/libraries/restclient/README.mustache new file mode 100644 index 0000000..ec6244a --- /dev/null +++ b/templates/libraries/restclient/README.mustache @@ -0,0 +1,216 @@ +# {{artifactId}} + +{{appName}} + +- API version: {{appVersion}} +{{^hideGenerationTimestamp}} + +- Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} + +- Generator version: {{generatorVersion}} + +{{{appDescriptionWithNewLines}}} + +{{#infoUrl}} + For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + +## Requirements + +Building the API client library requires: + +1. Java 17+ +2. Maven/Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + {{{groupId}}} + {{{artifactId}}} + {{{artifactVersion}}} + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the '{{{artifactId}}}' jar has been published to maven central. + mavenLocal() // Needed if the '{{{artifactId}}}' jar has been published to the local maven repo. + } + + dependencies { + implementation "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +- `target/{{{artifactId}}}-{{{artifactVersion}}}.jar` +- `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java +{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} +import {{{invokerPackage}}}.*; +import {{{invokerPackage}}}.auth.*; +import {{{modelPackage}}}.*; +import {{{package}}}.{{{classname}}}; + +public class {{{classname}}}Example { + + public static void main(String[] args) { + ApiClient defaultClient = new ApiClient(); + defaultClient.setBasePath("{{{basePath}}}"); + {{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + // Configure HTTP basic authorization: {{{name}}} + HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setUsername("YOUR USERNAME"); + {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}} + // Configure HTTP bearer authorization: {{{name}}} + HttpBearerAuth {{{name}}} = (HttpBearerAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} + // Configure API key authorization: {{{name}}} + ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} + // Configure OAuth2 access token for authorization: {{{name}}} + OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}}{{#isHttpSignature}} + // Configure HTTP signature authorization: {{{name}}} + HttpSignatureAuth {{{name}}} = (HttpSignatureAuth) defaultClient.getAuthentication("{{{name}}}"); + // All the HTTP signature parameters below should be customized to your environment. + // Configure the keyId + {{{name}}}.setKeyId("YOUR KEY ID"); + // Configure the signature algorithm + {{{name}}}.setSigningAlgorithm(SigningAlgorithm.HS2019); + // Configure the specific cryptographic algorithm + {{{name}}}.setAlgorithm(Algorithm.ECDSA_SHA256); + // Configure the cryptographic algorithm parameters, if applicable + {{{name}}}.setAlgorithmParameterSpec(null); + // Set the cryptographic digest algorithm. + {{{name}}}.setDigestAlgorithm("SHA-256"); + // Set the HTTP headers that should be included in the HTTP signature. + {{{name}}}.setHeaders(Arrays.asList("date", "host")); + // Set the private key used to sign the HTTP messages + {{{name}}}.setPrivateKey();{{/isHttpSignature}} + {{/authMethods}} + {{/hasAuthMethods}} + + {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); + {{#allParams}} + {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} + {{/allParams}} + try { + {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + System.out.println(result);{{/returnType}} + } catch (HttpStatusCodeException e) { + System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); + System.err.println("Status code: " + e.getStatusCode().value()); + System.err.println("Reason: " + e.getResponseBodyAsString()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` + +## Documentation for API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{commonPath}}{{path}} | {{summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +## Documentation for Models + +{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md) +{{/model}}{{/models}} + + +## Documentation for Authorization + +{{^authMethods}}Endpoints do not require authorization.{{/authMethods}} +{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}} +{{#authMethods}} + +### {{name}} + +{{#isApiKey}} + +- **Type**: API key +- **API key parameter name**: {{keyParamName}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} +{{/isApiKey}} +{{#isBasicBasic}} + +- **Type**: HTTP basic authentication +{{/isBasicBasic}} +{{#isBasicBearer}} + +- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} +{{/isBasicBearer}} +{{#isHttpSignature}} + +- **Type**: HTTP signature authentication +{{/isHttpSignature}} +{{#isOAuth}} + +- **Type**: OAuth +- **Flow**: {{flow}} +- **Authorization URL**: {{authorizationUrl}} +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} - {{scope}}: {{description}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + +{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} +{{/-last}}{{/apis}}{{/apiInfo}} diff --git a/templates/libraries/restclient/api.mustache b/templates/libraries/restclient/api.mustache new file mode 100644 index 0000000..1475fc0 --- /dev/null +++ b/templates/libraries/restclient/api.mustache @@ -0,0 +1,185 @@ +package {{package}}; + +import {{invokerPackage}}.ApiClient; + +{{#imports}}import {{import}}; +{{/imports}} + +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.stream.Collectors; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.web.client.RestClient.ResponseSpec; +import org.springframework.web.client.RestClientResponseException; +import org.springframework.core.io.FileSystemResource; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; + +{{>generatedAnnotation}} +{{#operations}} +public class {{classname}} { + private ApiClient apiClient; + + public {{classname}}() { + this(new ApiClient()); + } + + @Autowired + public {{classname}}(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + {{#operation}} + /** + * {{summary}} + * {{notes}} +{{#responses}} *

{{code}}{{#message}} - {{.}}{{/message}} +{{/responses}}{{#allParams}} * @param {{paramName}} {{description}}{{^description}}The {{paramName}} parameter{{/description}} +{{/allParams}}{{#returnType}} * @return {{.}} +{{/returnType}} * @throws RestClientResponseException if an error occurs while attempting to invoke the API +{{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation +{{/externalDocs}} +{{#isDeprecated}} + * @deprecated +{{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + private ResponseSpec {{operationId}}RequestCreation({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws RestClientResponseException { + Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + {{#allParams}} + {{#required}} + // verify the required parameter '{{paramName}}' is set + if ({{paramName}} == null) { + throw new RestClientResponseException("Missing the required parameter '{{paramName}}' when calling {{operationId}}", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + {{/required}} + {{/allParams}} + // create path and map variables + final Map pathParams = new HashMap<>(); + {{#hasPathParams}} + + {{#pathParams}} + pathParams.put("{{baseName}}", {{#collectionFormat}}apiClient.collectionPathParameterToString(ApiClient.CollectionFormat.valueOf("csv".toUpperCase()), {{/collectionFormat}}{{{paramName}}}{{#collectionFormat}}){{/collectionFormat}}); + {{/pathParams}} + {{/hasPathParams}} + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + {{#hasQueryParams}} + + {{#queryParams}}{{#isExplode}}{{#hasVars}}{{#vars}}queryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{.}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}}.{{getter}}())); + {{/vars}}{{/hasVars}}{{^hasVars}}queryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{.}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}})); + {{/hasVars}}{{/isExplode}}{{^isExplode}}queryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{.}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}})); + {{/isExplode}}{{/queryParams}}{{/hasQueryParams}}{{#hasHeaderParams}} + + {{#headerParams}} + if ({{paramName}} != null) + headerParams.add("{{baseName}}", apiClient.parameterToString({{paramName}}));{{^-last}} + {{/-last}} + {{/headerParams}} + {{/hasHeaderParams}} + {{#hasCookieParams}} + + {{#cookieParams}} + cookieParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{.}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}})); + {{/cookieParams}} + {{/hasCookieParams}} + {{#hasFormParams}} + + {{#formParams}} + if ({{paramName}} != null) + formParams.add{{#collectionFormat}}All{{/collectionFormat}}("{{baseName}}", {{#isFile}}{{^collectionFormat}}{{#useAbstractionForFiles}}{{paramName}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}new FileSystemResource({{paramName}}){{/useAbstractionForFiles}}{{/collectionFormat}}{{/isFile}}{{#isFile}}{{#collectionFormat}}{{paramName}}.stream(){{^useAbstractionForFiles}}.map(FileSystemResource::new){{/useAbstractionForFiles}}.collect(Collectors.toList()){{/collectionFormat}}{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}}); + {{/formParams}} + {{/hasFormParams}} + + final String[] localVarAccepts = { {{#hasProduces}} + {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} + {{/hasProduces}}}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { {{#hasConsumes}} + {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} + {{/hasConsumes}}}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; + + {{#returnType}}ParameterizedTypeReference<{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}> localVarReturnType = new ParameterizedTypeReference<>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {};{{/returnType}} + return apiClient.invokeAPI("{{{path}}}", HttpMethod.{{httpMethod}}, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * {{summary}} + * {{notes}} +{{#responses}} *

{{code}}{{#message}} - {{.}}{{/message}} +{{/responses}}{{#allParams}} * @param {{paramName}} {{description}}{{^description}}The {{paramName}} parameter{{/description}} +{{/allParams}}{{#returnType}} * @return {{.}} +{{/returnType}} * @throws RestClientResponseException if an error occurs while attempting to invoke the API +{{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation +{{/externalDocs}} + */ + public {{#returnType}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws RestClientResponseException { + {{#returnType}}ParameterizedTypeReference<{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}> localVarReturnType = new ParameterizedTypeReference<>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {};{{/returnType}} + {{#returnType}}return {{/returnType}}{{operationId}}RequestCreation({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).body(localVarReturnType); + } + + /** + * {{summary}} + * {{notes}} +{{#responses}} *

{{code}}{{#message}} - {{.}}{{/message}} +{{/responses}}{{#allParams}} * @param {{paramName}} {{description}}{{^description}}The {{paramName}} parameter{{/description}} +{{/allParams}}{{#returnType}} * @return ResponseEntity<{{.}}> +{{/returnType}} * @throws RestClientResponseException if an error occurs while attempting to invoke the API +{{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation +{{/externalDocs}} + */ + public {{#returnType}}ResponseEntity<{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}>{{/returnType}}{{^returnType}}ResponseEntity{{/returnType}} {{operationId}}WithHttpInfo({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws RestClientResponseException { + {{#returnType}}ParameterizedTypeReference<{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}> localVarReturnType = new ParameterizedTypeReference<>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {};{{/returnType}} + return {{operationId}}RequestCreation({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).toEntity(localVarReturnType); + } + + /** + * {{summary}} + * {{notes}} +{{#responses}} *

{{code}}{{#message}} - {{.}}{{/message}} +{{/responses}}{{#allParams}} * @param {{paramName}} {{description}}{{^description}}The {{paramName}} parameter{{/description}} +{{/allParams}} + * @return ResponseSpec + * @throws RestClientResponseException if an error occurs while attempting to invoke the API +{{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation +{{/externalDocs}} + */ + public ResponseSpec {{operationId}}WithResponseSpec({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws RestClientResponseException { + return {{operationId}}RequestCreation({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + } + {{/operation}} +} +{{/operations}} \ No newline at end of file diff --git a/templates/libraries/restclient/api_test.mustache b/templates/libraries/restclient/api_test.mustache new file mode 100644 index 0000000..dc34083 --- /dev/null +++ b/templates/libraries/restclient/api_test.mustache @@ -0,0 +1,40 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} +import org.junit.Test; +import org.junit.Ignore; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * API tests for {{classname}} + */ +@Ignore +public class {{classname}}Test { + + private final {{classname}} api = new {{classname}}(); + + {{#operations}}{{#operation}} + /** + * {{summary}} + * + * {{notes}} + */ + @Test + public void {{operationId}}Test() { + {{#allParams}} + {{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}} = null; + {{/allParams}} + {{#returnType}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{.}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{.}}}{{/isResponseFile}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + + // TODO: test validations + } + {{/operation}}{{/operations}} +} \ No newline at end of file diff --git a/templates/libraries/restclient/auth/ApiKeyAuth.mustache b/templates/libraries/restclient/auth/ApiKeyAuth.mustache new file mode 100644 index 0000000..d329303 --- /dev/null +++ b/templates/libraries/restclient/auth/ApiKeyAuth.mustache @@ -0,0 +1,64 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import org.springframework.http.HttpHeaders; +import org.springframework.util.MultiValueMap; + +{{>generatedAnnotation}} +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams) { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if (location.equals("query")) { + queryParams.add(paramName, value); + } else if (location.equals("header")) { + headerParams.add(paramName, value); + } else if (location.equals("cookie")) { + cookieParams.add(paramName, value); + } + } +} diff --git a/templates/libraries/restclient/auth/Authentication.mustache b/templates/libraries/restclient/auth/Authentication.mustache new file mode 100644 index 0000000..0636a6d --- /dev/null +++ b/templates/libraries/restclient/auth/Authentication.mustache @@ -0,0 +1,16 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import org.springframework.http.HttpHeaders; +import org.springframework.util.MultiValueMap; + +public interface Authentication { + /** + * Apply authentication settings to header and / or query parameters. + * @param queryParams The query parameters for the request + * @param headerParams The header parameters for the request + * @param cookieParams The cookie parameters for the request + */ + public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams); +} diff --git a/templates/libraries/restclient/auth/HttpBasicAuth.mustache b/templates/libraries/restclient/auth/HttpBasicAuth.mustache new file mode 100644 index 0000000..fba1265 --- /dev/null +++ b/templates/libraries/restclient/auth/HttpBasicAuth.mustache @@ -0,0 +1,40 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import java.nio.charset.StandardCharsets; +import java.util.Base64; + +import org.springframework.http.HttpHeaders; +import org.springframework.util.MultiValueMap; + +{{>generatedAnnotation}} +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams) { + if (username == null && password == null) { + return; + } + String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); + headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); + } +} diff --git a/templates/libraries/restclient/auth/HttpBearerAuth.mustache b/templates/libraries/restclient/auth/HttpBearerAuth.mustache new file mode 100644 index 0000000..ecf258a --- /dev/null +++ b/templates/libraries/restclient/auth/HttpBearerAuth.mustache @@ -0,0 +1,58 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import java.util.Optional; +import java.util.function.Supplier; +import org.springframework.http.HttpHeaders; +import org.springframework.util.MultiValueMap; + +{{>generatedAnnotation}} +public class HttpBearerAuth implements Authentication { + private final String scheme; + private Supplier tokenSupplier; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } + + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ + public String getBearerToken() { + return tokenSupplier.get(); + } + + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header + */ + public void setBearerToken(String bearerToken) { + this.tokenSupplier = () -> bearerToken; + } + + /** + * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header + */ + public void setBearerToken(Supplier tokenSupplier) { + this.tokenSupplier = tokenSupplier; + } + + @Override + public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams) { + String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null); + if (bearerToken == null) { + return; + } + headerParams.add(HttpHeaders.AUTHORIZATION, (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } +} diff --git a/templates/libraries/restclient/auth/OAuth.mustache b/templates/libraries/restclient/auth/OAuth.mustache new file mode 100644 index 0000000..1e1e624 --- /dev/null +++ b/templates/libraries/restclient/auth/OAuth.mustache @@ -0,0 +1,26 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import org.springframework.http.HttpHeaders; +import org.springframework.util.MultiValueMap; + +{{>generatedAnnotation}} +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams) { + if (accessToken != null) { + headerParams.add(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken); + } + } +} diff --git a/templates/libraries/restclient/auth/OAuthFlow.mustache b/templates/libraries/restclient/auth/OAuthFlow.mustache new file mode 100644 index 0000000..759f354 --- /dev/null +++ b/templates/libraries/restclient/auth/OAuthFlow.mustache @@ -0,0 +1,7 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +public enum OAuthFlow { + accessCode, implicit, password, application +} \ No newline at end of file diff --git a/templates/libraries/restclient/build.gradle.mustache b/templates/libraries/restclient/build.gradle.mustache new file mode 100644 index 0000000..4aec430 --- /dev/null +++ b/templates/libraries/restclient/build.gradle.mustache @@ -0,0 +1,159 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' + +group = '{{groupId}}' +version = '{{artifactVersion}}' + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.5.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' + } +} + +repositories { + mavenCentral() +} + + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 23 + buildToolsVersion '23.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 22 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task); + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + archiveClassifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven-publish' + + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + + publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + from components.java + } + } + } + + task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +ext { + {{#swagger1AnnotationLibrary}} + swagger_annotations_version = "1.6.9" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + swagger_annotations_version = "2.2.9" + {{/swagger2AnnotationLibrary}} + jackson_version = "2.17.1" + jackson_databind_version = "2.17.1" + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.6" + {{/openApiNullable}} + spring_web_version = "6.1.6" + jakarta_annotation_version = "2.1.1" + jodatime_version = "2.9.9" + junit_version = "5.10.2" +} + +dependencies { + {{#swagger1AnnotationLibrary}} + implementation "io.swagger:swagger-annotations:$swagger_annotations_version" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version" + {{/swagger2AnnotationLibrary}} + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "org.springframework:spring-web:$spring_web_version" + implementation "org.springframework:spring-context:$spring_web_version" + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" + implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" + {{#openApiNullable}} + implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + {{/openApiNullable}} + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + {{#joda}} + implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" + implementation "joda-time:joda-time:$jodatime_version" + {{/joda}} + {{#withXml}} + implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version" + {{/withXml}} + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" +} + +test { + // Enable JUnit 5 (Gradle 4.6+). + useJUnitPlatform() + + // Always run tests, even when nothing changed. + dependsOn 'cleanTest' + + // Show test results. + testLogging { + events "passed", "skipped", "failed" + } + +} diff --git a/templates/libraries/retrofit/pom.mustache b/templates/libraries/restclient/pom.mustache similarity index 60% rename from templates/libraries/retrofit/pom.mustache rename to templates/libraries/restclient/pom.mustache index 1566db9..d3f6ab6 100644 --- a/templates/libraries/retrofit/pom.mustache +++ b/templates/libraries/restclient/pom.mustache @@ -43,7 +43,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M1 + 3.4.0 enforce-maven @@ -63,18 +63,27 @@ org.apache.maven.plugins maven-surefire-plugin - 2.12 + 3.1.2 - + loggerPath conf/log4j.properties - + -Xms512m -Xmx1500m methods pertest + true + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + maven-dependency-plugin @@ -95,11 +104,10 @@ org.apache.maven.plugins maven-jar-plugin - 2.2 + 3.3.0 - jar test-jar @@ -111,7 +119,7 @@ org.codehaus.mojo build-helper-maven-plugin - 1.10 + 3.4.0 add_sources @@ -142,30 +150,18 @@ org.apache.maven.plugins maven-compiler-plugin - 3.6.1 + 3.11.0 - {{#java8}} - 1.8 - 1.8 - {{/java8}} - {{^java8}} - 1.7 - 1.7 - {{/java8}} + 17 + 17 org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.5.0 none - {{#java8}} - 1.8 - {{/java8}} - {{^java8}} - 1.7 - {{/java8}} @@ -179,7 +175,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.3.0 attach-sources @@ -217,79 +213,162 @@ + {{#swagger1AnnotationLibrary}} io.swagger swagger-annotations ${swagger-annotations-version} + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + + io.swagger.core.v3 + swagger-annotations + ${swagger-annotations-version} + + {{/swagger2AnnotationLibrary}} + com.google.code.findbugs jsr305 3.0.2 + + + + org.springframework + spring-web + ${spring-web-version} + + + org.springframework + spring-context + ${spring-web-version} + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind-version} + + + com.fasterxml.jackson.jakarta.rs + jackson-jakarta-rs-json-provider + ${jackson-version} + + {{#openApiNullable}} + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + {{/openApiNullable}} + {{#withXml}} + + - com.squareup.retrofit - retrofit - ${retrofit-version} + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson-version} - org.apache.oltu.oauth2 - org.apache.oltu.oauth2.client - ${oltu-version} + io.github.threeten-jaxb + threeten-jaxb-core + 1.2 + {{/withXml}} - com.squareup.okhttp - okhttp - ${okhttp-version} + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + {{#joda}} + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-version} joda-time joda-time ${jodatime-version} - {{#threetenbp}} + {{/joda}} + {{#useBeanValidation}} + - org.threeten - threetenbp - ${threetenbp-version} + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided - {{/threetenbp}} - {{#parcelableModel}} - + {{/useBeanValidation}} + {{#performBeanValidation}} + - com.google.android - android - 4.1.1.4 - provided + org.hibernate + hibernate-validator + ${hibernate-validator-version} - {{/parcelableModel}} + {{/performBeanValidation}} jakarta.annotation jakarta.annotation-api ${jakarta-annotation-version} provided + - junit - junit + org.junit.jupiter + junit-jupiter-engine ${junit-version} test + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + UTF-8 - 1.5.21 - 1.9.0 - 2.7.5 + {{#swagger1AnnotationLibrary}} + 1.6.9 + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + 2.2.15 + {{/swagger2AnnotationLibrary}} + 6.1.6 + 2.17.1 + 2.17.1 + {{#openApiNullable}} + 0.2.6 + {{/openApiNullable}} + 2.1.1 + {{#joda}} 2.9.9 - {{#threetenbp}} - 1.4.0 - {{/threetenbp}} - 1.0.1 - 1.3.5 - 1.0.0 - 4.13.1 + {{/joda}} + {{#useBeanValidation}} + 3.0.2 + {{/useBeanValidation}} + {{#performBeanValidation}} + 5.4.3.Final + {{/performBeanValidation}} + 5.10.2 + 1.10.0 diff --git a/templates/libraries/resteasy/ApiClient.mustache b/templates/libraries/resteasy/ApiClient.mustache index 7bdb6e8..fc59766 100644 --- a/templates/libraries/resteasy/ApiClient.mustache +++ b/templates/libraries/resteasy/ApiClient.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import java.io.File; @@ -24,24 +26,20 @@ import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; {{#jsr310}} -{{#threetenbp}} -import org.threeten.bp.OffsetDateTime; -{{/threetenbp}} -{{^threetenbp}} import java.time.OffsetDateTime; -{{/threetenbp}} {{/jsr310}} -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.Form; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; +import {{javaxPackage}}.ws.rs.client.Client; +import {{javaxPackage}}.ws.rs.client.ClientBuilder; +import {{javaxPackage}}.ws.rs.client.Entity; +import {{javaxPackage}}.ws.rs.client.Invocation; +import {{javaxPackage}}.ws.rs.client.WebTarget; +import {{javaxPackage}}.ws.rs.core.Form; +import {{javaxPackage}}.ws.rs.core.GenericEntity; +import {{javaxPackage}}.ws.rs.core.GenericType; +import {{javaxPackage}}.ws.rs.core.MediaType; +import {{javaxPackage}}.ws.rs.core.Response; +import {{javaxPackage}}.ws.rs.core.Response.Status; import org.jboss.logging.Logger; import org.jboss.resteasy.client.jaxrs.internal.ClientConfiguration; @@ -90,8 +88,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} - authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} + authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}} + authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} // Prevent the authentications from being modified. @@ -502,15 +500,16 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { if (param.getValue() instanceof File) { File file = (File) param.getValue(); try { - multipart.addFormData(param.getValue().toString(),new FileInputStream(file),MediaType.APPLICATION_OCTET_STREAM_TYPE); + multipart.addFormData(param.getKey(),new FileInputStream(file),MediaType.APPLICATION_OCTET_STREAM_TYPE, file.getName()); } catch (FileNotFoundException e) { throw new ApiException("Could not serialize multipart/form-data "+e.getMessage()); } } else { - multipart.addFormData(param.getValue().toString(),param.getValue().toString(),MediaType.APPLICATION_OCTET_STREAM_TYPE); + multipart.addFormData(param.getKey(),param.getValue().toString(),MediaType.APPLICATION_OCTET_STREAM_TYPE); } } - entity = Entity.entity(multipart.getFormData(), MediaType.MULTIPART_FORM_DATA_TYPE); + GenericEntity genericEntity = new GenericEntity(multipart) { }; + entity = Entity.entity(genericEntity, MediaType.MULTIPART_FORM_DATA_TYPE); } else if (contentType.startsWith("application/x-www-form-urlencoded")) { Form form = new Form(); for (Entry param: formParams.entrySet()) { @@ -677,6 +676,38 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { Entity entity = serialize(body, formParams, contentType); + try (Response response = invoke(invocationBuilder, method, entity)) { + statusCode = response.getStatusInfo().getStatusCode(); + responseHeaders = buildResponseHeaders(response); + + if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { + return null; + } else if (response.getStatusInfo().getFamily().equals(Status.Family.SUCCESSFUL)) { + if (returnType == null) + return null; + else + return deserialize(response, returnType); + } else { + String message = "error"; + String respBody = null; + if (response.hasEntity()) { + try { + respBody = String.valueOf(response.readEntity(String.class)); + message = respBody; + } catch (RuntimeException e) { + // e.printStackTrace(); + } + } + throw new ApiException( + response.getStatus(), + message, + buildResponseHeaders(response), + respBody); + } + } + } + + private Response invoke(Invocation.Builder invocationBuilder, String method, Entity entity) throws ApiException { Response response = null; if ("GET".equals(method)) { @@ -699,36 +730,10 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { throw new ApiException(500, "unknown method type " + method); } - statusCode = response.getStatusInfo().getStatusCode(); - responseHeaders = buildResponseHeaders(response); - - if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { - return null; - } else if (response.getStatusInfo().getFamily().equals(Status.Family.SUCCESSFUL)) { - if (returnType == null) - return null; - else - return deserialize(response, returnType); - } else { - String message = "error"; - String respBody = null; - if (response.hasEntity()) { - try { - respBody = String.valueOf(response.readEntity(String.class)); - message = respBody; - } catch (RuntimeException e) { - // e.printStackTrace(); - } - } - throw new ApiException( - response.getStatus(), - message, - buildResponseHeaders(response), - respBody); - } + return response; } - /** + /** * Build the Client used to make HTTP requests. */ private Client buildHttpClient(boolean debugging) { diff --git a/templates/libraries/resteasy/JSON.mustache b/templates/libraries/resteasy/JSON.mustache index 71bd624..b572830 100644 --- a/templates/libraries/resteasy/JSON.mustache +++ b/templates/libraries/resteasy/JSON.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import com.fasterxml.jackson.annotation.*; @@ -9,7 +11,7 @@ import com.fasterxml.jackson.datatype.jsr310.*; import java.text.DateFormat; -import javax.ws.rs.ext.ContextResolver; +import {{javaxPackage}}.ws.rs.ext.ContextResolver; {{>generatedAnnotation}} public class JSON implements ContextResolver { diff --git a/templates/libraries/resteasy/api.mustache b/templates/libraries/resteasy/api.mustache index 9194b75..773fc51 100644 --- a/templates/libraries/resteasy/api.mustache +++ b/templates/libraries/resteasy/api.mustache @@ -5,17 +5,15 @@ import {{invokerPackage}}.ApiClient; import {{invokerPackage}}.Configuration; import {{invokerPackage}}.Pair; -import javax.ws.rs.core.GenericType; +import {{javaxPackage}}.ws.rs.core.GenericType; {{#imports}}import {{import}}; {{/imports}} -{{^fullJavaUtil}} import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} {{>generatedAnnotation}} {{#operations}} @@ -69,10 +67,10 @@ public class {{classname}} { .replaceAll("\\{" + "{{baseName}}" + "\\}", apiClient.escapeString({{{paramName}}}.toString())){{/pathParams}}; // query params - {{javaUtilPrefix}}List localVarQueryParams = new {{javaUtilPrefix}}ArrayList(); - {{javaUtilPrefix}}Map localVarHeaderParams = new {{javaUtilPrefix}}HashMap(); - {{javaUtilPrefix}}Map localVarCookieParams = new {{javaUtilPrefix}}HashMap(); - {{javaUtilPrefix}}Map localVarFormParams = new {{javaUtilPrefix}}HashMap(); + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); {{#queryParams}} localVarQueryParams.addAll(apiClient.parameterToPairs("{{{collectionFormat}}}", "{{baseName}}", {{paramName}})); diff --git a/templates/libraries/resteasy/build.gradle.mustache b/templates/libraries/resteasy/build.gradle.mustache index 0a801b9..de86eb0 100644 --- a/templates/libraries/resteasy/build.gradle.mustache +++ b/templates/libraries/resteasy/build.gradle.mustache @@ -57,9 +57,9 @@ if(hasProperty('target') && target == 'android') { def task = project.tasks.create "jar${variant.name.capitalize()}", Jar task.description = "Create jar artifact for ${variant.name}" task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - task.destinationDir = project.file("${project.buildDir}/outputs/jar") - task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + task.from variant.javaCompile.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" artifacts.add('archives', task); } } @@ -98,15 +98,16 @@ if(hasProperty('target') && target == 'android') { ext { swagger_annotations_version = "1.6.3" - jackson_version = "2.10.5" - jackson_databind_version = "2.10.5.1" + jackson_version = "2.17.1" + jackson_databind_version = "2.17.1" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.2" + jackson_databind_nullable_version = "0.2.6" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" threetenbp_version = "2.9.10" resteasy_version = "4.5.11.Final" - junit_version = "4.13" + assertj_version = "3.23.1" + junit_version = "5.10.2" } dependencies { @@ -124,5 +125,6 @@ dependencies { {{/openApiNullable}} implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation "junit:junit:$junit_version" + testImplementation "org.assertj:assertj-core:$assertj_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" } diff --git a/templates/libraries/resteasy/build.sbt.mustache b/templates/libraries/resteasy/build.sbt.mustache index 957990e..8ebcd90 100644 --- a/templates/libraries/resteasy/build.sbt.mustache +++ b/templates/libraries/resteasy/build.sbt.mustache @@ -13,13 +13,14 @@ lazy val root = (project in file(".")). "org.jboss.resteasy" % "resteasy-client" % "3.1.3.Final" % "compile", "org.jboss.resteasy" % "resteasy-multipart-provider" % "4.5.11.Final" % "compile", "org.jboss.resteasy" % "resteasy-jackson2-provider" % "4.5.11.Final" % "compile", - "com.fasterxml.jackson.core" % "jackson-core" % "2.10.5" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.5" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.5.1" % "compile", - "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile", - "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.9.10" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.17.1" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.17.1" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.17.1" % "compile", + "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.15.2" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.17.1" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "junit" % "junit" % "4.13" % "test", + "org.assertj" % "assertj-core" % "3.23.1" % "test", + "junit" % "junit" % "5.10.2" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) ) diff --git a/templates/libraries/resteasy/pom.mustache b/templates/libraries/resteasy/pom.mustache index cf39a16..1b0dec8 100644 --- a/templates/libraries/resteasy/pom.mustache +++ b/templates/libraries/resteasy/pom.mustache @@ -61,17 +61,16 @@ org.apache.maven.plugins maven-surefire-plugin - 2.12 + 2.22.2 - + loggerPath conf/log4j.properties - + -Xms512m -Xmx1500m methods - pertest @@ -149,7 +148,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.2 none 1.8 @@ -166,11 +165,20 @@ + {{#swagger1AnnotationLibrary}} io.swagger swagger-annotations ${swagger-annotations-version} + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + + io.swagger.core.v3 + swagger-annotations + ${swagger-annotations-version} + + {{/swagger2AnnotationLibrary}} com.google.code.findbugs @@ -239,6 +247,11 @@ jackson-dataformat-xml ${jackson-version} + + io.github.threeten-jaxb + threeten-jaxb-core + 1.2 + {{/withXml}} @@ -264,24 +277,41 @@ - junit - junit + org.assertj + assertj-core + ${assertj-version} + test + + + org.junit.jupiter + junit-jupiter-api ${junit-version} test UTF-8 - 1.6.3 - 4.5.11.Final - 2.10.5 - 2.10.5.1 + {{#swagger1AnnotationLibrary}} + 1.6.6 + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + 2.2.15 + {{/swagger2AnnotationLibrary}} + 4.7.6.Final + 2.17.1 + 2.17.1 {{#openApiNullable}} - 0.2.2 + 0.2.6 {{/openApiNullable}} + {{#useJakartaEe}} + 2.1.1 + {{/useJakartaEe}} + {{^useJakartaEe}} 1.3.5 + {{/useJakartaEe}} 2.9.10 1.0.0 - 4.13 + 3.23.1 + 5.10.2 diff --git a/templates/libraries/resttemplate/ApiClient.mustache b/templates/libraries/resttemplate/ApiClient.mustache index f868eaa..e4711ca 100644 --- a/templates/libraries/resttemplate/ApiClient.mustache +++ b/templates/libraries/resttemplate/ApiClient.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; {{#withXml}} @@ -31,17 +33,12 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.util.StringUtils; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.HttpServerErrorException; import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestTemplate; import org.springframework.web.util.UriComponentsBuilder; import org.springframework.web.util.DefaultUriBuilderFactory; -{{#threetenbp}} -import org.threeten.bp.*; -import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; -import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter; -import com.fasterxml.jackson.databind.ObjectMapper; -{{/threetenbp}} {{#openApiNullable}} import org.openapitools.jackson.nullable.JsonNullableModule; {{/openApiNullable}} @@ -69,9 +66,10 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.TimeZone; -{{#jsr310}}{{^threetenbp}} +import java.util.function.Supplier; +{{#jsr310}} import java.time.OffsetDateTime; -{{/threetenbp}}{{/jsr310}} +{{/jsr310}} import {{invokerPackage}}.auth.Authentication; {{#hasHttpBasicMethods}} @@ -88,7 +86,9 @@ import {{invokerPackage}}.auth.OAuth; {{/hasOAuthMethods}} {{>generatedAnnotation}} +{{#generateClientAsBean}} @Component("{{invokerPackage}}.ApiClient") +{{/generateClientAsBean}} public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { public enum CollectionFormat { CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null); @@ -109,6 +109,10 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { private HttpHeaders defaultHeaders = new HttpHeaders(); private MultiValueMap defaultCookies = new LinkedMultiValueMap(); + private int maxAttemptsForRetry = {{maxAttemptsForRetry}}; + + private long waitTimeMillis = {{waitTimeMillis}}; + private String basePath = "{{basePath}}"; private RestTemplate restTemplate; @@ -122,7 +126,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { init(); } + {{#generateClientAsBean}} @Autowired + {{/generateClientAsBean}} public ApiClient(RestTemplate restTemplate) { this.restTemplate = restTemplate; init(); @@ -141,8 +147,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} - authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} + authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}} + authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} // Prevent the authentications from being modified. @@ -169,6 +175,46 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { return this; } + /** + * Get the max attempts for retry + * + * @return int the max attempts + */ + public int getMaxAttemptsForRetry() { + return maxAttemptsForRetry; + } + + /** + * Set the max attempts for retry + * + * @param maxAttemptsForRetry the max attempts for retry + * @return ApiClient this client + */ + public ApiClient setMaxAttemptsForRetry(int maxAttemptsForRetry) { + this.maxAttemptsForRetry = maxAttemptsForRetry; + return this; + } + + /** + * Get the wait time in milliseconds + * + * @return long wait time in milliseconds + */ + public long getWaitTimeMillis() { + return waitTimeMillis; + } + + /** + * Set the wait time in milliseconds + * + * @param waitTimeMillis the wait time in milliseconds + * @return ApiClient this client + */ + public ApiClient setWaitTimeMillis(long waitTimeMillis) { + this.waitTimeMillis = waitTimeMillis; + return this; + } + /** * Get authentications (key: authentication name, value: authentication). * @@ -190,14 +236,23 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { {{#hasHttpBearerMethods}} /** - * Helper method to set token for HTTP bearer authentication. + * Helper method to set access token for the first Bearer authentication. * - * @param bearerToken the token + * @param bearerToken Bearer token */ public void setBearerToken(String bearerToken) { + setBearerToken(() -> bearerToken); + } + + /** + * Helper method to set the supplier of access tokens for Bearer authentication. + * + * @param tokenSupplier The supplier of bearer tokens + */ + public void setBearerToken(Supplier tokenSupplier) { for (Authentication auth : authentications.values()) { if (auth instanceof HttpBearerAuth) { - ((HttpBearerAuth) auth).setBearerToken(bearerToken); + ((HttpBearerAuth) auth).setBearerToken(tokenSupplier); return; } } @@ -278,9 +333,18 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * @param accessToken Access token */ public void setAccessToken(String accessToken) { + setAccessToken(() -> accessToken); + } + + /** + * Helper method to set the supplier of access tokens for OAuth2 authentication. + * + * @param tokenSupplier The supplier of bearer tokens + */ + public void setAccessToken(Supplier tokenSupplier) { for (Authentication auth : authentications.values()) { if (auth instanceof OAuth) { - ((OAuth) auth).setAccessToken(accessToken); + ((OAuth) auth).setAccessToken(tokenSupplier); return; } } @@ -377,14 +441,6 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { */ public ApiClient setDateFormat(DateFormat dateFormat) { this.dateFormat = dateFormat; - {{#threetenbp}} - for (HttpMessageConverter converter : restTemplate.getMessageConverters()) { - if (converter instanceof AbstractJackson2HttpMessageConverter) { - ObjectMapper mapper = ((AbstractJackson2HttpMessageConverter) converter).getObjectMapper(); - mapper.setDateFormat(dateFormat); - } - } - {{/threetenbp}} return this; } @@ -623,12 +679,6 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * @return path with placeholders replaced by variables */ public String expandPath(String pathTemplate, Map variables) { - // disable default URL encoding - DefaultUriBuilderFactory uriBuilderFactory = new DefaultUriBuilderFactory(); - uriBuilderFactory.setEncodingMode(DefaultUriBuilderFactory.EncodingMode.NONE); - final RestTemplate restTemplate = new RestTemplate(); - restTemplate.setUriTemplateHandler(uriBuilderFactory); - return restTemplate.getUriTemplateHandler().expand(pathTemplate, variables).toString(); } @@ -658,8 +708,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { queryBuilder.append(encodedName); if (value != null) { String templatizedKey = encodedName + valueItemCounter++; - final String encodedValue = URLEncoder.encode(value.toString(), "UTF-8"); - uriParams.put(templatizedKey, encodedValue); + uriParams.put(templatizedKey, value.toString()); queryBuilder.append('=').append("{").append(templatizedKey).append("}"); } } @@ -693,7 +742,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { public ResponseEntity invokeAPI(String path, HttpMethod method, Map pathParams, MultiValueMap queryParams, Object body, HttpHeaders headerParams, MultiValueMap cookieParams, MultiValueMap formParams, List accept, MediaType contentType, String[] authNames, ParameterizedTypeReference returnType) throws RestClientException { updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); - Map uriParams = new HashMap<>(); + Map uriParams = new HashMap<>(); uriParams.putAll(pathParams); String finalUri = path; @@ -714,7 +763,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { throw new RestClientException("Could not build URL: " + builder.toUriString(), ex); } - final BodyBuilder requestBuilder = RequestEntity.method(method, uri); + final BodyBuilder requestBuilder = RequestEntity.method(method, UriComponentsBuilder.fromHttpUrl(basePath).toUriString() + finalUri, uriParams); if (accept != null) { requestBuilder.accept(accept.toArray(new MediaType[accept.size()])); } @@ -729,7 +778,36 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { RequestEntity requestEntity = requestBuilder.body(selectBody(body, formParams, contentType)); - ResponseEntity responseEntity = restTemplate.exchange(requestEntity, returnType); + ResponseEntity responseEntity = null; + int attempts = 0; + while (attempts < maxAttemptsForRetry) { + try { + responseEntity = restTemplate.exchange(requestEntity, returnType); + break; + } catch (HttpServerErrorException | HttpClientErrorException ex) { + if (ex instanceof HttpServerErrorException + || ((HttpClientErrorException) ex) + .getStatusCode() + .equals(HttpStatus.TOO_MANY_REQUESTS)) { + attempts++; + if (attempts < maxAttemptsForRetry) { + try { + Thread.sleep(waitTimeMillis); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } else { + throw ex; + } + } else { + throw ex; + } + } + } + + if (responseEntity == null) { + throw new RestClientException("ResponseEntity is null"); + } if (responseEntity.getStatusCode().is2xxSuccessful()) { return responseEntity; @@ -801,23 +879,13 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { RestTemplate restTemplate = new RestTemplate(messageConverters); {{/withXml}}{{^withXml}}RestTemplate restTemplate = new RestTemplate();{{/withXml}} - {{#threetenbp}} - for (HttpMessageConverter converter : restTemplate.getMessageConverters()) { - if (converter instanceof AbstractJackson2HttpMessageConverter){ - ObjectMapper mapper = ((AbstractJackson2HttpMessageConverter) converter).getObjectMapper(); - ThreeTenModule module = new ThreeTenModule(); - module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); - module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); - module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); - mapper.registerModule(module); - {{#openApiNullable}} - mapper.registerModule(new JsonNullableModule()); - {{/openApiNullable}} - } - } - {{/threetenbp}} // This allows us to read the response more than once - Necessary for debugging. restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(restTemplate.getRequestFactory())); + + // disable default URL encoding + DefaultUriBuilderFactory uriBuilderFactory = new DefaultUriBuilderFactory(); + uriBuilderFactory.setEncodingMode(DefaultUriBuilderFactory.EncodingMode.VALUES_ONLY); + restTemplate.setUriTemplateHandler(uriBuilderFactory); return restTemplate; } @@ -857,13 +925,16 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } private void logResponse(ClientHttpResponse response) throws IOException { - log.info("HTTP Status Code: " + response.getRawStatusCode()); + log.info("HTTP Status Code: " + response.getStatusCode().value()); log.info("Status Text: " + response.getStatusText()); log.info("HTTP Headers: " + headersToString(response.getHeaders())); log.info("Response Body: " + bodyToString(response.getBody())); } private String headersToString(HttpHeaders headers) { + if(headers == null || headers.isEmpty()) { + return ""; + } StringBuilder builder = new StringBuilder(); for (Entry> entry : headers.entrySet()) { builder.append(entry.getKey()).append("=["); diff --git a/templates/libraries/resttemplate/BaseApi.mustache b/templates/libraries/resttemplate/BaseApi.mustache new file mode 100644 index 0000000..3b47979 --- /dev/null +++ b/templates/libraries/resttemplate/BaseApi.mustache @@ -0,0 +1,76 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import org.springframework.web.client.RestClientException; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; + +{{>generatedAnnotation}} +public abstract class BaseApi { + + protected ApiClient apiClient; + + public BaseApi() { + this(new ApiClient()); + } + + public BaseApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @return ResponseEntity<Void> + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public ResponseEntity invokeAPI(String url, HttpMethod method) throws RestClientException { + return invokeAPI(url, method, null, new ParameterizedTypeReference() {}); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @param request The request object. + * @return ResponseEntity<Void> + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public ResponseEntity invokeAPI(String url, HttpMethod method, Object request) throws RestClientException { + return invokeAPI(url, method, request, new ParameterizedTypeReference() {}); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @param returnType The return type. + * @return ResponseEntity in the specified type. + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public ResponseEntity invokeAPI(String url, HttpMethod method, ParameterizedTypeReference returnType) throws RestClientException { + return invokeAPI(url, method, null, returnType); + } + + /** + * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests. + * @param url The URL for the request, either full URL or only the path. + * @param method The HTTP method for the request. + * @param request The request object. + * @param returnType The return type. + * @return ResponseEntity in the specified type. + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public abstract ResponseEntity invokeAPI(String url, HttpMethod method, Object request, ParameterizedTypeReference returnType) throws RestClientException; +} diff --git a/templates/libraries/resttemplate/api.mustache b/templates/libraries/resttemplate/api.mustache index cc207bd..aa1a98f 100644 --- a/templates/libraries/resttemplate/api.mustache +++ b/templates/libraries/resttemplate/api.mustache @@ -1,17 +1,23 @@ package {{package}}; import {{invokerPackage}}.ApiClient; +import {{invokerPackage}}.BaseApi; {{#imports}}import {{import}}; {{/imports}} -{{^fullJavaUtil}}import java.util.Collections; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.stream.Collectors;{{/fullJavaUtil}} +import java.util.stream.Collectors; +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.LinkedMultiValueMap; @@ -27,26 +33,21 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; {{>generatedAnnotation}} +{{#generateClientAsBean}} @Component("{{package}}.{{classname}}") +{{/generateClientAsBean}} {{#operations}} -public class {{classname}} { - private ApiClient apiClient; +public class {{classname}} extends BaseApi { public {{classname}}() { - this(new ApiClient()); + super(new ApiClient()); } + {{#generateClientAsBean}} @Autowired + {{/generateClientAsBean}} public {{classname}}(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; + super(apiClient); } {{#operation}} @@ -74,7 +75,7 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.Resource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws RestClientException { + public {{#returnType}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{.}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{.}}}{{/isResponseFile}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.Resource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws RestClientException { {{#returnType}} return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).getBody(); {{/returnType}} @@ -105,8 +106,8 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public ResponseEntity<{{{returnType}}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.Resource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws RestClientException { - Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + public ResponseEntity<{{#returnType}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{.}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{.}}}{{/isResponseFile}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.Resource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws RestClientException { + Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { @@ -117,40 +118,71 @@ public class {{classname}} { final Map uriVariables = new HashMap();{{#pathParams}} uriVariables.put("{{baseName}}", {{#collectionFormat}}apiClient.collectionPathParameterToString(ApiClient.CollectionFormat.valueOf("{{{collectionFormat}}}".toUpperCase()), {{{paramName}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}});{{/pathParams}}{{/hasPathParams}} - final MultiValueMap queryParams = new LinkedMultiValueMap(); - final HttpHeaders headerParams = new HttpHeaders(); - final MultiValueMap cookieParams = new LinkedMultiValueMap(); - final MultiValueMap formParams = new LinkedMultiValueMap();{{#hasQueryParams}} + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarCookieParams = new LinkedMultiValueMap(); + final MultiValueMap localVarFormParams = new LinkedMultiValueMap();{{#hasQueryParams}} - {{#queryParams}}queryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{.}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}}));{{^-last}} - {{/-last}}{{/queryParams}}{{/hasQueryParams}}{{#hasHeaderParams}} + {{#queryParams}}{{#isExplode}}{{#hasVars}} + if ({{paramName}} != null) { + {{#vars}} localVarQueryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{.}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}}.{{getter}}())); + {{/vars}}}{{/hasVars}}{{^hasVars}}localVarQueryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{.}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}})); + {{/hasVars}}{{/isExplode}}{{^isExplode}}localVarQueryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{.}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}})); + {{/isExplode}}{{/queryParams}}{{/hasQueryParams}}{{#hasHeaderParams}} {{#headerParams}}if ({{paramName}} != null) - headerParams.add("{{baseName}}", apiClient.parameterToString({{paramName}}));{{^-last}} + localVarHeaderParams.add("{{baseName}}", apiClient.parameterToString({{paramName}}));{{^-last}} {{/-last}}{{/headerParams}}{{/hasHeaderParams}}{{#hasCookieParams}} {{#cookieParams}}if ({{paramName}} != null) - cookieParams.add("{{baseName}}", apiClient.parameterToString({{paramName}}));{{^-last}} + localVarCookieParams.add("{{baseName}}", apiClient.parameterToString({{paramName}}));{{^-last}} {{/-last}}{{/cookieParams}}{{/hasCookieParams}}{{#hasFormParams}} {{#formParams}}if ({{paramName}} != null) - formParams.{{^collectionFormat}}add{{/collectionFormat}}{{#collectionFormat}}addAll{{/collectionFormat}}("{{baseName}}", {{#isFile}}{{^collectionFormat}}{{#useAbstractionForFiles}}{{paramName}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}new FileSystemResource({{paramName}}){{/useAbstractionForFiles}}{{/collectionFormat}}{{/isFile}}{{#isFile}}{{#collectionFormat}}{{paramName}}.stream(){{^useAbstractionForFiles}}.map(FileSystemResource::new){{/useAbstractionForFiles}}.collect(Collectors.toList()){{/collectionFormat}}{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}});{{^-last}} + localVarFormParams.{{^collectionFormat}}add{{/collectionFormat}}{{#collectionFormat}}addAll{{/collectionFormat}}("{{baseName}}", {{#isFile}}{{^collectionFormat}}{{#useAbstractionForFiles}}{{paramName}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}new FileSystemResource({{paramName}}){{/useAbstractionForFiles}}{{/collectionFormat}}{{/isFile}}{{#isFile}}{{#collectionFormat}}{{paramName}}.stream(){{^useAbstractionForFiles}}.map(FileSystemResource::new){{/useAbstractionForFiles}}.collect(Collectors.toList()){{/collectionFormat}}{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}});{{^-last}} {{/-last}}{{/formParams}}{{/hasFormParams}} final String[] localVarAccepts = { {{#hasProduces}} {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} {{/hasProduces}} }; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] contentTypes = { {{#hasConsumes}} + final String[] localVarContentTypes = { {{#hasConsumes}} + {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} + {{/hasConsumes}} }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; + + {{#returnType}}ParameterizedTypeReference<{{#returnType}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{.}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{.}}}{{/isResponseFile}}{{/returnType}}> localReturnType = new ParameterizedTypeReference<{{#returnType}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{.}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{.}}}{{/isResponseFile}}{{/returnType}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {};{{/returnType}} + return apiClient.invokeAPI("{{{path}}}", HttpMethod.{{httpMethod}}, {{#hasPathParams}}uriVariables{{/hasPathParams}}{{^hasPathParams}}Collections.emptyMap(){{/hasPathParams}}, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); + } + {{#-last}} + + @Override + public ResponseEntity invokeAPI(String url, HttpMethod method, Object request, ParameterizedTypeReference returnType) throws RestClientException { + String localVarPath = url.replace(apiClient.getBasePath(), ""); + Object localVarPostBody = request; + + final Map uriVariables = new HashMap(); + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarCookieParams = new LinkedMultiValueMap(); + final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { {{#hasProduces}} + {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} + {{/hasProduces}} }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { {{#hasConsumes}} {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} {{/hasConsumes}} }; - final MediaType localVarContentType = apiClient.selectHeaderContentType(contentTypes); + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] authNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; - {{#returnType}}ParameterizedTypeReference<{{{returnType}}}> returnType = new ParameterizedTypeReference<{{{returnType}}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference returnType = new ParameterizedTypeReference() {};{{/returnType}} - return apiClient.invokeAPI("{{{path}}}", HttpMethod.{{httpMethod}}, {{#hasPathParams}}uriVariables{{/hasPathParams}}{{^hasPathParams}}Collections.emptyMap(){{/hasPathParams}}, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, authNames, returnType); + return apiClient.invokeAPI(localVarPath, method, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, returnType); } + {{/-last}} {{/operation}} } {{/operations}} diff --git a/templates/libraries/resttemplate/api_test.mustache b/templates/libraries/resttemplate/api_test.mustache index 865572a..04a19f1 100644 --- a/templates/libraries/resttemplate/api_test.mustache +++ b/templates/libraries/resttemplate/api_test.mustache @@ -4,21 +4,27 @@ package {{package}}; {{#imports}}import {{import}}; {{/imports}} -import org.junit.Test; -import org.junit.Ignore; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.springframework.web.client.RestClientException; -{{^fullJavaUtil}} +import java.time.LocalDate; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} /** * API tests for {{classname}} */ -@Ignore -public class {{classname}}Test { +@Disabled +class {{classname}}Test { private final {{classname}} api = new {{classname}}(); @@ -28,15 +34,16 @@ public class {{classname}}Test { * * {{notes}} * - * @throws ApiException + * @throws RestClientException * if the Api call fails */ @Test - public void {{operationId}}Test() { + void {{operationId}}Test() { {{#allParams}} {{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.Resource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}} = null; {{/allParams}} - {{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + + {{#returnType}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{.}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{.}}}{{/isResponseFile}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); // TODO: test validations } diff --git a/templates/libraries/resttemplate/auth/ApiKeyAuth.mustache b/templates/libraries/resttemplate/auth/ApiKeyAuth.mustache index 857403b..d329303 100644 --- a/templates/libraries/resttemplate/auth/ApiKeyAuth.mustache +++ b/templates/libraries/resttemplate/auth/ApiKeyAuth.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import org.springframework.http.HttpHeaders; diff --git a/templates/libraries/resttemplate/auth/Authentication.mustache b/templates/libraries/resttemplate/auth/Authentication.mustache index 8e53c2b..0636a6d 100644 --- a/templates/libraries/resttemplate/auth/Authentication.mustache +++ b/templates/libraries/resttemplate/auth/Authentication.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import org.springframework.http.HttpHeaders; diff --git a/templates/libraries/resttemplate/auth/HttpBasicAuth.mustache b/templates/libraries/resttemplate/auth/HttpBasicAuth.mustache index 5b07cb9..fba1265 100644 --- a/templates/libraries/resttemplate/auth/HttpBasicAuth.mustache +++ b/templates/libraries/resttemplate/auth/HttpBasicAuth.mustache @@ -1,10 +1,11 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; -import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; +import java.util.Base64; import org.springframework.http.HttpHeaders; -import org.springframework.util.Base64Utils; import org.springframework.util.MultiValueMap; {{>generatedAnnotation}} @@ -34,6 +35,6 @@ public class HttpBasicAuth implements Authentication { return; } String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); - headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString(str.getBytes(StandardCharsets.UTF_8))); + headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); } } diff --git a/templates/libraries/resttemplate/auth/HttpBearerAuth.mustache b/templates/libraries/resttemplate/auth/HttpBearerAuth.mustache index 1d1610c..ecf258a 100644 --- a/templates/libraries/resttemplate/auth/HttpBearerAuth.mustache +++ b/templates/libraries/resttemplate/auth/HttpBearerAuth.mustache @@ -1,31 +1,51 @@ -package {{invokerPackage}}.auth; +{{>licenseInfo}} -import java.io.UnsupportedEncodingException; -import java.nio.charset.StandardCharsets; +package {{invokerPackage}}.auth; +import java.util.Optional; +import java.util.function.Supplier; import org.springframework.http.HttpHeaders; -import org.springframework.util.Base64Utils; import org.springframework.util.MultiValueMap; {{>generatedAnnotation}} public class HttpBearerAuth implements Authentication { private final String scheme; - private String bearerToken; + private Supplier tokenSupplier; public HttpBearerAuth(String scheme) { this.scheme = scheme; } + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ public String getBearerToken() { - return bearerToken; + return tokenSupplier.get(); } + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header + */ public void setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; + this.tokenSupplier = () -> bearerToken; + } + + /** + * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header + */ + public void setBearerToken(Supplier tokenSupplier) { + this.tokenSupplier = tokenSupplier; } @Override public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams) { + String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null); if (bearerToken == null) { return; } diff --git a/templates/libraries/resttemplate/auth/OAuth.mustache b/templates/libraries/resttemplate/auth/OAuth.mustache index 7889f15..1e82042 100644 --- a/templates/libraries/resttemplate/auth/OAuth.mustache +++ b/templates/libraries/resttemplate/auth/OAuth.mustache @@ -1,24 +1,50 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; +import java.util.Optional; +import java.util.function.Supplier; import org.springframework.http.HttpHeaders; import org.springframework.util.MultiValueMap; +/** + * Provides support for RFC 6750 - Bearer Token usage for OAUTH 2.0 Authorization. + */ {{>generatedAnnotation}} public class OAuth implements Authentication { - private String accessToken; + private Supplier tokenSupplier; + /** + * Returns the bearer token used for Authorization. + * + * @return The bearer token + */ public String getAccessToken() { - return accessToken; + return tokenSupplier.get(); } + /** + * Sets the bearer access token used for Authorization. + * + * @param bearerToken The bearer token to send in the Authorization header + */ public void setAccessToken(String accessToken) { - this.accessToken = accessToken; + setAccessToken(() -> accessToken); + } + + /** + * Sets the supplier of bearer tokens used for Authorization. + * + * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header + */ + public void setAccessToken(Supplier tokenSupplier) { + this.tokenSupplier = tokenSupplier; } @Override public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams) { - if (accessToken != null) { - headerParams.add(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken); - } + Optional.ofNullable(tokenSupplier).map(Supplier::get).ifPresent(accessToken -> + headerParams.add(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken) + ); } } diff --git a/templates/libraries/resttemplate/auth/OAuthFlow.mustache b/templates/libraries/resttemplate/auth/OAuthFlow.mustache index 7ab35f6..759f354 100644 --- a/templates/libraries/resttemplate/auth/OAuthFlow.mustache +++ b/templates/libraries/resttemplate/auth/OAuthFlow.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; public enum OAuthFlow { diff --git a/templates/libraries/resttemplate/build.gradle.mustache b/templates/libraries/resttemplate/build.gradle.mustache index 75b4478..a900fc8 100644 --- a/templates/libraries/resttemplate/build.gradle.mustache +++ b/templates/libraries/resttemplate/build.gradle.mustache @@ -32,14 +32,14 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 22 } compileOptions { - {{#java8}} + {{#useJakartaEe}} + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + {{/useJakartaEe}} + {{^useJakartaEe}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 - {{/java8}} - {{^java8}} - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - {{/java8}} + {{/useJakartaEe}} } // Rename the aar correctly @@ -63,16 +63,16 @@ if(hasProperty('target') && target == 'android') { def task = project.tasks.create "jar${variant.name.capitalize()}", Jar task.description = "Create jar artifact for ${variant.name}" task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - task.destinationDir = project.file("${project.buildDir}/outputs/jar") - task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + task.from variant.javaCompile.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" artifacts.add('archives', task); } } task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs - classifier = 'sources' + archiveClassifier = 'sources' } artifacts { @@ -84,14 +84,14 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven-publish' - {{#java8}} + {{#useJakartaEe}} + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + {{/useJakartaEe}} + {{^useJakartaEe}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - {{/java8}} - {{^java8}} - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 - {{/java8}} + {{/useJakartaEe}} publishing { publications { @@ -103,29 +103,42 @@ if(hasProperty('target') && target == 'android') { } task execute(type:JavaExec) { - main = System.getProperty('mainClass') + mainClass = System.getProperty('mainClass') classpath = sourceSets.main.runtimeClasspath } } ext { - swagger_annotations_version = "1.5.22" - jackson_version = "2.10.5" - jackson_databind_version = "2.10.5.1" + {{#swagger1AnnotationLibrary}} + swagger_annotations_version = "1.6.9" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + swagger_annotations_version = "2.2.9" + {{/swagger2AnnotationLibrary}} + jackson_version = "2.17.1" + jackson_databind_version = "2.17.1" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.2" + jackson_databind_nullable_version = "0.2.6" {{/openApiNullable}} + {{#useJakartaEe}} + spring_web_version = "6.1.5" + jakarta_annotation_version = "2.1.1" + {{/useJakartaEe}} + {{^useJakartaEe}} + spring_web_version = "5.3.33" jakarta_annotation_version = "1.3.5" - spring_web_version = "5.2.5.RELEASE" + {{/useJakartaEe}} jodatime_version = "2.9.9" - junit_version = "4.13.1" - {{#threetenbp}} - jackson_threeten_version = "2.9.10" - {{/threetenbp}} + junit_version = "5.10.2" } dependencies { + {{#swagger1AnnotationLibrary}} implementation "io.swagger:swagger-annotations:$swagger_annotations_version" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version" + {{/swagger2AnnotationLibrary}} implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.springframework:spring-web:$spring_web_version" implementation "org.springframework:spring-context:$spring_web_version" @@ -136,19 +149,29 @@ dependencies { {{#openApiNullable}} implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" {{/openApiNullable}} - {{#java8}} implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" - {{/java8}} {{#joda}} implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" implementation "joda-time:joda-time:$jodatime_version" {{/joda}} - {{#threetenbp}} - implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threeten_version" - {{/threetenbp}} {{#withXml}} implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version" {{/withXml}} implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation "junit:junit:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" +} + +test { + // Enable JUnit 5 (Gradle 4.6+). + useJUnitPlatform() + + // Always run tests, even when nothing changed. + dependsOn 'cleanTest' + + // Show test results. + testLogging { + events "passed", "skipped", "failed" + } + } diff --git a/templates/libraries/resttemplate/pom.mustache b/templates/libraries/resttemplate/pom.mustache index 6bd5637..250417d 100644 --- a/templates/libraries/resttemplate/pom.mustache +++ b/templates/libraries/resttemplate/pom.mustache @@ -43,7 +43,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M1 + 3.4.0 enforce-maven @@ -63,18 +63,27 @@ org.apache.maven.plugins maven-surefire-plugin - 2.12 + 3.1.2 - + loggerPath conf/log4j.properties - + -Xms512m -Xmx1500m methods pertest + true + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + maven-dependency-plugin @@ -95,11 +104,10 @@ org.apache.maven.plugins maven-jar-plugin - 2.2 + 3.3.0 - jar test-jar @@ -111,7 +119,7 @@ org.codehaus.mojo build-helper-maven-plugin - 1.10 + 3.4.0 add_sources @@ -142,22 +150,22 @@ org.apache.maven.plugins maven-compiler-plugin - 3.6.1 + 3.11.0 - {{#java8}} - 1.8 - 1.8 - {{/java8}} - {{^java8}} - 1.7 - 1.7 - {{/java8}} + {{#useJakartaEe}} + 17 + 17 + {{/useJakartaEe}} + {{^useJakartaEe}} + 1.8 + 1.8 + {{/useJakartaEe}} org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.5.0 none @@ -173,7 +181,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.3.0 attach-sources @@ -211,11 +219,20 @@ + {{#swagger1AnnotationLibrary}} io.swagger swagger-annotations ${swagger-annotations-version} + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + + io.swagger.core.v3 + swagger-annotations + ${swagger-annotations-version} + + {{/swagger2AnnotationLibrary}} @@ -252,52 +269,75 @@ jackson-databind ${jackson-databind-version} + {{^useJakartaEe}} com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider ${jackson-version} + {{/useJakartaEe}} + {{#useJakartaEe}} + + com.fasterxml.jackson.jakarta.rs + jackson-jakarta-rs-json-provider + ${jackson-version} + + {{/useJakartaEe}} + {{#openApiNullable}} org.openapitools jackson-databind-nullable ${jackson-databind-nullable-version} + {{/openApiNullable}} {{#withXml}} - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson-version} - - + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson-version} + + + io.github.threeten-jaxb + threeten-jaxb-core + 1.2 + {{/withXml}} - {{#java8}} - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${jackson-version} - - {{/java8}} + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + {{#joda}} - - com.fasterxml.jackson.datatype - jackson-datatype-joda - ${jackson-version} - - - joda-time - joda-time - ${jodatime-version} - + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-version} + + + joda-time + joda-time + ${jodatime-version} + {{/joda}} - {{#threetenbp}} - - com.github.joschi.jackson - jackson-datatype-threetenbp - ${jackson-threetenbp-version} - - {{/threetenbp}} + {{#useBeanValidation}} + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + {{/useBeanValidation}} + {{#performBeanValidation}} + + + org.hibernate + hibernate-validator + ${hibernate-validator-version} + + {{/performBeanValidation}} jakarta.annotation jakarta.annotation-api @@ -307,27 +347,53 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine ${junit-version} test + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + UTF-8 - 1.5.22 - 5.2.5.RELEASE - 2.10.5 - 2.10.5.1 - 0.2.2 + {{#swagger1AnnotationLibrary}} + 1.6.9 + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + 2.2.15 + {{/swagger2AnnotationLibrary}} + {{#useJakartaEe}} + 6.1.5 + {{/useJakartaEe}} + {{^useJakartaEe}} + 5.3.33 + {{/useJakartaEe}} + 2.17.1 + 2.17.1 + {{#openApiNullable}} + 0.2.6 + {{/openApiNullable}} + {{#useJakartaEe}} + 2.1.1 + {{/useJakartaEe}} + {{^useJakartaEe}} 1.3.5 + {{/useJakartaEe}} {{#joda}} 2.9.9 {{/joda}} - {{#threetenbp}} - 2.9.10 - {{/threetenbp}} - 1.0.0 - 4.13.1 + {{#useBeanValidation}} + 3.0.2 + {{/useBeanValidation}} + {{#performBeanValidation}} + 5.4.3.Final + {{/performBeanValidation}} + 5.10.2 + 1.10.0 diff --git a/templates/libraries/retrofit/ApiClient.mustache b/templates/libraries/retrofit/ApiClient.mustache deleted file mode 100644 index ad3057e..0000000 --- a/templates/libraries/retrofit/ApiClient.mustache +++ /dev/null @@ -1,448 +0,0 @@ -package {{invokerPackage}}; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.Type; -import java.util.LinkedHashMap; -import java.util.Map; - -{{#hasOAuthMethods}} -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; -{{/hasOAuthMethods}} - -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.joda.time.format.DateTimeFormatter; -import org.joda.time.format.ISODateTimeFormat; - -import retrofit.RestAdapter; -import retrofit.client.OkClient; -import retrofit.converter.ConversionException; -import retrofit.converter.Converter; -import retrofit.converter.GsonConverter; -import retrofit.mime.TypedByteArray; -import retrofit.mime.TypedInput; -import retrofit.mime.TypedOutput; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.squareup.okhttp.Interceptor; -import com.squareup.okhttp.OkHttpClient; - -import {{invokerPackage}}.auth.HttpBasicAuth; -import {{invokerPackage}}.auth.HttpBearerAuth; -import {{invokerPackage}}.auth.ApiKeyAuth; -{{#hasOAuthMethods}} -import {{invokerPackage}}.auth.OAuth; -import {{invokerPackage}}.auth.OAuth.AccessTokenListener; -import {{invokerPackage}}.auth.OAuthFlow; -{{/hasOAuthMethods}} - -public class ApiClient { - - private Map apiAuthorizations; - private OkHttpClient okClient; - private RestAdapter.Builder adapterBuilder; - - public ApiClient() { - apiAuthorizations = new LinkedHashMap(); - createDefaultAdapter(); - } - - public ApiClient(String[] authNames) { - this(); - for(String authName : authNames) { - {{#hasAuthMethods}} - Interceptor auth; - {{#authMethods}}if ("{{name}}".equals(authName)) { - {{#isBasic}} - {{#isBasicBasic}} - auth = new HttpBasicAuth(); - {{/isBasicBasic}} - {{^isBasicBasic}} - auth = new HttpBearerAuth("{{scheme}}"); - {{/isBasicBasic}} - {{/isBasic}} - {{#isApiKey}} - auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"); - {{/isApiKey}} - {{#isOAuth}} - auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}"); - {{/isOAuth}} - } else {{/authMethods}}{ - throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); - } - addAuthorization(authName, auth); - {{/hasAuthMethods}} - {{^hasAuthMethods}} - throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); - {{/hasAuthMethods}} - } - } - - /** - * Basic constructor for single auth name - * @param authName Authentication name - */ - public ApiClient(String authName) { - this(new String[]{authName}); - } - - /** - * Helper constructor for single api key - * @param authName Authentication name - * @param apiKey API key - */ - public ApiClient(String authName, String apiKey) { - this(authName); - this.setApiKey(apiKey); - } - - /** - * Helper constructor for single basic auth or password oauth2 - * @param authName Authentication name - * @param username Username - * @param password Password - */ - public ApiClient(String authName, String username, String password) { - this(authName); - this.setCredentials(username, password); - } - - {{#hasOAuthMethods}} - /** - * Helper constructor for single password oauth2 - * @param authName Authentication name - * @param clientId Client ID - * @param secret Client secret - * @param username Username - * @param password Password - */ - public ApiClient(String authName, String clientId, String secret, String username, String password) { - this(authName); - this.getTokenEndPoint() - .setClientId(clientId) - .setClientSecret(secret) - .setUsername(username) - .setPassword(password); - } - - {{/hasOAuthMethods}} - public void createDefaultAdapter() { - Gson gson = new GsonBuilder() - .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") - .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter()) - .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) - .create(); - - okClient = new OkHttpClient(); - - adapterBuilder = new RestAdapter - .Builder() - .setEndpoint("{{{basePath}}}") - .setClient(new OkClient(okClient)) - .setConverter(new GsonConverterWrapper(gson)); - } - - public S createService(Class serviceClass) { - return adapterBuilder.build().create(serviceClass); - - } - - /** - * Helper method to configure the first api key found - * @param apiKey API key - */ - private void setApiKey(String apiKey) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof ApiKeyAuth) { - ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization; - keyAuth.setApiKey(apiKey); - return; - } - } - } - - /** - * Helper method to set token for the first Http Bearer authentication found. - * @param bearerToken Bearer token - */ - public void setBearerToken(String bearerToken) { - for (Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof HttpBearerAuth) { - ((HttpBearerAuth) apiAuthorization).setBearerToken(bearerToken); - return; - } - } - } - - /** - * Helper method to configure the username/password for basic auth or password oauth - * @param username Username - * @param password Password - */ - private void setCredentials(String username, String password) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof HttpBasicAuth) { - HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization; - basicAuth.setCredentials(username, password); - return; - } - {{#hasOAuthMethods}} - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.getTokenRequestBuilder().setUsername(username).setPassword(password); - return; - } - {{/hasOAuthMethods}} - } - } - - {{#hasOAuthMethods}} - /** - * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return Token request builder - */ - public TokenRequestBuilder getTokenEndPoint() { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - return oauth.getTokenRequestBuilder(); - } - } - return null; - } - - /** - * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return Authentication request builder - */ - public AuthenticationRequestBuilder getAuthorizationEndPoint() { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - return oauth.getAuthenticationRequestBuilder(); - } - } - return null; - } - - /** - * Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one) - * @param accessToken Access token - */ - public void setAccessToken(String accessToken) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.setAccessToken(accessToken); - return; - } - } - } - - /** - * Helper method to configure the oauth accessCode/implicit flow parameters - * @param clientId Client ID - * @param clientSecret Client secret - * @param redirectURI Redirect URI - */ - public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.getTokenRequestBuilder() - .setClientId(clientId) - .setClientSecret(clientSecret) - .setRedirectURI(redirectURI); - oauth.getAuthenticationRequestBuilder() - .setClientId(clientId) - .setRedirectURI(redirectURI); - return; - } - } - } - - /** - * Configures a listener which is notified when a new access token is received. - * @param accessTokenListener Access token listener - */ - public void registerAccessTokenListener(AccessTokenListener accessTokenListener) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.registerAccessTokenListener(accessTokenListener); - return; - } - } - } - {{/hasOAuthMethods}} - - /** - * Adds an authorization to be used by the client - * @param authName Authentication name - * @param authorization Authorization - */ - public void addAuthorization(String authName, Interceptor authorization) { - if (apiAuthorizations.containsKey(authName)) { - throw new RuntimeException("auth name \"" + authName + "\" already in api authorizations"); - } - apiAuthorizations.put(authName, authorization); - okClient.interceptors().add(authorization); - } - - public Map getApiAuthorizations() { - return apiAuthorizations; - } - - public void setApiAuthorizations(Map apiAuthorizations) { - this.apiAuthorizations = apiAuthorizations; - } - - public RestAdapter.Builder getAdapterBuilder() { - return adapterBuilder; - } - - public void setAdapterBuilder(RestAdapter.Builder adapterBuilder) { - this.adapterBuilder = adapterBuilder; - } - - public OkHttpClient getOkClient() { - return okClient; - } - - public void addAuthsToOkClient(OkHttpClient okClient) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - okClient.interceptors().add(apiAuthorization); - } - } - - /** - * Clones the okClient given in parameter, adds the auth interceptors and uses it to configure the RestAdapter - * @param okClient OkHttp client - */ - public void configureFromOkclient(OkHttpClient okClient) { - OkHttpClient clone = okClient.clone(); - addAuthsToOkClient(clone); - adapterBuilder.setClient(new OkClient(clone)); - } -} - -/** - * This wrapper is to take care of this case: - * when the deserialization fails due to JsonParseException and the - * expected type is String, then just return the body string. - */ -class GsonConverterWrapper implements Converter { - private GsonConverter converter; - - public GsonConverterWrapper(Gson gson) { - converter = new GsonConverter(gson); - } - - @Override public Object fromBody(TypedInput body, Type type) throws ConversionException { - byte[] bodyBytes = readInBytes(body); - TypedByteArray newBody = new TypedByteArray(body.mimeType(), bodyBytes); - try { - return converter.fromBody(newBody, type); - } catch (ConversionException e) { - if (e.getCause() instanceof JsonParseException && type.equals(String.class)) { - return new String(bodyBytes); - } else { - throw e; - } - } - } - - @Override public TypedOutput toBody(Object object) { - return converter.toBody(object); - } - - private byte[] readInBytes(TypedInput body) throws ConversionException { - InputStream in = null; - try { - in = body.in(); - ByteArrayOutputStream os = new ByteArrayOutputStream(); - byte[] buffer = new byte[0xFFFF]; - for (int len; (len = in.read(buffer)) != -1;) - os.write(buffer, 0, len); - os.flush(); - return os.toByteArray(); - } catch (IOException e) { - throw new ConversionException(e); - } finally { - if (in != null) { - try { - in.close(); - } catch (IOException ignored) { - } - } - } - - } -} - -/** - * Gson TypeAdapter for Joda DateTime type - */ -class DateTimeTypeAdapter extends TypeAdapter { - - private final DateTimeFormatter parseFormatter = ISODateTimeFormat.dateOptionalTimeParser(); - private final DateTimeFormatter printFormatter = ISODateTimeFormat.dateTime(); - - @Override - public void write(JsonWriter out, DateTime date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(printFormatter.print(date)); - } - } - - @Override - public DateTime read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - return parseFormatter.parseDateTime(date); - } - } -} - -/** - * Gson TypeAdapter for Joda DateTime type - */ -class LocalDateTypeAdapter extends TypeAdapter { - - private final DateTimeFormatter formatter = ISODateTimeFormat.date(); - - @Override - public void write(JsonWriter out, LocalDate date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.print(date)); - } - } - - @Override - public LocalDate read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - return formatter.parseLocalDate(date); - } - } -} diff --git a/templates/libraries/retrofit/CollectionFormats.mustache b/templates/libraries/retrofit/CollectionFormats.mustache deleted file mode 100644 index dbfa4ae..0000000 --- a/templates/libraries/retrofit/CollectionFormats.mustache +++ /dev/null @@ -1,99 +0,0 @@ -package {{invokerPackage}}; - -import java.util.Arrays; -import java.util.List; - -public class CollectionFormats { - - public static class CSVParams { - - protected List params; - - public CSVParams() { - } - - public CSVParams(List params) { - this.params = params; - } - - public CSVParams(String... params) { - this.params = Arrays.asList(params); - } - - public List getParams() { - return params; - } - - public void setParams(List params) { - this.params = params; - } - - @Override - public String toString() { - return StringUtil.join(params.toArray(new String[0]), ","); - } - - } - - public static class SPACEParams extends SSVParams { - - } - - public static class SSVParams extends CSVParams { - - public SSVParams() { - } - - public SSVParams(List params) { - super(params); - } - - public SSVParams(String... params) { - super(params); - } - - @Override - public String toString() { - return StringUtil.join(params.toArray(new String[0]), " "); - } - } - - public static class TSVParams extends CSVParams { - - public TSVParams() { - } - - public TSVParams(List params) { - super(params); - } - - public TSVParams(String... params) { - super(params); - } - - @Override - public String toString() { - return StringUtil.join( params.toArray(new String[0]), "\t"); - } - } - - public static class PIPESParams extends CSVParams { - - public PIPESParams() { - } - - public PIPESParams(List params) { - super(params); - } - - public PIPESParams(String... params) { - super(params); - } - - @Override - public String toString() { - return StringUtil.join(params.toArray(new String[0]), "|"); - } - } - -} diff --git a/templates/libraries/retrofit/README.mustache b/templates/libraries/retrofit/README.mustache deleted file mode 100644 index c987758..0000000 --- a/templates/libraries/retrofit/README.mustache +++ /dev/null @@ -1,42 +0,0 @@ -# {{artifactId}} - -## Requirements - -Building the API client library requires [Maven](https://maven.apache.org/) to be installed. - -## Installation & Usage - -To install the API client library to your local Maven repository, simply execute: - -```shell -mvn install -``` - -To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: - -```shell -mvn deploy -``` - -Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. - -After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: - -```xml - - {{groupId}} - {{artifactId}} - {{artifactVersion}} - compile - - -``` - -## Recommendation - -It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. - -## Author - -{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} -{{/-last}}{{/apis}}{{/apiInfo}} diff --git a/templates/libraries/retrofit/api.mustache b/templates/libraries/retrofit/api.mustache deleted file mode 100644 index 79e4ff1..0000000 --- a/templates/libraries/retrofit/api.mustache +++ /dev/null @@ -1,74 +0,0 @@ -package {{package}}; - -import {{invokerPackage}}.CollectionFormats.*; - -import retrofit.Callback; -import retrofit.http.*; -import retrofit.mime.*; - -{{#imports}}import {{import}}; -{{/imports}} - -{{^fullJavaUtil}} -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -{{/fullJavaUtil}} - -{{#operations}} -public interface {{classname}} { - {{#operation}} - /** - * {{summary}} - * Sync method - * {{notes}} -{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} -{{/allParams}} - * @return {{returnType}}{{^returnType}}Void{{/returnType}} -{{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation -{{/externalDocs}} -{{#isDeprecated}} - * @deprecated -{{/isDeprecated}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - {{#formParams}}{{#-first}} - {{#isMultipart}}@retrofit.http.Multipart{{/isMultipart}}{{^isMultipart}}@retrofit.http.FormUrlEncoded{{/isMultipart}}{{/-first}}{{/formParams}} - @{{httpMethod}}("{{{path}}}") - {{{returnType}}}{{^returnType}}Void{{/returnType}} {{operationId}}({{^allParams}});{{/allParams}} - {{#allParams}}{{>libraries/retrofit/queryParams}}{{>libraries/retrofit/pathParams}}{{>libraries/retrofit/headerParams}}{{>libraries/retrofit/bodyParams}}{{>libraries/retrofit/formParams}}{{^-last}}, {{/-last}}{{#-last}} - );{{/-last}}{{/allParams}} - - /** - * {{summary}} - * Async method -{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} -{{/allParams}} - * @param cb callback method -{{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation -{{/externalDocs}} -{{#isDeprecated}} - * @deprecated -{{/isDeprecated}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - {{#formParams}}{{#-first}} - {{#isMultipart}}@retrofit.http.Multipart{{/isMultipart}}{{^isMultipart}}@retrofit.http.FormUrlEncoded{{/isMultipart}}{{/-first}}{{/formParams}} - @{{httpMethod}}("{{{path}}}") - void {{operationId}}( - {{#allParams}}{{>libraries/retrofit/queryParams}}{{>libraries/retrofit/pathParams}}{{>libraries/retrofit/headerParams}}{{>libraries/retrofit/bodyParams}}{{>libraries/retrofit/formParams}}, {{/allParams}}Callback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> cb - ); - {{/operation}} -} -{{/operations}} diff --git a/templates/libraries/retrofit/api_test.mustache b/templates/libraries/retrofit/api_test.mustache deleted file mode 100644 index 112d7f7..0000000 --- a/templates/libraries/retrofit/api_test.mustache +++ /dev/null @@ -1,44 +0,0 @@ -package {{package}}; - -import {{invokerPackage}}.ApiClient; -{{#imports}}import {{import}}; -{{/imports}} -import org.junit.Before; -import org.junit.Test; - -{{^fullJavaUtil}} -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -{{/fullJavaUtil}} - -/** - * API tests for {{classname}} - */ -public class {{classname}}Test { - - private {{classname}} api; - - @Before - public void setup() { - api = new ApiClient().createService({{classname}}.class); - } - - {{#operations}}{{#operation}} - /** - * {{summary}} - * - * {{notes}} - */ - @Test - public void {{operationId}}Test() { - {{#allParams}} - {{{dataType}}} {{paramName}} = null; - {{/allParams}} - // {{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); - - // TODO: test validations - } - {{/operation}}{{/operations}} -} diff --git a/templates/libraries/retrofit/auth/ApiKeyAuth.mustache b/templates/libraries/retrofit/auth/ApiKeyAuth.mustache deleted file mode 100644 index 69205bb..0000000 --- a/templates/libraries/retrofit/auth/ApiKeyAuth.mustache +++ /dev/null @@ -1,72 +0,0 @@ -package {{invokerPackage}}.auth; - -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -import com.squareup.okhttp.Interceptor; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.Response; - -public class ApiKeyAuth implements Interceptor { - private final String location; - private final String paramName; - - private String apiKey; - - public ApiKeyAuth(String location, String paramName) { - this.location = location; - this.paramName = paramName; - } - - public String getLocation() { - return location; - } - - public String getParamName() { - return paramName; - } - - public String getApiKey() { - return apiKey; - } - - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } - - @Override - public Response intercept(Chain chain) throws IOException { - String paramValue; - Request request = chain.request(); - - if ("query".equals(location)) { - String newQuery = request.uri().getQuery(); - paramValue = paramName + "=" + apiKey; - if (newQuery == null) { - newQuery = paramValue; - } else { - newQuery += "&" + paramValue; - } - - URI newUri; - try { - newUri = new URI(request.uri().getScheme(), request.uri().getAuthority(), - request.uri().getPath(), newQuery, request.uri().getFragment()); - } catch (URISyntaxException e) { - throw new IOException(e); - } - - request = request.newBuilder().url(newUri.toURL()).build(); - } else if ("header".equals(location)) { - request = request.newBuilder() - .addHeader(paramName, apiKey) - .build(); - } else if ("cookie".equals(location)) { - request = request.newBuilder() - .addHeader("Cookie", String.format("%s=%s", paramName, apiKey)) - .build(); - } - return chain.proceed(request); - } -} diff --git a/templates/libraries/retrofit/auth/HttpBasicAuth.mustache b/templates/libraries/retrofit/auth/HttpBasicAuth.mustache deleted file mode 100644 index cf82b27..0000000 --- a/templates/libraries/retrofit/auth/HttpBasicAuth.mustache +++ /dev/null @@ -1,49 +0,0 @@ -package {{invokerPackage}}.auth; - -import java.io.IOException; - -import com.squareup.okhttp.Credentials; -import com.squareup.okhttp.Interceptor; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.Response; - -public class HttpBasicAuth implements Interceptor { - - private String username; - private String password; - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public void setCredentials(String username, String password) { - this.username = username; - this.password = password; - } - - @Override - public Response intercept(Chain chain) throws IOException { - Request request = chain.request(); - - // If the request already have an authorization (eg. Basic auth), do nothing - if (request.header("Authorization") == null) { - String credentials = Credentials.basic(username, password); - request = request.newBuilder() - .addHeader("Authorization", credentials) - .build(); - } - return chain.proceed(request); - } -} diff --git a/templates/libraries/retrofit/auth/HttpBearerAuth.mustache b/templates/libraries/retrofit/auth/HttpBearerAuth.mustache deleted file mode 100644 index 9b910c4..0000000 --- a/templates/libraries/retrofit/auth/HttpBearerAuth.mustache +++ /dev/null @@ -1,42 +0,0 @@ -package {{invokerPackage}}.auth; - -import java.io.IOException; - -import com.squareup.okhttp.Interceptor; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.Response; - -public class HttpBearerAuth implements Interceptor { - private final String scheme; - private String bearerToken; - - public HttpBearerAuth(String scheme) { - this.scheme = scheme; - } - - public String getBearerToken() { - return bearerToken; - } - - public void setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - } - - @Override - public Response intercept(Chain chain) throws IOException { - Request request = chain.request(); - - // If the request already have an authorization (eg. Basic auth), do nothing - if (request.header("Authorization") == null && bearerToken != null) { - request = request.newBuilder() - .addHeader("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken) - .build(); - } - return chain.proceed(request); - } - - private static String upperCaseBearer(String scheme) { - return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; - } - -} diff --git a/templates/libraries/retrofit/auth/OAuth.mustache b/templates/libraries/retrofit/auth/OAuth.mustache deleted file mode 100644 index 57bfd3d..0000000 --- a/templates/libraries/retrofit/auth/OAuth.mustache +++ /dev/null @@ -1,185 +0,0 @@ -package {{invokerPackage}}.auth; - -import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED; -import static java.net.HttpURLConnection.HTTP_FORBIDDEN; - -import java.io.IOException; -import java.util.Map; - -import org.apache.oltu.oauth2.client.OAuthClient; -import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; -import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; -import org.apache.oltu.oauth2.common.exception.OAuthProblemException; -import org.apache.oltu.oauth2.common.exception.OAuthSystemException; -import org.apache.oltu.oauth2.common.message.types.GrantType; -import org.apache.oltu.oauth2.common.token.BasicOAuthToken; - -import com.squareup.okhttp.Interceptor; -import com.squareup.okhttp.OkHttpClient; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.Request.Builder; -import com.squareup.okhttp.Response; - -public class OAuth implements Interceptor { - - public interface AccessTokenListener { - public void notify(BasicOAuthToken token); - } - - private volatile String accessToken; - private OAuthClient oauthClient; - - private TokenRequestBuilder tokenRequestBuilder; - private AuthenticationRequestBuilder authenticationRequestBuilder; - - private AccessTokenListener accessTokenListener; - - public OAuth( OkHttpClient client, TokenRequestBuilder requestBuilder ) { - this.oauthClient = new OAuthClient(new OAuthOkHttpClient(client)); - this.tokenRequestBuilder = requestBuilder; - } - - public OAuth(TokenRequestBuilder requestBuilder ) { - this(new OkHttpClient(), requestBuilder); - } - - public OAuth(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) { - this(OAuthClientRequest.tokenLocation(tokenUrl).setScope(scopes)); - setFlow(flow); - authenticationRequestBuilder = OAuthClientRequest.authorizationLocation(authorizationUrl); - } - - public void setFlow(OAuthFlow flow) { - switch(flow) { - case accessCode: - case implicit: - tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); - break; - case password: - tokenRequestBuilder.setGrantType(GrantType.PASSWORD); - break; - case application: - tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); - break; - default: - break; - } - } - - @Override - public Response intercept(Chain chain) - throws IOException { - - return retryingIntercept(chain, true); - } - - private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { - Request request = chain.request(); - - // If the request already have an authorization (eg. Basic auth), do nothing - if (request.header("Authorization") != null) { - return chain.proceed(request); - } - - // If first time, get the token - OAuthClientRequest oAuthRequest; - if (getAccessToken() == null) { - updateAccessToken(null); - } - - if (getAccessToken() != null) { - // Build the request - Builder rb = request.newBuilder(); - - String requestAccessToken = new String(getAccessToken()); - try { - oAuthRequest = new OAuthBearerClientRequest(request.urlString()) - .setAccessToken(requestAccessToken) - .buildHeaderMessage(); - } catch (OAuthSystemException e) { - throw new IOException(e); - } - - for ( Map.Entry header : oAuthRequest.getHeaders().entrySet() ) { - rb.addHeader(header.getKey(), header.getValue()); - } - rb.url( oAuthRequest.getLocationUri()); - - //Execute the request - Response response = chain.proceed(rb.build()); - - // 401/403 most likely indicates that access token has expired. Unless it happens two times in a row. - if ( response != null && (response.code() == HTTP_UNAUTHORIZED || response.code() == HTTP_FORBIDDEN) && updateTokenAndRetryOnAuthorizationFailure ) { - try { - if (updateAccessToken(requestAccessToken)) { - response.body().close(); - return retryingIntercept( chain, false ); - } - } catch (Exception e) { - response.body().close(); - throw e; - } - } - return response; - } else { - return chain.proceed(chain.request()); - } - } - - /* - * Returns true if the access token has been updated - */ - public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { - if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { - try { - OAuthJSONAccessTokenResponse accessTokenResponse = oauthClient.accessToken(this.tokenRequestBuilder.buildBodyMessage()); - if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { - setAccessToken(accessTokenResponse.getAccessToken()); - if (accessTokenListener != null) { - accessTokenListener.notify((BasicOAuthToken) accessTokenResponse.getOAuthToken()); - } - return !getAccessToken().equals(requestAccessToken); - } else { - return false; - } - } catch (OAuthSystemException e) { - throw new IOException(e); - } catch (OAuthProblemException e) { - throw new IOException(e); - } - } - return true; - } - - public void registerAccessTokenListener(AccessTokenListener accessTokenListener) { - this.accessTokenListener = accessTokenListener; - } - - public synchronized String getAccessToken() { - return accessToken; - } - - public synchronized void setAccessToken(String accessToken) { - this.accessToken = accessToken; - } - - public TokenRequestBuilder getTokenRequestBuilder() { - return tokenRequestBuilder; - } - - public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { - this.tokenRequestBuilder = tokenRequestBuilder; - } - - public AuthenticationRequestBuilder getAuthenticationRequestBuilder() { - return authenticationRequestBuilder; - } - - public void setAuthenticationRequestBuilder(AuthenticationRequestBuilder authenticationRequestBuilder) { - this.authenticationRequestBuilder = authenticationRequestBuilder; - } - -} diff --git a/templates/libraries/retrofit/auth/OAuthOkHttpClient.mustache b/templates/libraries/retrofit/auth/OAuthOkHttpClient.mustache deleted file mode 100644 index 48fc7ea..0000000 --- a/templates/libraries/retrofit/auth/OAuthOkHttpClient.mustache +++ /dev/null @@ -1,69 +0,0 @@ -package {{invokerPackage}}.auth; - -import java.io.IOException; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.oltu.oauth2.client.HttpClient; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest; -import org.apache.oltu.oauth2.client.response.OAuthClientResponse; -import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; -import org.apache.oltu.oauth2.common.exception.OAuthProblemException; -import org.apache.oltu.oauth2.common.exception.OAuthSystemException; - -import com.squareup.okhttp.MediaType; -import com.squareup.okhttp.OkHttpClient; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.RequestBody; -import com.squareup.okhttp.Response; - - -public class OAuthOkHttpClient implements HttpClient { - - private OkHttpClient client; - - public OAuthOkHttpClient() { - this.client = new OkHttpClient(); - } - - public OAuthOkHttpClient(OkHttpClient client) { - this.client = client; - } - - public T execute(OAuthClientRequest request, Map headers, - String requestMethod, Class responseClass) - throws OAuthSystemException, OAuthProblemException { - - MediaType mediaType = MediaType.parse("application/json"); - Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); - - if(headers != null) { - for (Entry entry : headers.entrySet()) { - if (entry.getKey().equalsIgnoreCase("Content-Type")) { - mediaType = MediaType.parse(entry.getValue()); - } else { - requestBuilder.addHeader(entry.getKey(), entry.getValue()); - } - } - } - - RequestBody body = request.getBody() != null ? RequestBody.create(mediaType, request.getBody()) : null; - requestBuilder.method(requestMethod, body); - - try { - Response response = client.newCall(requestBuilder.build()).execute(); - return OAuthClientResponseFactory.createCustomResponse( - response.body().string(), - response.body().contentType().toString(), - response.code(), - responseClass); - } catch (IOException e) { - throw new OAuthSystemException(e); - } - } - - public void shutdown() { - // Nothing to do here - } - -} diff --git a/templates/libraries/retrofit/bodyParams.mustache b/templates/libraries/retrofit/bodyParams.mustache deleted file mode 100644 index 81de324..0000000 --- a/templates/libraries/retrofit/bodyParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isBodyParam}}@retrofit.http.Body {{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/templates/libraries/retrofit/build.gradle.mustache b/templates/libraries/retrofit/build.gradle.mustache deleted file mode 100644 index 1266cde..0000000 --- a/templates/libraries/retrofit/build.gradle.mustache +++ /dev/null @@ -1,130 +0,0 @@ -apply plugin: 'idea' -apply plugin: 'eclipse' - -group = '{{groupId}}' -version = '{{artifactVersion}}' - -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:2.3.+' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' - } -} - -repositories { - mavenCentral() -} - - -if(hasProperty('target') && target == 'android') { - - apply plugin: 'com.android.library' - apply plugin: 'com.github.dcendents.android-maven' - - android { - compileSdkVersion 25 - buildToolsVersion '25.0.2' - defaultConfig { - minSdkVersion 14 - targetSdkVersion 25 - } - compileOptions { - {{#java8}} - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - {{/java8}} - {{^java8}} - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - {{/java8}} - } - - // Rename the aar correctly - libraryVariants.all { variant -> - variant.outputs.each { output -> - def outputFile = output.outputFile - if (outputFile != null && outputFile.name.endsWith('.aar')) { - def fileName = "${project.name}-${variant.baseName}-${version}.aar" - output.outputFile = new File(outputFile.parent, fileName) - } - } - } - - dependencies { - provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - } - } - - afterEvaluate { - android.libraryVariants.all { variant -> - def task = project.tasks.create "jar${variant.name.capitalize()}", Jar - task.description = "Create jar artifact for ${variant.name}" - task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - task.destinationDir = project.file("${project.buildDir}/outputs/jar") - task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" - artifacts.add('archives', task); - } - } - - task sourcesJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier = 'sources' - } - - artifacts { - archives sourcesJar - } - -} else { - - apply plugin: 'java' - apply plugin: 'maven-publish' - - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 - - publishing { - publications { - maven(MavenPublication) { - artifactId = '{{artifactId}}' - from components.java - } - } - } - - task execute(type:JavaExec) { - main = System.getProperty('mainClass') - classpath = sourceSets.main.runtimeClasspath - } -} - -ext { - okhttp_version = "2.7.5" - oltu_version = "1.0.1" - retrofit_version = "1.9.0" - swagger_annotations_version = "1.5.21" - jakarta_annotation_version = "1.3.5" - junit_version = "4.13.1" - jodatime_version = "2.9.3" - {{#threetenbp}} - threetenbp_version = "1.4.0" - {{/threetenbp}} -} - -dependencies { - implementation "com.squareup.okhttp:okhttp:$okhttp_version" - implementation "com.google.code.findbugs:jsr305:3.0.2" - implementation "com.squareup.retrofit:retrofit:$retrofit_version" - implementation "io.swagger:swagger-annotations:$swagger_annotations_version" - implementation "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version" - implementation "joda-time:joda-time:$jodatime_version" - {{#threetenbp}} - implementation "org.threeten:threetenbp:$threetenbp_version" - {{/threetenbp}} - implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation "junit:junit:$junit_version" -} diff --git a/templates/libraries/retrofit/build.sbt.mustache b/templates/libraries/retrofit/build.sbt.mustache deleted file mode 100644 index b279317..0000000 --- a/templates/libraries/retrofit/build.sbt.mustache +++ /dev/null @@ -1,24 +0,0 @@ -lazy val root = (project in file(".")). - settings( - organization := "{{groupId}}", - name := "{{artifactId}}", - version := "{{artifactVersion}}", - scalaVersion := "2.11.4", - scalacOptions ++= Seq("-feature"), - javacOptions in compile ++= Seq("-Xlint:deprecation"), - publishArtifact in (Compile, packageDoc) := false, - resolvers += Resolver.mavenLocal, - libraryDependencies ++= Seq( - "com.squareup.okhttp" % "okhttp" % "2.7.5" % "compile", - "com.squareup.retrofit" % "retrofit" % "1.9.0" % "compile", - "io.swagger" % "swagger-annotations" % "1.5.21" % "compile", - "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", - "joda-time" % "joda-time" % "2.9.3" % "compile", - {{#threetenbp}} - "org.threeten" % "threetenbp" % "1.4.0" % "compile", - {{/threetenbp}} - "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "junit" % "junit" % "4.13.1" % "test", - "com.novocode" % "junit-interface" % "0.10" % "test" - ) - ) diff --git a/templates/libraries/retrofit/formParams.mustache b/templates/libraries/retrofit/formParams.mustache deleted file mode 100644 index 851072b..0000000 --- a/templates/libraries/retrofit/formParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isFormParam}}{{^isFile}}{{#isMultipart}}@retrofit.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit.http.Field{{/isMultipart}}("{{baseName}}") {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}{{#isMultipart}}@retrofit.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit.http.Field{{/isMultipart}}("{{baseName}}") TypedFile {{paramName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/templates/libraries/retrofit/headerParams.mustache b/templates/libraries/retrofit/headerParams.mustache deleted file mode 100644 index 5d6da4a..0000000 --- a/templates/libraries/retrofit/headerParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isHeaderParam}}@retrofit.http.Header("{{baseName}}") {{{dataType}}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/templates/libraries/retrofit/pathParams.mustache b/templates/libraries/retrofit/pathParams.mustache deleted file mode 100644 index 7b8be84..0000000 --- a/templates/libraries/retrofit/pathParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isPathParam}}@retrofit.http.Path("{{baseName}}") {{{dataType}}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/templates/libraries/retrofit/queryParams.mustache b/templates/libraries/retrofit/queryParams.mustache deleted file mode 100644 index 2a580ab..0000000 --- a/templates/libraries/retrofit/queryParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isQueryParam}}@retrofit.http.Query("{{baseName}}") {{#collectionFormat}}{{#isCollectionFormatMulti}}{{{dataType}}}{{/isCollectionFormatMulti}}{{^isCollectionFormatMulti}}{{{collectionFormat.toUpperCase}}}Params{{/isCollectionFormatMulti}}{{/collectionFormat}}{{^collectionFormat}}{{{dataType}}}{{/collectionFormat}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/templates/libraries/retrofit2/ApiClient.mustache b/templates/libraries/retrofit2/ApiClient.mustache index 57c9772..077e8d6 100644 --- a/templates/libraries/retrofit2/ApiClient.mustache +++ b/templates/libraries/retrofit2/ApiClient.mustache @@ -1,8 +1,12 @@ +{{>licenseInfo}} + package {{invokerPackage}}; +{{#gson}} import com.google.gson.Gson; import com.google.gson.JsonParseException; import com.google.gson.JsonElement; +{{/gson}} import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.RequestBody; @@ -14,18 +18,20 @@ import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuil {{#joda}} import org.joda.time.format.DateTimeFormatter; {{/joda}} -{{#threetenbp}} -import org.threeten.bp.format.DateTimeFormatter; -{{/threetenbp}} import retrofit2.Converter; import retrofit2.Retrofit; {{#useRxJava2}} import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; {{/useRxJava2}} {{#useRxJava3}} -import hu.akarnokd.rxjava3.retrofit.RxJava3CallAdapterFactory; +import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory; {{/useRxJava3}} +{{#gson}} import retrofit2.converter.gson.GsonConverterFactory; +{{/gson}} +{{#jackson}} +import retrofit2.converter.jackson.JacksonConverterFactory; +{{/jackson}} import retrofit2.converter.scalars.ScalarsConverterFactory; import {{invokerPackage}}.auth.HttpBasicAuth; import {{invokerPackage}}.auth.HttpBearerAuth; @@ -40,9 +46,7 @@ import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.text.DateFormat; -{{#java8}} import java.time.format.DateTimeFormatter; -{{/java8}} import java.util.LinkedHashMap; import java.util.Map; import java.util.HashMap; @@ -71,24 +75,25 @@ public class ApiClient { this(); for(String authName : authNames) { {{#hasAuthMethods}} - Interceptor auth; + Interceptor auth = null; {{#authMethods}}if ("{{name}}".equals(authName)) { - {{#isBasic}}{{#isBasicBasic}} + {{#isBasicBasic}} auth = new HttpBasicAuth(); - {{/isBasicBasic}}{{^isBasicBasic}} + {{/isBasicBasic}}{{#isBasicBearer}} auth = new HttpBearerAuth("{{scheme}}"); - {{/isBasicBasic}}{{/isBasic}} + {{/isBasicBearer}} {{#isApiKey}} auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"); {{/isApiKey}} {{#isOAuth}} - auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}"); + auth = new OAuth(OAuthFlow.{{#lambda.uppercase}}{{#lambda.snakecase}}{{flow}}{{/lambda.snakecase}}{{/lambda.uppercase}}, "{{{authorizationUrl}}}", "{{{tokenUrl}}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}"); {{/isOAuth}} } else {{/authMethods}}{ throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } - - addAuthorization(authName, auth); + if (auth != null) { + addAuthorization(authName, auth); + } {{/hasAuthMethods}} {{^hasAuthMethods}} throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); @@ -161,7 +166,12 @@ public class ApiClient { .addCallAdapterFactory(RxJava3CallAdapterFactory.create()) {{/useRxJava3}} .addConverterFactory(ScalarsConverterFactory.create()) + {{#jackson}} + .addConverterFactory(JacksonConverterFactory.create(json.getMapper())); + {{/jackson}} + {{#gson}} .addConverterFactory(GsonCustomConverterFactory.create(json.getGson())); + {{/gson}} } public S createService(Class serviceClass) { @@ -177,6 +187,7 @@ public class ApiClient { return this; } + {{#gson}} public ApiClient setSqlDateFormat(DateFormat dateFormat) { this.json.setSqlDateFormat(dateFormat); return this; @@ -204,8 +215,9 @@ public class ApiClient { this.json.setLocalDateFormat(dateFormat); return this; } - {{/jsr310}} + {{/gson}} + /** * Helper method to configure the first api key found @@ -405,6 +417,7 @@ public class ApiClient { } } +{{#gson}} /** * This wrapper is to take care of this case: * when the deserialization fails due to JsonParseException and the @@ -459,3 +472,4 @@ class GsonCustomConverterFactory extends Converter.Factory return gsonConverterFactory.requestBodyConverter(type, parameterAnnotations, methodAnnotations, retrofit); } } +{{/gson}} \ No newline at end of file diff --git a/templates/libraries/retrofit2/CollectionFormats.mustache b/templates/libraries/retrofit2/CollectionFormats.mustache index dbfa4ae..d63c8a8 100644 --- a/templates/libraries/retrofit2/CollectionFormats.mustache +++ b/templates/libraries/retrofit2/CollectionFormats.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import java.util.Arrays; diff --git a/templates/libraries/retrofit2/JSON.mustache b/templates/libraries/retrofit2/JSON.mustache index 9ba7567..2ff8b1c 100644 --- a/templates/libraries/retrofit2/JSON.mustache +++ b/templates/libraries/retrofit2/JSON.mustache @@ -19,11 +19,6 @@ import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatterBuilder; import org.joda.time.format.ISODateTimeFormat; {{/joda}} -{{#threetenbp}} -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; -{{/threetenbp}} {{#models.0}} import {{modelPackage}}.*; @@ -35,11 +30,9 @@ import java.lang.reflect.Type; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; -{{#java8}} import java.time.LocalDate; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; -{{/java8}} import java.util.Date; import java.util.Locale; import java.util.Map; diff --git a/templates/libraries/retrofit2/JSON_jackson.mustache b/templates/libraries/retrofit2/JSON_jackson.mustache new file mode 100644 index 0000000..525fe5d --- /dev/null +++ b/templates/libraries/retrofit2/JSON_jackson.mustache @@ -0,0 +1,263 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; +{{#openApiNullable}} +import org.openapitools.jackson.nullable.JsonNullableModule; +{{/openApiNullable}} +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +{{#joda}} +import com.fasterxml.jackson.datatype.joda.JodaModule; +{{/joda}} +{{#models.0}} +import {{modelPackage}}.*; +{{/models.0}} + +import java.text.DateFormat; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import {{javaxPackage}}.ws.rs.core.GenericType; +import {{javaxPackage}}.ws.rs.ext.ContextResolver; + +{{>generatedAnnotation}} +public class JSON implements ContextResolver { + private ObjectMapper mapper; + + public JSON() { + mapper = JsonMapper.builder() + .serializationInclusion(JsonInclude.Include.NON_NULL) + .configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false) + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true) + .configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) + .enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING) + .defaultDateFormat(new RFC3339DateFormat()) + .addModule(new JavaTimeModule()) + {{#joda}} + .addModule(new JodaModule()) + {{/joda}} + {{#openApiNullable}} + .addModule(new JsonNullableModule()) + {{/openApiNullable}} + .build(); + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + * @param dateFormat Date format + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + @Override + public ObjectMapper getContext(Class type) { + return mapper; + } + + /** + * Get the object mapper + * + * @return object mapper + */ + public ObjectMapper getMapper() { return mapper; } + + /** + * Returns the target model class that should be used to deserialize the input data. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param modelClass The class that contains the discriminator mappings. + */ + public static Class getClassForElement(JsonNode node, Class modelClass) { + ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); + if (cdm != null) { + return cdm.getClassForElement(node, new HashSet<>()); + } + return null; + } + + /** + * Helper class to register the discriminator mappings. + */ + private static class ClassDiscriminatorMapping { + // The model class name. + Class modelClass; + // The name of the discriminator property. + String discriminatorName; + // The discriminator mappings for a model class. + Map> discriminatorMappings; + + // Constructs a new class discriminator. + ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { + modelClass = cls; + discriminatorName = propertyName; + discriminatorMappings = new HashMap<>(); + if (mappings != null) { + discriminatorMappings.putAll(mappings); + } + } + + // Return the name of the discriminator property for this model class. + String getDiscriminatorPropertyName() { + return discriminatorName; + } + + // Return the discriminator value or null if the discriminator is not + // present in the payload. + String getDiscriminatorValue(JsonNode node) { + // Determine the value of the discriminator property in the input data. + if (discriminatorName != null) { + // Get the value of the discriminator property, if present in the input payload. + node = node.get(discriminatorName); + if (node != null && node.isValueNode()) { + String discrValue = node.asText(); + if (discrValue != null) { + return discrValue; + } + } + } + return null; + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * This function can be invoked for anyOf/oneOf composed models with discriminator mappings. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param visitedClasses The set of classes that have already been visited. + */ + Class getClassForElement(JsonNode node, Set> visitedClasses) { + if (visitedClasses.contains(modelClass)) { + // Class has already been visited. + return null; + } + // Determine the value of the discriminator property in the input data. + String discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + return null; + } + Class cls = discriminatorMappings.get(discrValue); + // It may not be sufficient to return this cls directly because that target class + // may itself be a composed schema, possibly with its own discriminator. + visitedClasses.add(modelClass); + for (Class childClass : discriminatorMappings.values()) { + ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass); + if (childCdm == null) { + continue; + } + if (!discriminatorName.equals(childCdm.discriminatorName)) { + discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + continue; + } + } + if (childCdm != null) { + // Recursively traverse the discriminator mappings. + Class childDiscr = childCdm.getClassForElement(node, visitedClasses); + if (childDiscr != null) { + return childDiscr; + } + } + } + return cls; + } + } + + /** + * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy. + * + * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy, + * so it's not possible to use the instanceof keyword. + * + * @param modelClass A OpenAPI model class. + * @param inst The instance object. + */ + public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { + if (modelClass.isInstance(inst)) { + // This handles the 'allOf' use case with single parent inheritance. + return true; + } + if (visitedClasses.contains(modelClass)) { + // This is to prevent infinite recursion when the composed schemas have + // a circular dependency. + return false; + } + visitedClasses.add(modelClass); + + // Traverse the oneOf/anyOf composed schemas. + Map descendants = modelDescendants.get(modelClass); + if (descendants != null) { + for (GenericType childType : descendants.values()) { + if (isInstanceOf(childType.getRawType(), inst, visitedClasses)) { + return true; + } + } + } + return false; + } + + /** + * A map of discriminators for all model classes. + */ + private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<>(); + + /** + * A map of oneOf/anyOf descendants for each model class. + */ + private static Map, Map> modelDescendants = new HashMap<>(); + + /** + * Register a model class discriminator. + * + * @param modelClass the model class + * @param discriminatorPropertyName the name of the discriminator property + * @param mappings a map with the discriminator mappings. + */ + public static void registerDiscriminator(Class modelClass, String discriminatorPropertyName, Map> mappings) { + ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings); + modelDiscriminators.put(modelClass, m); + } + + /** + * Register the oneOf/anyOf descendants of the modelClass. + * + * @param modelClass the model class + * @param descendants a map of oneOf/anyOf descendants. + */ + public static void registerDescendants(Class modelClass, Map descendants) { + modelDescendants.put(modelClass, descendants); + } + + private static JSON json; + + static + { + json = new JSON(); + } + + /** + * Get the default JSON instance. + * + * @return the default JSON instance + */ + public static JSON getDefault() { + return json; + } + + /** + * Set the default JSON instance. + * + * @param json JSON instance to be used + */ + public static void setDefault(JSON json) { + JSON.json = json; + } +} diff --git a/templates/libraries/retrofit2/api.mustache b/templates/libraries/retrofit2/api.mustache index 82c3fe0..dd521a5 100644 --- a/templates/libraries/retrofit2/api.mustache +++ b/templates/libraries/retrofit2/api.mustache @@ -28,13 +28,17 @@ import okhttp3.MultipartBody; {{#imports}}import {{import}}; {{/imports}} -{{^fullJavaUtil}} import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} +import java.util.Set; +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} {{#operations}} public interface {{classname}} { {{#operation}} diff --git a/templates/libraries/retrofit2/api_test.mustache b/templates/libraries/retrofit2/api_test.mustache index 3f60dd1..dab62f3 100644 --- a/templates/libraries/retrofit2/api_test.mustache +++ b/templates/libraries/retrofit2/api_test.mustache @@ -3,16 +3,22 @@ package {{package}}; import {{invokerPackage}}.ApiClient; {{#imports}}import {{import}}; {{/imports}} -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -{{^fullJavaUtil}} +import java.time.LocalDate; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} /** * API tests for {{classname}} */ @@ -20,7 +26,7 @@ public class {{classname}}Test { private {{classname}} api; - @Before + @BeforeEach public void setup() { api = new ApiClient().createService({{classname}}.class); } diff --git a/templates/libraries/retrofit2/auth/ApiKeyAuth.mustache b/templates/libraries/retrofit2/auth/ApiKeyAuth.mustache index bcc62b2..d87c2e4 100644 --- a/templates/libraries/retrofit2/auth/ApiKeyAuth.mustache +++ b/templates/libraries/retrofit2/auth/ApiKeyAuth.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import java.io.IOException; diff --git a/templates/libraries/retrofit2/auth/HttpBasicAuth.mustache b/templates/libraries/retrofit2/auth/HttpBasicAuth.mustache index 9bd756e..ac03476 100644 --- a/templates/libraries/retrofit2/auth/HttpBasicAuth.mustache +++ b/templates/libraries/retrofit2/auth/HttpBasicAuth.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import java.io.IOException; diff --git a/templates/libraries/retrofit2/auth/HttpBearerAuth.mustache b/templates/libraries/retrofit2/auth/HttpBearerAuth.mustache index da1bef5..764c8f2 100644 --- a/templates/libraries/retrofit2/auth/HttpBearerAuth.mustache +++ b/templates/libraries/retrofit2/auth/HttpBearerAuth.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import java.io.IOException; diff --git a/templates/libraries/retrofit2/auth/OAuth.mustache b/templates/libraries/retrofit2/auth/OAuth.mustache index 88e4e62..6ea77b7 100644 --- a/templates/libraries/retrofit2/auth/OAuth.mustache +++ b/templates/libraries/retrofit2/auth/OAuth.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED; @@ -54,14 +56,14 @@ public class OAuth implements Interceptor { public void setFlow(OAuthFlow flow) { switch(flow) { - case accessCode: - case implicit: + case ACCESS_CODE: + case IMPLICIT: tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); break; - case password: + case PASSWORD: tokenRequestBuilder.setGrantType(GrantType.PASSWORD); break; - case application: + case APPLICATION: tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); break; default: diff --git a/templates/libraries/retrofit2/auth/OAuthOkHttpClient.mustache b/templates/libraries/retrofit2/auth/OAuthOkHttpClient.mustache index a499c7b..5fe0131 100644 --- a/templates/libraries/retrofit2/auth/OAuthOkHttpClient.mustache +++ b/templates/libraries/retrofit2/auth/OAuthOkHttpClient.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import java.io.IOException; diff --git a/templates/libraries/retrofit2/build.gradle.mustache b/templates/libraries/retrofit2/build.gradle.mustache index a5c716b..407e97a 100644 --- a/templates/libraries/retrofit2/build.gradle.mustache +++ b/templates/libraries/retrofit2/build.gradle.mustache @@ -32,14 +32,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 - {{/java8}} - {{^java8}} - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - {{/java8}} } // Rename the aar correctly @@ -63,9 +57,9 @@ if(hasProperty('target') && target == 'android') { def task = project.tasks.create "jar${variant.name.capitalize()}", Jar task.description = "Create jar artifact for ${variant.name}" task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - task.destinationDir = project.file("${project.buildDir}/outputs/jar") - task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + task.from variant.javaCompile.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" artifacts.add('archives', task); } } @@ -84,14 +78,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven-publish' - {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - {{/java8}} - {{^java8}} - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 - {{/java8}} publishing { publications { @@ -110,18 +98,21 @@ if(hasProperty('target') && target == 'android') { ext { oltu_version = "1.0.1" - retrofit_version = "2.3.0" + retrofit_version = "2.11.0" + {{#jackson}} + jackson_version = "2.17.1" + jackson_databind_version = "2.17.1" + javax_ws_rs_api_version = "2.1.1" + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.6" + {{/openApiNullable}} + {{/jackson}} {{#usePlayWS}} - jackson_version = "2.10.5" - jackson_databind_version = "2.10.5.1" - {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.2" - {{/openApiNullable}} - jakarta_annotation_version = "1.3.5" play_version = "2.6.7" {{/usePlayWS}} + jakarta_annotation_version = "1.3.5" swagger_annotations_version = "1.5.22" - junit_version = "4.13.1" + junit_version = "5.10.3" {{#useRxJava2}} rx_java_version = "2.1.1" {{/useRxJava2}} @@ -131,10 +122,7 @@ ext { {{#joda}} jodatime_version = "2.9.9" {{/joda}} - {{#threetenbp}} - threetenbp_version = "1.4.0" - {{/threetenbp}} - json_fire_version = "1.8.0" + json_fire_version = "1.9.0" } dependencies { @@ -146,7 +134,7 @@ dependencies { implementation "io.reactivex.rxjava2:rxjava:$rx_java_version" {{/useRxJava2}} {{#useRxJava3}} - implementation 'com.github.akarnokd:rxjava3-retrofit-adapter:3.0.0' + implementation 'com.squareup.retrofit2:adapter-rxjava3:$$retrofit_version' implementation "io.reactivex.rxjava3:rxjava:$rx_java_version" {{/useRxJava3}} implementation "io.swagger:swagger-annotations:$swagger_annotations_version" @@ -158,21 +146,21 @@ dependencies { {{#joda}} implementation "joda-time:joda-time:$jodatime_version" {{/joda}} - {{#threetenbp}} - implementation "org.threeten:threetenbp:$threetenbp_version" - {{/threetenbp}} {{#usePlayWS}} implementation "com.typesafe.play:play-ahc-ws_2.12:$play_version" - implementation "jakarta.validation:jakarta.validation-api:2.0.2" + {{/usePlayWS}} + {{#jackson}} + implementation "jakarta.validation:jakarta.validation-api:3.0.2" implementation "com.squareup.retrofit2:converter-jackson:$retrofit_version" implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" + implementation "javax.ws.rs:javax.ws.rs-api:$javax_ws_rs_api_version" {{#openApiNullable}} implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" {{/openApiNullable}} - implementation "com.fasterxml.jackson.datatype:jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}:$jackson_version" - {{/usePlayWS}} + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + {{/jackson}} implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation "junit:junit:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" } diff --git a/templates/libraries/retrofit2/build.sbt.mustache b/templates/libraries/retrofit2/build.sbt.mustache index a572f4b..03b8653 100644 --- a/templates/libraries/retrofit2/build.sbt.mustache +++ b/templates/libraries/retrofit2/build.sbt.mustache @@ -9,25 +9,25 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "com.squareup.retrofit2" % "retrofit" % "2.3.0" % "compile", - "com.squareup.retrofit2" % "converter-scalars" % "2.3.0" % "compile", + "com.squareup.retrofit2" % "retrofit" % "2.11.0" % "compile", + "com.squareup.retrofit2" % "converter-scalars" % "2.11.0" % "compile", {{^usePlayWS}} - "com.squareup.retrofit2" % "converter-gson" % "2.3.0" % "compile", + "com.squareup.retrofit2" % "converter-gson" % "2.11.0" % "compile", {{/usePlayWS}} {{#usePlayWS}} "com.typesafe.play" % "play-ahc-ws_2.12" % "2.6.7" % "compile", - "jakarta.validation" % "jakarta.validation-api" % "2.0.2" % "compile", - "com.squareup.retrofit2" % "converter-jackson" % "2.3.0" % "compile", - "com.fasterxml.jackson.core" % "jackson-core" % "2.10.5" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.5" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.5.1" % "compile", + "jakarta.validation" % "jakarta.validation-api" % "3.0.2" % "compile", + "com.squareup.retrofit2" % "converter-jackson" % "2.11.0" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.17.1" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.17.1" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.17.1" % "compile", {{/usePlayWS}} {{#useRxJava2}} - "com.squareup.retrofit2" % "adapter-rxjava2" % "2.3.0" % "compile", + "com.squareup.retrofit2" % "adapter-rxjava2" % "2.11.0" % "compile", "io.reactivex.rxjava2" % "rxjava" % "2.1.1" % "compile", {{/useRxJava2}} {{#useRxJava3}} - "com.github.akarnokd" % "rxjava3-retrofit-adapter" % "3.0.0" % "compile", + "com.squareup.retrofit2" % "adapter-rxjava3" % "2.11.0" % "compile", "io.reactivex.rxjava3" % "rxjava" % "3.0.4" % "compile", {{/useRxJava3}} "io.swagger" % "swagger-annotations" % "1.5.21" % "compile", @@ -35,12 +35,9 @@ lazy val root = (project in file(".")). {{#joda}} "joda-time" % "joda-time" % "2.9.9" % "compile", {{/joda}} - {{#threetenbp}} - "org.threeten" % "threetenbp" % "1.4.0" % "compile", - {{/threetenbp}} - "io.gsonfire" % "gson-fire" % "1.8.0" % "compile", + "io.gsonfire" % "gson-fire" % "1.9.0" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "junit" % "junit" % "4.13.1" % "test", + "org.junit.jupiter" % "junit-jupiter-api" % "5.10.3" % "test", "com.novocode" % "junit-interface" % "0.11" % "test" ) ) diff --git a/templates/libraries/retrofit2/play24/ApiClient.mustache b/templates/libraries/retrofit2/play24/ApiClient.mustache index c43f800..78e3f85 100644 --- a/templates/libraries/retrofit2/play24/ApiClient.mustache +++ b/templates/libraries/retrofit2/play24/ApiClient.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import java.io.IOException; @@ -45,8 +47,8 @@ public class ApiClient { public ApiClient() { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap<>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - // authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} - // authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} + // authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}} + // authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} // authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} // Prevent the authentications from being modified. diff --git a/templates/libraries/retrofit2/play24/Play24CallAdapterFactory.mustache b/templates/libraries/retrofit2/play24/Play24CallAdapterFactory.mustache index d9ed333..d6411f2 100644 --- a/templates/libraries/retrofit2/play24/Play24CallAdapterFactory.mustache +++ b/templates/libraries/retrofit2/play24/Play24CallAdapterFactory.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import play.libs.F; diff --git a/templates/libraries/retrofit2/play24/Play24CallFactory.mustache b/templates/libraries/retrofit2/play24/Play24CallFactory.mustache index b17ac64..2808f26 100644 --- a/templates/libraries/retrofit2/play24/Play24CallFactory.mustache +++ b/templates/libraries/retrofit2/play24/Play24CallFactory.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import okhttp3.*; diff --git a/templates/libraries/retrofit2/play24/api.mustache b/templates/libraries/retrofit2/play24/api.mustache index 2b7512d..f793699 100644 --- a/templates/libraries/retrofit2/play24/api.mustache +++ b/templates/libraries/retrofit2/play24/api.mustache @@ -14,12 +14,10 @@ import okhttp3.MultipartBody; {{#imports}}import {{import}}; {{/imports}} -{{^fullJavaUtil}} import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} import play.libs.F; import retrofit2.Response; diff --git a/templates/libraries/retrofit2/play25/ApiClient.mustache b/templates/libraries/retrofit2/play25/ApiClient.mustache index 849e066..22d48bd 100644 --- a/templates/libraries/retrofit2/play25/ApiClient.mustache +++ b/templates/libraries/retrofit2/play25/ApiClient.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import java.io.IOException; @@ -44,8 +46,8 @@ public class ApiClient { public ApiClient() { // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap<>();{{#authMethods}}{{#isBasic}} - // authentications.put("{{name}}", new HttpBasicAuth());{{/isBasic}}{{#isApiKey}} + authentications = new HashMap<>();{{#authMethods}}{{#isBasicBasic}} + // authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isApiKey}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"query"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} // authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} // Prevent the authentications from being modified. diff --git a/templates/libraries/retrofit2/play25/Play25CallAdapterFactory.mustache b/templates/libraries/retrofit2/play25/Play25CallAdapterFactory.mustache index 62360bf..b431690 100644 --- a/templates/libraries/retrofit2/play25/Play25CallAdapterFactory.mustache +++ b/templates/libraries/retrofit2/play25/Play25CallAdapterFactory.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import java.util.concurrent.CompletionStage; diff --git a/templates/libraries/retrofit2/play25/Play25CallFactory.mustache b/templates/libraries/retrofit2/play25/Play25CallFactory.mustache index a9f1947..d7d27d2 100644 --- a/templates/libraries/retrofit2/play25/Play25CallFactory.mustache +++ b/templates/libraries/retrofit2/play25/Play25CallFactory.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import okhttp3.*; diff --git a/templates/libraries/retrofit2/play25/api.mustache b/templates/libraries/retrofit2/play25/api.mustache index d4e97cc..de6a6f6 100644 --- a/templates/libraries/retrofit2/play25/api.mustache +++ b/templates/libraries/retrofit2/play25/api.mustache @@ -14,12 +14,10 @@ import okhttp3.MultipartBody; {{#imports}}import {{import}}; {{/imports}} -{{^fullJavaUtil}} import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} import java.util.concurrent.*; import retrofit2.Response; diff --git a/templates/libraries/retrofit2/play26/ApiClient.mustache b/templates/libraries/retrofit2/play26/ApiClient.mustache index b752b43..ef1b75d 100644 --- a/templates/libraries/retrofit2/play26/ApiClient.mustache +++ b/templates/libraries/retrofit2/play26/ApiClient.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import java.io.File; @@ -59,8 +61,8 @@ public class ApiClient { public ApiClient() { // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap<>();{{#authMethods}}{{#isBasic}} - // authentications.put("{{name}}", new HttpBasicAuth());{{/isBasic}}{{#isApiKey}} + authentications = new HashMap<>();{{#authMethods}}{{#isBasicBasic}} + // authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isApiKey}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} // authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} // Prevent the authentications from being modified. diff --git a/templates/libraries/retrofit2/play26/Play26CallAdapterFactory.mustache b/templates/libraries/retrofit2/play26/Play26CallAdapterFactory.mustache index 05c7254..2b7739f 100644 --- a/templates/libraries/retrofit2/play26/Play26CallAdapterFactory.mustache +++ b/templates/libraries/retrofit2/play26/Play26CallAdapterFactory.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import java.util.concurrent.CompletionStage; diff --git a/templates/libraries/retrofit2/play26/Play26CallFactory.mustache b/templates/libraries/retrofit2/play26/Play26CallFactory.mustache index f65c921..c309dee 100644 --- a/templates/libraries/retrofit2/play26/Play26CallFactory.mustache +++ b/templates/libraries/retrofit2/play26/Play26CallFactory.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import okhttp3.*; diff --git a/templates/libraries/retrofit2/play26/api.mustache b/templates/libraries/retrofit2/play26/api.mustache index dd3339f..e78bd98 100644 --- a/templates/libraries/retrofit2/play26/api.mustache +++ b/templates/libraries/retrofit2/play26/api.mustache @@ -17,12 +17,15 @@ import okhttp3.MultipartBody; {{#imports}}import {{import}}; {{/imports}} -{{^fullJavaUtil}} +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; +{{/useBeanValidation}} + import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} import java.util.concurrent.*; import retrofit2.Response; diff --git a/templates/libraries/retrofit2/pom.mustache b/templates/libraries/retrofit2/pom.mustache index 5c00061..b02a5fb 100644 --- a/templates/libraries/retrofit2/pom.mustache +++ b/templates/libraries/retrofit2/pom.mustache @@ -65,12 +65,12 @@ maven-surefire-plugin 2.12 - + loggerPath conf/log4j.properties - + -Xms512m -Xmx1500m methods pertest @@ -144,28 +144,17 @@ maven-compiler-plugin 3.6.1 - {{#java8}} 1.8 1.8 - {{/java8}} - {{^java8}} - 1.7 - 1.7 - {{/java8}} org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.2 none - {{#java8}} - 1.8 - {{/java8}} - {{^java8}} - 1.7 - {{/java8}} + 1.8 @@ -228,11 +217,13 @@ jsr305 3.0.2 + {{#gson}} com.squareup.retrofit2 converter-gson ${retrofit-version} + {{/gson}} com.squareup.retrofit2 retrofit @@ -254,11 +245,13 @@ + {{#gson}} io.gsonfire gson-fire ${gson-fire-version} + {{/gson}} {{#joda}} joda-time @@ -266,13 +259,6 @@ ${jodatime-version} {{/joda}} - {{#threetenbp}} - - org.threeten - threetenbp - ${threetenbp-version} - - {{/threetenbp}} {{#useRxJava2}} io.reactivex.rxjava2 @@ -292,12 +278,12 @@ ${rxjava-version} - com.github.akarnokd - rxjava3-retrofit-adapter - 3.0.0 + com.squareup.retrofit2 + adapter-rxjava3 + ${retrofit-version} {{/useRxJava3}} - {{#usePlayWS}} + {{#jackson}} com.squareup.retrofit2 @@ -317,7 +303,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} {{#openApiNullable}} @@ -328,7 +314,7 @@ {{/openApiNullable}} com.fasterxml.jackson.datatype - jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}} + jackson-datatype-jsr310 ${jackson-version} {{#withXml}} @@ -339,6 +325,20 @@ ${jackson-version} {{/withXml}} + {{#useBeanValidation}} + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + + {{/useBeanValidation}} + + javax.ws.rs + javax.ws.rs-api + ${javax.ws.rs-api-version} + + {{/jackson}} + {{#usePlayWS}} com.typesafe.play play-ahc-ws_2.12 @@ -367,27 +367,33 @@ - junit - junit + org.junit.jupiter + junit-jupiter-api ${junit-version} test UTF-8 - {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} + 1.8 ${java.version} ${java.version} - 1.8.3 + {{#gson}} + 1.9.0 + {{/gson}} 1.6.3 + {{#jackson}} + 2.17.1 + 2.17.1 + {{#openApiNullable}} + 0.2.6 + {{/openApiNullable}} + 2.1.1 + {{/jackson}} {{#usePlayWS}} - 2.12.1 2.6.7 - {{#openApiNullable}} - 0.2.2 - {{/openApiNullable}} {{/usePlayWS}} - 2.5.0 + 2.11.0 {{#useRxJava2}} 2.1.1 {{/useRxJava2}} @@ -397,14 +403,16 @@ {{#joda}} 2.9.9 {{/joda}} - {{#threetenbp}} - 1.4.0 - {{/threetenbp}} + {{#useJakartaEe}} + 2.1.1 + {{/useJakartaEe}} + {{^useJakartaEe}} 1.3.5 -{{#useBeanValidation}} - 2.0.2 -{{/useBeanValidation}} + {{/useJakartaEe}} + {{#useBeanValidation}} + 3.0.2 + {{/useBeanValidation}} 1.0.1 - 4.13.1 + 5.10.3 diff --git a/templates/libraries/vertx/ApiClient.mustache b/templates/libraries/vertx/ApiClient.mustache index b3668e9..6607107 100644 --- a/templates/libraries/vertx/ApiClient.mustache +++ b/templates/libraries/vertx/ApiClient.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import {{invokerPackage}}.auth.Authentication; @@ -34,12 +36,7 @@ import io.vertx.ext.web.client.WebClient; import io.vertx.ext.web.client.WebClientOptions; {{#jsr310}} -{{#threetenbp}} -import org.threeten.bp.OffsetDateTime; -{{/threetenbp}} -{{^threetenbp}} import java.time.OffsetDateTime; -{{/threetenbp}} {{/jsr310}} import java.text.DateFormat; import java.util.*; @@ -98,8 +95,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { // Setup authentications (key: authentication name, value: authentication). this.authentications = new HashMap<>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} - authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} + authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}} + authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} // Prevent the authentications from being modified. @@ -685,54 +682,54 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { private final Map authentications = new LinkedHashMap<>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - public void add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String username, String password) { + public void add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(String username, String password) { HttpBasicAuth auth = new HttpBasicAuth(); auth.setUsername(username); auth.setPassword(password); authentications.put("{{name}}", auth); - }{{/isBasicBasic}}{{^isBasicBasic}} + }{{/isBasicBasic}}{{#isBasicBearer}} - public void add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String bearerToken) { + public void add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(String bearerToken) { HttpBearerAuth auth = new HttpBearerAuth("{{scheme}}"); auth.setBearerToken(bearerToken); authentications.put("{{name}}", auth); - }{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} + }{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} - public void add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String apikey, String apiKeyPrefix) { + public void add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(String apikey, String apiKeyPrefix) { ApiKeyAuth auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}},"{{keyParamName}}"); auth.setApiKey(apikey); auth.setApiKeyPrefix(apiKeyPrefix); authentications.put("{{name}}", auth); }{{/isApiKey}}{{#isOAuth}} - public void add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String accessToken) { + public void add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(String accessToken) { OAuth auth = new OAuth(); auth.setAccessToken(accessToken); authentications.put("{{name}}", auth); }{{/isOAuth}}{{/authMethods}}{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - public static AuthInfo for{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}(String username, String password) { + public static AuthInfo for{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}(String username, String password) { AuthInfo authInfo = new AuthInfo(); - authInfo.add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(username, password); + authInfo.add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(username, password); return authInfo; - }{{/isBasicBasic}}{{^isBasicBasic}} + }{{/isBasicBasic}}{{#isBasicBearer}} - public static AuthInfo for{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String bearerToken) { + public static AuthInfo for{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(String bearerToken) { AuthInfo authInfo = new AuthInfo(); - authInfo.add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(bearerToken); + authInfo.add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(bearerToken); return authInfo; - }{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} + }{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} - public static AuthInfo for{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String apikey, String apiKeyPrefix) { + public static AuthInfo for{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(String apikey, String apiKeyPrefix) { AuthInfo authInfo = new AuthInfo(); - authInfo.add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(apikey, apiKeyPrefix); + authInfo.add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(apikey, apiKeyPrefix); return authInfo; }{{/isApiKey}}{{#isOAuth}} - public static AuthInfo for{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String accessToken) { + public static AuthInfo for{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(String accessToken) { AuthInfo authInfo = new AuthInfo(); - authInfo.add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(accessToken); + authInfo.add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(accessToken); return authInfo; }{{/isOAuth}}{{/authMethods}} } diff --git a/templates/libraries/vertx/Configuration.mustache b/templates/libraries/vertx/Configuration.mustache index 17710ae..5f26ea8 100644 --- a/templates/libraries/vertx/Configuration.mustache +++ b/templates/libraries/vertx/Configuration.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import io.vertx.core.Vertx; @@ -6,6 +8,7 @@ import io.vertx.core.json.JsonObject; import java.util.Objects; public class Configuration { + public static final String VERSION = "{{{artifactVersion}}}"; private static ApiClient defaultApiClient = null; diff --git a/templates/libraries/vertx/apiException.mustache b/templates/libraries/vertx/apiException.mustache index 6e9bbdb..9ce8101 100644 --- a/templates/libraries/vertx/apiException.mustache +++ b/templates/libraries/vertx/apiException.mustache @@ -8,6 +8,8 @@ import io.vertx.core.MultiMap; {{>generatedAnnotation}} public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ + private static final long serialVersionUID = 1L; + private int code = 0; private MultiMap responseHeaders = null; private String responseBody = null; diff --git a/templates/libraries/vertx/api_test.mustache b/templates/libraries/vertx/api_test.mustache index 5eb2ec7..1469d11 100644 --- a/templates/libraries/vertx/api_test.mustache +++ b/templates/libraries/vertx/api_test.mustache @@ -6,11 +6,10 @@ package {{package}}; import {{invokerPackage}}.Configuration; -import org.junit.Test; -import org.junit.Ignore; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import io.vertx.core.AsyncResult; import io.vertx.core.Handler; @@ -21,34 +20,28 @@ import io.vertx.ext.unit.junit.RunTestOnContext; import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.Async; -{{^fullJavaUtil}} +import java.time.LocalDate; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} /** * API tests for {{classname}} */ -@RunWith(VertxUnitRunner.class) -@Ignore +@Disabled public class {{classname}}Test { private {{classname}} api; - @Rule - public RunTestOnContext rule = new RunTestOnContext(); - - @BeforeClass + @BeforeAll public void setupApiClient() { - JsonObject config = new JsonObject(); - Vertx vertx = rule.vertx(); - Configuration.setupDefaultApiClient(vertx, config); - api = new {{classname}}Impl(); } - {{#operations}}{{#operation}} + + {{#operations}} + {{#operation}} /** * {{summary}} * {{notes}} @@ -66,5 +59,6 @@ public class {{classname}}Test { async.complete(); }); } - {{/operation}}{{/operations}} + {{/operation}} + {{/operations}} } diff --git a/templates/libraries/vertx/build.gradle.mustache b/templates/libraries/vertx/build.gradle.mustache index bc33a07..0e8fd59 100644 --- a/templates/libraries/vertx/build.gradle.mustache +++ b/templates/libraries/vertx/build.gradle.mustache @@ -30,17 +30,14 @@ task execute(type:JavaExec) { ext { swagger_annotations_version = "1.5.21" - jackson_version = "2.10.5" - jackson_databind_version = "2.10.5.1" - vertx_version = "3.4.2" - junit_version = "4.13.1" + jackson_version = "2.17.1" + jackson_databind_version = "2.17.1" + vertx_version = "3.5.2" + junit_version = "5.10.3" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.2" + jackson_databind_nullable_version = "0.2.6" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" - {{#threetenbp}} - jackson_threeten_version = "2.9.10" - {{/threetenbp}} } dependencies { @@ -54,16 +51,11 @@ dependencies { {{#joda}} implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" {{/joda}} - {{#java8}} implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" - {{/java8}} - {{#threetenbp}} - implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:jackson_threeten_version" - {{/threetenbp}} {{#openApiNullable}} implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" {{/openApiNullable}} implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation "junit:junit:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" testImplementation "io.vertx:vertx-unit:$vertx_version" } diff --git a/templates/libraries/vertx/pom.mustache b/templates/libraries/vertx/pom.mustache index 2306edb..b9b44cd 100644 --- a/templates/libraries/vertx/pom.mustache +++ b/templates/libraries/vertx/pom.mustache @@ -65,12 +65,12 @@ maven-surefire-plugin 2.12 - + loggerPath conf/log4j.properties - + -Xms512m -Xmx1500m methods pertest @@ -151,15 +151,10 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.2 none - {{#java8}} - 1.8 - {{/java8}} - {{^java8}} - 1.7 - {{/java8}} + 1.8 @@ -211,11 +206,20 @@ + {{#swagger1AnnotationLibrary}} io.swagger swagger-annotations ${swagger-annotations-version} + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + + io.swagger.core.v3 + swagger-annotations + ${swagger-annotations-version} + + {{/swagger2AnnotationLibrary}} @@ -266,20 +270,11 @@ ${jackson-version} {{/joda}} - {{#java8}} com.fasterxml.jackson.datatype jackson-datatype-jsr310 ${jackson-version} - {{/java8}} - {{#threetenbp}} - - com.github.joschi.jackson - jackson-datatype-threetenbp - 2.9.10 - - {{/threetenbp}} jakarta.annotation jakarta.annotation-api @@ -289,8 +284,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-api ${junit-version} test @@ -304,12 +299,22 @@ UTF-8 - 3.4.2 - 1.5.22 - 2.10.5 - 2.10.5.1 - 0.2.2 + 3.5.2 + {{#swagger1AnnotationLibrary}} + 1.6.6 + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + 2.2.15 + {{/swagger2AnnotationLibrary}} + 2.17.1 + 2.17.1 + 0.2.6 + {{#useJakartaEe}} + 2.1.1 + {{/useJakartaEe}} + {{^useJakartaEe}} 1.3.5 - 4.13.1 + {{/useJakartaEe}} + 5.10.3 diff --git a/templates/libraries/webclient/ApiClient.mustache b/templates/libraries/webclient/ApiClient.mustache index 2fa35f5..9072a88 100644 --- a/templates/libraries/webclient/ApiClient.mustache +++ b/templates/libraries/webclient/ApiClient.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import com.fasterxml.jackson.databind.DeserializationFeature; @@ -6,8 +8,6 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; {{#openApiNullable}} import org.openapitools.jackson.nullable.JsonNullableModule; {{/openApiNullable}} -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -45,7 +45,6 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.text.DateFormat; @@ -62,15 +61,10 @@ import java.util.Map; import java.util.Map.Entry; import java.util.TimeZone; -import javax.annotation.Nullable; +import {{javaxPackage}}.annotation.Nullable; {{#jsr310}} -{{#threetenbp}} -import org.threeten.bp.OffsetDateTime; -{{/threetenbp}} -{{^threetenbp}} import java.time.OffsetDateTime; -{{/threetenbp}} {{/jsr310}} import {{invokerPackage}}.auth.Authentication; @@ -160,8 +154,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { protected void init() { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} - authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} + authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}} + authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} // Prevent the authentications from being modified. @@ -522,7 +516,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * @return boolean true if the MediaType represents JSON, false otherwise */ public boolean isJsonMime(MediaType mediaType) { - return mediaType != null && (MediaType.APPLICATION_JSON.isCompatibleWith(mediaType) || mediaType.getSubtype().matches("^.*\\+json[;]?\\s*$")); + return mediaType != null && (MediaType.APPLICATION_JSON.isCompatibleWith(mediaType) || mediaType.getSubtype().matches("^.*(\\+json|ndjson)[;]?\\s*$")); } /** diff --git a/templates/libraries/webclient/api.mustache b/templates/libraries/webclient/api.mustache index 166a4fb..65600db 100644 --- a/templates/libraries/webclient/api.mustache +++ b/templates/libraries/webclient/api.mustache @@ -4,15 +4,18 @@ import {{invokerPackage}}.ApiClient; {{#imports}}import {{import}}; {{/imports}} -{{^fullJavaUtil}} import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.stream.Collectors; -{{/fullJavaUtil}} +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; @@ -94,11 +97,10 @@ public class {{classname}} { final MultiValueMap formParams = new LinkedMultiValueMap(); {{#hasQueryParams}} - {{#queryParams}} - queryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{.}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}})); - {{/queryParams}} - {{/hasQueryParams}} - {{#hasHeaderParams}} + {{#queryParams}}{{#isExplode}}{{#hasVars}}{{#vars}}queryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{.}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}}.{{getter}}())); + {{/vars}}{{/hasVars}}{{^hasVars}}queryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{.}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}})); + {{/hasVars}}{{/isExplode}}{{^isExplode}}queryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{.}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}})); + {{/isExplode}}{{/queryParams}}{{/hasQueryParams}}{{#hasHeaderParams}} {{#headerParams}} if ({{paramName}} != null) @@ -131,7 +133,7 @@ public class {{classname}} { String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; - {{#returnType}}ParameterizedTypeReference<{{#isArray}}{{{returnBaseType}}}{{/isArray}}{{^isArray}}{{{returnType}}}{{/isArray}}> localVarReturnType = new ParameterizedTypeReference<{{#isArray}}{{{returnBaseType}}}{{/isArray}}{{^isArray}}{{{returnType}}}{{/isArray}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};{{/returnType}} + {{#returnType}}ParameterizedTypeReference<{{#vendorExtensions.x-webclient-return-except-list-of-string}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnBaseType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnBaseType}}}{{/isResponseFile}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}> localVarReturnType = new ParameterizedTypeReference<{{#vendorExtensions.x-webclient-return-except-list-of-string}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnBaseType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnBaseType}}}{{/isResponseFile}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};{{/returnType}} return apiClient.invokeAPI("{{{path}}}", HttpMethod.{{httpMethod}}, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } @@ -147,14 +149,43 @@ public class {{classname}} { * @see {{summary}} Documentation {{/externalDocs}} */ - public {{#returnType}}{{#isArray}}Flux<{{{returnBaseType}}}>{{/isArray}}{{^isArray}}Mono<{{{returnType}}}>{{/isArray}} {{/returnType}}{{^returnType}}Mono {{/returnType}}{{operationId}}({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws WebClientResponseException { - {{#returnType}}ParameterizedTypeReference<{{#isArray}}{{{returnBaseType}}}{{/isArray}}{{^isArray}}{{{returnType}}}{{/isArray}}> localVarReturnType = new ParameterizedTypeReference<{{#isArray}}{{{returnBaseType}}}{{/isArray}}{{^isArray}}{{{returnType}}}{{/isArray}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};{{/returnType}} - return {{operationId}}RequestCreation({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).{{#isArray}}bodyToFlux{{/isArray}}{{^isArray}}bodyToMono{{/isArray}}(localVarReturnType); + public {{#returnType}}{{#vendorExtensions.x-webclient-blocking}}{{#vendorExtensions.x-webclient-return-except-list-of-string}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}<{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnBaseType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnBaseType}}}{{/isResponseFile}}>{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{/vendorExtensions.x-webclient-blocking}}{{^vendorExtensions.x-webclient-blocking}}{{#vendorExtensions.x-webclient-return-except-list-of-string}}Flux<{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnBaseType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnBaseType}}}{{/isResponseFile}}>{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}Mono<{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}>{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{/vendorExtensions.x-webclient-blocking}} {{/returnType}}{{^returnType}}{{#vendorExtensions.x-webclient-blocking}}void{{/vendorExtensions.x-webclient-blocking}}{{^vendorExtensions.x-webclient-blocking}}Mono{{/vendorExtensions.x-webclient-blocking}} {{/returnType}}{{operationId}}({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws WebClientResponseException { + {{#returnType}}ParameterizedTypeReference<{{#vendorExtensions.x-webclient-return-except-list-of-string}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnBaseType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnBaseType}}}{{/isResponseFile}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}> localVarReturnType = new ParameterizedTypeReference<{{#vendorExtensions.x-webclient-return-except-list-of-string}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnBaseType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnBaseType}}}{{/isResponseFile}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};{{/returnType}} + {{^returnType}}{{^vendorExtensions.x-webclient-blocking}}return {{/vendorExtensions.x-webclient-blocking}}{{/returnType}}{{#returnType}}return {{/returnType}}{{operationId}}RequestCreation({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).{{#vendorExtensions.x-webclient-return-except-list-of-string}}bodyToFlux{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}bodyToMono{{/vendorExtensions.x-webclient-return-except-list-of-string}}(localVarReturnType){{#vendorExtensions.x-webclient-blocking}}{{#vendorExtensions.x-webclient-return-except-list-of-string}}{{#uniqueItems}}.collect(Collectors.toSet()){{/uniqueItems}}{{^uniqueItems}}.collectList(){{/uniqueItems}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}.block(){{/vendorExtensions.x-webclient-blocking}}; + } + + /** + * {{summary}} + * {{notes}} +{{#responses}} *

{{code}}{{#message}} - {{.}}{{/message}} +{{/responses}}{{#allParams}} * @param {{paramName}} {{description}}{{^description}}The {{paramName}} parameter{{/description}} +{{/allParams}}{{#returnType}} * @return ResponseEntity<{{.}}> +{{/returnType}} * @throws WebClientResponseException if an error occurs while attempting to invoke the API +{{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation +{{/externalDocs}} + */ + public {{#vendorExtensions.x-webclient-blocking}}{{#returnType}}{{#vendorExtensions.x-webclient-return-except-list-of-string}}ResponseEntity>{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}ResponseEntity<{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}>{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{/returnType}}{{^returnType}}ResponseEntity{{/returnType}} {{/vendorExtensions.x-webclient-blocking}}{{^vendorExtensions.x-webclient-blocking}}{{#returnType}}{{#vendorExtensions.x-webclient-return-except-list-of-string}}Mono>>{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}Mono>{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{/returnType}}{{^returnType}}Mono>{{/returnType}} {{/vendorExtensions.x-webclient-blocking}}{{operationId}}WithHttpInfo({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws WebClientResponseException { + {{#returnType}}ParameterizedTypeReference<{{#vendorExtensions.x-webclient-return-except-list-of-string}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnBaseType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnBaseType}}}{{/isResponseFile}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}> localVarReturnType = new ParameterizedTypeReference<{{#vendorExtensions.x-webclient-return-except-list-of-string}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnBaseType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnBaseType}}}{{/isResponseFile}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};{{/returnType}} + return {{operationId}}RequestCreation({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).{{#vendorExtensions.x-webclient-return-except-list-of-string}}toEntityList{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}toEntity{{/vendorExtensions.x-webclient-return-except-list-of-string}}(localVarReturnType){{#vendorExtensions.x-webclient-blocking}}.block(){{/vendorExtensions.x-webclient-blocking}}; } - public {{#returnType}}{{#isArray}}Mono>>{{/isArray}}{{^isArray}}Mono>{{/isArray}} {{/returnType}}{{^returnType}}Mono> {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws WebClientResponseException { - {{#returnType}}ParameterizedTypeReference<{{#isArray}}{{{returnBaseType}}}{{/isArray}}{{^isArray}}{{{returnType}}}{{/isArray}}> localVarReturnType = new ParameterizedTypeReference<{{#isArray}}{{{returnBaseType}}}{{/isArray}}{{^isArray}}{{{returnType}}}{{/isArray}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};{{/returnType}} - return {{operationId}}RequestCreation({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).{{#isArray}}toEntityList{{/isArray}}{{^isArray}}toEntity{{/isArray}}(localVarReturnType); + /** + * {{summary}} + * {{notes}} +{{#responses}} *

{{code}}{{#message}} - {{.}}{{/message}} +{{/responses}}{{#allParams}} * @param {{paramName}} {{description}}{{^description}}The {{paramName}} parameter{{/description}} +{{/allParams}} + * @return ResponseSpec + * @throws WebClientResponseException if an error occurs while attempting to invoke the API +{{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation +{{/externalDocs}} + */ + public ResponseSpec {{operationId}}WithResponseSpec({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws WebClientResponseException { + return {{operationId}}RequestCreation({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); } {{/operation}} } diff --git a/templates/libraries/webclient/api_test.mustache b/templates/libraries/webclient/api_test.mustache index b9aea53..c5d5686 100644 --- a/templates/libraries/webclient/api_test.mustache +++ b/templates/libraries/webclient/api_test.mustache @@ -4,21 +4,25 @@ package {{package}}; {{#imports}}import {{import}}; {{/imports}} -import org.junit.Test; -import org.junit.Ignore; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -{{^fullJavaUtil}} import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -{{/fullJavaUtil}} +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +{{/useBeanValidation}} /** * API tests for {{classname}} */ -@Ignore +@Disabled public class {{classname}}Test { private final {{classname}} api = new {{classname}}(); @@ -31,10 +35,11 @@ public class {{classname}}Test { */ @Test public void {{operationId}}Test() { + // uncomment below to test the function {{#allParams}} - {{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}} = null; + //{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}} = null; {{/allParams}} - {{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){{#isArray}}{{#uniqueItems}}.collect(Collectors.toSet()){{/uniqueItems}}{{^uniqueItems}}.collectList(){{/uniqueItems}}.block(){{/isArray}}{{^isArray}}.block(){{/isArray}}; + //{{#returnType}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{.}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{.}}}{{/isResponseFile}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){{^vendorExtensions.x-webclient-blocking}}{{#vendorExtensions.x-webclient-return-except-list-of-string}}{{#uniqueItems}}.collect(Collectors.toSet()){{/uniqueItems}}{{^uniqueItems}}.collectList(){{/uniqueItems}}.block(){{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}.block(){{/vendorExtensions.x-webclient-return-except-list-of-string}}{{/vendorExtensions.x-webclient-blocking}}; // TODO: test validations } diff --git a/templates/libraries/webclient/auth/ApiKeyAuth.mustache b/templates/libraries/webclient/auth/ApiKeyAuth.mustache index 857403b..d329303 100644 --- a/templates/libraries/webclient/auth/ApiKeyAuth.mustache +++ b/templates/libraries/webclient/auth/ApiKeyAuth.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import org.springframework.http.HttpHeaders; diff --git a/templates/libraries/webclient/auth/Authentication.mustache b/templates/libraries/webclient/auth/Authentication.mustache index 8e53c2b..0636a6d 100644 --- a/templates/libraries/webclient/auth/Authentication.mustache +++ b/templates/libraries/webclient/auth/Authentication.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import org.springframework.http.HttpHeaders; diff --git a/templates/libraries/webclient/auth/HttpBasicAuth.mustache b/templates/libraries/webclient/auth/HttpBasicAuth.mustache index 5b07cb9..fba1265 100644 --- a/templates/libraries/webclient/auth/HttpBasicAuth.mustache +++ b/templates/libraries/webclient/auth/HttpBasicAuth.mustache @@ -1,10 +1,11 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; -import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; +import java.util.Base64; import org.springframework.http.HttpHeaders; -import org.springframework.util.Base64Utils; import org.springframework.util.MultiValueMap; {{>generatedAnnotation}} @@ -34,6 +35,6 @@ public class HttpBasicAuth implements Authentication { return; } String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); - headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString(str.getBytes(StandardCharsets.UTF_8))); + headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); } } diff --git a/templates/libraries/webclient/auth/HttpBearerAuth.mustache b/templates/libraries/webclient/auth/HttpBearerAuth.mustache index 027c128..45931f9 100644 --- a/templates/libraries/webclient/auth/HttpBearerAuth.mustache +++ b/templates/libraries/webclient/auth/HttpBearerAuth.mustache @@ -1,10 +1,8 @@ -package {{invokerPackage}}.auth; +{{>licenseInfo}} -import java.io.UnsupportedEncodingException; -import java.nio.charset.StandardCharsets; +package {{invokerPackage}}.auth; import org.springframework.http.HttpHeaders; -import org.springframework.util.Base64Utils; import org.springframework.util.MultiValueMap; {{>generatedAnnotation}} diff --git a/templates/libraries/webclient/auth/OAuth.mustache b/templates/libraries/webclient/auth/OAuth.mustache index 7889f15..1e1e624 100644 --- a/templates/libraries/webclient/auth/OAuth.mustache +++ b/templates/libraries/webclient/auth/OAuth.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import org.springframework.http.HttpHeaders; diff --git a/templates/libraries/webclient/auth/OAuthFlow.mustache b/templates/libraries/webclient/auth/OAuthFlow.mustache index 7ab35f6..759f354 100644 --- a/templates/libraries/webclient/auth/OAuthFlow.mustache +++ b/templates/libraries/webclient/auth/OAuthFlow.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; public enum OAuthFlow { diff --git a/templates/libraries/webclient/build.gradle.mustache b/templates/libraries/webclient/build.gradle.mustache index 8481b94..5974116 100644 --- a/templates/libraries/webclient/build.gradle.mustache +++ b/templates/libraries/webclient/build.gradle.mustache @@ -32,14 +32,14 @@ if(hasProperty('target') && target == 'android') { } compileOptions { - {{#java8}} + {{#useJakartaEe}} + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + {{/useJakartaEe}} + {{^useJakartaEe}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 - {{/java8}} - {{^java8}} - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - {{/java8}} + {{/useJakartaEe}} } // Rename the aar correctly @@ -63,16 +63,16 @@ if(hasProperty('target') && target == 'android') { def task = project.tasks.create "jar${variant.name.capitalize()}", Jar task.description = "Create jar artifact for ${variant.name}" task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - task.destinationDir = project.file("${project.buildDir}/outputs/jar") - task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + task.from variant.javaCompile.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" artifacts.add('archives', task); } } task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs - classifier = 'sources' + archiveClassifier = 'sources' } artifacts { @@ -84,14 +84,14 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven-publish' - {{#java8}} + {{#useJakartaEe}} + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + {{/useJakartaEe}} + {{^useJakartaEe}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - {{/java8}} - {{^java8}} - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 - {{/java8}} + {{/useJakartaEe}} publishing { publications { @@ -103,17 +103,17 @@ if(hasProperty('target') && target == 'android') { } task execute(type:JavaExec) { - main = System.getProperty('mainClass') + mainClass = System.getProperty('mainClass') classpath = sourceSets.main.runtimeClasspath } task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' + archiveClassifier = 'sources' from sourceSets.main.allSource } task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' + archiveClassifier = 'javadoc' from javadoc.destinationDir } @@ -124,26 +124,46 @@ if(hasProperty('target') && target == 'android') { } ext { + {{#swagger1AnnotationLibrary}} swagger_annotations_version = "1.6.3" - spring_web_version = "2.4.3" - jackson_version = "2.11.4" - jackson_databind_version = "2.11.4" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + swagger_annotations_version = "2.2.9" + {{/swagger2AnnotationLibrary}} + {{#useJakartaEe}} + spring_boot_version = "3.0.12" + jakarta_annotation_version = "2.1.1" + reactor_version = "3.5.12" + reactor_netty_version = "1.1.13" + {{/useJakartaEe}} + {{^useJakartaEe}} + spring_boot_version = "2.7.17" + jakarta_annotation_version = "1.3.5" + reactor_version = "3.4.34" + reactor_netty_version = "1.0.39" + {{/useJakartaEe}} + jackson_version = "2.17.1" + jackson_databind_version = "2.17.1" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.2" + jackson_databind_nullable_version = "0.2.6" {{/openApiNullable}} - jakarta_annotation_version = "1.3.5" - reactor_version = "3.4.3" - reactor_netty_version = "0.7.15.RELEASE" + {{#joda}} jodatime_version = "2.9.9" - junit_version = "4.13.1" + {{/joda}} + junit_version = "5.10.2" } dependencies { + {{#swagger1AnnotationLibrary}} implementation "io.swagger:swagger-annotations:$swagger_annotations_version" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version" + {{/swagger2AnnotationLibrary}} implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "io.projectreactor:reactor-core:$reactor_version" - implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_web_version" - implementation "io.projectreactor.ipc:reactor-netty:$reactor_netty_version" + implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_boot_version" + implementation "io.projectreactor.netty:reactor-netty-http:$reactor_netty_version" implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" @@ -154,12 +174,7 @@ dependencies { {{#joda}} implementation "joda-time:joda-time:$jodatime_version" {{/joda}} - {{#java8}} implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" - {{/java8}} - {{^java8}} - implementation "com.brsanthu:migbase64:2.2" - {{/java8}} implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation "junit:junit:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" } diff --git a/templates/libraries/webclient/pom.mustache b/templates/libraries/webclient/pom.mustache index b5e01df..4180b2d 100644 --- a/templates/libraries/webclient/pom.mustache +++ b/templates/libraries/webclient/pom.mustache @@ -43,16 +43,22 @@ org.apache.maven.plugins maven-compiler-plugin - 3.6.1 + 3.13.0 + {{#useJakartaEe}} + 17 + 17 + {{/useJakartaEe}} + {{^useJakartaEe}} 1.8 1.8 + {{/useJakartaEe}} org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.3.1 attach-sources @@ -66,11 +72,20 @@ + {{#swagger1AnnotationLibrary}} io.swagger swagger-annotations ${swagger-annotations-version} + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + + io.swagger.core.v3 + swagger-annotations + ${swagger-annotations-version} + + {{/swagger2AnnotationLibrary}} @@ -89,12 +104,12 @@ org.springframework.boot spring-boot-starter-webflux - ${spring-web-version} + ${spring-boot-version} - io.projectreactor.ipc - reactor-netty + io.projectreactor.netty + reactor-netty-http ${reactor-netty-version} @@ -112,13 +127,11 @@ {{/openApiNullable}} - {{#java8}} com.fasterxml.jackson.datatype jackson-datatype-jsr310 ${jackson-version} - {{/java8}} {{#joda}} com.fasterxml.jackson.datatype @@ -140,25 +153,38 @@ - junit - junit + org.junit.jupiter + junit-jupiter-api ${junit-version} test UTF-8 - 1.6.3 - 2.4.3 - 2.11.3 - 2.11.4 + {{#swagger1AnnotationLibrary}} + 1.6.6 + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + 2.2.15 + {{/swagger2AnnotationLibrary}} + 2.17.1 + 2.17.1 {{#openApiNullable}} - 0.2.2 + 0.2.6 {{/openApiNullable}} + {{#useJakartaEe}} + 3.0.12 + 2.1.1 + 3.5.12 + 1.1.13 + {{/useJakartaEe}} + {{^useJakartaEe}} + 2.7.17 1.3.5 - 4.13.1 - 3.4.3 - 0.7.15.RELEASE + 3.4.34 + 1.0.39 + {{/useJakartaEe}} + 5.10.2 {{#joda}} 2.9.9 {{/joda}} diff --git a/templates/maven.yml.mustache b/templates/maven.yml.mustache new file mode 100644 index 0000000..69ad415 --- /dev/null +++ b/templates/maven.yml.mustache @@ -0,0 +1,31 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build {{{appName}}} + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + {{=< >=}} + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/templates/model.mustache b/templates/model.mustache index 0c4d165..b504167 100644 --- a/templates/model.mustache +++ b/templates/model.mustache @@ -25,21 +25,23 @@ import com.fasterxml.jackson.annotation.JsonCreator; {{/vendorExtensions.x-has-readonly-properties}} {{/jackson}} {{#withXml}} -import javax.xml.bind.annotation.*; +import {{javaxPackage}}.xml.bind.annotation.*; +import {{javaxPackage}}.xml.bind.annotation.adapters.*; +import io.github.threetenjaxb.core.*; {{/withXml}} {{#jsonb}} import java.lang.reflect.Type; -import javax.json.bind.annotation.JsonbTypeDeserializer; -import javax.json.bind.annotation.JsonbTypeSerializer; -import javax.json.bind.serializer.DeserializationContext; -import javax.json.bind.serializer.JsonbDeserializer; -import javax.json.bind.serializer.JsonbSerializer; -import javax.json.bind.serializer.SerializationContext; -import javax.json.stream.JsonGenerator; -import javax.json.stream.JsonParser; -import javax.json.bind.annotation.JsonbProperty; +import {{javaxPackage}}.json.bind.annotation.JsonbTypeDeserializer; +import {{javaxPackage}}.json.bind.annotation.JsonbTypeSerializer; +import {{javaxPackage}}.json.bind.serializer.DeserializationContext; +import {{javaxPackage}}.json.bind.serializer.JsonbDeserializer; +import {{javaxPackage}}.json.bind.serializer.JsonbSerializer; +import {{javaxPackage}}.json.bind.serializer.SerializationContext; +import {{javaxPackage}}.json.stream.JsonGenerator; +import {{javaxPackage}}.json.stream.JsonParser; +import {{javaxPackage}}.json.bind.annotation.JsonbProperty; {{#vendorExtensions.x-has-readonly-properties}} -import javax.json.bind.annotation.JsonbCreator; +import {{javaxPackage}}.json.bind.annotation.JsonbCreator; {{/vendorExtensions.x-has-readonly-properties}} {{/jsonb}} {{#parcelableModel}} @@ -47,12 +49,17 @@ import android.os.Parcelable; import android.os.Parcel; {{/parcelableModel}} {{#useBeanValidation}} -import javax.validation.constraints.*; -import javax.validation.Valid; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; {{/useBeanValidation}} {{#performBeanValidation}} import org.hibernate.validator.constraints.*; {{/performBeanValidation}} +{{#supportUrlQuery}} +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.StringJoiner; +{{/supportUrlQuery}} {{#models}} {{#model}} diff --git a/templates/modelEnum.mustache b/templates/modelEnum.mustache index f81c7c9..d1ba359 100644 --- a/templates/modelEnum.mustache +++ b/templates/modelEnum.mustache @@ -9,6 +9,9 @@ import com.google.gson.annotations.JsonAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; {{/gson}} +{{#isUri}} +import java.net.URI; +{{/isUri}} /** * {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}} @@ -56,28 +59,29 @@ import com.google.gson.stream.JsonWriter; {{/jackson}} public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) { for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { - if (b.value.equals(value)) { + if (b.value.{{^isString}}equals{{/isString}}{{#isString}}{{#useEnumCaseInsensitive}}equalsIgnoreCase{{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}equals{{/useEnumCaseInsensitive}}{{/isString}}(value)) { return b; } } - {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/isNullable}} + {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}return {{{name}}};{{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/enumUnknownDefaultCase}}{{/isNullable}} } {{#gson}} public static class Adapter extends TypeAdapter<{{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}> { @Override public void write(final JsonWriter jsonWriter, final {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); + jsonWriter.value(enumeration.getValue(){{#isUri}}.toASCIIString(){{/isUri}}); } @Override public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException { - {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{^isNumber}}{{^isInteger}}next{{{dataType}}}(){{/isInteger}}{{/isNumber}}; - return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isFloat}}(float){{/isFloat}}{{#isUri}}URI.create({{/isUri}}jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{#isUri}}nextString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}{{#isFloat}}nextDouble{{/isFloat}}{{^isFloat}}next{{{dataType}}}{{/isFloat}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; + return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); } } {{/gson}} {{#jsonb}} + public static final class Deserializer implements JsonbDeserializer<{{datatypeWithEnum}}> { @Override public {{datatypeWithEnum}} deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) { @@ -97,4 +101,20 @@ import com.google.gson.stream.JsonWriter; } } {{/jsonb}} +{{#supportUrlQuery}} + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + if (prefix == null) { + prefix = ""; + } + + return String.format("%s=%s", prefix, this.toString()); + } +{{/supportUrlQuery}} } diff --git a/templates/modelInnerEnum.mustache b/templates/modelInnerEnum.mustache index a9c9978..0096d84 100644 --- a/templates/modelInnerEnum.mustache +++ b/templates/modelInnerEnum.mustache @@ -51,23 +51,23 @@ {{/jackson}} public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) { for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { - if (b.value.equals(value)) { + if (b.value.{{^isString}}equals{{/isString}}{{#isString}}{{#useEnumCaseInsensitive}}equalsIgnoreCase{{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}equals{{/useEnumCaseInsensitive}}{{/isString}}(value)) { return b; } } - {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/isNullable}} + {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}return {{{name}}};{{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/enumUnknownDefaultCase}}{{/isNullable}} } {{#gson}} public static class Adapter extends TypeAdapter<{{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}> { @Override public void write(final JsonWriter jsonWriter, final {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); + jsonWriter.value(enumeration.getValue(){{#isUri}}.toASCIIString(){{/isUri}}); } @Override public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException { - {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isFloat}}(float){{/isFloat}} jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{^isNumber}}{{^isInteger}}{{#isFloat}}nextDouble{{/isFloat}}{{^isFloat}}next{{{dataType}}}{{/isFloat}}(){{/isInteger}}{{/isNumber}}; + {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isFloat}}(float){{/isFloat}} {{#isUri}}URI.create({{/isUri}}jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{#isUri}}nextString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}{{#isFloat}}nextDouble{{/isFloat}}{{^isFloat}}next{{{dataType}}}{{/isFloat}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); } } diff --git a/templates/model_test.mustache b/templates/model_test.mustache index 07468db..931a5da 100644 --- a/templates/model_test.mustache +++ b/templates/model_test.mustache @@ -4,21 +4,14 @@ package {{package}}; {{#imports}}import {{import}}; {{/imports}} -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -{{#fullJavaUtil}} -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -{{/fullJavaUtil}} +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; /** * Model tests for {{classname}} */ -public class {{classname}}Test { +class {{classname}}Test { {{#models}} {{#model}} {{^vendorExtensions.x-is-one-of-interface}} @@ -30,7 +23,7 @@ public class {{classname}}Test { * Model tests for {{classname}} */ @Test - public void test{{classname}}() { + void test{{classname}}() { // TODO: test {{classname}} } @@ -39,7 +32,7 @@ public class {{classname}}Test { * Test the property '{{name}}' */ @Test - public void {{name}}Test() { + void {{name}}Test() { // TODO: test {{name}} } diff --git a/templates/oneof_interface.mustache b/templates/oneof_interface.mustache index 02deb48..d672772 100644 --- a/templates/oneof_interface.mustache +++ b/templates/oneof_interface.mustache @@ -1,4 +1,4 @@ -{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>typeInfoAnnotation}}{{>xmlAnnotation}} +{{>additionalOneOfTypeAnnotations}}{{>generatedAnnotation}}{{>typeInfoAnnotation}}{{>xmlAnnotation}} public interface {{classname}} {{#vendorExtensions.x-implements}}{{#-first}}extends {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { {{#discriminator}} public {{propertyType}} {{propertyGetter}}(); diff --git a/templates/pojo.mustache b/templates/pojo.mustache index 7ca5ced..05be7e5 100644 --- a/templates/pojo.mustache +++ b/templates/pojo.mustache @@ -2,17 +2,33 @@ * {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} * @deprecated{{/isDeprecated}} */{{#isDeprecated}} -@Deprecated{{/isDeprecated}}{{#description}} -@ApiModel(description = "{{{.}}}"){{/description}} +@Deprecated{{/isDeprecated}} +{{#swagger1AnnotationLibrary}} +{{#description}} +@ApiModel(description = "{{{.}}}") +{{/description}} +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} +{{#description}} +@Schema(description = "{{{.}}}") +{{/description}} +{{/swagger2AnnotationLibrary}} {{#jackson}} @JsonPropertyOrder({ {{#vars}} {{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}} {{/vars}} }) +{{#isClassnameSanitized}} +{{^hasDiscriminatorWithNonEmptyMapping}} @JsonTypeName("{{name}}") +{{/hasDiscriminatorWithNonEmptyMapping}} +{{/isClassnameSanitized}} {{/jackson}} {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} +{{#vendorExtensions.x-class-extra-annotation}} +{{{vendorExtensions.x-class-extra-annotation}}} +{{/vendorExtensions.x-class-extra-annotation}} public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ {{#serializableModel}} private static final long serialVersionUID = 1L; @@ -36,65 +52,87 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens public static final String JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}"; {{/jackson}} {{#withXml}} - {{#isXmlAttribute}} - @XmlAttribute(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/isXmlAttribute}} - {{^isXmlAttribute}} - {{^isContainer}} - @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/isContainer}} - {{#isContainer}} - // Is a container wrapped={{isXmlWrapped}} - {{#items}} - // items.name={{name}} items.baseName={{baseName}} items.xmlName={{xmlName}} items.xmlNamespace={{xmlNamespace}} - // items.example={{example}} items.type={{dataType}} - @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/items}} - {{#isXmlWrapped}} - @XmlElementWrapper({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/isXmlWrapped}} - {{/isContainer}} - {{/isXmlAttribute}} + @Xml{{#isXmlAttribute}}Attribute{{/isXmlAttribute}}{{^isXmlAttribute}}Element{{/isXmlAttribute}}(name = "{{items.xmlName}}{{^items.xmlName}}{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}{{/items.xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{#isXmlWrapped}} + @XmlElementWrapper(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{/isXmlWrapped}} + {{^isXmlAttribute}} + {{#isDateTime}} + @XmlJavaTypeAdapter(OffsetDateTimeXmlAdapter.class) + {{/isDateTime}} + {{/isXmlAttribute}} {{/withXml}} {{#gson}} @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) {{/gson}} + {{#vendorExtensions.x-field-extra-annotation}} + {{{vendorExtensions.x-field-extra-annotation}}} + {{/vendorExtensions.x-field-extra-annotation}} {{#vendorExtensions.x-is-jackson-optional-nullable}} {{#isContainer}} - private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); + {{#hasChildren}}protected{{/hasChildren}}{{^hasChildren}}private{{/hasChildren}} JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); {{/isContainer}} {{^isContainer}} - private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}}; + {{#hasChildren}}protected{{/hasChildren}}{{^hasChildren}}private{{/hasChildren}} JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}}; {{/isContainer}} {{/vendorExtensions.x-is-jackson-optional-nullable}} {{^vendorExtensions.x-is-jackson-optional-nullable}} {{#isContainer}} - private {{{datatypeWithEnum}}} {{name}}{{#required}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/required}}{{^required}} = null{{/required}}; + {{#hasChildren}}protected{{/hasChildren}}{{^hasChildren}}private{{/hasChildren}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/isContainer}} {{^isContainer}} - {{#isDiscriminator}}protected{{/isDiscriminator}}{{^isDiscriminator}}private{{/isDiscriminator}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; + {{#hasChildren}}protected{{/hasChildren}}{{^hasChildren}}private{{/hasChildren}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/isContainer}} {{/vendorExtensions.x-is-jackson-optional-nullable}} {{/vars}} - public {{classname}}() { {{#parent}}{{#parcelableModel}} - super();{{/parcelableModel}}{{/parent}}{{#gson}}{{#discriminator}} - this.{{{discriminatorName}}} = this.getClass().getSimpleName();{{/discriminator}}{{/gson}} - }{{#vendorExtensions.x-has-readonly-properties}}{{^withXml}} - + public {{classname}}() { + {{#parent}} + {{#parcelableModel}} + super();{{/parcelableModel}} + {{/parent}} + {{#gson}} + {{#discriminator}} + {{#discriminator.isEnum}} + this.{{{discriminatorName}}} = this.getClass().getSimpleName(); + {{/discriminator.isEnum}} + {{/discriminator}} + {{/gson}} + } + {{#vendorExtensions.x-has-readonly-properties}} + {{^withXml}} + /** + * Constructor with only readonly parameters{{#generateConstructorWithAllArgs}}{{^vendorExtensions.x-java-all-args-constructor}} and all parameters{{/vendorExtensions.x-java-all-args-constructor}}{{/generateConstructorWithAllArgs}} + */ {{#jsonb}}@JsonbCreator{{/jsonb}}{{#jackson}}@JsonCreator{{/jackson}} public {{classname}}( {{#readOnlyVars}} - {{#jsonb}}@JsonbProperty("{{baseName}}"){{/jsonb}}{{#jackson}}@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}){{/jackson}} {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}} + {{#jsonb}}@JsonbProperty(value = "{{baseName}}"{{^required}}, nullable = true{{/required}}){{/jsonb}}{{#jackson}}@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}){{/jackson}} {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}} {{/readOnlyVars}} ) { this(); {{#readOnlyVars}} - this.{{name}} = {{name}}; + this.{{name}} = {{#vendorExtensions.x-is-jackson-optional-nullable}}{{name}} == null ? JsonNullable.<{{{datatypeWithEnum}}}>undefined() : JsonNullable.of({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{name}}{{/vendorExtensions.x-is-jackson-optional-nullable}}; {{/readOnlyVars}} - }{{/withXml}}{{/vendorExtensions.x-has-readonly-properties}} + } + {{/withXml}} + {{/vendorExtensions.x-has-readonly-properties}} +{{#vendorExtensions.x-java-all-args-constructor}} + + /** + * Constructor with all args parameters + */ + public {{classname}}({{#vendorExtensions.x-java-all-args-constructor-vars}}{{#jsonb}}@JsonbProperty(value = "{{baseName}}"{{^required}}, nullable = true{{/required}}){{/jsonb}}{{#jackson}}@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}){{/jackson}} {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-java-all-args-constructor-vars}}) { +{{#parent}} + super({{#parentVars}}{{name}}{{^-last}}, {{/-last}}{{/parentVars}}); +{{/parent}} {{#vars}} + this.{{name}} = {{#vendorExtensions.x-is-jackson-optional-nullable}}{{name}} == null ? JsonNullable.<{{{datatypeWithEnum}}}>undefined() : JsonNullable.of({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{name}}{{/vendorExtensions.x-is-jackson-optional-nullable}}; +{{/vars}} + } +{{/vendorExtensions.x-java-all-args-constructor}} +{{#vars}} {{^isReadOnly}} public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { {{#vendorExtensions.x-is-jackson-optional-nullable}}this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}});{{/vendorExtensions.x-is-jackson-optional-nullable}} @@ -103,10 +141,10 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens } {{#isArray}} - public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} if (this.{{name}} == null || !this.{{name}}.isPresent()) { - this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}); } try { this.{{name}}.get().add({{name}}Item); @@ -116,11 +154,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens return this; {{/vendorExtensions.x-is-jackson-optional-nullable}} {{^vendorExtensions.x-is-jackson-optional-nullable}} - {{^required}} if (this.{{name}} == null) { - this.{{name}} = {{{defaultValue}}}; + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}; } - {{/required}} this.{{name}}.add({{name}}Item); return this; {{/vendorExtensions.x-is-jackson-optional-nullable}} @@ -128,10 +164,10 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/isArray}} {{#isMap}} - public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} if (this.{{name}} == null || !this.{{name}}.isPresent()) { - this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}); } try { this.{{name}}.get().put(key, {{name}}Item); @@ -143,7 +179,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{^vendorExtensions.x-is-jackson-optional-nullable}} {{^required}} if (this.{{name}} == null) { - this.{{name}} = {{{defaultValue}}}; + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}; } {{/required}} this.{{name}}.put(key, {{name}}Item); @@ -153,7 +189,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/isMap}} {{/isReadOnly}} - /** + /** {{#description}} * {{.}} {{/description}} @@ -170,25 +206,33 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{#deprecated}} * @deprecated {{/deprecated}} - **/ + */ {{#deprecated}} @Deprecated {{/deprecated}} {{#required}} {{#isNullable}} - @javax.annotation.Nullable + @{{javaxPackage}}.annotation.Nullable {{/isNullable}} {{^isNullable}} - @javax.annotation.Nonnull + @{{javaxPackage}}.annotation.Nonnull {{/isNullable}} {{/required}} {{^required}} - @javax.annotation.Nullable + @{{javaxPackage}}.annotation.Nullable {{/required}} {{#jsonb}} @JsonbProperty("{{baseName}}") {{/jsonb}} -{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{#useBeanValidation}} +{{>beanValidation}} +{{/useBeanValidation}} +{{#swagger1AnnotationLibrary}} + @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} + @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}") +{{/swagger2AnnotationLibrary}} {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} {{/vendorExtensions.x-extra-annotation}} @@ -237,7 +281,23 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/isReadOnly}} {{/vars}} + {{#parent}} + {{#readWriteVars}} + {{#isOverridden}} + @Override + public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.{{setter}}(JsonNullable.<{{{datatypeWithEnum}}}>of({{name}})); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + this.{{setter}}({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + return this; + } + {{/isOverridden}} + {{/readWriteVars}} + {{/parent}} @Override public boolean equals(Object o) { {{#useReflectionEqualsHashCode}} @@ -287,7 +347,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens sb.append(" ").append(toIndentedString(super.toString())).append("\n"); {{/parent}} {{#vars}} - sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); + sb.append(" {{name}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{name}}){{/isPassword}}).append("\n"); {{/vars}} sb.append("}"); return sb.toString(); @@ -303,7 +363,200 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens } return o.toString().replace("\n", "\n "); } +{{#supportUrlQuery}} + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + {{#allVars}} + // add `{{baseName}}` to the URL query string + {{#isArray}} + {{#items.isPrimitiveType}} + {{#uniqueItems}} + if ({{getter}}() != null) { + int i = 0; + for ({{{items.dataType}}} _item : {{getter}}()) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if ({{getter}}() != null) { + for (int i = 0; i < {{getter}}().size(); i++) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + {{/uniqueItems}} + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + {{#items.isModel}} + {{#uniqueItems}} + if ({{getter}}() != null) { + int i = 0; + for ({{{items.dataType}}} _item : {{getter}}()) { + if (_item != null) { + joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if ({{getter}}() != null) { + for (int i = 0; i < {{getter}}().size(); i++) { + if ({{getter}}().get(i) != null) { + joiner.add({{getter}}().get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{^items.isModel}} + {{#uniqueItems}} + if ({{getter}}() != null) { + int i = 0; + for ({{{items.dataType}}} _item : {{getter}}()) { + if (_item != null) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + i++; + } + } + {{/uniqueItems}} + {{^uniqueItems}} + if ({{getter}}() != null) { + for (int i = 0; i < {{getter}}().size(); i++) { + if ({{getter}}().get(i) != null) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{/items.isPrimitiveType}} + {{/isArray}} + {{^isArray}} + {{#isMap}} + {{^items.isModel}} + if ({{getter}}() != null) { + for (String _key : {{getter}}().keySet()) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix), + {{getter}}().get(_key), URLEncoder.encode(String.valueOf({{getter}}().get(_key)), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + {{/items.isModel}} + {{#items.isModel}} + if ({{getter}}() != null) { + for (String _key : {{getter}}().keySet()) { + if ({{getter}}().get(_key) != null) { + joiner.add({{getter}}().get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix)))); + } + } + } + {{/items.isModel}} + {{/isMap}} + {{^isMap}} + {{#isPrimitiveType}} + if ({{getter}}() != null) { + try { + joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isModel}} + if ({{getter}}() != null) { + joiner.add({{getter}}().toUrlQueryString(prefix + "{{{baseName}}}" + suffix)); + } + {{/isModel}} + {{^isModel}} + if ({{getter}}() != null) { + try { + joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + {{/isModel}} + {{/isPrimitiveType}} + {{/isMap}} + {{/isArray}} + {{/allVars}} + return joiner.toString(); + } +{{/supportUrlQuery}} {{#parcelableModel}} public void writeToParcel(Parcel out, int flags) { @@ -363,4 +616,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens } }; {{/parcelableModel}} +{{#generateBuilders}} + + {{>javaBuilder}} +{{/generateBuilders}} + } diff --git a/templates/pojo_doc.mustache b/templates/pojo_doc.mustache index 2c4eac3..1617ec5 100644 --- a/templates/pojo_doc.mustache +++ b/templates/pojo_doc.mustache @@ -1,22 +1,40 @@ # {{#vendorExtensions.x-is-one-of-interface}}Interface {{/vendorExtensions.x-is-one-of-interface}}{{classname}} +{{^useCustomTemplateCode}} +{{#description}}{{&description}} +{{/description}} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} {{unescapedDescription}} +{{/useCustomTemplateCode}} {{^vendorExtensions.x-is-one-of-interface}} ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +{{^useCustomTemplateCode}} +{{#vars}}|**{{name}}** | {{#isEnum}}[**{{datatypeWithEnum}}**](#{{datatypeWithEnum}}){{/isEnum}}{{^isEnum}}{{#isContainer}}{{#isArray}}{{#items}}{{#isModel}}[{{/isModel}}{{/items}}**{{baseType}}{{#items}}<{{dataType}}>**{{#isModel}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isModel}}{{/items}}{{/isArray}}{{#isMap}}{{#items}}{{#isModel}}[{{/isModel}}**Map<String, {{dataType}}>**{{#isModel}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isModel}}{{/items}}{{/isMap}}{{/isContainer}}{{^isContainer}}{{#isModel}}[{{/isModel}}**{{dataType}}**{{#isModel}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isModel}}{{/isContainer}}{{/isEnum}} | {{description}} | {{^required}} [optional]{{/required}}{{#isReadOnly}} [readonly]{{/isReadOnly}} | +{{/vars}} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} {{#vars}}| `{{name}}`{{#required}}*_required_{{/required}} | {{#isEnum}}[```{{datatypeWithEnum}}```](#{{datatypeWithEnum}}){{/isEnum}}{{^isEnum}}{{#isContainer}}{{#isArray}}{{#items}}{{#isModel}}[{{/isModel}}{{/items}}```{{baseType}}{{#items}}<{{dataType}}>```{{#isModel}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isModel}}{{/items}}{{/isArray}}{{#isMap}}{{#items}}{{#isModel}}[{{/isModel}}```Map```{{#isModel}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isModel}}{{/items}}{{/isMap}}{{/isContainer}}{{^isContainer}}{{#isModel}}[{{/isModel}}```{{dataType}}```{{#isModel}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isModel}}{{/isContainer}}{{/isEnum}} | REPLACE_ME_WITH_DESCRIPTION_BEGIN {{unescapedDescription}} REPLACE_ME_WITH_DESCRIPTION_END | {{#isReadOnly}} [readonly]{{/isReadOnly}} | {{/vars}} +{{/useCustomTemplateCode}} {{#vars}}{{#isEnum}} ## Enum: {{datatypeWithEnum}} -Name | Value +| Name | Value | +{{^useCustomTemplateCode}} +|---- | -----|{{#allowableValues}}{{#enumVars}} +| {{name}} | {{value}} |{{/enumVars}}{{/allowableValues}} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} ---- | -----{{#allowableValues}}{{#enumVars}} | {{name}} | {{value}} |{{/enumVars}}{{/allowableValues}} +{{/useCustomTemplateCode}} {{/isEnum}}{{/vars}} {{#vendorExtensions.x-implements.0}} diff --git a/templates/pom.mustache b/templates/pom.mustache index 5705ea7..b733ab9 100644 --- a/templates/pom.mustache +++ b/templates/pom.mustache @@ -45,6 +45,8 @@ maven-compiler-plugin 3.8.1 + 1.8 + 1.8 true 128m 512m @@ -80,16 +82,24 @@ maven-surefire-plugin 2.12 - + loggerPath conf/log4j.properties - + -Xms512m -Xmx1500m methods pertest + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + maven-dependency-plugin @@ -154,33 +164,13 @@ - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.1 - - {{#java8}} - 1.8 - 1.8 - {{/java8}} - {{^java8}} - 1.7 - 1.7 - {{/java8}} - - org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.2 none - {{#java8}} - 1.8 - {{/java8}} - {{^java8}} - 1.7 - {{/java8}} + 1.8 @@ -232,11 +222,20 @@ + {{#swagger1AnnotationLibrary}} io.swagger swagger-annotations ${swagger-annotations-version} + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + + io.swagger.core.v3 + swagger-annotations + ${swagger-annotations-version} + + {{/swagger2AnnotationLibrary}} @@ -272,13 +271,22 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-version} + ${jackson-databind-version} + {{^useJakartaEe}} com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider ${jackson-version} + {{/useJakartaEe}} + {{#useJakartaEe}} + + com.fasterxml.jackson.jakarta.rs + jackson-jakarta-rs-json-provider + ${jackson-version} + + {{/useJakartaEe}} {{#withXml}} @@ -296,28 +304,11 @@ ${jackson-version} {{/joda}} - {{#java8}} com.fasterxml.jackson.datatype jackson-datatype-jsr310 ${jackson-version} - {{/java8}} - {{#threetenbp}} - - com.github.joschi.jackson - jackson-datatype-threetenbp - ${jackson-threetenbp-version} - - {{/threetenbp}} - {{^java8}} - - - com.brsanthu - migbase64 - 2.2 - - {{/java8}} {{#useBeanValidation}} @@ -352,25 +343,40 @@ - junit - junit + org.junit.jupiter + junit-jupiter-engine ${junit-version} test + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + UTF-8 - 1.6.3 + {{#swagger1AnnotationLibrary}} + 1.6.6 + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + 2.2.15 + {{/swagger2AnnotationLibrary}} 1.19.4 - 2.12.5 - {{#threetenbp}} - 2.9.10 - {{/threetenbp}} + 2.17.1 + 2.17.1 + {{#useJakartaEe}} + 2.1.1 + {{/useJakartaEe}} + {{^useJakartaEe}} 1.3.5 + {{/useJakartaEe}} {{#useBeanValidation}} - 2.0.2 + 3.0.2 {{/useBeanValidation}} 1.0.0 - 4.13.1 + 5.10.2 + 1.10.0 diff --git a/templates/typeInfoAnnotation.mustache b/templates/typeInfoAnnotation.mustache index 63eb42e..c21efb4 100644 --- a/templates/typeInfoAnnotation.mustache +++ b/templates/typeInfoAnnotation.mustache @@ -1,6 +1,21 @@ {{#jackson}} +@JsonIgnoreProperties( +{{^useCustomTemplateCode}} + value = "{{{discriminator.propertyBaseName}}}", // ignore manually set {{{discriminator.propertyBaseName}}}, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the {{{discriminator.propertyBaseName}}} to be set during deserialization +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} + allowSetters = true, // allows the {{{discriminator.propertyBaseName}}} to be set during deserialization + ignoreUnknown = true +{{/useCustomTemplateCode}} +) +{{^useCustomTemplateCode}} +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) +{{/useCustomTemplateCode}} {{#discriminator.mappedModels}} {{#-first}} @JsonSubTypes({ @@ -10,7 +25,4 @@ }) {{/-last}} {{/discriminator.mappedModels}} -{{#isClassnameSanitized}} -@JsonTypeName("{{name}}") -{{/isClassnameSanitized}} {{/jackson}}