|
| 1 | +""" |
| 2 | +AvaTax Software Development Kit for Python. |
| 3 | +
|
| 4 | + Copyright 2022 Avalara, Inc. |
| 5 | +
|
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | +
|
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +
|
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | +
|
| 18 | + Avalara 1099 & W-9 API Definition |
| 19 | + ## 🔐 Authentication Use **username/password** or generate a **license key** from: *Avalara Portal → Settings → License and API Keys*. [More on authentication methods](https://developer.avalara.com/avatax-dm-combined-erp/common-setup/authentication/authentication-methods/) [Test your credentials](https://developer.avalara.com/avatax/test-credentials/) ## 📘 API & SDK Documentation [Avalara SDK (.NET) on GitHub](https://github.com/avadev/Avalara-SDK-DotNet#avalarasdk--the-unified-c-library-for-next-gen-avalara-services) [Code Examples – 1099 API](https://github.com/avadev/Avalara-SDK-DotNet/blob/main/docs/A1099/V2/Class1099IssuersApi.md#call1099issuersget) |
| 20 | +
|
| 21 | +@author Sachin Baijal <[email protected]> |
| 22 | +@author Jonathan Wenger <[email protected]> |
| 23 | +@copyright 2022 Avalara, Inc. |
| 24 | +@license https://www.apache.org/licenses/LICENSE-2.0 |
| 25 | +@version 25.6.0 |
| 26 | +@link https://github.com/avadev/AvaTax-REST-V3-Python-SDK |
| 27 | +""" |
| 28 | + |
| 29 | +import re # noqa: F401 |
| 30 | +import sys # noqa: F401 |
| 31 | + |
| 32 | +from Avalara.SDK.api_client import ApiClient, Endpoint as _Endpoint |
| 33 | +from Avalara.SDK.model_utils import ( # noqa: F401 |
| 34 | + check_allowed_values, |
| 35 | + check_validations, |
| 36 | + date, |
| 37 | + datetime, |
| 38 | + file_type, |
| 39 | + none_type, |
| 40 | + validate_and_convert_types |
| 41 | +) |
| 42 | +from pydantic import Field, StrictStr |
| 43 | +from typing_extensions import Annotated |
| 44 | +from Avalara.SDK.models.A1099.V2.job_result import JobResult |
| 45 | +from Avalara.SDK.exceptions import ApiTypeError, ApiValueError, ApiException |
| 46 | +from Avalara.SDK.oauth_helper.AvalaraSdkOauthUtils import avalara_retry_oauth |
| 47 | + |
| 48 | +class Jobs1099Api(object): |
| 49 | + |
| 50 | + def __init__(self, api_client): |
| 51 | + self.__set_configuration(api_client) |
| 52 | + |
| 53 | + def __verify_api_client(self,api_client): |
| 54 | + if api_client is None: |
| 55 | + raise ApiValueError("APIClient not defined") |
| 56 | + |
| 57 | + def __set_configuration(self, api_client): |
| 58 | + self.__verify_api_client(api_client) |
| 59 | + api_client.set_sdk_version("25.6.0") |
| 60 | + self.api_client = api_client |
| 61 | + |
| 62 | + self.get_job_endpoint = _Endpoint( |
| 63 | + settings={ |
| 64 | + 'response_type': (JobResult,), |
| 65 | + 'auth': [ |
| 66 | + 'bearer' |
| 67 | + ], |
| 68 | + 'endpoint_path': '/1099/jobs/{id}', |
| 69 | + 'operation_id': 'get_job', |
| 70 | + 'http_method': 'GET', |
| 71 | + 'servers': None, |
| 72 | + }, |
| 73 | + params_map={ |
| 74 | + 'all': [ |
| 75 | + 'id', |
| 76 | + 'avalara_version', |
| 77 | + 'x_correlation_id', |
| 78 | + ], |
| 79 | + 'required': [ |
| 80 | + 'id', |
| 81 | + 'avalara_version', |
| 82 | + 'x_correlation_id', |
| 83 | + ], |
| 84 | + 'nullable': [ |
| 85 | + ], |
| 86 | + 'enum': [ |
| 87 | + ], |
| 88 | + 'validation': [ |
| 89 | + ] |
| 90 | + }, |
| 91 | + root_map={ |
| 92 | + 'validations': { |
| 93 | + }, |
| 94 | + 'allowed_values': { |
| 95 | + }, |
| 96 | + 'openapi_types': { |
| 97 | + 'id': |
| 98 | + (str,), |
| 99 | + 'avalara_version': |
| 100 | + (str,), |
| 101 | + 'x_correlation_id': |
| 102 | + (str,), |
| 103 | + }, |
| 104 | + 'attribute_map': { |
| 105 | + 'id': 'id', |
| 106 | + 'avalara_version': 'avalara-version', |
| 107 | + 'x_correlation_id': 'X-Correlation-Id', |
| 108 | + }, |
| 109 | + 'location_map': { |
| 110 | + 'id': 'path', |
| 111 | + 'avalara_version': 'header', |
| 112 | + 'x_correlation_id': 'header', |
| 113 | + }, |
| 114 | + 'collection_format_map': { |
| 115 | + } |
| 116 | + }, |
| 117 | + headers_map={ |
| 118 | + 'avalara-version': '2.0', |
| 119 | + 'accept': [ |
| 120 | + 'application/json' |
| 121 | + ], |
| 122 | + 'content_type': [], |
| 123 | + }, |
| 124 | + api_client=api_client, |
| 125 | + required_scopes='', |
| 126 | + microservice='A1099' |
| 127 | + ) |
| 128 | + |
| 129 | + @avalara_retry_oauth(max_retry_attempts=2) |
| 130 | + def get_job( |
| 131 | + self, |
| 132 | + id, |
| 133 | + avalara_version, |
| 134 | + x_correlation_id, |
| 135 | + **kwargs |
| 136 | + ): |
| 137 | + """Retrieves information about the job # noqa: E501 |
| 138 | +
|
| 139 | + Retrieves information about the job # noqa: E501 |
| 140 | + This method makes a synchronous HTTP request by default. To make an |
| 141 | + asynchronous HTTP request, please pass async_req=True |
| 142 | +
|
| 143 | + >>> thread = api.get_job(id, avalara_version, x_correlation_id, async_req=True) |
| 144 | + >>> result = thread.get() |
| 145 | +
|
| 146 | + Args: |
| 147 | + id (str): Job id obtained from other API responses, like `/1099/bulk-upsert`. |
| 148 | + avalara_version (str): API version |
| 149 | + x_correlation_id (str): Unique correlation Id in a GUID format |
| 150 | +
|
| 151 | + Keyword Args: |
| 152 | + _return_http_data_only (bool): response data without head status |
| 153 | + code and headers. Default is True. |
| 154 | + _preload_content (bool): if False, the urllib3.HTTPResponse object |
| 155 | + will be returned without reading/decoding response data. |
| 156 | + Default is True. |
| 157 | + _request_timeout (int/float/tuple): timeout setting for this request. If |
| 158 | + one number provided, it will be total request timeout. It can also |
| 159 | + be a pair (tuple) of (connection, read) timeouts. |
| 160 | + Default is None. |
| 161 | + _check_input_type (bool): specifies if type checking |
| 162 | + should be done one the data sent to the server. |
| 163 | + Default is True. |
| 164 | + _check_return_type (bool): specifies if type checking |
| 165 | + should be done one the data received from the server. |
| 166 | + Default is True. |
| 167 | + _host_index (int/None): specifies the index of the server |
| 168 | + that we want to use. |
| 169 | + Default is read from the configuration. |
| 170 | + async_req (bool): execute request asynchronously |
| 171 | +
|
| 172 | + Returns: |
| 173 | + JobResult |
| 174 | + If the method is called asynchronously, returns the request |
| 175 | + thread. |
| 176 | + """ |
| 177 | + self.__verify_api_client(self.api_client) |
| 178 | + kwargs['async_req'] = kwargs.get( |
| 179 | + 'async_req', False |
| 180 | + ) |
| 181 | + kwargs['_return_http_data_only'] = kwargs.get( |
| 182 | + '_return_http_data_only', True |
| 183 | + ) |
| 184 | + kwargs['_preload_content'] = kwargs.get( |
| 185 | + '_preload_content', True |
| 186 | + ) |
| 187 | + kwargs['_request_timeout'] = kwargs.get( |
| 188 | + '_request_timeout', None |
| 189 | + ) |
| 190 | + kwargs['_check_input_type'] = kwargs.get( |
| 191 | + '_check_input_type', True |
| 192 | + ) |
| 193 | + kwargs['_check_return_type'] = kwargs.get( |
| 194 | + '_check_return_type', True |
| 195 | + ) |
| 196 | + kwargs['_host_index'] = kwargs.get('_host_index') |
| 197 | + kwargs['id'] = id |
| 198 | + kwargs['avalara_version'] = avalara_version |
| 199 | + kwargs['x_correlation_id'] = x_correlation_id |
| 200 | + return self.get_job_endpoint.call_with_http_info(**kwargs) |
| 201 | + |
0 commit comments