diff --git a/.bsp/sbt.json b/.bsp/sbt.json index 9879b70..d6a2d82 100644 --- a/.bsp/sbt.json +++ b/.bsp/sbt.json @@ -1 +1 @@ -{"name":"sbt","version":"1.5.8","bspVersion":"2.0.0-M5","languages":["scala"],"argv":["C:\\Program Files\\Java\\jdk-17.0.1/bin/java","-Xms100m","-Xmx100m","-classpath","C:/Users/jonathan.wenger/AppData/Roaming/JetBrains/IdeaIC2021.3/plugins/Scala/launcher/sbt-launch.jar","xsbt.boot.Boot","-bsp","--sbt-launch-jar=C:/Users/jonathan.wenger/AppData/Roaming/JetBrains/IdeaIC2021.3/plugins/Scala/launcher/sbt-launch.jar"]} \ No newline at end of file +{"name":"sbt","version":"1.5.8","bspVersion":"2.0.0-M5","languages":["scala"],"argv":["C:\\Users\\jonathan.wenger\\.jdks\\corretto-17.0.11/bin/java","-Xms100m","-Xmx100m","-classpath","C:/Users/jonathan.wenger/AppData/Roaming/JetBrains/IdeaIC2021.3/plugins/Scala/launcher/sbt-launch.jar","xsbt.boot.Boot","-bsp","--sbt-launch-jar=C:/Users/jonathan.wenger/AppData/Roaming/JetBrains/IdeaIC2021.3/plugins/Scala/launcher/sbt-launch.jar"]} \ No newline at end of file diff --git a/README.md b/README.md index bfa44e0..3f61e0f 100644 --- a/README.md +++ b/README.md @@ -232,32 +232,6 @@ It's recommended to create an instance of `ApiClient` per thread in a multithrea ### EInvoicing V1 API Documentation -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*DataInputFieldsApi* | [**getDataInputFields**](docs/EInvoicing/V1/DataInputFieldsApi.md#getdatainputfields) | **GET** /data-input-fields | Returns the mandatory and conditional invoice or creditnote input fields for different country mandates -*DocumentsApi* | [**downloadDocument**](docs/EInvoicing/V1/DocumentsApi.md#downloaddocument) | **GET** /documents/{documentId}/$download | Returns a copy of the document -*DocumentsApi* | [**getDocumentList**](docs/EInvoicing/V1/DocumentsApi.md#getdocumentlist) | **GET** /documents | Returns a summary of documents for a date range -*DocumentsApi* | [**getDocumentStatus**](docs/EInvoicing/V1/DocumentsApi.md#getdocumentstatus) | **GET** /documents/{documentId}/status | Checks the status of a document -*DocumentsApi* | [**submitDocument**](docs/EInvoicing/V1/DocumentsApi.md#submitdocument) | **POST** /documents | Submits a document to Avalara E-Invoicing API -*MandatesApi* | [**getMandates**](docs/EInvoicing/V1/MandatesApi.md#getmandates) | **GET** /mandates | List country mandates that are supported by the Avalara E-Invoicing platform - - -### EInvoicing V1 API Documentation - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*DataInputFieldsApi* | [**getDataInputFields**](docs/EInvoicing/V1/DataInputFieldsApi.md#getdatainputfields) | **GET** /data-input-fields | Returns the optionality of document fields for different country mandates -*DocumentsApi* | [**downloadDocument**](docs/EInvoicing/V1/DocumentsApi.md#downloaddocument) | **GET** /documents/{documentId}/$download | Returns a copy of the document -*DocumentsApi* | [**fetchDocuments**](docs/EInvoicing/V1/DocumentsApi.md#fetchdocuments) | **POST** /documents/$fetch | Fetch the inbound document from a tax authority -*DocumentsApi* | [**getDocumentList**](docs/EInvoicing/V1/DocumentsApi.md#getdocumentlist) | **GET** /documents | Returns a summary of documents for a date range -*DocumentsApi* | [**getDocumentStatus**](docs/EInvoicing/V1/DocumentsApi.md#getdocumentstatus) | **GET** /documents/{documentId}/status | Checks the status of a document -*DocumentsApi* | [**submitDocument**](docs/EInvoicing/V1/DocumentsApi.md#submitdocument) | **POST** /documents | Submits a document to Avalara E-Invoicing API -*MandatesApi* | [**getMandateDataInputFields**](docs/EInvoicing/V1/MandatesApi.md#getmandatedatainputfields) | **GET** /mandates/{mandateId}/data-input-fields | Returns document field information for a country mandate, a selected document type, and its version -*MandatesApi* | [**getMandates**](docs/EInvoicing/V1/MandatesApi.md#getmandates) | **GET** /mandates | List country mandates that are supported by the Avalara E-Invoicing platform - - -### EInvoicing V1 API Documentation - Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *DataInputFieldsApi* | [**getDataInputFields**](docs/EInvoicing/V1/DataInputFieldsApi.md#getdatainputfields) | **GET** /data-input-fields | Returns the optionality of document fields for different country mandates @@ -278,70 +252,6 @@ Class | Method | HTTP request | Description ## Documentation for Models - -### EInvoicing V1 Model Documentation - - - [Avalara.SDK.model.EInvoicing.V1.BadDownloadRequest](docs/EInvoicing/V1/BadDownloadRequest.md) - - [Avalara.SDK.model.EInvoicing.V1.BadRequest](docs/EInvoicing/V1/BadRequest.md) - - [Avalara.SDK.model.EInvoicing.V1.ConditionalForField](docs/EInvoicing/V1/ConditionalForField.md) - - [Avalara.SDK.model.EInvoicing.V1.DataInputField](docs/EInvoicing/V1/DataInputField.md) - - [Avalara.SDK.model.EInvoicing.V1.DataInputFieldNotUsedFor](docs/EInvoicing/V1/DataInputFieldNotUsedFor.md) - - [Avalara.SDK.model.EInvoicing.V1.DataInputFieldOptionalFor](docs/EInvoicing/V1/DataInputFieldOptionalFor.md) - - [Avalara.SDK.model.EInvoicing.V1.DataInputFieldRequiredFor](docs/EInvoicing/V1/DataInputFieldRequiredFor.md) - - [Avalara.SDK.model.EInvoicing.V1.DataInputFieldsResponse](docs/EInvoicing/V1/DataInputFieldsResponse.md) - - [Avalara.SDK.model.EInvoicing.V1.DocumentListResponse](docs/EInvoicing/V1/DocumentListResponse.md) - - [Avalara.SDK.model.EInvoicing.V1.DocumentStatusResponse](docs/EInvoicing/V1/DocumentStatusResponse.md) - - [Avalara.SDK.model.EInvoicing.V1.DocumentSubmissionError](docs/EInvoicing/V1/DocumentSubmissionError.md) - - [Avalara.SDK.model.EInvoicing.V1.DocumentSubmitResponse](docs/EInvoicing/V1/DocumentSubmitResponse.md) - - [Avalara.SDK.model.EInvoicing.V1.DocumentSummary](docs/EInvoicing/V1/DocumentSummary.md) - - [Avalara.SDK.model.EInvoicing.V1.ForbiddenError](docs/EInvoicing/V1/ForbiddenError.md) - - [Avalara.SDK.model.EInvoicing.V1.InputDataFormats](docs/EInvoicing/V1/InputDataFormats.md) - - [Avalara.SDK.model.EInvoicing.V1.InternalServerError](docs/EInvoicing/V1/InternalServerError.md) - - [Avalara.SDK.model.EInvoicing.V1.Mandate](docs/EInvoicing/V1/Mandate.md) - - [Avalara.SDK.model.EInvoicing.V1.MandatesResponse](docs/EInvoicing/V1/MandatesResponse.md) - - [Avalara.SDK.model.EInvoicing.V1.NotFoundError](docs/EInvoicing/V1/NotFoundError.md) - - [Avalara.SDK.model.EInvoicing.V1.NotUsedForField](docs/EInvoicing/V1/NotUsedForField.md) - - [Avalara.SDK.model.EInvoicing.V1.RequiredWhenField](docs/EInvoicing/V1/RequiredWhenField.md) - - [Avalara.SDK.model.EInvoicing.V1.StatusEvent](docs/EInvoicing/V1/StatusEvent.md) - - [Avalara.SDK.model.EInvoicing.V1.SubmitDocumentMetadata](docs/EInvoicing/V1/SubmitDocumentMetadata.md) - - [Avalara.SDK.model.EInvoicing.V1.WorkflowIds](docs/EInvoicing/V1/WorkflowIds.md) - - - -### EInvoicing V1 Model Documentation - - - [Avalara.SDK.model.EInvoicing.V1.BadDownloadRequest](docs/EInvoicing/V1/BadDownloadRequest.md) - - [Avalara.SDK.model.EInvoicing.V1.BadRequest](docs/EInvoicing/V1/BadRequest.md) - - [Avalara.SDK.model.EInvoicing.V1.ConditionalForField](docs/EInvoicing/V1/ConditionalForField.md) - - [Avalara.SDK.model.EInvoicing.V1.DataInputField](docs/EInvoicing/V1/DataInputField.md) - - [Avalara.SDK.model.EInvoicing.V1.DataInputFieldNotUsedFor](docs/EInvoicing/V1/DataInputFieldNotUsedFor.md) - - [Avalara.SDK.model.EInvoicing.V1.DataInputFieldOptionalFor](docs/EInvoicing/V1/DataInputFieldOptionalFor.md) - - [Avalara.SDK.model.EInvoicing.V1.DataInputFieldRequiredFor](docs/EInvoicing/V1/DataInputFieldRequiredFor.md) - - [Avalara.SDK.model.EInvoicing.V1.DataInputFieldsResponse](docs/EInvoicing/V1/DataInputFieldsResponse.md) - - [Avalara.SDK.model.EInvoicing.V1.DocumentFetch](docs/EInvoicing/V1/DocumentFetch.md) - - [Avalara.SDK.model.EInvoicing.V1.DocumentListResponse](docs/EInvoicing/V1/DocumentListResponse.md) - - [Avalara.SDK.model.EInvoicing.V1.DocumentStatusResponse](docs/EInvoicing/V1/DocumentStatusResponse.md) - - [Avalara.SDK.model.EInvoicing.V1.DocumentSubmissionError](docs/EInvoicing/V1/DocumentSubmissionError.md) - - [Avalara.SDK.model.EInvoicing.V1.DocumentSubmitResponse](docs/EInvoicing/V1/DocumentSubmitResponse.md) - - [Avalara.SDK.model.EInvoicing.V1.DocumentSummary](docs/EInvoicing/V1/DocumentSummary.md) - - [Avalara.SDK.model.EInvoicing.V1.FetchDocumentsRequest](docs/EInvoicing/V1/FetchDocumentsRequest.md) - - [Avalara.SDK.model.EInvoicing.V1.FetchDocumentsRequestDataInner](docs/EInvoicing/V1/FetchDocumentsRequestDataInner.md) - - [Avalara.SDK.model.EInvoicing.V1.FetchDocumentsRequestMetadata](docs/EInvoicing/V1/FetchDocumentsRequestMetadata.md) - - [Avalara.SDK.model.EInvoicing.V1.ForbiddenError](docs/EInvoicing/V1/ForbiddenError.md) - - [Avalara.SDK.model.EInvoicing.V1.InputDataFormats](docs/EInvoicing/V1/InputDataFormats.md) - - [Avalara.SDK.model.EInvoicing.V1.InternalServerError](docs/EInvoicing/V1/InternalServerError.md) - - [Avalara.SDK.model.EInvoicing.V1.Mandate](docs/EInvoicing/V1/Mandate.md) - - [Avalara.SDK.model.EInvoicing.V1.MandateDataInputField](docs/EInvoicing/V1/MandateDataInputField.md) - - [Avalara.SDK.model.EInvoicing.V1.MandateDataInputFieldNamespace](docs/EInvoicing/V1/MandateDataInputFieldNamespace.md) - - [Avalara.SDK.model.EInvoicing.V1.MandatesResponse](docs/EInvoicing/V1/MandatesResponse.md) - - [Avalara.SDK.model.EInvoicing.V1.NotFoundError](docs/EInvoicing/V1/NotFoundError.md) - - [Avalara.SDK.model.EInvoicing.V1.NotUsedForField](docs/EInvoicing/V1/NotUsedForField.md) - - [Avalara.SDK.model.EInvoicing.V1.RequiredWhenField](docs/EInvoicing/V1/RequiredWhenField.md) - - [Avalara.SDK.model.EInvoicing.V1.StatusEvent](docs/EInvoicing/V1/StatusEvent.md) - - [Avalara.SDK.model.EInvoicing.V1.SubmitDocumentMetadata](docs/EInvoicing/V1/SubmitDocumentMetadata.md) - - [Avalara.SDK.model.EInvoicing.V1.WorkflowIds](docs/EInvoicing/V1/WorkflowIds.md) - - ### EInvoicing V1 Model Documentation @@ -361,15 +271,15 @@ Class | Method | HTTP request | Description - [Avalara.SDK.model.EInvoicing.V1.DirectorySearchResponseValueInnerIdentifiersInner](docs/EInvoicing/V1/DirectorySearchResponseValueInnerIdentifiersInner.md) - [Avalara.SDK.model.EInvoicing.V1.DirectorySearchResponseValueInnerSupportedDocumentTypesInner](docs/EInvoicing/V1/DirectorySearchResponseValueInnerSupportedDocumentTypesInner.md) - [Avalara.SDK.model.EInvoicing.V1.DocumentFetch](docs/EInvoicing/V1/DocumentFetch.md) + - [Avalara.SDK.model.EInvoicing.V1.DocumentFetchRequest](docs/EInvoicing/V1/DocumentFetchRequest.md) + - [Avalara.SDK.model.EInvoicing.V1.DocumentFetchRequestDataInner](docs/EInvoicing/V1/DocumentFetchRequestDataInner.md) + - [Avalara.SDK.model.EInvoicing.V1.DocumentFetchRequestMetadata](docs/EInvoicing/V1/DocumentFetchRequestMetadata.md) - [Avalara.SDK.model.EInvoicing.V1.DocumentListResponse](docs/EInvoicing/V1/DocumentListResponse.md) - [Avalara.SDK.model.EInvoicing.V1.DocumentStatusResponse](docs/EInvoicing/V1/DocumentStatusResponse.md) - [Avalara.SDK.model.EInvoicing.V1.DocumentSubmissionError](docs/EInvoicing/V1/DocumentSubmissionError.md) - [Avalara.SDK.model.EInvoicing.V1.DocumentSubmitResponse](docs/EInvoicing/V1/DocumentSubmitResponse.md) - [Avalara.SDK.model.EInvoicing.V1.DocumentSummary](docs/EInvoicing/V1/DocumentSummary.md) - [Avalara.SDK.model.EInvoicing.V1.ErrorResponse](docs/EInvoicing/V1/ErrorResponse.md) - - [Avalara.SDK.model.EInvoicing.V1.FetchDocumentsRequest](docs/EInvoicing/V1/FetchDocumentsRequest.md) - - [Avalara.SDK.model.EInvoicing.V1.FetchDocumentsRequestDataInner](docs/EInvoicing/V1/FetchDocumentsRequestDataInner.md) - - [Avalara.SDK.model.EInvoicing.V1.FetchDocumentsRequestMetadata](docs/EInvoicing/V1/FetchDocumentsRequestMetadata.md) - [Avalara.SDK.model.EInvoicing.V1.ForbiddenError](docs/EInvoicing/V1/ForbiddenError.md) - [Avalara.SDK.model.EInvoicing.V1.InputDataFormats](docs/EInvoicing/V1/InputDataFormats.md) - [Avalara.SDK.model.EInvoicing.V1.InternalServerError](docs/EInvoicing/V1/InternalServerError.md) diff --git a/docs/EInvoicing/V1/DocumentFetchRequest.md b/docs/EInvoicing/V1/DocumentFetchRequest.md new file mode 100644 index 0000000..ae55778 --- /dev/null +++ b/docs/EInvoicing/V1/DocumentFetchRequest.md @@ -0,0 +1,14 @@ + + +# DocumentFetchRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**data** | [**List<DocumentFetchRequestDataInner>**](DocumentFetchRequestDataInner.md) | Array of key-value pairs used to retrieve inbound documents from the Tax Authority | [optional] | +|**metadata** | [**DocumentFetchRequestMetadata**](DocumentFetchRequestMetadata.md) | | [optional] | + + + diff --git a/docs/EInvoicing/V1/DocumentFetchRequestDataInner.md b/docs/EInvoicing/V1/DocumentFetchRequestDataInner.md new file mode 100644 index 0000000..72775b4 --- /dev/null +++ b/docs/EInvoicing/V1/DocumentFetchRequestDataInner.md @@ -0,0 +1,14 @@ + + +# DocumentFetchRequestDataInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**key** | **String** | Descriptor of the identifier | | +|**value** | **String** | Value of the identifier | | + + + diff --git a/docs/EInvoicing/V1/DocumentFetchRequestMetadata.md b/docs/EInvoicing/V1/DocumentFetchRequestMetadata.md new file mode 100644 index 0000000..fca39ad --- /dev/null +++ b/docs/EInvoicing/V1/DocumentFetchRequestMetadata.md @@ -0,0 +1,17 @@ + + +# DocumentFetchRequestMetadata + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**workflowId** | **String** | Specifies a unique ID for this workflow. | | +|**dataFormat** | **String** | Specifies the data format for this workflow | | +|**dataFormatVersion** | **BigDecimal** | Specifies the data format version number | | +|**countryCode** | **String** | The two-letter ISO-3166 country code for the country for which document is being retrieved | | +|**countryMandate** | **String** | The e-invoicing mandate for the specified country | | + + + diff --git a/docs/EInvoicing/V1/DocumentsApi.md b/docs/EInvoicing/V1/DocumentsApi.md index 9e820d5..fd9b1f3 100644 --- a/docs/EInvoicing/V1/DocumentsApi.md +++ b/docs/EInvoicing/V1/DocumentsApi.md @@ -102,7 +102,7 @@ Name | Type | Description | Notes ## fetchDocuments -> DocumentFetch fetchDocuments(avalaraVersion, fetchDocumentsRequest, xAvalaraClient) +> DocumentFetch fetchDocuments(avalaraVersion, documentFetchRequest, xAvalaraClient) Fetch the inbound document from a tax authority @@ -137,10 +137,10 @@ public class Example { DocumentsApi apiInstance = new DocumentsApi(apiClient); String avalaraVersion = "1.2"; // String | The HTTP Header meant to specify the version of the API intended to be used - FetchDocumentsRequest fetchDocumentsRequest = new FetchDocumentsRequest(); // FetchDocumentsRequest | + DocumentFetchRequest documentFetchRequest = new DocumentFetchRequest(); // DocumentFetchRequest | String xAvalaraClient = "John's E-Invoicing-API Client"; // String | You can freely use any text you wish for this value. This feature can help you diagnose and solve problems with your software. The header can be treated like a fingerprint. try { - DocumentFetch result = apiInstance.fetchDocuments(avalaraVersion, fetchDocumentsRequest, xAvalaraClient); + DocumentFetch result = apiInstance.fetchDocuments(avalaraVersion, documentFetchRequest, xAvalaraClient); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling DocumentsApi#fetchDocuments"); @@ -159,7 +159,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **avalaraVersion** | **String**| The HTTP Header meant to specify the version of the API intended to be used | - **fetchDocumentsRequest** | [**FetchDocumentsRequest**](FetchDocumentsRequest.md)| | + **documentFetchRequest** | [**DocumentFetchRequest**](DocumentFetchRequest.md)| | **xAvalaraClient** | **String**| You can freely use any text you wish for this value. This feature can help you diagnose and solve problems with your software. The header can be treated like a fingerprint. | [optional] ### Return type @@ -407,7 +407,7 @@ public class Example { DocumentsApi apiInstance = new DocumentsApi(apiClient); String avalaraVersion = "1.2"; // String | The HTTP Header meant to specify the version of the API intended to be used SubmitDocumentMetadata metadata = new SubmitDocumentMetadata(); // SubmitDocumentMetadata | - Object data = null; // Object | The document to be submitted, as indicated by the metadata fields 'dataFormat' and 'dataFormatVersion' + String data = "data_example"; // String | The document to be submitted, as indicated by the metadata fields 'dataFormat' and 'dataFormatVersion' String xAvalaraClient = "John's E-Invoicing-API Client"; // String | You can freely use any text you wish for this value. This feature can help you diagnose and solve problems with your software. The header can be treated like a fingerprint. try { DocumentSubmitResponse result = apiInstance.submitDocument(avalaraVersion, metadata, data, xAvalaraClient); @@ -430,7 +430,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **avalaraVersion** | **String**| The HTTP Header meant to specify the version of the API intended to be used | **metadata** | [**SubmitDocumentMetadata**](SubmitDocumentMetadata.md)| | - **data** | [**Object**](Object.md)| The document to be submitted, as indicated by the metadata fields 'dataFormat' and 'dataFormatVersion' | + **data** | **String**| The document to be submitted, as indicated by the metadata fields 'dataFormat' and 'dataFormatVersion' | **xAvalaraClient** | **String**| You can freely use any text you wish for this value. This feature can help you diagnose and solve problems with your software. The header can be treated like a fingerprint. | [optional] ### Return type diff --git a/src/main/java/Avalara/SDK/ApiClient.java b/src/main/java/Avalara/SDK/ApiClient.java index fcdcb43..6ec5d3a 100644 --- a/src/main/java/Avalara/SDK/ApiClient.java +++ b/src/main/java/Avalara/SDK/ApiClient.java @@ -28,9 +28,9 @@ import okio.BufferedSink; import okio.Okio; import org.apache.commons.lang3.StringUtils; -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import javax.net.ssl.*; import java.io.File; diff --git a/src/main/java/Avalara/SDK/AvalaraMicroservice.java b/src/main/java/Avalara/SDK/AvalaraMicroservice.java new file mode 100644 index 0000000..e6292fc --- /dev/null +++ b/src/main/java/Avalara/SDK/AvalaraMicroservice.java @@ -0,0 +1,5 @@ +package Avalara.SDK; + +public class AvalaraMicroservice { + +} diff --git a/src/main/java/Avalara/SDK/api/EInvoicing/V1/DocumentsApi.java b/src/main/java/Avalara/SDK/api/EInvoicing/V1/DocumentsApi.java index 83c9046..d90c30c 100644 --- a/src/main/java/Avalara/SDK/api/EInvoicing/V1/DocumentsApi.java +++ b/src/main/java/Avalara/SDK/api/EInvoicing/V1/DocumentsApi.java @@ -41,11 +41,11 @@ import Avalara.SDK.model.EInvoicing.V1.BadRequest; import java.math.BigDecimal; import Avalara.SDK.model.EInvoicing.V1.DocumentFetch; +import Avalara.SDK.model.EInvoicing.V1.DocumentFetchRequest; import Avalara.SDK.model.EInvoicing.V1.DocumentListResponse; import Avalara.SDK.model.EInvoicing.V1.DocumentStatusResponse; import Avalara.SDK.model.EInvoicing.V1.DocumentSubmissionError; import Avalara.SDK.model.EInvoicing.V1.DocumentSubmitResponse; -import Avalara.SDK.model.EInvoicing.V1.FetchDocumentsRequest; import java.io.File; import Avalara.SDK.model.EInvoicing.V1.ForbiddenError; import Avalara.SDK.model.EInvoicing.V1.InternalServerError; @@ -328,7 +328,7 @@ public okhttp3.Call fetchDocumentsCall(FetchDocumentsRequest requestParameters, basePath = null; } - Object localVarPostBody = requestParameters.getFetchDocumentsRequest(); + Object localVarPostBody = requestParameters.getDocumentFetchRequest(); // create path and map variables String localVarPath = "/documents/$fetch"; @@ -377,9 +377,9 @@ private okhttp3.Call fetchDocumentsValidateBeforeCall(FetchDocumentsRequest requ throw new ApiException("Missing the required parameter 'requestParameters.avalaraVersion' when calling fetchDocuments(Async)"); } - // verify the required parameter 'requestParameters.fetchDocumentsRequest' is set - if (requestParameters.getFetchDocumentsRequest() == null) { - throw new ApiException("Missing the required parameter 'requestParameters.fetchDocumentsRequest' when calling fetchDocuments(Async)"); + // verify the required parameter 'requestParameters.documentFetchRequest' is set + if (requestParameters.getDocumentFetchRequest() == null) { + throw new ApiException("Missing the required parameter 'requestParameters.documentFetchRequest' when calling fetchDocuments(Async)"); } @@ -456,12 +456,12 @@ public okhttp3.Call fetchDocumentsAsync(FetchDocumentsRequest requestParameters, * Represents the Request object for the FetchDocuments API * * @param avalaraVersion The HTTP Header meant to specify the version of the API intended to be used - * @param fetchDocumentsRequest + * @param documentFetchRequest * @param xAvalaraClient You can freely use any text you wish for this value. This feature can help you diagnose and solve problems with your software. The header can be treated like a fingerprint. (optional) */ public class FetchDocumentsRequest { private String avalaraVersion; - private FetchDocumentsRequest fetchDocumentsRequest; + private DocumentFetchRequest documentFetchRequest; private String xAvalaraClient; public FetchDocumentsRequest () { @@ -469,8 +469,8 @@ public FetchDocumentsRequest () { public String getAvalaraVersion() { return avalaraVersion; } public void setAvalaraVersion(String avalaraVersion) { this.avalaraVersion = avalaraVersion; } - public FetchDocumentsRequest getFetchDocumentsRequest() { return fetchDocumentsRequest; } - public void setFetchDocumentsRequest(FetchDocumentsRequest fetchDocumentsRequest) { this.fetchDocumentsRequest = fetchDocumentsRequest; } + public DocumentFetchRequest getDocumentFetchRequest() { return documentFetchRequest; } + public void setDocumentFetchRequest(DocumentFetchRequest documentFetchRequest) { this.documentFetchRequest = documentFetchRequest; } public String getXAvalaraClient() { return xAvalaraClient; } public void setXAvalaraClient(String xAvalaraClient) { this.xAvalaraClient = xAvalaraClient; } } @@ -1096,7 +1096,7 @@ public okhttp3.Call submitDocumentAsync(SubmitDocumentRequest requestParameters, public class SubmitDocumentRequest { private String avalaraVersion; private SubmitDocumentMetadata metadata; - private Object data; + private String data; private String xAvalaraClient; public SubmitDocumentRequest () { @@ -1106,8 +1106,8 @@ public SubmitDocumentRequest () { public void setAvalaraVersion(String avalaraVersion) { this.avalaraVersion = avalaraVersion; } public SubmitDocumentMetadata getMetadata() { return metadata; } public void setMetadata(SubmitDocumentMetadata metadata) { this.metadata = metadata; } - public Object getData() { return data; } - public void setData(Object data) { this.data = data; } + public String getData() { return data; } + public void setData(String data) { this.data = data; } public String getXAvalaraClient() { return xAvalaraClient; } public void setXAvalaraClient(String xAvalaraClient) { this.xAvalaraClient = xAvalaraClient; } } diff --git a/src/main/java/Avalara/SDK/model/EInvoicing/V1/DocumentFetchRequest.java b/src/main/java/Avalara/SDK/model/EInvoicing/V1/DocumentFetchRequest.java new file mode 100644 index 0000000..b7755ca --- /dev/null +++ b/src/main/java/Avalara/SDK/model/EInvoicing/V1/DocumentFetchRequest.java @@ -0,0 +1,266 @@ +/* + * AvaTax Software Development Kit for Java (JRE) + * + * (c) 2004-2022 Avalara, Inc. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * Avalara E-Invoicing API + * + * An API that supports sending data for an E-Invoicing compliance use-case. + * + * @author Sachin Baijal + * @author Jonathan Wenger + * @copyright 2004-2022 Avalara, Inc. + * @license https://www.apache.org/licenses/LICENSE-2.0 + * @version + * @link https://github.com/avadev/AvaTax-REST-V3-JRE-SDK + */ + +package Avalara.SDK.model.EInvoicing.V1; + +import java.util.Objects; +import Avalara.SDK.model.EInvoicing.V1.DocumentFetchRequestDataInner; +import Avalara.SDK.model.EInvoicing.V1.DocumentFetchRequestMetadata; +import com.google.gson.TypeAdapter; +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 java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +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.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import Avalara.SDK.JSON; + +/** + * DocumentFetchRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0") +public class DocumentFetchRequest { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data = new ArrayList<>(); + + public static final String SERIALIZED_NAME_METADATA = "metadata"; + @SerializedName(SERIALIZED_NAME_METADATA) + private DocumentFetchRequestMetadata metadata; + + public DocumentFetchRequest() { + } + + public DocumentFetchRequest data(List data) { + this.data = data; + return this; + } + + public DocumentFetchRequest addDataItem(DocumentFetchRequestDataInner dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Array of key-value pairs used to retrieve inbound documents from the Tax Authority + * @return data + */ + @javax.annotation.Nullable + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + + public DocumentFetchRequest metadata(DocumentFetchRequestMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get metadata + * @return metadata + */ + @javax.annotation.Nullable + public DocumentFetchRequestMetadata getMetadata() { + return metadata; + } + + public void setMetadata(DocumentFetchRequestMetadata metadata) { + this.metadata = metadata; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DocumentFetchRequest documentFetchRequest = (DocumentFetchRequest) o; + return Objects.equals(this.data, documentFetchRequest.data) && + Objects.equals(this.metadata, documentFetchRequest.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(data, metadata); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DocumentFetchRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).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 static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("metadata"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * 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 DocumentFetchRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DocumentFetchRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DocumentFetchRequest is not found in the empty JSON string", DocumentFetchRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DocumentFetchRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DocumentFetchRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + DocumentFetchRequestDataInner.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + // validate the optional field `metadata` + if (jsonObj.get("metadata") != null && !jsonObj.get("metadata").isJsonNull()) { + DocumentFetchRequestMetadata.validateJsonElement(jsonObj.get("metadata")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DocumentFetchRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DocumentFetchRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DocumentFetchRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DocumentFetchRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DocumentFetchRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DocumentFetchRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of DocumentFetchRequest + * @throws IOException if the JSON string is invalid with respect to DocumentFetchRequest + */ + public static DocumentFetchRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DocumentFetchRequest.class); + } + + /** + * Convert an instance of DocumentFetchRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/Avalara/SDK/model/EInvoicing/V1/DocumentFetchRequestDataInner.java b/src/main/java/Avalara/SDK/model/EInvoicing/V1/DocumentFetchRequestDataInner.java new file mode 100644 index 0000000..9f4694e --- /dev/null +++ b/src/main/java/Avalara/SDK/model/EInvoicing/V1/DocumentFetchRequestDataInner.java @@ -0,0 +1,251 @@ +/* + * AvaTax Software Development Kit for Java (JRE) + * + * (c) 2004-2022 Avalara, Inc. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * Avalara E-Invoicing API + * + * An API that supports sending data for an E-Invoicing compliance use-case. + * + * @author Sachin Baijal + * @author Jonathan Wenger + * @copyright 2004-2022 Avalara, Inc. + * @license https://www.apache.org/licenses/LICENSE-2.0 + * @version + * @link https://github.com/avadev/AvaTax-REST-V3-JRE-SDK + */ + +package Avalara.SDK.model.EInvoicing.V1; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +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 java.io.IOException; +import java.util.Arrays; + +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.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import Avalara.SDK.JSON; + +/** + * DocumentFetchRequestDataInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0") +public class DocumentFetchRequestDataInner { + public static final String SERIALIZED_NAME_KEY = "key"; + @SerializedName(SERIALIZED_NAME_KEY) + private String key; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private String value; + + public DocumentFetchRequestDataInner() { + } + + public DocumentFetchRequestDataInner key(String key) { + this.key = key; + return this; + } + + /** + * Descriptor of the identifier + * @return key + */ + @javax.annotation.Nonnull + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + + public DocumentFetchRequestDataInner value(String value) { + this.value = value; + return this; + } + + /** + * Value of the identifier + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DocumentFetchRequestDataInner documentFetchRequestDataInner = (DocumentFetchRequestDataInner) o; + return Objects.equals(this.key, documentFetchRequestDataInner.key) && + Objects.equals(this.value, documentFetchRequestDataInner.value); + } + + @Override + public int hashCode() { + return Objects.hash(key, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DocumentFetchRequestDataInner {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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 static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("key"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("key"); + openapiRequiredFields.add("value"); + } + + /** + * 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 DocumentFetchRequestDataInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DocumentFetchRequestDataInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DocumentFetchRequestDataInner is not found in the empty JSON string", DocumentFetchRequestDataInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DocumentFetchRequestDataInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DocumentFetchRequestDataInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DocumentFetchRequestDataInner.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())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("key").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").toString())); + } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DocumentFetchRequestDataInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DocumentFetchRequestDataInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DocumentFetchRequestDataInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DocumentFetchRequestDataInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DocumentFetchRequestDataInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DocumentFetchRequestDataInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of DocumentFetchRequestDataInner + * @throws IOException if the JSON string is invalid with respect to DocumentFetchRequestDataInner + */ + public static DocumentFetchRequestDataInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DocumentFetchRequestDataInner.class); + } + + /** + * Convert an instance of DocumentFetchRequestDataInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/Avalara/SDK/model/EInvoicing/V1/DocumentFetchRequestMetadata.java b/src/main/java/Avalara/SDK/model/EInvoicing/V1/DocumentFetchRequestMetadata.java new file mode 100644 index 0000000..df9eaed --- /dev/null +++ b/src/main/java/Avalara/SDK/model/EInvoicing/V1/DocumentFetchRequestMetadata.java @@ -0,0 +1,339 @@ +/* + * AvaTax Software Development Kit for Java (JRE) + * + * (c) 2004-2022 Avalara, Inc. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * Avalara E-Invoicing API + * + * An API that supports sending data for an E-Invoicing compliance use-case. + * + * @author Sachin Baijal + * @author Jonathan Wenger + * @copyright 2004-2022 Avalara, Inc. + * @license https://www.apache.org/licenses/LICENSE-2.0 + * @version + * @link https://github.com/avadev/AvaTax-REST-V3-JRE-SDK + */ + +package Avalara.SDK.model.EInvoicing.V1; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +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 java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +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.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import Avalara.SDK.JSON; + +/** + * DocumentFetchRequestMetadata + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0") +public class DocumentFetchRequestMetadata { + public static final String SERIALIZED_NAME_WORKFLOW_ID = "workflowId"; + @SerializedName(SERIALIZED_NAME_WORKFLOW_ID) + private String workflowId; + + public static final String SERIALIZED_NAME_DATA_FORMAT = "dataFormat"; + @SerializedName(SERIALIZED_NAME_DATA_FORMAT) + private String dataFormat; + + public static final String SERIALIZED_NAME_DATA_FORMAT_VERSION = "dataFormatVersion"; + @SerializedName(SERIALIZED_NAME_DATA_FORMAT_VERSION) + private BigDecimal dataFormatVersion; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + private String countryCode; + + public static final String SERIALIZED_NAME_COUNTRY_MANDATE = "countryMandate"; + @SerializedName(SERIALIZED_NAME_COUNTRY_MANDATE) + private String countryMandate; + + public DocumentFetchRequestMetadata() { + } + + public DocumentFetchRequestMetadata workflowId(String workflowId) { + this.workflowId = workflowId; + return this; + } + + /** + * Specifies a unique ID for this workflow. + * @return workflowId + */ + @javax.annotation.Nonnull + public String getWorkflowId() { + return workflowId; + } + + public void setWorkflowId(String workflowId) { + this.workflowId = workflowId; + } + + + public DocumentFetchRequestMetadata dataFormat(String dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + /** + * Specifies the data format for this workflow + * @return dataFormat + */ + @javax.annotation.Nonnull + public String getDataFormat() { + return dataFormat; + } + + public void setDataFormat(String dataFormat) { + this.dataFormat = dataFormat; + } + + + public DocumentFetchRequestMetadata dataFormatVersion(BigDecimal dataFormatVersion) { + this.dataFormatVersion = dataFormatVersion; + return this; + } + + /** + * Specifies the data format version number + * @return dataFormatVersion + */ + @javax.annotation.Nonnull + public BigDecimal getDataFormatVersion() { + return dataFormatVersion; + } + + public void setDataFormatVersion(BigDecimal dataFormatVersion) { + this.dataFormatVersion = dataFormatVersion; + } + + + public DocumentFetchRequestMetadata countryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * The two-letter ISO-3166 country code for the country for which document is being retrieved + * @return countryCode + */ + @javax.annotation.Nonnull + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + + + public DocumentFetchRequestMetadata countryMandate(String countryMandate) { + this.countryMandate = countryMandate; + return this; + } + + /** + * The e-invoicing mandate for the specified country + * @return countryMandate + */ + @javax.annotation.Nonnull + public String getCountryMandate() { + return countryMandate; + } + + public void setCountryMandate(String countryMandate) { + this.countryMandate = countryMandate; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DocumentFetchRequestMetadata documentFetchRequestMetadata = (DocumentFetchRequestMetadata) o; + return Objects.equals(this.workflowId, documentFetchRequestMetadata.workflowId) && + Objects.equals(this.dataFormat, documentFetchRequestMetadata.dataFormat) && + Objects.equals(this.dataFormatVersion, documentFetchRequestMetadata.dataFormatVersion) && + Objects.equals(this.countryCode, documentFetchRequestMetadata.countryCode) && + Objects.equals(this.countryMandate, documentFetchRequestMetadata.countryMandate); + } + + @Override + public int hashCode() { + return Objects.hash(workflowId, dataFormat, dataFormatVersion, countryCode, countryMandate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DocumentFetchRequestMetadata {\n"); + sb.append(" workflowId: ").append(toIndentedString(workflowId)).append("\n"); + sb.append(" dataFormat: ").append(toIndentedString(dataFormat)).append("\n"); + sb.append(" dataFormatVersion: ").append(toIndentedString(dataFormatVersion)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" countryMandate: ").append(toIndentedString(countryMandate)).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 static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("workflowId"); + openapiFields.add("dataFormat"); + openapiFields.add("dataFormatVersion"); + openapiFields.add("countryCode"); + openapiFields.add("countryMandate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("workflowId"); + openapiRequiredFields.add("dataFormat"); + openapiRequiredFields.add("dataFormatVersion"); + openapiRequiredFields.add("countryCode"); + openapiRequiredFields.add("countryMandate"); + } + + /** + * 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 DocumentFetchRequestMetadata + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DocumentFetchRequestMetadata.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DocumentFetchRequestMetadata is not found in the empty JSON string", DocumentFetchRequestMetadata.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DocumentFetchRequestMetadata.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DocumentFetchRequestMetadata` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DocumentFetchRequestMetadata.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())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("workflowId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `workflowId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("workflowId").toString())); + } + if (!jsonObj.get("dataFormat").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `dataFormat` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dataFormat").toString())); + } + if (!jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + if (!jsonObj.get("countryMandate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryMandate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryMandate").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DocumentFetchRequestMetadata.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DocumentFetchRequestMetadata' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DocumentFetchRequestMetadata.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DocumentFetchRequestMetadata value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DocumentFetchRequestMetadata read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DocumentFetchRequestMetadata given an JSON string + * + * @param jsonString JSON string + * @return An instance of DocumentFetchRequestMetadata + * @throws IOException if the JSON string is invalid with respect to DocumentFetchRequestMetadata + */ + public static DocumentFetchRequestMetadata fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DocumentFetchRequestMetadata.class); + } + + /** + * Convert an instance of DocumentFetchRequestMetadata to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +