qcs_api_client 0.27.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. qcs_api_client/__init__.py +1 -0
  2. qcs_api_client/api/__init__.py +1 -0
  3. qcs_api_client/api/account/__init__.py +1 -0
  4. qcs_api_client/api/account/activate_user.py +155 -0
  5. qcs_api_client/api/account/add_group_user.py +156 -0
  6. qcs_api_client/api/account/dismiss_viewer_announcement.py +145 -0
  7. qcs_api_client/api/account/get_group_balance.py +149 -0
  8. qcs_api_client/api/account/get_group_billing_customer.py +145 -0
  9. qcs_api_client/api/account/get_group_upcoming_billing_invoice.py +145 -0
  10. qcs_api_client/api/account/get_user_balance.py +149 -0
  11. qcs_api_client/api/account/get_user_billing_customer.py +145 -0
  12. qcs_api_client/api/account/get_user_event_billing_price.py +170 -0
  13. qcs_api_client/api/account/get_user_upcoming_billing_invoice.py +145 -0
  14. qcs_api_client/api/account/get_viewer_user_onboarding_completed.py +124 -0
  15. qcs_api_client/api/account/list_group_billing_invoice_lines.py +189 -0
  16. qcs_api_client/api/account/list_group_billing_invoices.py +177 -0
  17. qcs_api_client/api/account/list_group_upcoming_billing_invoice_lines.py +177 -0
  18. qcs_api_client/api/account/list_group_users.py +185 -0
  19. qcs_api_client/api/account/list_user_billing_invoice_lines.py +189 -0
  20. qcs_api_client/api/account/list_user_billing_invoices.py +177 -0
  21. qcs_api_client/api/account/list_user_groups.py +181 -0
  22. qcs_api_client/api/account/list_user_upcoming_billing_invoice_lines.py +177 -0
  23. qcs_api_client/api/account/list_viewer_announcements.py +178 -0
  24. qcs_api_client/api/account/put_viewer_user_onboarding_completed.py +150 -0
  25. qcs_api_client/api/account/remove_group_user.py +158 -0
  26. qcs_api_client/api/account/update_viewer_user_profile.py +150 -0
  27. qcs_api_client/api/authentication/__init__.py +1 -0
  28. qcs_api_client/api/authentication/auth_email_password_reset_token.py +153 -0
  29. qcs_api_client/api/authentication/auth_get_user.py +128 -0
  30. qcs_api_client/api/authentication/auth_reset_password.py +152 -0
  31. qcs_api_client/api/authentication/auth_reset_password_with_token.py +154 -0
  32. qcs_api_client/api/client_applications/__init__.py +1 -0
  33. qcs_api_client/api/client_applications/check_client_application.py +154 -0
  34. qcs_api_client/api/client_applications/get_client_application.py +151 -0
  35. qcs_api_client/api/client_applications/list_client_applications.py +129 -0
  36. qcs_api_client/api/default/__init__.py +1 -0
  37. qcs_api_client/api/default/get_health.py +123 -0
  38. qcs_api_client/api/default/health_check.py +124 -0
  39. qcs_api_client/api/default/health_check_deprecated.py +126 -0
  40. qcs_api_client/api/endpoints/__init__.py +1 -0
  41. qcs_api_client/api/endpoints/create_endpoint.py +157 -0
  42. qcs_api_client/api/endpoints/delete_endpoint.py +148 -0
  43. qcs_api_client/api/endpoints/get_default_endpoint.py +154 -0
  44. qcs_api_client/api/endpoints/get_endpoint.py +150 -0
  45. qcs_api_client/api/endpoints/list_endpoints.py +182 -0
  46. qcs_api_client/api/endpoints/restart_endpoint.py +168 -0
  47. qcs_api_client/api/engagements/__init__.py +1 -0
  48. qcs_api_client/api/engagements/create_engagement.py +196 -0
  49. qcs_api_client/api/quantum_processors/__init__.py +1 -0
  50. qcs_api_client/api/quantum_processors/get_instruction_set_architecture.py +144 -0
  51. qcs_api_client/api/quantum_processors/get_quantum_processor.py +148 -0
  52. qcs_api_client/api/quantum_processors/get_quantum_processor_accessors.py +150 -0
  53. qcs_api_client/api/quantum_processors/list_instruction_set_architectures.py +164 -0
  54. qcs_api_client/api/quantum_processors/list_quantum_processors.py +170 -0
  55. qcs_api_client/api/reservations/__init__.py +1 -0
  56. qcs_api_client/api/reservations/create_reservation.py +200 -0
  57. qcs_api_client/api/reservations/delete_reservation.py +149 -0
  58. qcs_api_client/api/reservations/find_available_reservations.py +211 -0
  59. qcs_api_client/api/reservations/get_quantum_processor_calendar.py +149 -0
  60. qcs_api_client/api/reservations/get_reservation.py +149 -0
  61. qcs_api_client/api/reservations/list_group_reservations.py +309 -0
  62. qcs_api_client/api/reservations/list_reservations.py +335 -0
  63. qcs_api_client/client/__init__.py +12 -0
  64. qcs_api_client/client/auth.py +78 -0
  65. qcs_api_client/client/client.py +48 -0
  66. qcs_api_client/errors.py +16 -0
  67. qcs_api_client/models/__init__.py +185 -0
  68. qcs_api_client/models/account_balance.py +72 -0
  69. qcs_api_client/models/account_type.py +9 -0
  70. qcs_api_client/models/activate_user_request.py +93 -0
  71. qcs_api_client/models/add_group_user_request.py +95 -0
  72. qcs_api_client/models/announcement.py +97 -0
  73. qcs_api_client/models/announcements_response.py +93 -0
  74. qcs_api_client/models/architecture.py +134 -0
  75. qcs_api_client/models/auth_email_password_reset_token_request.py +69 -0
  76. qcs_api_client/models/auth_reset_password_request.py +77 -0
  77. qcs_api_client/models/auth_reset_password_with_token_request.py +78 -0
  78. qcs_api_client/models/available_reservation.py +104 -0
  79. qcs_api_client/models/billing_customer.py +78 -0
  80. qcs_api_client/models/billing_invoice.py +130 -0
  81. qcs_api_client/models/billing_invoice_line.py +165 -0
  82. qcs_api_client/models/billing_invoice_line_line_item_type.py +9 -0
  83. qcs_api_client/models/billing_invoice_line_metadata.py +55 -0
  84. qcs_api_client/models/billing_invoice_status.py +12 -0
  85. qcs_api_client/models/billing_price.py +234 -0
  86. qcs_api_client/models/billing_price_object.py +8 -0
  87. qcs_api_client/models/billing_price_price_type.py +9 -0
  88. qcs_api_client/models/billing_price_recurrence.py +124 -0
  89. qcs_api_client/models/billing_price_recurrence_aggregate_usage.py +11 -0
  90. qcs_api_client/models/billing_price_recurrence_interval.py +11 -0
  91. qcs_api_client/models/billing_price_recurrence_usage_type.py +9 -0
  92. qcs_api_client/models/billing_price_scheme.py +9 -0
  93. qcs_api_client/models/billing_price_tiers_mode.py +9 -0
  94. qcs_api_client/models/billing_product.py +109 -0
  95. qcs_api_client/models/billing_product_object.py +8 -0
  96. qcs_api_client/models/billing_upcoming_invoice.py +122 -0
  97. qcs_api_client/models/characteristic.py +125 -0
  98. qcs_api_client/models/check_client_application_request.py +77 -0
  99. qcs_api_client/models/check_client_application_response.py +85 -0
  100. qcs_api_client/models/checksum_description.py +78 -0
  101. qcs_api_client/models/checksum_description_type.py +8 -0
  102. qcs_api_client/models/client_application.py +130 -0
  103. qcs_api_client/models/client_applications_download_link.py +100 -0
  104. qcs_api_client/models/code.py +17 -0
  105. qcs_api_client/models/create_endpoint_parameters.py +93 -0
  106. qcs_api_client/models/create_engagement_request.py +116 -0
  107. qcs_api_client/models/create_reservation_request.py +124 -0
  108. qcs_api_client/models/dictionary.py +55 -0
  109. qcs_api_client/models/edge.py +78 -0
  110. qcs_api_client/models/endpoint.py +140 -0
  111. qcs_api_client/models/endpoint_addresses.py +77 -0
  112. qcs_api_client/models/engagement_credentials.py +87 -0
  113. qcs_api_client/models/engagement_with_credentials.py +169 -0
  114. qcs_api_client/models/error.py +112 -0
  115. qcs_api_client/models/event_billing_price_rate.py +107 -0
  116. qcs_api_client/models/family.py +11 -0
  117. qcs_api_client/models/find_available_reservations_response.py +92 -0
  118. qcs_api_client/models/get_account_event_billing_price_request.py +81 -0
  119. qcs_api_client/models/group.py +112 -0
  120. qcs_api_client/models/health.py +69 -0
  121. qcs_api_client/models/instruction_set_architecture.py +142 -0
  122. qcs_api_client/models/invite_user_request.py +87 -0
  123. qcs_api_client/models/list_account_billing_invoice_lines_response.py +92 -0
  124. qcs_api_client/models/list_account_billing_invoices_response.py +92 -0
  125. qcs_api_client/models/list_client_applications_response.py +83 -0
  126. qcs_api_client/models/list_endpoints_response.py +93 -0
  127. qcs_api_client/models/list_group_reservations_show_deleted.py +9 -0
  128. qcs_api_client/models/list_group_users_response.py +92 -0
  129. qcs_api_client/models/list_groups_response.py +92 -0
  130. qcs_api_client/models/list_instruction_set_architecture_response.py +94 -0
  131. qcs_api_client/models/list_quantum_processor_accessors_response.py +92 -0
  132. qcs_api_client/models/list_quantum_processors_response.py +92 -0
  133. qcs_api_client/models/list_reservations_response.py +91 -0
  134. qcs_api_client/models/list_reservations_show_deleted.py +9 -0
  135. qcs_api_client/models/node.py +76 -0
  136. qcs_api_client/models/nomad_job_datacenters.py +10 -0
  137. qcs_api_client/models/operation.py +138 -0
  138. qcs_api_client/models/operation_site.py +93 -0
  139. qcs_api_client/models/parameter.py +70 -0
  140. qcs_api_client/models/product.py +10 -0
  141. qcs_api_client/models/quantum_processor.py +70 -0
  142. qcs_api_client/models/quantum_processor_accessor.py +112 -0
  143. qcs_api_client/models/quantum_processor_accessor_type.py +9 -0
  144. qcs_api_client/models/quantum_processor_calendar.py +69 -0
  145. qcs_api_client/models/remove_group_user_request.py +95 -0
  146. qcs_api_client/models/reservation.py +218 -0
  147. qcs_api_client/models/restart_endpoint_request.py +67 -0
  148. qcs_api_client/models/tier.py +113 -0
  149. qcs_api_client/models/update_viewer_user_profile_request.py +85 -0
  150. qcs_api_client/models/user.py +110 -0
  151. qcs_api_client/models/user_credentials.py +75 -0
  152. qcs_api_client/models/user_credentials_password.py +69 -0
  153. qcs_api_client/models/user_profile.py +93 -0
  154. qcs_api_client/models/validation_error.py +89 -0
  155. qcs_api_client/models/validation_error_in.py +11 -0
  156. qcs_api_client/models/validation_location.py +11 -0
  157. qcs_api_client/models/viewer_user_onboarding_completed.py +69 -0
  158. qcs_api_client/operations/__init__.py +8 -0
  159. qcs_api_client/operations/asyncio/__init__.py +121 -0
  160. qcs_api_client/operations/asyncio_from_dict/__init__.py +139 -0
  161. qcs_api_client/operations/sync/__init__.py +117 -0
  162. qcs_api_client/operations/sync_from_dict/__init__.py +133 -0
  163. qcs_api_client/py.typed +1 -0
  164. qcs_api_client/types.py +74 -0
  165. qcs_api_client/util/__init__.py +0 -0
  166. qcs_api_client/util/errors.py +32 -0
  167. qcs_api_client/util/retry.py +26 -0
  168. qcs_api_client/util/serialization.py +5 -0
  169. qcs_api_client-0.27.3.dist-info/METADATA +101 -0
  170. qcs_api_client-0.27.3.dist-info/RECORD +172 -0
  171. qcs_api_client-0.27.3.dist-info/WHEEL +4 -0
  172. qcs_api_client-0.27.3.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,145 @@
