|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +""" |
| 4 | + OAuthService |
| 5 | +
|
| 6 | + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 |
| 7 | +
|
| 8 | + The version of the OpenAPI document: v1 |
| 9 | + Generated by: https://openapi-generator.tech |
| 10 | +""" |
| 11 | + |
| 12 | + |
| 13 | +from __future__ import absolute_import |
| 14 | + |
| 15 | +import re # noqa: F401 |
| 16 | + |
| 17 | +# python 2 and python 3 compatibility library |
| 18 | +import six |
| 19 | + |
| 20 | +from hubspot.auth.oauth.api_client import ApiClient |
| 21 | +from hubspot.auth.oauth.exceptions import ApiTypeError, ApiValueError # noqa: F401 |
| 22 | + |
| 23 | + |
| 24 | +class AccessTokensApi(object): |
| 25 | + """NOTE: This class is auto generated by OpenAPI Generator |
| 26 | + Ref: https://openapi-generator.tech |
| 27 | +
|
| 28 | + Do not edit the class manually. |
| 29 | + """ |
| 30 | + |
| 31 | + def __init__(self, api_client=None): |
| 32 | + if api_client is None: |
| 33 | + api_client = ApiClient() |
| 34 | + self.api_client = api_client |
| 35 | + |
| 36 | + def get_access_token(self, token, **kwargs): # noqa: E501 |
| 37 | + """get_access_token # noqa: E501 |
| 38 | +
|
| 39 | + This method makes a synchronous HTTP request by default. To make an |
| 40 | + asynchronous HTTP request, please pass async_req=True |
| 41 | + >>> thread = api.get_access_token(token, async_req=True) |
| 42 | + >>> result = thread.get() |
| 43 | +
|
| 44 | + :param async_req bool: execute request asynchronously |
| 45 | + :param str token: (required) |
| 46 | + :param _preload_content: if False, the urllib3.HTTPResponse object will |
| 47 | + be returned without reading/decoding response |
| 48 | + data. Default is True. |
| 49 | + :param _request_timeout: timeout setting for this request. If one |
| 50 | + number provided, it will be total request |
| 51 | + timeout. It can also be a pair (tuple) of |
| 52 | + (connection, read) timeouts. |
| 53 | + :return: AccessTokenInfoResponse |
| 54 | + If the method is called asynchronously, |
| 55 | + returns the request thread. |
| 56 | + """ |
| 57 | + kwargs["_return_http_data_only"] = True |
| 58 | + return self.get_access_token_with_http_info(token, **kwargs) # noqa: E501 |
| 59 | + |
| 60 | + def get_access_token_with_http_info(self, token, **kwargs): # noqa: E501 |
| 61 | + """get_access_token # noqa: E501 |
| 62 | +
|
| 63 | + This method makes a synchronous HTTP request by default. To make an |
| 64 | + asynchronous HTTP request, please pass async_req=True |
| 65 | + >>> thread = api.get_access_token_with_http_info(token, async_req=True) |
| 66 | + >>> result = thread.get() |
| 67 | +
|
| 68 | + :param async_req bool: execute request asynchronously |
| 69 | + :param str token: (required) |
| 70 | + :param _return_http_data_only: response data without head status code |
| 71 | + and headers |
| 72 | + :param _preload_content: if False, the urllib3.HTTPResponse object will |
| 73 | + be returned without reading/decoding response |
| 74 | + data. Default is True. |
| 75 | + :param _request_timeout: timeout setting for this request. If one |
| 76 | + number provided, it will be total request |
| 77 | + timeout. It can also be a pair (tuple) of |
| 78 | + (connection, read) timeouts. |
| 79 | + :return: tuple(AccessTokenInfoResponse, status_code(int), headers(HTTPHeaderDict)) |
| 80 | + If the method is called asynchronously, |
| 81 | + returns the request thread. |
| 82 | + """ |
| 83 | + |
| 84 | + local_var_params = locals() |
| 85 | + |
| 86 | + all_params = ["token"] |
| 87 | + all_params.extend(["async_req", "_return_http_data_only", "_preload_content", "_request_timeout"]) |
| 88 | + |
| 89 | + for key, val in six.iteritems(local_var_params["kwargs"]): |
| 90 | + if key not in all_params: |
| 91 | + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_access_token" % key) |
| 92 | + local_var_params[key] = val |
| 93 | + del local_var_params["kwargs"] |
| 94 | + # verify the required parameter 'token' is set |
| 95 | + if self.api_client.client_side_validation and ("token" not in local_var_params or local_var_params["token"] is None): # noqa: E501 # noqa: E501 |
| 96 | + raise ApiValueError("Missing the required parameter `token` when calling `get_access_token`") # noqa: E501 |
| 97 | + |
| 98 | + collection_formats = {} |
| 99 | + |
| 100 | + path_params = {} |
| 101 | + if "token" in local_var_params: |
| 102 | + path_params["token"] = local_var_params["token"] # noqa: E501 |
| 103 | + |
| 104 | + query_params = [] |
| 105 | + |
| 106 | + header_params = {} |
| 107 | + |
| 108 | + form_params = [] |
| 109 | + local_var_files = {} |
| 110 | + |
| 111 | + body_params = None |
| 112 | + # HTTP header `Accept` |
| 113 | + header_params["Accept"] = self.api_client.select_header_accept(["application/json", "*/*"]) # noqa: E501 |
| 114 | + |
| 115 | + # Authentication setting |
| 116 | + auth_settings = [] # noqa: E501 |
| 117 | + |
| 118 | + return self.api_client.call_api( |
| 119 | + "/oauth/v1/access-tokens/{token}", |
| 120 | + "GET", |
| 121 | + path_params, |
| 122 | + query_params, |
| 123 | + header_params, |
| 124 | + body=body_params, |
| 125 | + post_params=form_params, |
| 126 | + files=local_var_files, |
| 127 | + response_type="AccessTokenInfoResponse", # noqa: E501 |
| 128 | + auth_settings=auth_settings, |
| 129 | + async_req=local_var_params.get("async_req"), |
| 130 | + _return_http_data_only=local_var_params.get("_return_http_data_only"), # noqa: E501 |
| 131 | + _preload_content=local_var_params.get("_preload_content", True), |
| 132 | + _request_timeout=local_var_params.get("_request_timeout"), |
| 133 | + collection_formats=collection_formats, |
| 134 | + ) |
0 commit comments