1
+ from typing import Any
2
+ from urllib.parse import quote
3
+
4
+ import httpx
5
+ from tenacity import retry
6
+
7
+ from ...models.billing_customer import BillingCustomer
8
+ from ...models.error import Error
9
+ from ...types import Response
10
+ from ...util.errors import QCSHTTPStatusError
11
+ from ...util.retry import DEFAULT_RETRY_ARGUMENTS
12
+
13
+
14
+ def _get_kwargs(
15
+ group_name: str,
16
+ ) -> dict[str, Any]:
17
+
18
+ _kwargs: dict[str, Any] = {
19
+ "method": "get",
20
+ "url": "/v1/groups/{group_name}/billingCustomer".format(
21
+ group_name=quote(str(group_name), safe=""),
22
+ ),
23
+ }
24
+
25
+ return _kwargs
26
+
27
+
28
+ def _parse_response(*, response: httpx.Response) -> BillingCustomer | Error | None:
29
+ if response.status_code == 200:
30
+ response_200 = BillingCustomer.from_dict(response.json())
31
+
32
+ return response_200
33
+
34
+ raise QCSHTTPStatusError(
35
+ message=f"Unexpected response: status code {response.status_code}",
36
+ response=response,
37
+ )
38
+
39
+
40
+ def _build_response(*, response: httpx.Response) -> Response[BillingCustomer | Error]:
41
+ """Construct the Response class from the raw ``httpx.Response``."""
42
+ return Response.build_from_httpx_response(response=response, parse_function=_parse_response)
43
+
44
+
45
+ @retry(**DEFAULT_RETRY_ARGUMENTS)
46
+ def sync(
47
+ group_name: str,
48
+ *,
49
+ client: httpx.Client,
50
+ httpx_request_kwargs: dict[str, Any] | None = None,
51
+ ) -> Response[BillingCustomer | Error]:
52
+ """Retrieve billing customer for a QCS group account.
53
+
54
+ Args:
55
+ group_name (str):
56
+
57
+ Raises:
58
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
59
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
60
+
61
+ Returns:
62
+ Response[BillingCustomer | Error]
63
+ """
64
+
65
+ httpx_request_kwargs = httpx_request_kwargs or {}
66
+
67
+ kwargs = _get_kwargs(
68
+ group_name=group_name,
69
+ )
70
+ kwargs.update(httpx_request_kwargs)
71
+ response = client.request(
72
+ **kwargs,
73
+ )
74
+
75
+ return _build_response(response=response)
76
+
77
+
78
+ @retry(**DEFAULT_RETRY_ARGUMENTS)
79
+ def sync_from_dict(
80
+ group_name: str,
81
+ *,
82
+ client: httpx.Client,
83
+ httpx_request_kwargs: dict[str, Any] | None = None,
84
+ ) -> Response[BillingCustomer | Error]:
85
+ httpx_request_kwargs = httpx_request_kwargs or {}
86
+
87
+ kwargs = _get_kwargs(
88
+ group_name=group_name,
89
+ client=client,
90
+ )
91
+ kwargs.update(httpx_request_kwargs)
92
+ response = client.request(
93
+ **kwargs,
94
+ )
95
+ return _build_response(response=response)
96
+
97
+
98
+ @retry(**DEFAULT_RETRY_ARGUMENTS)
99
+ async def asyncio(
100
+ group_name: str,
101
+ *,
102
+ client: httpx.AsyncClient,
103
+ httpx_request_kwargs: dict[str, Any] | None = None,
104
+ ) -> Response[BillingCustomer | Error]:
105
+ """Retrieve billing customer for a QCS group account.
106
+
107
+ Args:
108
+ group_name (str):
109
+
110
+ Raises:
111
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
112
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
113
+
114
+ Returns:
115
+ Response[BillingCustomer | Error]
116
+ """
117
+
118
+ httpx_request_kwargs = httpx_request_kwargs or {}
119
+ kwargs = _get_kwargs(
120
+ group_name=group_name,
121
+ )
122
+ kwargs.update(httpx_request_kwargs)
123
+ response = await client.request(**kwargs)
124
+ return _build_response(response=response)
125
+
126
+
127
+ @retry(**DEFAULT_RETRY_ARGUMENTS)
128
+ async def asyncio_from_dict(
129
+ group_name: str,
130
+ *,
131
+ client: httpx.AsyncClient,
132
+ httpx_request_kwargs: dict[str, Any] | None = None,
133
+ ) -> Response[BillingCustomer | Error]:
134
+ httpx_request_kwargs = httpx_request_kwargs or {}
135
+
136
+ kwargs = _get_kwargs(
137
+ group_name=group_name,
138
+ client=client,
139
+ )
140
+ kwargs.update(httpx_request_kwargs)
141
+ response = await client.request(
142
+ **kwargs,
143
+ )
144
+
145
+ return _build_response(response=response)
@@ -0,0 +1,145 @@
1
+ from typing import Any
2
+ from urllib.parse import quote
3
+
4
+ import httpx
5
+ from tenacity import retry
6
+
7
+ from ...models.billing_upcoming_invoice import BillingUpcomingInvoice
8
+ from ...models.error import Error
9
+ from ...types import Response
10
+ from ...util.errors import QCSHTTPStatusError
11
+ from ...util.retry import DEFAULT_RETRY_ARGUMENTS
12
+
13
+
14
+ def _get_kwargs(
15
+ group_name: str,
16
+ ) -> dict[str, Any]:
17
+
18
+ _kwargs: dict[str, Any] = {
19
+ "method": "get",
20
+ "url": "/v1/groups/{group_name}/billingInvoices:getUpcoming".format(
21
+ group_name=quote(str(group_name), safe=""),
22
+ ),
23
+ }
24
+
25
+ return _kwargs
26
+
27
+
28
+ def _parse_response(*, response: httpx.Response) -> BillingUpcomingInvoice | Error | None:
29
+ if response.status_code == 200:
30
+ response_200 = BillingUpcomingInvoice.from_dict(response.json())
31
+
32
+ return response_200
33
+
34
+ raise QCSHTTPStatusError(
35
+ message=f"Unexpected response: status code {response.status_code}",
36
+ response=response,
37
+ )
38
+
39
+
40
+ def _build_response(*, response: httpx.Response) -> Response[BillingUpcomingInvoice | Error]:
41
+ """Construct the Response class from the raw ``httpx.Response``."""
42
+ return Response.build_from_httpx_response(response=response, parse_function=_parse_response)
43
+
44
+
45
+ @retry(**DEFAULT_RETRY_ARGUMENTS)
46
+ def sync(
47
+ group_name: str,
48
+ *,
49
+ client: httpx.Client,
50
+ httpx_request_kwargs: dict[str, Any] | None = None,
51
+ ) -> Response[BillingUpcomingInvoice | Error]:
52
+ """Retrieve upcoming invoice for QCS group billing customer.
53
+
54
+ Args:
55
+ group_name (str):
56
+
57
+ Raises:
58
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
59
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
60
+
61
+ Returns:
62
+ Response[BillingUpcomingInvoice | Error]
63
+ """
64
+
65
+ httpx_request_kwargs = httpx_request_kwargs or {}
66
+
67
+ kwargs = _get_kwargs(
68
+ group_name=group_name,
69
+ )
70
+ kwargs.update(httpx_request_kwargs)
71
+ response = client.request(
72
+ **kwargs,
73
+ )
74
+
75
+ return _build_response(response=response)
76
+
77
+
78
+ @retry(**DEFAULT_RETRY_ARGUMENTS)
79
+ def sync_from_dict(
80
+ group_name: str,
81
+ *,
82
+ client: httpx.Client,
83
+ httpx_request_kwargs: dict[str, Any] | None = None,
84
+ ) -> Response[BillingUpcomingInvoice | Error]:
85
+ httpx_request_kwargs = httpx_request_kwargs or {}
86
+
87
+ kwargs = _get_kwargs(
88
+ group_name=group_name,
89
+ client=client,
90
+ )
91
+ kwargs.update(httpx_request_kwargs)
92
+ response = client.request(
93
+ **kwargs,
94
+ )
95
+ return _build_response(response=response)
96
+
97
+
98
+ @retry(**DEFAULT_RETRY_ARGUMENTS)
99
+ async def asyncio(
100
+ group_name: str,
101
+ *,
102
+ client: httpx.AsyncClient,
103
+ httpx_request_kwargs: dict[str, Any] | None = None,
104
+ ) -> Response[BillingUpcomingInvoice | Error]:
105
+ """Retrieve upcoming invoice for QCS group billing customer.
106
+
107
+ Args:
108
+ group_name (str):
109
+
110
+ Raises:
111
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
112
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
113
+
114
+ Returns:
115
+ Response[BillingUpcomingInvoice | Error]
116
+ """
117
+
118
+ httpx_request_kwargs = httpx_request_kwargs or {}
119
+ kwargs = _get_kwargs(
120
+ group_name=group_name,
121
+ )
122
+ kwargs.update(httpx_request_kwargs)
123
+ response = await client.request(**kwargs)
124
+ return _build_response(response=response)
125
+
126
+
127
+ @retry(**DEFAULT_RETRY_ARGUMENTS)
128
+ async def asyncio_from_dict(
129
+ group_name: str,
130
+ *,
131
+ client: httpx.AsyncClient,
132
+ httpx_request_kwargs: dict[str, Any] | None = None,
133
+ ) -> Response[BillingUpcomingInvoice | Error]:
134
+ httpx_request_kwargs = httpx_request_kwargs or {}
135
+
136
+ kwargs = _get_kwargs(
137
+ group_name=group_name,
138
+ client=client,
139
+ )
140
+ kwargs.update(httpx_request_kwargs)
141
+ response = await client.request(
142
+ **kwargs,
143
+ )
144
+
145
+ return _build_response(response=response)
@@ -0,0 +1,149 @@
1
+ from typing import Any
2
+ from urllib.parse import quote
3
+
4
+ import httpx
5
+ from tenacity import retry
6
+
7
+ from ...models.account_balance import AccountBalance
8
+ from ...models.error import Error
9
+ from ...types import Response
10
+ from ...util.errors import QCSHTTPStatusError
11
+ from ...util.retry import DEFAULT_RETRY_ARGUMENTS
12
+
13
+
14
+ def _get_kwargs(
15
+ user_id: str,
16
+ ) -> dict[str, Any]:
17
+
18
+ _kwargs: dict[str, Any] = {
19
+ "method": "get",
20
+ "url": "/v1/users/{user_id}/balance".format(
21
+ user_id=quote(str(user_id), safe=""),
22
+ ),
23
+ }
24
+
25
+ return _kwargs
26
+
27
+
28
+ def _parse_response(*, response: httpx.Response) -> AccountBalance | Error | None:
29
+ if response.status_code == 200:
30
+ response_200 = AccountBalance.from_dict(response.json())
31
+
32
+ return response_200
33
+
34
+ raise QCSHTTPStatusError(
35
+ message=f"Unexpected response: status code {response.status_code}",
36
+ response=response,
37
+ )
38
+
39
+
40
+ def _build_response(*, response: httpx.Response) -> Response[AccountBalance | Error]:
41
+ """Construct the Response class from the raw ``httpx.Response``."""
42
+ return Response.build_from_httpx_response(response=response, parse_function=_parse_response)
43
+
44
+
45
+ @retry(**DEFAULT_RETRY_ARGUMENTS)
46
+ def sync(
47
+ user_id: str,
48
+ *,
49
+ client: httpx.Client,
50
+ httpx_request_kwargs: dict[str, Any] | None = None,
51
+ ) -> Response[AccountBalance | Error]:
52
+ """Get User Balance
53
+
54
+ Retrieve the balance of the requested QCS user account.
55
+
56
+ Args:
57
+ user_id (str):
58
+
59
+ Raises:
60
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
61
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
62
+
63
+ Returns:
64
+ Response[AccountBalance | Error]
65
+ """
66
+
67
+ httpx_request_kwargs = httpx_request_kwargs or {}
68
+
69
+ kwargs = _get_kwargs(
70
+ user_id=user_id,
71
+ )
72
+ kwargs.update(httpx_request_kwargs)
73
+ response = client.request(
74
+ **kwargs,
75
+ )
76
+
77
+ return _build_response(response=response)
78
+
79
+
80
+ @retry(**DEFAULT_RETRY_ARGUMENTS)
81
+ def sync_from_dict(
82
+ user_id: str,
83
+ *,
84
+ client: httpx.Client,
85
+ httpx_request_kwargs: dict[str, Any] | None = None,
86
+ ) -> Response[AccountBalance | Error]:
87
+ httpx_request_kwargs = httpx_request_kwargs or {}
88
+
89
+ kwargs = _get_kwargs(
90
+ user_id=user_id,
91
+ client=client,
92
+ )
93
+ kwargs.update(httpx_request_kwargs)
94
+ response = client.request(
95
+ **kwargs,
96
+ )
97
+ return _build_response(response=response)
98
+
99
+
100
+ @retry(**DEFAULT_RETRY_ARGUMENTS)
101
+ async def asyncio(
102
+ user_id: str,
103
+ *,
104
+ client: httpx.AsyncClient,
105
+ httpx_request_kwargs: dict[str, Any] | None = None,
106
+ ) -> Response[AccountBalance | Error]:
107
+ """Get User Balance
108
+
109
+ Retrieve the balance of the requested QCS user account.
110
+
111
+ Args:
112
+ user_id (str):
113
+
114
+ Raises:
115
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
116
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
117
+
118
+ Returns:
119
+ Response[AccountBalance | Error]
120
+ """
121
+
122
+ httpx_request_kwargs = httpx_request_kwargs or {}
123
+ kwargs = _get_kwargs(
124
+ user_id=user_id,
125
+ )
126
+ kwargs.update(httpx_request_kwargs)
127
+ response = await client.request(**kwargs)
128
+ return _build_response(response=response)
129
+
130
+
131
+ @retry(**DEFAULT_RETRY_ARGUMENTS)
132
+ async def asyncio_from_dict(
133
+ user_id: str,
134
+ *,
135
+ client: httpx.AsyncClient,
136
+ httpx_request_kwargs: dict[str, Any] | None = None,
137
+ ) -> Response[AccountBalance | Error]:
138
+ httpx_request_kwargs = httpx_request_kwargs or {}
139
+
140
+ kwargs = _get_kwargs(
141
+ user_id=user_id,
142
+ client=client,
143
+ )
144
+ kwargs.update(httpx_request_kwargs)
145
+ response = await client.request(
146
+ **kwargs,
147
+ )
148
+
149
+ return _build_response(response=response)
@@ -0,0 +1,145 @@
1
+ from typing import Any
2
+ from urllib.parse import quote
3
+
4
+ import httpx
5
+ from tenacity import retry
6
+
7
+ from ...models.billing_customer import BillingCustomer
8
+ from ...models.error import Error
9
+ from ...types import Response
10
+ from ...util.errors import QCSHTTPStatusError
11
+ from ...util.retry import DEFAULT_RETRY_ARGUMENTS
12
+
13
+
14
+ def _get_kwargs(
15
+ user_id: str,
16
+ ) -> dict[str, Any]:
17
+
18
+ _kwargs: dict[str, Any] = {
19
+ "method": "get",
20
+ "url": "/v1/users/{user_id}/billingCustomer".format(
21
+ user_id=quote(str(user_id), safe=""),
22
+ ),
23
+ }
24
+
25
+ return _kwargs
26
+
27
+
28
+ def _parse_response(*, response: httpx.Response) -> BillingCustomer | Error | None:
29
+ if response.status_code == 200:
30
+ response_200 = BillingCustomer.from_dict(response.json())
31
+
32
+ return response_200
33
+
34
+ raise QCSHTTPStatusError(
35
+ message=f"Unexpected response: status code {response.status_code}",
36
+ response=response,
37
+ )
38
+
39
+
40
+ def _build_response(*, response: httpx.Response) -> Response[BillingCustomer | Error]:
41
+ """Construct the Response class from the raw ``httpx.Response``."""
42
+ return Response.build_from_httpx_response(response=response, parse_function=_parse_response)
43
+
44
+
45
+ @retry(**DEFAULT_RETRY_ARGUMENTS)
46
+ def sync(
47
+ user_id: str,
48
+ *,
49
+ client: httpx.Client,
50
+ httpx_request_kwargs: dict[str, Any] | None = None,
51
+ ) -> Response[BillingCustomer | Error]:
52
+ """Retrieve billing customer for a QCS user account.
53
+
54
+ Args:
55
+ user_id (str):
56
+
57
+ Raises:
58
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
59
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
60
+
61
+ Returns:
62
+ Response[BillingCustomer | Error]
63
+ """
64
+
65
+ httpx_request_kwargs = httpx_request_kwargs or {}
66
+
67
+ kwargs = _get_kwargs(
68
+ user_id=user_id,
69
+ )
70
+ kwargs.update(httpx_request_kwargs)
71
+ response = client.request(
72
+ **kwargs,
73
+ )
74
+
75
+ return _build_response(response=response)
76
+
77
+
78
+ @retry(**DEFAULT_RETRY_ARGUMENTS)
79
+ def sync_from_dict(
80
+ user_id: str,
81
+ *,
82
+ client: httpx.Client,
83
+ httpx_request_kwargs: dict[str, Any] | None = None,
84
+ ) -> Response[BillingCustomer | Error]:
85
+ httpx_request_kwargs = httpx_request_kwargs or {}
86
+
87
+ kwargs = _get_kwargs(
88
+ user_id=user_id,
89
+ client=client,
90
+ )
91
+ kwargs.update(httpx_request_kwargs)
92
+ response = client.request(
93
+ **kwargs,
94
+ )
95
+ return _build_response(response=response)
96
+
97
+
98
+ @retry(**DEFAULT_RETRY_ARGUMENTS)
99
+ async def asyncio(
100
+ user_id: str,
101
+ *,
102
+ client: httpx.AsyncClient,
103
+ httpx_request_kwargs: dict[str, Any] | None = None,
104
+ ) -> Response[BillingCustomer | Error]:
105
+ """Retrieve billing customer for a QCS user account.
106
+
107
+ Args:
108
+ user_id (str):
109
+
110
+ Raises:
111
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
112
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
113
+
114
+ Returns:
115
+ Response[BillingCustomer | Error]
116
+ """
117
+
118
+ httpx_request_kwargs = httpx_request_kwargs or {}
119
+ kwargs = _get_kwargs(
120
+ user_id=user_id,
121
+ )
122
+ kwargs.update(httpx_request_kwargs)
123
+ response = await client.request(**kwargs)
124
+ return _build_response(response=response)
125
+
126
+
127
+ @retry(**DEFAULT_RETRY_ARGUMENTS)
128
+ async def asyncio_from_dict(
129
+ user_id: str,
130
+ *,
131
+ client: httpx.AsyncClient,
132
+ httpx_request_kwargs: dict[str, Any] | None = None,
133
+ ) -> Response[BillingCustomer | Error]:
134
+ httpx_request_kwargs = httpx_request_kwargs or {}
135
+
136
+ kwargs = _get_kwargs(
137
+ user_id=user_id,
138
+ client=client,
139
+ )
140
+ kwargs.update(httpx_request_kwargs)
141
+ response = await client.request(
142
+ **kwargs,
143
+ )
144
+
145
+ return _build_response(response=response)