ory-client 1.9.0__py3-none-any.whl → 1.11.7__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 (565) hide show
  1. ory_client/__init__.py +279 -10
  2. ory_client/api/__init__.py +16 -3
  3. ory_client/api/courier_api.py +576 -287
  4. ory_client/api/events_api.py +1147 -576
  5. ory_client/api/frontend_api.py +8736 -4145
  6. ory_client/api/identity_api.py +5219 -2605
  7. ory_client/api/jwk_api.py +1881 -939
  8. ory_client/api/metadata_api.py +245 -376
  9. ory_client/api/o_auth2_api.py +7763 -3858
  10. ory_client/api/oidc_api.py +2071 -1034
  11. ory_client/api/permission_api.py +1675 -776
  12. ory_client/api/project_api.py +5314 -2638
  13. ory_client/api/relationship_api.py +1844 -860
  14. ory_client/api/wellknown_api.py +250 -131
  15. ory_client/api_client.py +520 -658
  16. ory_client/api_response.py +21 -0
  17. ory_client/configuration.py +65 -75
  18. ory_client/exceptions.py +73 -32
  19. ory_client/models/__init__.py +266 -291
  20. ory_client/models/accept_o_auth2_consent_request.py +118 -0
  21. ory_client/models/accept_o_auth2_consent_request_session.py +113 -0
  22. ory_client/models/accept_o_auth2_login_request.py +117 -0
  23. ory_client/models/active_project_in_console.py +101 -0
  24. ory_client/models/attribute.py +103 -0
  25. ory_client/models/attribute_filter.py +115 -0
  26. ory_client/models/attributes_count_datapoint.py +103 -0
  27. ory_client/models/authenticator_assurance_level.py +40 -0
  28. ory_client/models/batch_patch_identities_response.py +109 -0
  29. ory_client/models/check_opl_syntax_result.py +109 -0
  30. ory_client/models/check_permission_result.py +101 -0
  31. ory_client/models/cloud_account.py +105 -0
  32. ory_client/models/consistency_request_parameters.py +111 -0
  33. ory_client/models/continue_with.py +214 -0
  34. ory_client/models/continue_with_recovery_ui.py +114 -0
  35. ory_client/models/continue_with_recovery_ui_flow.py +103 -0
  36. ory_client/models/continue_with_set_ory_session_token.py +110 -0
  37. ory_client/models/continue_with_settings_ui.py +114 -0
  38. ory_client/models/continue_with_settings_ui_flow.py +101 -0
  39. ory_client/models/continue_with_verification_ui.py +114 -0
  40. ory_client/models/continue_with_verification_ui_flow.py +105 -0
  41. ory_client/models/courier_message_status.py +40 -0
  42. ory_client/models/courier_message_type.py +38 -0
  43. ory_client/models/create_custom_domain_body.py +109 -0
  44. ory_client/models/create_event_stream_body.py +112 -0
  45. ory_client/models/create_identity_body.py +155 -0
  46. ory_client/models/create_invite_response.py +114 -0
  47. ory_client/models/create_json_web_key_set.py +105 -0
  48. ory_client/models/create_project_api_key_request.py +101 -0
  49. ory_client/models/create_project_body.py +112 -0
  50. ory_client/models/create_project_branding.py +115 -0
  51. ory_client/models/create_project_member_invite_body.py +101 -0
  52. ory_client/models/create_project_normalized_payload.py +685 -0
  53. ory_client/models/create_recovery_code_for_identity_body.py +114 -0
  54. ory_client/models/create_recovery_link_for_identity_body.py +114 -0
  55. ory_client/models/create_relationship_body.py +113 -0
  56. ory_client/models/create_subscription_body.py +126 -0
  57. ory_client/models/create_subscription_common.py +124 -0
  58. ory_client/models/create_verifiable_credential_request_body.py +109 -0
  59. ory_client/models/create_workspace_member_invite_body.py +101 -0
  60. ory_client/models/create_workspace_payload.py +101 -0
  61. ory_client/models/create_workspace_subscription_body.py +124 -0
  62. ory_client/models/credential_supported_draft00.py +107 -0
  63. ory_client/models/custom_domain.py +132 -0
  64. ory_client/models/delete_my_sessions_count.py +101 -0
  65. ory_client/models/email_template_data.py +107 -0
  66. ory_client/models/email_template_data_body.py +103 -0
  67. ory_client/models/error_authenticator_assurance_level_not_satisfied.py +107 -0
  68. ory_client/models/error_browser_location_change_required.py +107 -0
  69. ory_client/models/error_flow_replaced.py +107 -0
  70. ory_client/models/error_generic.py +105 -0
  71. ory_client/models/error_o_auth2.py +109 -0
  72. ory_client/models/event_stream.py +112 -0
  73. ory_client/models/expanded_permission_tree.py +125 -0
  74. ory_client/models/flow_error.py +108 -0
  75. ory_client/models/generic_error.py +126 -0
  76. ory_client/models/generic_error_content.py +109 -0
  77. ory_client/models/generic_usage.py +103 -0
  78. ory_client/models/get_attributes_count_response.py +111 -0
  79. ory_client/models/get_managed_identity_schema_location.py +101 -0
  80. ory_client/models/get_metrics_event_attributes_response.py +103 -0
  81. ory_client/models/get_metrics_event_types_response.py +103 -0
  82. ory_client/models/get_organization_response.py +105 -0
  83. ory_client/models/get_project_events_body.py +120 -0
  84. ory_client/models/get_project_events_response.py +115 -0
  85. ory_client/models/get_project_metrics_response.py +111 -0
  86. ory_client/models/get_session_activity_response.py +111 -0
  87. ory_client/models/get_version200_response.py +101 -0
  88. ory_client/models/health_not_ready_status.py +101 -0
  89. ory_client/models/health_status.py +101 -0
  90. ory_client/models/identity.py +187 -0
  91. ory_client/models/identity_credentials.py +122 -0
  92. ory_client/models/identity_credentials_code.py +109 -0
  93. ory_client/models/identity_credentials_oidc.py +109 -0
  94. ory_client/models/identity_credentials_oidc_provider.py +111 -0
  95. ory_client/models/identity_credentials_password.py +101 -0
  96. ory_client/models/identity_patch.py +107 -0
  97. ory_client/models/identity_patch_response.py +115 -0
  98. ory_client/models/identity_schema_container.py +103 -0
  99. ory_client/models/identity_schema_preset.py +103 -0
  100. ory_client/models/identity_with_credentials.py +111 -0
  101. ory_client/models/identity_with_credentials_oidc.py +105 -0
  102. ory_client/models/identity_with_credentials_oidc_config.py +115 -0
  103. ory_client/models/identity_with_credentials_oidc_config_provider.py +103 -0
  104. ory_client/models/identity_with_credentials_password.py +105 -0
  105. ory_client/models/identity_with_credentials_password_config.py +103 -0
  106. ory_client/models/internal_get_project_branding_body.py +101 -0
  107. ory_client/models/internal_is_ax_welcome_screen_enabled_for_project_body.py +103 -0
  108. ory_client/models/internal_is_owner_for_project_by_slug_body.py +114 -0
  109. ory_client/models/internal_is_owner_for_project_by_slug_response.py +101 -0
  110. ory_client/models/introspected_o_auth2_token.py +127 -0
  111. ory_client/models/is_owner_for_project_by_slug.py +103 -0
  112. ory_client/models/json_patch.py +119 -0
  113. ory_client/models/json_web_key.py +133 -0
  114. ory_client/models/json_web_key_set.py +109 -0
  115. ory_client/models/keto_namespace.py +103 -0
  116. ory_client/models/list_event_streams.py +109 -0
  117. ory_client/models/list_my_workspaces_response.py +113 -0
  118. ory_client/models/list_organizations_response.py +109 -0
  119. ory_client/models/list_workspace_projects_response.py +113 -0
  120. ory_client/models/login_flow.py +165 -0
  121. ory_client/models/login_flow_state.py +39 -0
  122. ory_client/models/logout_flow.py +103 -0
  123. ory_client/models/managed_identity_schema.py +120 -0
  124. ory_client/models/managed_identity_schema_validation_result.py +103 -0
  125. ory_client/models/member_invite.py +148 -0
  126. ory_client/models/message.py +141 -0
  127. ory_client/models/message_dispatch.py +119 -0
  128. ory_client/models/metrics_datapoint.py +104 -0
  129. ory_client/models/migration_options.py +117 -0
  130. ory_client/models/namespace.py +101 -0
  131. ory_client/models/needs_privileged_session_error.py +107 -0
  132. ory_client/models/normalized_project.py +171 -0
  133. ory_client/models/normalized_project_revision.py +674 -0
  134. ory_client/models/normalized_project_revision_courier_channel.py +145 -0
  135. ory_client/models/normalized_project_revision_hook.py +140 -0
  136. ory_client/models/normalized_project_revision_identity_schema.py +133 -0
  137. ory_client/models/normalized_project_revision_third_party_provider.py +187 -0
  138. ory_client/models/normalized_project_revision_tokenizer_template.py +133 -0
  139. ory_client/models/o_auth2_client.py +352 -0
  140. ory_client/models/o_auth2_client_token_lifespans.py +270 -0
  141. ory_client/models/o_auth2_consent_request.py +133 -0
  142. ory_client/models/o_auth2_consent_request_open_id_connect_context.py +109 -0
  143. ory_client/models/o_auth2_consent_session.py +130 -0
  144. ory_client/models/o_auth2_consent_session_expires_at.py +110 -0
  145. ory_client/models/o_auth2_login_request.py +125 -0
  146. ory_client/models/o_auth2_logout_request.py +115 -0
  147. ory_client/models/o_auth2_redirect_to.py +101 -0
  148. ory_client/models/o_auth2_token_exchange.py +111 -0
  149. ory_client/models/oidc_configuration.py +169 -0
  150. ory_client/models/oidc_user_info.py +137 -0
  151. ory_client/models/organization.py +116 -0
  152. ory_client/models/organization_body.py +103 -0
  153. ory_client/models/pagination.py +104 -0
  154. ory_client/models/pagination_headers.py +103 -0
  155. ory_client/models/parse_error.py +112 -0
  156. ory_client/models/patch_identities_body.py +109 -0
  157. ory_client/models/perform_native_logout_body.py +101 -0
  158. ory_client/models/permissions_on_workpace_response.py +101 -0
  159. ory_client/models/plan.py +103 -0
  160. ory_client/models/plan_details.py +128 -0
  161. ory_client/models/post_check_permission_body.py +113 -0
  162. ory_client/models/post_check_permission_or_error_body.py +113 -0
  163. ory_client/models/project.py +148 -0
  164. ory_client/models/project_api_key.py +126 -0
  165. ory_client/models/project_branding.py +129 -0
  166. ory_client/models/project_branding_colors.py +157 -0
  167. ory_client/models/project_branding_theme.py +182 -0
  168. ory_client/models/project_cors.py +103 -0
  169. ory_client/models/project_events_datapoint.py +114 -0
  170. ory_client/models/project_host.py +107 -0
  171. ory_client/models/project_member.py +107 -0
  172. ory_client/models/project_metadata.py +161 -0
  173. ory_client/models/project_service_identity.py +101 -0
  174. ory_client/models/project_service_o_auth2.py +101 -0
  175. ory_client/models/project_service_permission.py +101 -0
  176. ory_client/models/project_services.py +117 -0
  177. ory_client/models/quota_usage.py +118 -0
  178. ory_client/models/recovery_code_for_identity.py +106 -0
  179. ory_client/models/recovery_flow.py +139 -0
  180. ory_client/models/recovery_flow_state.py +39 -0
  181. ory_client/models/recovery_identity_address.py +110 -0
  182. ory_client/models/recovery_link_for_identity.py +104 -0
  183. ory_client/models/registration_flow.py +156 -0
  184. ory_client/models/registration_flow_state.py +39 -0
  185. ory_client/models/reject_o_auth2_request.py +109 -0
  186. ory_client/models/relation_query.py +113 -0
  187. ory_client/models/relationship.py +113 -0
  188. ory_client/models/relationship_namespaces.py +109 -0
  189. ory_client/models/relationship_patch.py +117 -0
  190. ory_client/models/relationships.py +111 -0
  191. ory_client/models/rfc6749_error_json.py +109 -0
  192. ory_client/models/schema_patch.py +103 -0
  193. ory_client/models/self_service_flow_expired_error.py +112 -0
  194. ory_client/models/session.py +141 -0
  195. ory_client/models/session_activity_datapoint.py +105 -0
  196. ory_client/models/session_authentication_method.py +121 -0
  197. ory_client/models/session_device.py +107 -0
  198. ory_client/models/set_active_project_in_console_body.py +101 -0
  199. ory_client/models/set_custom_domain_body.py +109 -0
  200. ory_client/models/set_event_stream_body.py +112 -0
  201. ory_client/models/set_project.py +118 -0
  202. ory_client/models/set_project_branding_theme_body.py +115 -0
  203. ory_client/models/settings_flow.py +145 -0
  204. ory_client/models/settings_flow_state.py +38 -0
  205. ory_client/models/source_position.py +103 -0
  206. ory_client/models/subject_set.py +105 -0
  207. ory_client/models/subscription.py +179 -0
  208. ory_client/models/successful_code_exchange_response.py +107 -0
  209. ory_client/models/successful_native_login.py +117 -0
  210. ory_client/models/successful_native_registration.py +123 -0
  211. ory_client/models/successful_project_update.py +115 -0
  212. ory_client/models/token_pagination.py +104 -0
  213. ory_client/models/token_pagination_headers.py +103 -0
  214. ory_client/models/token_pagination_request_parameters.py +104 -0
  215. ory_client/models/token_pagination_response_headers.py +103 -0
  216. ory_client/models/trust_o_auth2_jwt_grant_issuer.py +116 -0
  217. ory_client/models/trusted_o_auth2_jwt_grant_issuer.py +120 -0
  218. ory_client/models/trusted_o_auth2_jwt_grant_json_web_key.py +103 -0
  219. ory_client/models/ui_container.py +123 -0
  220. ory_client/models/ui_node.py +139 -0
  221. ory_client/models/ui_node_anchor_attributes.py +118 -0
  222. ory_client/models/ui_node_attributes.py +238 -0
  223. ory_client/models/ui_node_image_attributes.py +116 -0
  224. ory_client/models/ui_node_input_attributes.py +154 -0
  225. ory_client/models/ui_node_meta.py +105 -0
  226. ory_client/models/ui_node_script_attributes.py +124 -0
  227. ory_client/models/ui_node_text_attributes.py +116 -0
  228. ory_client/models/ui_text.py +114 -0
  229. ory_client/models/update_identity_body.py +132 -0
  230. ory_client/models/update_login_flow_body.py +286 -0
  231. ory_client/models/update_login_flow_with_code_method.py +111 -0
  232. ory_client/models/update_login_flow_with_lookup_secret_method.py +105 -0
  233. ory_client/models/update_login_flow_with_oidc_method.py +115 -0
  234. ory_client/models/update_login_flow_with_passkey_method.py +105 -0
  235. ory_client/models/update_login_flow_with_password_method.py +111 -0
  236. ory_client/models/update_login_flow_with_totp_method.py +107 -0
  237. ory_client/models/update_login_flow_with_web_authn_method.py +109 -0
  238. ory_client/models/update_recovery_flow_body.py +166 -0
  239. ory_client/models/update_recovery_flow_with_code_method.py +116 -0
  240. ory_client/models/update_recovery_flow_with_link_method.py +114 -0
  241. ory_client/models/update_registration_flow_body.py +238 -0
  242. ory_client/models/update_registration_flow_with_code_method.py +111 -0
  243. ory_client/models/update_registration_flow_with_oidc_method.py +115 -0
  244. ory_client/models/update_registration_flow_with_passkey_method.py +109 -0
  245. ory_client/models/update_registration_flow_with_password_method.py +109 -0
  246. ory_client/models/update_registration_flow_with_profile_method.py +109 -0
  247. ory_client/models/update_registration_flow_with_web_authn_method.py +111 -0
  248. ory_client/models/update_settings_flow_body.py +286 -0
  249. ory_client/models/update_settings_flow_with_lookup_method.py +113 -0
  250. ory_client/models/update_settings_flow_with_oidc_method.py +113 -0
  251. ory_client/models/update_settings_flow_with_passkey_method.py +107 -0
  252. ory_client/models/update_settings_flow_with_password_method.py +107 -0
  253. ory_client/models/update_settings_flow_with_profile_method.py +107 -0
  254. ory_client/models/update_settings_flow_with_totp_method.py +109 -0
  255. ory_client/models/update_settings_flow_with_web_authn_method.py +111 -0
  256. ory_client/models/update_subscription_body.py +112 -0
  257. ory_client/models/update_verification_flow_body.py +166 -0
  258. ory_client/models/update_verification_flow_with_code_method.py +116 -0
  259. ory_client/models/update_verification_flow_with_link_method.py +114 -0
  260. ory_client/models/update_workspace_payload.py +101 -0
  261. ory_client/models/usage.py +105 -0
  262. ory_client/models/verifiable_credential_priming_response.py +115 -0
  263. ory_client/models/verifiable_credential_proof.py +103 -0
  264. ory_client/models/verifiable_credential_response.py +103 -0
  265. ory_client/models/verifiable_identity_address.py +123 -0
  266. ory_client/models/verification_flow.py +129 -0
  267. ory_client/models/verification_flow_state.py +39 -0
  268. ory_client/models/version.py +101 -0
  269. ory_client/models/warning.py +103 -0
  270. ory_client/models/workspace.py +115 -0
  271. ory_client/models/workspace_meta.py +122 -0
  272. ory_client/py.typed +0 -0
  273. ory_client/rest.py +139 -236
  274. {ory_client-1.9.0.dist-info → ory_client-1.11.7.dist-info}/METADATA +6 -4
  275. ory_client-1.11.7.dist-info/RECORD +278 -0
  276. ory_client/apis/__init__.py +0 -28
  277. ory_client/model/__init__.py +0 -5
  278. ory_client/model/accept_o_auth2_consent_request.py +0 -296
  279. ory_client/model/accept_o_auth2_consent_request_session.py +0 -268
  280. ory_client/model/accept_o_auth2_login_request.py +0 -308
  281. ory_client/model/active_project_in_console.py +0 -264
  282. ory_client/model/attribute.py +0 -268
  283. ory_client/model/attribute_filter.py +0 -282
  284. ory_client/model/attributes_count_datapoint.py +0 -276
  285. ory_client/model/authenticator_assurance_level.py +0 -293
  286. ory_client/model/batch_patch_identities_response.py +0 -270
  287. ory_client/model/check_opl_syntax_result.py +0 -270
  288. ory_client/model/check_permission_result.py +0 -270
  289. ory_client/model/cloud_account.py +0 -282
  290. ory_client/model/consistency_request_parameters.py +0 -269
  291. ory_client/model/continue_with.py +0 -356
  292. ory_client/model/continue_with_recovery_ui.py +0 -287
  293. ory_client/model/continue_with_recovery_ui_flow.py +0 -274
  294. ory_client/model/continue_with_set_ory_session_token.py +0 -281
  295. ory_client/model/continue_with_settings_ui.py +0 -287
  296. ory_client/model/continue_with_settings_ui_flow.py +0 -270
  297. ory_client/model/continue_with_verification_ui.py +0 -287
  298. ory_client/model/continue_with_verification_ui_flow.py +0 -280
  299. ory_client/model/courier_message_status.py +0 -293
  300. ory_client/model/courier_message_type.py +0 -291
  301. ory_client/model/create_custom_domain_body.py +0 -280
  302. ory_client/model/create_event_stream_body.py +0 -287
  303. ory_client/model/create_identity_body.py +0 -314
  304. ory_client/model/create_invite_response.py +0 -282
  305. ory_client/model/create_json_web_key_set.py +0 -282
  306. ory_client/model/create_member_invite_response.py +0 -287
  307. ory_client/model/create_project_api_key_request.py +0 -270
  308. ory_client/model/create_project_body.py +0 -284
  309. ory_client/model/create_project_branding.py +0 -290
  310. ory_client/model/create_project_member_invite_body.py +0 -264
  311. ory_client/model/create_project_normalized_payload.py +0 -1119
  312. ory_client/model/create_recovery_code_for_identity_body.py +0 -279
  313. ory_client/model/create_recovery_link_for_identity_body.py +0 -279
  314. ory_client/model/create_relationship_body.py +0 -286
  315. ory_client/model/create_subscription_body.py +0 -298
  316. ory_client/model/create_subscription_common.py +0 -292
  317. ory_client/model/create_verifiable_credential_request_body.py +0 -278
  318. ory_client/model/create_workspace_member_invite_body.py +0 -264
  319. ory_client/model/create_workspace_payload.py +0 -270
  320. ory_client/model/create_workspace_subscription_body.py +0 -292
  321. ory_client/model/credential_supported_draft00.py +0 -276
  322. ory_client/model/custom_domain.py +0 -334
  323. ory_client/model/delete_my_sessions_count.py +0 -264
  324. ory_client/model/email_template_data.py +0 -282
  325. ory_client/model/email_template_data_body.py +0 -276
  326. ory_client/model/error_authenticator_assurance_level_not_satisfied.py +0 -274
  327. ory_client/model/error_browser_location_change_required.py +0 -274
  328. ory_client/model/error_flow_replaced.py +0 -274
  329. ory_client/model/error_generic.py +0 -276
  330. ory_client/model/error_o_auth2.py +0 -280
  331. ory_client/model/event_stream.py +0 -284
  332. ory_client/model/expanded_permission_tree.py +0 -294
  333. ory_client/model/flow_error.py +0 -282
  334. ory_client/model/generic_error.py +0 -308
  335. ory_client/model/generic_error_content.py +0 -280
  336. ory_client/model/generic_usage.py +0 -276
  337. ory_client/model/get_attributes_count_response.py +0 -273
  338. ory_client/model/get_managed_identity_schema_location.py +0 -264
  339. ory_client/model/get_metrics_event_attributes_response.py +0 -267
  340. ory_client/model/get_metrics_event_types_response.py +0 -267
  341. ory_client/model/get_organization_response.py +0 -276
  342. ory_client/model/get_project_events_body.py +0 -298
  343. ory_client/model/get_project_events_response.py +0 -278
  344. ory_client/model/get_project_metrics_response.py +0 -273
  345. ory_client/model/get_session_activity_response.py +0 -273
  346. ory_client/model/get_version200_response.py +0 -270
  347. ory_client/model/health_not_ready_status.py +0 -264
  348. ory_client/model/health_status.py +0 -264
  349. ory_client/model/identity.py +0 -342
  350. ory_client/model/identity_credentials.py +0 -294
  351. ory_client/model/identity_credentials_code.py +0 -268
  352. ory_client/model/identity_credentials_oidc.py +0 -270
  353. ory_client/model/identity_credentials_oidc_provider.py +0 -284
  354. ory_client/model/identity_credentials_password.py +0 -264
  355. ory_client/model/identity_patch.py +0 -274
  356. ory_client/model/identity_patch_response.py +0 -275
  357. ory_client/model/identity_schema_container.py +0 -268
  358. ory_client/model/identity_schema_preset.py +0 -276
  359. ory_client/model/identity_schema_presets.py +0 -292
  360. ory_client/model/identity_schemas.py +0 -292
  361. ory_client/model/identity_with_credentials.py +0 -276
  362. ory_client/model/identity_with_credentials_oidc.py +0 -270
  363. ory_client/model/identity_with_credentials_oidc_config.py +0 -276
  364. ory_client/model/identity_with_credentials_oidc_config_provider.py +0 -276
  365. ory_client/model/identity_with_credentials_password.py +0 -270
  366. ory_client/model/identity_with_credentials_password_config.py +0 -268
  367. ory_client/model/internal_get_project_branding_body.py +0 -264
  368. ory_client/model/internal_is_ax_welcome_screen_enabled_for_project_body.py +0 -276
  369. ory_client/model/internal_is_owner_for_project_by_slug_body.py +0 -290
  370. ory_client/model/internal_is_owner_for_project_by_slug_response.py +0 -270
  371. ory_client/model/introspected_o_auth2_token.py +0 -322
  372. ory_client/model/is_owner_for_project_by_slug.py +0 -276
  373. ory_client/model/is_ready200_response.py +0 -270
  374. ory_client/model/is_ready503_response.py +0 -270
  375. ory_client/model/json_patch.py +0 -292
  376. ory_client/model/json_patch_document.py +0 -292
  377. ory_client/model/json_web_key.py +0 -340
  378. ory_client/model/json_web_key_set.py +0 -270
  379. ory_client/model/keto_namespace.py +0 -268
  380. ory_client/model/keto_namespaces.py +0 -292
  381. ory_client/model/list_custom_domains.py +0 -292
  382. ory_client/model/list_event_streams.py +0 -270
  383. ory_client/model/list_my_workspaces_response.py +0 -288
  384. ory_client/model/list_organizations_response.py +0 -276
  385. ory_client/model/list_workspace_projects_response.py +0 -288
  386. ory_client/model/login_flow.py +0 -370
  387. ory_client/model/login_flow_state.py +0 -292
  388. ory_client/model/logout_flow.py +0 -276
  389. ory_client/model/managed_identity_schema.py +0 -300
  390. ory_client/model/managed_identity_schema_validation_result.py +0 -268
  391. ory_client/model/managed_identity_schemas.py +0 -292
  392. ory_client/model/member_invite.py +0 -321
  393. ory_client/model/member_invites.py +0 -292
  394. ory_client/model/message.py +0 -355
  395. ory_client/model/message_dispatch.py +0 -302
  396. ory_client/model/metrics_datapoint.py +0 -276
  397. ory_client/model/migration_options.py +0 -284
  398. ory_client/model/namespace.py +0 -264
  399. ory_client/model/needs_privileged_session_error.py +0 -280
  400. ory_client/model/normalized_project.py +0 -337
  401. ory_client/model/normalized_project_revision.py +0 -1105
  402. ory_client/model/normalized_project_revision_courier_channel.py +0 -328
  403. ory_client/model/normalized_project_revision_hook.py +0 -342
  404. ory_client/model/normalized_project_revision_identity_schema.py +0 -308
  405. ory_client/model/normalized_project_revision_identity_schemas.py +0 -292
  406. ory_client/model/normalized_project_revision_third_party_provider.py +0 -368
  407. ory_client/model/normalized_project_revision_tokenizer_template.py +0 -300
  408. ory_client/model/normalized_project_revision_tokenizer_templates.py +0 -292
  409. ory_client/model/normalized_projects.py +0 -292
  410. ory_client/model/null_duration.py +0 -292
  411. ory_client/model/o_auth2_client.py +0 -460
  412. ory_client/model/o_auth2_client_token_lifespans.py +0 -306
  413. ory_client/model/o_auth2_consent_request.py +0 -328
  414. ory_client/model/o_auth2_consent_request_open_id_connect_context.py +0 -280
  415. ory_client/model/o_auth2_consent_session.py +0 -308
  416. ory_client/model/o_auth2_consent_session_expires_at.py +0 -280
  417. ory_client/model/o_auth2_consent_sessions.py +0 -292
  418. ory_client/model/o_auth2_login_request.py +0 -320
  419. ory_client/model/o_auth2_logout_request.py +0 -290
  420. ory_client/model/o_auth2_redirect_to.py +0 -270
  421. ory_client/model/o_auth2_token_exchange.py +0 -284
  422. ory_client/model/oidc_configuration.py +0 -412
  423. ory_client/model/oidc_user_info.py +0 -336
  424. ory_client/model/organization.py +0 -302
  425. ory_client/model/organization_body.py +0 -268
  426. ory_client/model/pagination.py +0 -274
  427. ory_client/model/pagination_headers.py +0 -268
  428. ory_client/model/parse_error.py +0 -278
  429. ory_client/model/patch_identities_body.py +0 -270
  430. ory_client/model/perform_native_logout_body.py +0 -270
  431. ory_client/model/permissions_on_project.py +0 -260
  432. ory_client/model/permissions_on_workpace_response.py +0 -264
  433. ory_client/model/plan.py +0 -276
  434. ory_client/model/plan_details.py +0 -316
  435. ory_client/model/plan_features.py +0 -266
  436. ory_client/model/plans.py +0 -287
  437. ory_client/model/post_check_permission_body.py +0 -286
  438. ory_client/model/post_check_permission_or_error_body.py +0 -286
  439. ory_client/model/pricing.py +0 -292
  440. ory_client/model/project.py +0 -319
  441. ory_client/model/project_api_key.py +0 -298
  442. ory_client/model/project_api_keys.py +0 -292
  443. ory_client/model/project_branding.py +0 -303
  444. ory_client/model/project_branding_colors.py +0 -376
  445. ory_client/model/project_branding_theme.py +0 -421
  446. ory_client/model/project_branding_themes.py +0 -292
  447. ory_client/model/project_cors.py +0 -268
  448. ory_client/model/project_events_datapoint.py +0 -288
  449. ory_client/model/project_host.py +0 -281
  450. ory_client/model/project_member.py +0 -288
  451. ory_client/model/project_members.py +0 -292
  452. ory_client/model/project_metadata.py +0 -337
  453. ory_client/model/project_metadata_list.py +0 -292
  454. ory_client/model/project_revision_hooks.py +0 -292
  455. ory_client/model/project_revision_identity_schemas.py +0 -292
  456. ory_client/model/project_revision_third_party_login_providers.py +0 -292
  457. ory_client/model/project_revisions.py +0 -292
  458. ory_client/model/project_service_identity.py +0 -270
  459. ory_client/model/project_service_o_auth2.py +0 -270
  460. ory_client/model/project_service_permission.py +0 -270
  461. ory_client/model/project_services.py +0 -282
  462. ory_client/model/projects.py +0 -292
  463. ory_client/model/quota_usage.py +0 -328
  464. ory_client/model/recovery_code_for_identity.py +0 -280
  465. ory_client/model/recovery_flow.py +0 -330
  466. ory_client/model/recovery_flow_state.py +0 -292
  467. ory_client/model/recovery_identity_address.py +0 -290
  468. ory_client/model/recovery_link_for_identity.py +0 -274
  469. ory_client/model/registration_flow.py +0 -352
  470. ory_client/model/registration_flow_state.py +0 -292
  471. ory_client/model/reject_o_auth2_request.py +0 -280
  472. ory_client/model/relation_query.py +0 -286
  473. ory_client/model/relationship.py +0 -296
  474. ory_client/model/relationship_namespaces.py +0 -270
  475. ory_client/model/relationship_patch.py +0 -278
  476. ory_client/model/relationships.py +0 -274
  477. ory_client/model/revision_courier_channels.py +0 -292
  478. ory_client/model/rfc6749_error_json.py +0 -280
  479. ory_client/model/schema_patch.py +0 -276
  480. ory_client/model/self_service_flow_expired_error.py +0 -282
  481. ory_client/model/session.py +0 -318
  482. ory_client/model/session_activity_datapoint.py +0 -282
  483. ory_client/model/session_authentication_method.py +0 -297
  484. ory_client/model/session_authentication_methods.py +0 -292
  485. ory_client/model/session_device.py +0 -282
  486. ory_client/model/set_active_project_in_console_body.py +0 -270
  487. ory_client/model/set_custom_domain_body.py +0 -280
  488. ory_client/model/set_event_stream_body.py +0 -287
  489. ory_client/model/set_project.py +0 -296
  490. ory_client/model/set_project_branding_theme_body.py +0 -290
  491. ory_client/model/settings_flow.py +0 -338
  492. ory_client/model/settings_flow_state.py +0 -291
  493. ory_client/model/source_position.py +0 -268
  494. ory_client/model/string_slice_json_format.py +0 -287
  495. ory_client/model/subject_set.py +0 -282
  496. ory_client/model/subscription.py +0 -350
  497. ory_client/model/successful_code_exchange_response.py +0 -280
  498. ory_client/model/successful_native_login.py +0 -280
  499. ory_client/model/successful_native_registration.py +0 -292
  500. ory_client/model/successful_project_update.py +0 -284
  501. ory_client/model/token_pagination.py +0 -274
  502. ory_client/model/token_pagination_headers.py +0 -268
  503. ory_client/model/token_pagination_request_parameters.py +0 -274
  504. ory_client/model/token_pagination_response_headers.py +0 -268
  505. ory_client/model/trust_o_auth2_jwt_grant_issuer.py +0 -302
  506. ory_client/model/trusted_o_auth2_jwt_grant_issuer.py +0 -298
  507. ory_client/model/trusted_o_auth2_jwt_grant_issuers.py +0 -292
  508. ory_client/model/trusted_o_auth2_jwt_grant_json_web_key.py +0 -268
  509. ory_client/model/ui_container.py +0 -294
  510. ory_client/model/ui_node.py +0 -322
  511. ory_client/model/ui_node_anchor_attributes.py +0 -294
  512. ory_client/model/ui_node_attributes.py +0 -440
  513. ory_client/model/ui_node_image_attributes.py +0 -294
  514. ory_client/model/ui_node_input_attributes.py +0 -340
  515. ory_client/model/ui_node_meta.py +0 -270
  516. ory_client/model/ui_node_script_attributes.py +0 -318
  517. ory_client/model/ui_node_text_attributes.py +0 -288
  518. ory_client/model/ui_nodes.py +0 -292
  519. ory_client/model/ui_text.py +0 -291
  520. ory_client/model/ui_texts.py +0 -292
  521. ory_client/model/update_identity_body.py +0 -304
  522. ory_client/model/update_login_flow_body.py +0 -411
  523. ory_client/model/update_login_flow_with_code_method.py +0 -292
  524. ory_client/model/update_login_flow_with_lookup_secret_method.py +0 -280
  525. ory_client/model/update_login_flow_with_oidc_method.py +0 -300
  526. ory_client/model/update_login_flow_with_password_method.py +0 -294
  527. ory_client/model/update_login_flow_with_totp_method.py +0 -284
  528. ory_client/model/update_login_flow_with_web_authn_method.py +0 -288
  529. ory_client/model/update_recovery_flow_body.py +0 -351
  530. ory_client/model/update_recovery_flow_with_code_method.py +0 -290
  531. ory_client/model/update_recovery_flow_with_link_method.py +0 -288
  532. ory_client/model/update_registration_flow_body.py +0 -389
  533. ory_client/model/update_registration_flow_with_code_method.py +0 -292
  534. ory_client/model/update_registration_flow_with_oidc_method.py +0 -300
  535. ory_client/model/update_registration_flow_with_password_method.py +0 -290
  536. ory_client/model/update_registration_flow_with_web_authn_method.py +0 -292
  537. ory_client/model/update_settings_flow_body.py +0 -419
  538. ory_client/model/update_settings_flow_with_lookup_method.py +0 -294
  539. ory_client/model/update_settings_flow_with_oidc_method.py +0 -294
  540. ory_client/model/update_settings_flow_with_password_method.py +0 -284
  541. ory_client/model/update_settings_flow_with_profile_method.py +0 -284
  542. ory_client/model/update_settings_flow_with_totp_method.py +0 -286
  543. ory_client/model/update_settings_flow_with_web_authn_method.py +0 -290
  544. ory_client/model/update_subscription_body.py +0 -284
  545. ory_client/model/update_verification_flow_body.py +0 -351
  546. ory_client/model/update_verification_flow_with_code_method.py +0 -290
  547. ory_client/model/update_verification_flow_with_link_method.py +0 -288
  548. ory_client/model/update_workspace_payload.py +0 -270
  549. ory_client/model/usage.py +0 -270
  550. ory_client/model/verifiable_credential_priming_response.py +0 -292
  551. ory_client/model/verifiable_credential_proof.py +0 -268
  552. ory_client/model/verifiable_credential_response.py +0 -268
  553. ory_client/model/verifiable_identity_address.py +0 -308
  554. ory_client/model/verification_flow.py +0 -318
  555. ory_client/model/verification_flow_state.py +0 -292
  556. ory_client/model/version.py +0 -264
  557. ory_client/model/warning.py +0 -268
  558. ory_client/model/workspace.py +0 -292
  559. ory_client/model/workspace_meta.py +0 -296
  560. ory_client/model/workspaces.py +0 -292
  561. ory_client/model_utils.py +0 -2059
  562. ory_client-1.9.0.dist-info/RECORD +0 -310
  563. {ory_client-1.9.0.dist-info → ory_client-1.11.7.dist-info}/LICENSE +0 -0
  564. {ory_client-1.9.0.dist-info → ory_client-1.11.7.dist-info}/WHEEL +0 -0
  565. {ory_client-1.9.0.dist-info → ory_client-1.11.7.dist-info}/top_level.txt +0 -0
ory_client/api_client.py CHANGED
@@ -1,46 +1,47 @@
1
+ # coding: utf-8
2
+
1
3
  """
2
4
  Ory APIs
3
5
 
4
- Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501
6
+ Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers.
5
7
 
6
- The version of the OpenAPI document: v1.9.0
8
+ The version of the OpenAPI document: v1.11.7
7
9
  Contact: support@ory.sh
8
- Generated by: https://openapi-generator.tech
9
- """
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
10
14
 
11
15
 
16
+ import datetime
17
+ from dateutil.parser import parse
18
+ from enum import Enum
12
19
  import json
13
- import atexit
14
20
  import mimetypes
15
- from multiprocessing.pool import ThreadPool
16
- import io
17
21
  import os
18
22
  import re
19
- import typing
20
- from urllib.parse import quote
21
- from urllib3.fields import RequestField
23
+ import tempfile
22
24
 
25
+ from urllib.parse import quote
26
+ from typing import Tuple, Optional, List, Dict
23
27
 
24
- from ory_client import rest
25
28
  from ory_client.configuration import Configuration
26
- from ory_client.exceptions import ApiTypeError, ApiValueError, ApiException
27
- from ory_client.model_utils import (
28
- ModelNormal,
29
- ModelSimple,
30
- ModelComposed,
31
- check_allowed_values,
32
- check_validations,
33
- date,
34
- datetime,
35
- deserialize_file,
36
- file_type,
37
- model_to_dict,
38
- none_type,
39
- validate_and_convert_types
29
+ from ory_client.api_response import ApiResponse, T as ApiResponseT
30
+ import ory_client.models
31
+ from ory_client import rest
32
+ from ory_client.exceptions import (
33
+ ApiValueError,
34
+ ApiException,
35
+ BadRequestException,
36
+ UnauthorizedException,
37
+ ForbiddenException,
38
+ NotFoundException,
39
+ ServiceException
40
40
  )
41
41
 
42
+ RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]]
42
43
 
43
- class ApiClient(object):
44
+ class ApiClient:
44
45
  """Generic API client for OpenAPI client library builds.
45
46
 
46
47
  OpenAPI generic API client. This client handles the client-
@@ -48,28 +49,38 @@ class ApiClient(object):
48
49
  the methods and models for each application are generated from the OpenAPI
49
50
  templates.
50
51
 
51
- NOTE: This class is auto generated by OpenAPI Generator.
52
- Ref: https://openapi-generator.tech
53
- Do not edit the class manually.
54
-
55
52
  :param configuration: .Configuration object for this client
56
53
  :param header_name: a header to pass when making calls to the API.
57
54
  :param header_value: a header value to pass when making calls to
58
55
  the API.
59
56
  :param cookie: a cookie to include in the header when making calls
60
57
  to the API
61
- :param pool_threads: The number of threads to use for async requests
62
- to the API. More threads means more concurrent API requests.
63
58
  """
64
59
 
60
+ PRIMITIVE_TYPES = (float, bool, bytes, str, int)
61
+ NATIVE_TYPES_MAPPING = {
62
+ 'int': int,
63
+ 'long': int, # TODO remove as only py3 is supported?
64
+ 'float': float,
65
+ 'str': str,
66
+ 'bool': bool,
67
+ 'date': datetime.date,
68
+ 'datetime': datetime.datetime,
69
+ 'object': object,
70
+ }
65
71
  _pool = None
66
72
 
67
- def __init__(self, configuration=None, header_name=None, header_value=None,
68
- cookie=None, pool_threads=1):
73
+ def __init__(
74
+ self,
75
+ configuration=None,
76
+ header_name=None,
77
+ header_value=None,
78
+ cookie=None
79
+ ) -> None:
80
+ # use default configuration if none is provided
69
81
  if configuration is None:
70
- configuration = Configuration.get_default_copy()
82
+ configuration = Configuration.get_default()
71
83
  self.configuration = configuration
72
- self.pool_threads = pool_threads
73
84
 
74
85
  self.rest_client = rest.RESTClientObject(configuration)
75
86
  self.default_headers = {}
@@ -77,31 +88,14 @@ class ApiClient(object):
77
88
  self.default_headers[header_name] = header_value
78
89
  self.cookie = cookie
79
90
  # Set default User-Agent.
80
- self.user_agent = 'OpenAPI-Generator/v1.9.0/python'
91
+ self.user_agent = 'OpenAPI-Generator/v1.11.7/python'
92
+ self.client_side_validation = configuration.client_side_validation
81
93
 
82
94
  def __enter__(self):
83
95
  return self
84
96
 
85
97
  def __exit__(self, exc_type, exc_value, traceback):
86
- self.close()
87
-
88
- def close(self):
89
- if self._pool:
90
- self._pool.close()
91
- self._pool.join()
92
- self._pool = None
93
- if hasattr(atexit, 'unregister'):
94
- atexit.unregister(self.close)
95
-
96
- @property
97
- def pool(self):
98
- """Create thread pool on first request
99
- avoids instantiating unused threadpool for blocking clients.
100
- """
101
- if self._pool is None:
102
- atexit.register(self.close)
103
- self._pool = ThreadPool(self.pool_threads)
104
- return self._pool
98
+ pass
105
99
 
106
100
  @property
107
101
  def user_agent(self):
@@ -115,27 +109,69 @@ class ApiClient(object):
115
109
  def set_default_header(self, header_name, header_value):
116
110
  self.default_headers[header_name] = header_value
117
111
 
118
- def __call_api(
112
+
113
+ _default = None
114
+
115
+ @classmethod
116
+ def get_default(cls):
117
+ """Return new instance of ApiClient.
118
+
119
+ This method returns newly created, based on default constructor,
120
+ object of ApiClient class or returns a copy of default
121
+ ApiClient.
122
+
123
+ :return: The ApiClient object.
124
+ """
125
+ if cls._default is None:
126
+ cls._default = ApiClient()
127
+ return cls._default
128
+
129
+ @classmethod
130
+ def set_default(cls, default):
131
+ """Set default instance of ApiClient.
132
+
133
+ It stores default ApiClient.
134
+
135
+ :param default: object of ApiClient.
136
+ """
137
+ cls._default = default
138
+
139
+ def param_serialize(
119
140
  self,
120
- resource_path: str,
121
- method: str,
122
- path_params: typing.Optional[typing.Dict[str, typing.Any]] = None,
123
- query_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None,
124
- header_params: typing.Optional[typing.Dict[str, typing.Any]] = None,
125
- body: typing.Optional[typing.Any] = None,
126
- post_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None,
127
- files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None,
128
- response_type: typing.Optional[typing.Tuple[typing.Any]] = None,
129
- auth_settings: typing.Optional[typing.List[str]] = None,
130
- _return_http_data_only: typing.Optional[bool] = None,
131
- collection_formats: typing.Optional[typing.Dict[str, str]] = None,
132
- _preload_content: bool = True,
133
- _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
134
- _host: typing.Optional[str] = None,
135
- _check_type: typing.Optional[bool] = None,
136
- _content_type: typing.Optional[str] = None,
137
- _request_auths: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None
138
- ):
141
+ method,
142
+ resource_path,
143
+ path_params=None,
144
+ query_params=None,
145
+ header_params=None,
146
+ body=None,
147
+ post_params=None,
148
+ files=None, auth_settings=None,
149
+ collection_formats=None,
150
+ _host=None,
151
+ _request_auth=None
152
+ ) -> RequestSerialized:
153
+
154
+ """Builds the HTTP request params needed by the request.
155
+ :param method: Method to call.
156
+ :param resource_path: Path to method endpoint.
157
+ :param path_params: Path parameters in the url.
158
+ :param query_params: Query parameters in the url.
159
+ :param header_params: Header parameters to be
160
+ placed in the request header.
161
+ :param body: Request body.
162
+ :param post_params dict: Request post form parameters,
163
+ for `application/x-www-form-urlencoded`, `multipart/form-data`.
164
+ :param auth_settings list: Auth Settings names for the request.
165
+ :param files dict: key -> filename, value -> filepath,
166
+ for `multipart/form-data`.
167
+ :param collection_formats: dict of collection formats for path, query,
168
+ header, and post parameters.
169
+ :param _request_auth: set to override the auth_settings for an a single
170
+ request; this effectively ignores the authentication
171
+ in the spec for a single request.
172
+ :return: tuple of form (path, http_method, query_params, header_params,
173
+ body, post_params, files)
174
+ """
139
175
 
140
176
  config = self.configuration
141
177
 
@@ -146,14 +182,17 @@ class ApiClient(object):
146
182
  header_params['Cookie'] = self.cookie
147
183
  if header_params:
148
184
  header_params = self.sanitize_for_serialization(header_params)
149
- header_params = dict(self.parameters_to_tuples(header_params,
150
- collection_formats))
185
+ header_params = dict(
186
+ self.parameters_to_tuples(header_params,collection_formats)
187
+ )
151
188
 
152
189
  # path parameters
153
190
  if path_params:
154
191
  path_params = self.sanitize_for_serialization(path_params)
155
- path_params = self.parameters_to_tuples(path_params,
156
- collection_formats)
192
+ path_params = self.parameters_to_tuples(
193
+ path_params,
194
+ collection_formats
195
+ )
157
196
  for k, v in path_params:
158
197
  # specified safe chars, encode everything
159
198
  resource_path = resource_path.replace(
@@ -161,32 +200,31 @@ class ApiClient(object):
161
200
  quote(str(v), safe=config.safe_chars_for_path_param)
162
201
  )
163
202
 
164
- # query parameters
165
- if query_params:
166
- query_params = self.sanitize_for_serialization(query_params)
167
- query_params = self.parameters_to_tuples(query_params,
168
- collection_formats)
169
-
170
203
  # post parameters
171
204
  if post_params or files:
172
205
  post_params = post_params if post_params else []
173
206
  post_params = self.sanitize_for_serialization(post_params)
174
- post_params = self.parameters_to_tuples(post_params,
175
- collection_formats)
207
+ post_params = self.parameters_to_tuples(
208
+ post_params,
209
+ collection_formats
210
+ )
176
211
  post_params.extend(self.files_parameters(files))
177
- if header_params['Content-Type'].startswith("multipart"):
178
- post_params = self.parameters_to_multipart(post_params,
179
- (dict))
212
+
213
+ # auth setting
214
+ self.update_params_for_auth(
215
+ header_params,
216
+ query_params,
217
+ auth_settings,
218
+ resource_path,
219
+ method,
220
+ body,
221
+ request_auth=_request_auth
222
+ )
180
223
 
181
224
  # body
182
225
  if body:
183
226
  body = self.sanitize_for_serialization(body)
184
227
 
185
- # auth setting
186
- self.update_params_for_auth(header_params, query_params,
187
- auth_settings, resource_path, method, body,
188
- request_auths=_request_auths)
189
-
190
228
  # request url
191
229
  if _host is None:
192
230
  url = self.configuration.host + resource_path
@@ -194,74 +232,106 @@ class ApiClient(object):
194
232
  # use server/host defined in path or operation instead
195
233
  url = _host + resource_path
196
234
 
235
+ # query parameters
236
+ if query_params:
237
+ query_params = self.sanitize_for_serialization(query_params)
238
+ url_query = self.parameters_to_url_query(
239
+ query_params,
240
+ collection_formats
241
+ )
242
+ url += "?" + url_query
243
+
244
+ return method, url, header_params, body, post_params
245
+
246
+
247
+ def call_api(
248
+ self,
249
+ method,
250
+ url,
251
+ header_params=None,
252
+ body=None,
253
+ post_params=None,
254
+ _request_timeout=None
255
+ ) -> rest.RESTResponse:
256
+ """Makes the HTTP request (synchronous)
257
+ :param method: Method to call.
258
+ :param url: Path to method endpoint.
259
+ :param header_params: Header parameters to be
260
+ placed in the request header.
261
+ :param body: Request body.
262
+ :param post_params dict: Request post form parameters,
263
+ for `application/x-www-form-urlencoded`, `multipart/form-data`.
264
+ :param _request_timeout: timeout setting for this request.
265
+ :return: RESTResponse
266
+ """
267
+
197
268
  try:
198
269
  # perform request and return response
199
- response_data = self.request(
200
- method, url, query_params=query_params, headers=header_params,
201
- post_params=post_params, body=body,
202
- _preload_content=_preload_content,
203
- _request_timeout=_request_timeout)
270
+ response_data = self.rest_client.request(
271
+ method, url,
272
+ headers=header_params,
273
+ body=body, post_params=post_params,
274
+ _request_timeout=_request_timeout
275
+ )
276
+
204
277
  except ApiException as e:
205
- e.body = e.body.decode('utf-8')
206
278
  raise e
207
279
 
208
- self.last_response = response_data
280
+ return response_data
209
281
 
210
- return_data = response_data
282
+ def response_deserialize(
283
+ self,
284
+ response_data: rest.RESTResponse,
285
+ response_types_map: Optional[Dict[str, ApiResponseT]]=None
286
+ ) -> ApiResponse[ApiResponseT]:
287
+ """Deserializes response into an object.
288
+ :param response_data: RESTResponse object to be deserialized.
289
+ :param response_types_map: dict of response types.
290
+ :return: ApiResponse
291
+ """
292
+
293
+ msg = "RESTResponse.read() must be called before passing it to response_deserialize()"
294
+ assert response_data.data is not None, msg
211
295
 
212
- if not _preload_content:
213
- return (return_data)
214
- return return_data
296
+ response_type = response_types_map.get(str(response_data.status), None)
297
+ if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599:
298
+ # if not found, look for '1XX', '2XX', etc.
299
+ response_type = response_types_map.get(str(response_data.status)[0] + "XX", None)
215
300
 
216
301
  # deserialize response data
217
- if response_type:
218
- if response_type != (file_type,):
219
- encoding = "utf-8"
302
+ response_text = None
303
+ return_data = None
304
+ try:
305
+ if response_type == "bytearray":
306
+ return_data = response_data.data
307
+ elif response_type == "file":
308
+ return_data = self.__deserialize_file(response_data)
309
+ elif response_type is not None:
310
+ match = None
220
311
  content_type = response_data.getheader('content-type')
221
312
  if content_type is not None:
222
- match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type)
223
- if match:
224
- encoding = match.group(1)
225
- response_data.data = response_data.data.decode(encoding)
226
-
227
- return_data = self.deserialize(
228
- response_data,
229
- response_type,
230
- _check_type
231
- )
232
- else:
233
- return_data = None
234
-
235
- if _return_http_data_only:
236
- return (return_data)
237
- else:
238
- return (return_data, response_data.status,
239
- response_data.getheaders())
313
+ match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
314
+ encoding = match.group(1) if match else "utf-8"
315
+ response_text = response_data.data.decode(encoding)
316
+ return_data = self.deserialize(response_text, response_type)
317
+ finally:
318
+ if not 200 <= response_data.status <= 299:
319
+ raise ApiException.from_response(
320
+ http_resp=response_data,
321
+ body=response_text,
322
+ data=return_data,
323
+ )
240
324
 
241
- def parameters_to_multipart(self, params, collection_types):
242
- """Get parameters as list of tuples, formatting as json if value is collection_types
325
+ return ApiResponse(
326
+ status_code = response_data.status,
327
+ data = return_data,
328
+ headers = response_data.getheaders(),
329
+ raw_data = response_data.data
330
+ )
243
331
 
244
- :param params: Parameters as list of two-tuples
245
- :param dict collection_types: Parameter collection types
246
- :return: Parameters as list of tuple or urllib3.fields.RequestField
247
- """
248
- new_params = []
249
- if collection_types is None:
250
- collection_types = (dict)
251
- for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501
252
- if isinstance(
253
- v, collection_types): # v is instance of collection_type, formatting as application/json
254
- v = json.dumps(v, ensure_ascii=False).encode("utf-8")
255
- field = RequestField(k, v)
256
- field.make_multipart(content_type="application/json; charset=utf-8")
257
- new_params.append(field)
258
- else:
259
- new_params.append((k, v))
260
- return new_params
332
+ def sanitize_for_serialization(self, obj):
333
+ """Builds a JSON POST object.
261
334
 
262
- @classmethod
263
- def sanitize_for_serialization(cls, obj):
264
- """Prepares data for transmission before it is sent with the rest client
265
335
  If obj is None, return None.
266
336
  If obj is str, int, long, float, bool, return directly.
267
337
  If obj is datetime.datetime, datetime.date
@@ -269,237 +339,102 @@ class ApiClient(object):
269
339
  If obj is list, sanitize each element in the list.
270
340
  If obj is dict, return the dict.
271
341
  If obj is OpenAPI model, return the properties dict.
272
- If obj is io.IOBase, return the bytes
342
+
273
343
  :param obj: The data to serialize.
274
344
  :return: The serialized form of data.
275
345
  """
276
- if isinstance(obj, (ModelNormal, ModelComposed)):
277
- return {
278
- key: cls.sanitize_for_serialization(val) for key,
279
- val in model_to_dict(
280
- obj,
281
- serialize=True).items()}
282
- elif isinstance(obj, io.IOBase):
283
- return cls.get_file_data_and_close_file(obj)
284
- elif isinstance(obj, (str, int, float, none_type, bool)):
346
+ if obj is None:
347
+ return None
348
+ elif isinstance(obj, self.PRIMITIVE_TYPES):
285
349
  return obj
286
- elif isinstance(obj, (datetime, date)):
350
+ elif isinstance(obj, list):
351
+ return [
352
+ self.sanitize_for_serialization(sub_obj) for sub_obj in obj
353
+ ]
354
+ elif isinstance(obj, tuple):
355
+ return tuple(
356
+ self.sanitize_for_serialization(sub_obj) for sub_obj in obj
357
+ )
358
+ elif isinstance(obj, (datetime.datetime, datetime.date)):
287
359
  return obj.isoformat()
288
- elif isinstance(obj, ModelSimple):
289
- return cls.sanitize_for_serialization(obj.value)
290
- elif isinstance(obj, (list, tuple)):
291
- return [cls.sanitize_for_serialization(item) for item in obj]
292
- if isinstance(obj, dict):
293
- return {key: cls.sanitize_for_serialization(val) for key, val in obj.items()}
294
- raise ApiValueError(
295
- 'Unable to prepare type {} for serialization'.format(
296
- obj.__class__.__name__))
297
-
298
- def deserialize(self, response, response_type, _check_type):
360
+
361
+ elif isinstance(obj, dict):
362
+ obj_dict = obj
363
+ else:
364
+ # Convert model obj to dict except
365
+ # attributes `openapi_types`, `attribute_map`
366
+ # and attributes which value is not None.
367
+ # Convert attribute name to json key in
368
+ # model definition for request.
369
+ obj_dict = obj.to_dict()
370
+
371
+ return {
372
+ key: self.sanitize_for_serialization(val)
373
+ for key, val in obj_dict.items()
374
+ }
375
+
376
+ def deserialize(self, response_text, response_type):
299
377
  """Deserializes response into an object.
300
378
 
301
379
  :param response: RESTResponse object to be deserialized.
302
- :param response_type: For the response, a tuple containing:
303
- valid classes
304
- a list containing valid classes (for list schemas)
305
- a dict containing a tuple of valid classes as the value
306
- Example values:
307
- (str,)
308
- (Pet,)
309
- (float, none_type)
310
- ([int, none_type],)
311
- ({str: (bool, str, int, float, date, datetime, str, none_type)},)
312
- :param _check_type: boolean, whether to check the types of the data
313
- received from the server
314
- :type _check_type: bool
380
+ :param response_type: class literal for
381
+ deserialized object, or string of class name.
315
382
 
316
383
  :return: deserialized object.
317
384
  """
318
- # handle file downloading
319
- # save response body into a tmp file and return the instance
320
- if response_type == (file_type,):
321
- content_disposition = response.getheader("Content-Disposition")
322
- return deserialize_file(response.data, self.configuration,
323
- content_disposition=content_disposition)
324
385
 
325
386
  # fetch data from response object
326
387
  try:
327
- received_data = json.loads(response.data)
388
+ data = json.loads(response_text)
328
389
  except ValueError:
329
- received_data = response.data
330
-
331
- # store our data under the key of 'received_data' so users have some
332
- # context if they are deserializing a string and the data type is wrong
333
- deserialized_data = validate_and_convert_types(
334
- received_data,
335
- response_type,
336
- ['received_data'],
337
- True,
338
- _check_type,
339
- configuration=self.configuration
340
- )
341
- return deserialized_data
390
+ data = response_text
342
391
 
343
- def call_api(
344
- self,
345
- resource_path: str,
346
- method: str,
347
- path_params: typing.Optional[typing.Dict[str, typing.Any]] = None,
348
- query_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None,
349
- header_params: typing.Optional[typing.Dict[str, typing.Any]] = None,
350
- body: typing.Optional[typing.Any] = None,
351
- post_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None,
352
- files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None,
353
- response_type: typing.Optional[typing.Tuple[typing.Any]] = None,
354
- auth_settings: typing.Optional[typing.List[str]] = None,
355
- async_req: typing.Optional[bool] = None,
356
- _return_http_data_only: typing.Optional[bool] = None,
357
- collection_formats: typing.Optional[typing.Dict[str, str]] = None,
358
- _preload_content: bool = True,
359
- _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
360
- _host: typing.Optional[str] = None,
361
- _check_type: typing.Optional[bool] = None,
362
- _request_auths: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None
363
- ):
364
- """Makes the HTTP request (synchronous) and returns deserialized data.
365
-
366
- To make an async_req request, set the async_req parameter.
392
+ return self.__deserialize(data, response_type)
367
393
 
368
- :param resource_path: Path to method endpoint.
369
- :param method: Method to call.
370
- :param path_params: Path parameters in the url.
371
- :param query_params: Query parameters in the url.
372
- :param header_params: Header parameters to be
373
- placed in the request header.
374
- :param body: Request body.
375
- :param post_params dict: Request post form parameters,
376
- for `application/x-www-form-urlencoded`, `multipart/form-data`.
377
- :param auth_settings list: Auth Settings names for the request.
378
- :param response_type: For the response, a tuple containing:
379
- valid classes
380
- a list containing valid classes (for list schemas)
381
- a dict containing a tuple of valid classes as the value
382
- Example values:
383
- (str,)
384
- (Pet,)
385
- (float, none_type)
386
- ([int, none_type],)
387
- ({str: (bool, str, int, float, date, datetime, str, none_type)},)
388
- :param files: key -> field name, value -> a list of open file
389
- objects for `multipart/form-data`.
390
- :type files: dict
391
- :param async_req bool: execute request asynchronously
392
- :type async_req: bool, optional
393
- :param _return_http_data_only: response data without head status code
394
- and headers
395
- :type _return_http_data_only: bool, optional
396
- :param collection_formats: dict of collection formats for path, query,
397
- header, and post parameters.
398
- :type collection_formats: dict, optional
399
- :param _preload_content: if False, the urllib3.HTTPResponse object will
400
- be returned without reading/decoding response
401
- data. Default is True.
402
- :type _preload_content: bool, optional
403
- :param _request_timeout: timeout setting for this request. If one
404
- number provided, it will be total request
405
- timeout. It can also be a pair (tuple) of
406
- (connection, read) timeouts.
407
- :param _check_type: boolean describing if the data back from the server
408
- should have its type checked.
409
- :type _check_type: bool, optional
410
- :param _request_auths: set to override the auth_settings for an a single
411
- request; this effectively ignores the authentication
412
- in the spec for a single request.
413
- :type _request_auths: list, optional
414
- :return:
415
- If async_req parameter is True,
416
- the request will be called asynchronously.
417
- The method will return the request thread.
418
- If parameter async_req is False or missing,
419
- then the method will return the response directly.
394
+ def __deserialize(self, data, klass):
395
+ """Deserializes dict, list, str into an object.
396
+
397
+ :param data: dict, list or str.
398
+ :param klass: class literal, or string of class name.
399
+
400
+ :return: object.
420
401
  """
421
- if not async_req:
422
- return self.__call_api(resource_path, method,
423
- path_params, query_params, header_params,
424
- body, post_params, files,
425
- response_type, auth_settings,
426
- _return_http_data_only, collection_formats,
427
- _preload_content, _request_timeout, _host,
428
- _check_type, _request_auths=_request_auths)
429
-
430
- return self.pool.apply_async(self.__call_api, (resource_path,
431
- method, path_params,
432
- query_params,
433
- header_params, body,
434
- post_params, files,
435
- response_type,
436
- auth_settings,
437
- _return_http_data_only,
438
- collection_formats,
439
- _preload_content,
440
- _request_timeout,
441
- _host, _check_type, None, _request_auths))
442
-
443
- def request(self, method, url, query_params=None, headers=None,
444
- post_params=None, body=None, _preload_content=True,
445
- _request_timeout=None):
446
- """Makes the HTTP request using RESTClient."""
447
- if method == "GET":
448
- return self.rest_client.GET(url,
449
- query_params=query_params,
450
- _preload_content=_preload_content,
451
- _request_timeout=_request_timeout,
452
- headers=headers)
453
- elif method == "HEAD":
454
- return self.rest_client.HEAD(url,
455
- query_params=query_params,
456
- _preload_content=_preload_content,
457
- _request_timeout=_request_timeout,
458
- headers=headers)
459
- elif method == "OPTIONS":
460
- return self.rest_client.OPTIONS(url,
461
- query_params=query_params,
462
- headers=headers,
463
- post_params=post_params,
464
- _preload_content=_preload_content,
465
- _request_timeout=_request_timeout,
466
- body=body)
467
- elif method == "POST":
468
- return self.rest_client.POST(url,
469
- query_params=query_params,
470
- headers=headers,
471
- post_params=post_params,
472
- _preload_content=_preload_content,
473
- _request_timeout=_request_timeout,
474
- body=body)
475
- elif method == "PUT":
476
- return self.rest_client.PUT(url,
477
- query_params=query_params,
478
- headers=headers,
479
- post_params=post_params,
480
- _preload_content=_preload_content,
481
- _request_timeout=_request_timeout,
482
- body=body)
483
- elif method == "PATCH":
484
- return self.rest_client.PATCH(url,
485
- query_params=query_params,
486
- headers=headers,
487
- post_params=post_params,
488
- _preload_content=_preload_content,
489
- _request_timeout=_request_timeout,
490
- body=body)
491
- elif method == "DELETE":
492
- return self.rest_client.DELETE(url,
493
- query_params=query_params,
494
- headers=headers,
495
- _preload_content=_preload_content,
496
- _request_timeout=_request_timeout,
497
- body=body)
402
+ if data is None:
403
+ return None
404
+
405
+ if isinstance(klass, str):
406
+ if klass.startswith('List['):
407
+ m = re.match(r'List\[(.*)]', klass)
408
+ assert m is not None, "Malformed List type definition"
409
+ sub_kls = m.group(1)
410
+ return [self.__deserialize(sub_data, sub_kls)
411
+ for sub_data in data]
412
+
413
+ if klass.startswith('Dict['):
414
+ m = re.match(r'Dict\[([^,]*), (.*)]', klass)
415
+ assert m is not None, "Malformed Dict type definition"
416
+ sub_kls = m.group(2)
417
+ return {k: self.__deserialize(v, sub_kls)
418
+ for k, v in data.items()}
419
+
420
+ # convert str to class
421
+ if klass in self.NATIVE_TYPES_MAPPING:
422
+ klass = self.NATIVE_TYPES_MAPPING[klass]
423
+ else:
424
+ klass = getattr(ory_client.models, klass)
425
+
426
+ if klass in self.PRIMITIVE_TYPES:
427
+ return self.__deserialize_primitive(data, klass)
428
+ elif klass == object:
429
+ return self.__deserialize_object(data)
430
+ elif klass == datetime.date:
431
+ return self.__deserialize_date(data)
432
+ elif klass == datetime.datetime:
433
+ return self.__deserialize_datetime(data)
434
+ elif issubclass(klass, Enum):
435
+ return self.__deserialize_enum(data, klass)
498
436
  else:
499
- raise ApiValueError(
500
- "http method must be `GET`, `HEAD`, `OPTIONS`,"
501
- " `POST`, `PATCH`, `PUT` or `DELETE`."
502
- )
437
+ return self.__deserialize_model(data, klass)
503
438
 
504
439
  def parameters_to_tuples(self, params, collection_formats):
505
440
  """Get parameters as list of tuples, formatting collections.
@@ -508,10 +443,10 @@ class ApiClient(object):
508
443
  :param dict collection_formats: Parameter collection formats
509
444
  :return: Parameters as list of tuples, collections formatted
510
445
  """
511
- new_params = []
446
+ new_params: List[Tuple[str, str]] = []
512
447
  if collection_formats is None:
513
448
  collection_formats = {}
514
- for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501
449
+ for k, v in params.items() if isinstance(params, dict) else params:
515
450
  if k in collection_formats:
516
451
  collection_format = collection_formats[k]
517
452
  if collection_format == 'multi':
@@ -531,118 +466,170 @@ class ApiClient(object):
531
466
  new_params.append((k, v))
532
467
  return new_params
533
468
 
534
- @staticmethod
535
- def get_file_data_and_close_file(file_instance: io.IOBase) -> bytes:
536
- file_data = file_instance.read()
537
- file_instance.close()
538
- return file_data
469
+ def parameters_to_url_query(self, params, collection_formats):
470
+ """Get parameters as list of tuples, formatting collections.
539
471
 
540
- def files_parameters(self,
541
- files: typing.Optional[typing.Dict[str,
542
- typing.List[io.IOBase]]] = None):
472
+ :param params: Parameters as dict or list of two-tuples
473
+ :param dict collection_formats: Parameter collection formats
474
+ :return: URL query string (e.g. a=Hello%20World&b=123)
475
+ """
476
+ new_params: List[Tuple[str, str]] = []
477
+ if collection_formats is None:
478
+ collection_formats = {}
479
+ for k, v in params.items() if isinstance(params, dict) else params:
480
+ if isinstance(v, bool):
481
+ v = str(v).lower()
482
+ if isinstance(v, (int, float)):
483
+ v = str(v)
484
+ if isinstance(v, dict):
485
+ v = json.dumps(v)
486
+
487
+ if k in collection_formats:
488
+ collection_format = collection_formats[k]
489
+ if collection_format == 'multi':
490
+ new_params.extend((k, str(value)) for value in v)
491
+ else:
492
+ if collection_format == 'ssv':
493
+ delimiter = ' '
494
+ elif collection_format == 'tsv':
495
+ delimiter = '\t'
496
+ elif collection_format == 'pipes':
497
+ delimiter = '|'
498
+ else: # csv is the default
499
+ delimiter = ','
500
+ new_params.append(
501
+ (k, delimiter.join(quote(str(value)) for value in v))
502
+ )
503
+ else:
504
+ new_params.append((k, quote(str(v))))
505
+
506
+ return "&".join(["=".join(map(str, item)) for item in new_params])
507
+
508
+ def files_parameters(self, files=None):
543
509
  """Builds form parameters.
544
510
 
545
- :param files: None or a dict with key=param_name and
546
- value is a list of open file objects
547
- :return: List of tuples of form parameters with file data
511
+ :param files: File parameters.
512
+ :return: Form parameters with files.
548
513
  """
549
- if files is None:
550
- return []
551
-
552
514
  params = []
553
- for param_name, file_instances in files.items():
554
- if file_instances is None:
555
- # if the file field is nullable, skip None values
556
- continue
557
- for file_instance in file_instances:
558
- if file_instance is None:
559
- # if the file field is nullable, skip None values
515
+
516
+ if files:
517
+ for k, v in files.items():
518
+ if not v:
560
519
  continue
561
- if file_instance.closed is True:
562
- raise ApiValueError(
563
- "Cannot read a closed file. The passed in file_type "
564
- "for %s must be open." % param_name
565
- )
566
- filename = os.path.basename(file_instance.name)
567
- filedata = self.get_file_data_and_close_file(file_instance)
568
- mimetype = (mimetypes.guess_type(filename)[0] or
569
- 'application/octet-stream')
570
- params.append(
571
- tuple([param_name, tuple([filename, filedata, mimetype])]))
520
+ file_names = v if type(v) is list else [v]
521
+ for n in file_names:
522
+ with open(n, 'rb') as f:
523
+ filename = os.path.basename(f.name)
524
+ filedata = f.read()
525
+ mimetype = (
526
+ mimetypes.guess_type(filename)[0]
527
+ or 'application/octet-stream'
528
+ )
529
+ params.append(
530
+ tuple([k, tuple([filename, filedata, mimetype])])
531
+ )
572
532
 
573
533
  return params
574
534
 
575
- def select_header_accept(self, accepts):
535
+ def select_header_accept(self, accepts: List[str]) -> Optional[str]:
576
536
  """Returns `Accept` based on an array of accepts provided.
577
537
 
578
538
  :param accepts: List of headers.
579
539
  :return: Accept (e.g. application/json).
580
540
  """
581
541
  if not accepts:
582
- return
542
+ return None
583
543
 
584
- accepts = [x.lower() for x in accepts]
544
+ for accept in accepts:
545
+ if re.search('json', accept, re.IGNORECASE):
546
+ return accept
585
547
 
586
- if 'application/json' in accepts:
587
- return 'application/json'
588
- else:
589
- return ', '.join(accepts)
548
+ return accepts[0]
590
549
 
591
- def select_header_content_type(self, content_types, method=None, body=None):
550
+ def select_header_content_type(self, content_types):
592
551
  """Returns `Content-Type` based on an array of content_types provided.
593
552
 
594
553
  :param content_types: List of content-types.
595
- :param method: http method (e.g. POST, PATCH).
596
- :param body: http body to send.
597
554
  :return: Content-Type (e.g. application/json).
598
555
  """
599
556
  if not content_types:
600
557
  return None
601
558
 
602
- content_types = [x.lower() for x in content_types]
559
+ for content_type in content_types:
560
+ if re.search('json', content_type, re.IGNORECASE):
561
+ return content_type
603
562
 
604
- if (method == 'PATCH' and
605
- 'application/json-patch+json' in content_types and
606
- isinstance(body, list)):
607
- return 'application/json-patch+json'
563
+ return content_types[0]
608
564
 
609
- if 'application/json' in content_types or '*/*' in content_types:
610
- return 'application/json'
611
- else:
612
- return content_types[0]
613
-
614
- def update_params_for_auth(self, headers, queries, auth_settings,
615
- resource_path, method, body, request_auths=None):
565
+ def update_params_for_auth(
566
+ self,
567
+ headers,
568
+ queries,
569
+ auth_settings,
570
+ resource_path,
571
+ method,
572
+ body,
573
+ request_auth=None
574
+ ) -> None:
616
575
  """Updates header and query params based on authentication setting.
617
576
 
618
577
  :param headers: Header parameters dict to be updated.
619
578
  :param queries: Query parameters tuple list to be updated.
620
579
  :param auth_settings: Authentication setting identifiers list.
621
- :param resource_path: A string representation of the HTTP request resource path.
622
- :param method: A string representation of the HTTP request method.
623
- :param body: A object representing the body of the HTTP request.
624
- The object type is the return value of _encoder.default().
625
- :param request_auths: if set, the provided settings will
626
- override the token in the configuration.
580
+ :resource_path: A string representation of the HTTP request resource path.
581
+ :method: A string representation of the HTTP request method.
582
+ :body: A object representing the body of the HTTP request.
583
+ The object type is the return value of sanitize_for_serialization().
584
+ :param request_auth: if set, the provided settings will
585
+ override the token in the configuration.
627
586
  """
628
587
  if not auth_settings:
629
588
  return
630
589
 
631
- if request_auths:
632
- for auth_setting in request_auths:
633
- self._apply_auth_params(
634
- headers, queries, resource_path, method, body, auth_setting)
635
- return
590
+ if request_auth:
591
+ self._apply_auth_params(
592
+ headers,
593
+ queries,
594
+ resource_path,
595
+ method,
596
+ body,
597
+ request_auth
598
+ )
599
+ else:
600
+ for auth in auth_settings:
601
+ auth_setting = self.configuration.auth_settings().get(auth)
602
+ if auth_setting:
603
+ self._apply_auth_params(
604
+ headers,
605
+ queries,
606
+ resource_path,
607
+ method,
608
+ body,
609
+ auth_setting
610
+ )
636
611
 
637
- for auth in auth_settings:
638
- auth_setting = self.configuration.auth_settings().get(auth)
639
- if auth_setting:
640
- self._apply_auth_params(
641
- headers, queries, resource_path, method, body, auth_setting)
612
+ def _apply_auth_params(
613
+ self,
614
+ headers,
615
+ queries,
616
+ resource_path,
617
+ method,
618
+ body,
619
+ auth_setting
620
+ ) -> None:
621
+ """Updates the request parameters based on a single auth_setting
642
622
 
643
- def _apply_auth_params(self, headers, queries, resource_path, method, body, auth_setting):
623
+ :param headers: Header parameters dict to be updated.
624
+ :param queries: Query parameters tuple list to be updated.
625
+ :resource_path: A string representation of the HTTP request resource path.
626
+ :method: A string representation of the HTTP request method.
627
+ :body: A object representing the body of the HTTP request.
628
+ The object type is the return value of sanitize_for_serialization().
629
+ :param auth_setting: auth settings for the endpoint
630
+ """
644
631
  if auth_setting['in'] == 'cookie':
645
- headers['Cookie'] = auth_setting['key'] + "=" + auth_setting['value']
632
+ headers['Cookie'] = auth_setting['value']
646
633
  elif auth_setting['in'] == 'header':
647
634
  if auth_setting['type'] != 'http-signature':
648
635
  headers[auth_setting['key']] = auth_setting['value']
@@ -653,245 +640,120 @@ class ApiClient(object):
653
640
  'Authentication token must be in `query` or `header`'
654
641
  )
655
642
 
643
+ def __deserialize_file(self, response):
644
+ """Deserializes body to file
656
645
 
657
- class Endpoint(object):
658
- def __init__(self, settings=None, params_map=None, root_map=None,
659
- headers_map=None, api_client=None, callable=None):
660
- """Creates an endpoint
661
-
662
- Args:
663
- settings (dict): see below key value pairs
664
- 'response_type' (tuple/None): response type
665
- 'auth' (list): a list of auth type keys
666
- 'endpoint_path' (str): the endpoint path
667
- 'operation_id' (str): endpoint string identifier
668
- 'http_method' (str): POST/PUT/PATCH/GET etc
669
- 'servers' (list): list of str servers that this endpoint is at
670
- params_map (dict): see below key value pairs
671
- 'all' (list): list of str endpoint parameter names
672
- 'required' (list): list of required parameter names
673
- 'nullable' (list): list of nullable parameter names
674
- 'enum' (list): list of parameters with enum values
675
- 'validation' (list): list of parameters with validations
676
- root_map
677
- 'validations' (dict): the dict mapping endpoint parameter tuple
678
- paths to their validation dictionaries
679
- 'allowed_values' (dict): the dict mapping endpoint parameter
680
- tuple paths to their allowed_values (enum) dictionaries
681
- 'openapi_types' (dict): param_name to openapi type
682
- 'attribute_map' (dict): param_name to camelCase name
683
- 'location_map' (dict): param_name to 'body', 'file', 'form',
684
- 'header', 'path', 'query'
685
- collection_format_map (dict): param_name to `csv` etc.
686
- headers_map (dict): see below key value pairs
687
- 'accept' (list): list of Accept header strings
688
- 'content_type' (list): list of Content-Type header strings
689
- api_client (ApiClient) api client instance
690
- callable (function): the function which is invoked when the
691
- Endpoint is called
692
- """
693
- self.settings = settings
694
- self.params_map = params_map
695
- self.params_map['all'].extend([
696
- 'async_req',
697
- '_host_index',
698
- '_preload_content',
699
- '_request_timeout',
700
- '_return_http_data_only',
701
- '_check_input_type',
702
- '_check_return_type',
703
- '_content_type',
704
- '_spec_property_naming',
705
- '_request_auths'
706
- ])
707
- self.params_map['nullable'].extend(['_request_timeout'])
708
- self.validations = root_map['validations']
709
- self.allowed_values = root_map['allowed_values']
710
- self.openapi_types = root_map['openapi_types']
711
- extra_types = {
712
- 'async_req': (bool,),
713
- '_host_index': (none_type, int),
714
- '_preload_content': (bool,),
715
- '_request_timeout': (none_type, float, (float,), [float], int, (int,), [int]),
716
- '_return_http_data_only': (bool,),
717
- '_check_input_type': (bool,),
718
- '_check_return_type': (bool,),
719
- '_spec_property_naming': (bool,),
720
- '_content_type': (none_type, str),
721
- '_request_auths': (none_type, list)
722
- }
723
- self.openapi_types.update(extra_types)
724
- self.attribute_map = root_map['attribute_map']
725
- self.location_map = root_map['location_map']
726
- self.collection_format_map = root_map['collection_format_map']
727
- self.headers_map = headers_map
728
- self.api_client = api_client
729
- self.callable = callable
730
-
731
- def __validate_inputs(self, kwargs):
732
- for param in self.params_map['enum']:
733
- if param in kwargs:
734
- check_allowed_values(
735
- self.allowed_values,
736
- (param,),
737
- kwargs[param]
738
- )
739
-
740
- for param in self.params_map['validation']:
741
- if param in kwargs:
742
- check_validations(
743
- self.validations,
744
- (param,),
745
- kwargs[param],
746
- configuration=self.api_client.configuration
747
- )
646
+ Saves response body into a file in a temporary folder,
647
+ using the filename from the `Content-Disposition` header if provided.
748
648
 
749
- if kwargs['_check_input_type'] is False:
750
- return
649
+ handle file downloading
650
+ save response body into a tmp file and return the instance
751
651
 
752
- for key, value in kwargs.items():
753
- fixed_val = validate_and_convert_types(
754
- value,
755
- self.openapi_types[key],
756
- [key],
757
- kwargs['_spec_property_naming'],
758
- kwargs['_check_input_type'],
759
- configuration=self.api_client.configuration
652
+ :param response: RESTResponse.
653
+ :return: file path.
654
+ """
655
+ fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
656
+ os.close(fd)
657
+ os.remove(path)
658
+
659
+ content_disposition = response.getheader("Content-Disposition")
660
+ if content_disposition:
661
+ m = re.search(
662
+ r'filename=[\'"]?([^\'"\s]+)[\'"]?',
663
+ content_disposition
760
664
  )
761
- kwargs[key] = fixed_val
762
-
763
- def __gather_params(self, kwargs):
764
- params = {
765
- 'body': None,
766
- 'collection_format': {},
767
- 'file': {},
768
- 'form': [],
769
- 'header': {},
770
- 'path': {},
771
- 'query': []
772
- }
665
+ assert m is not None, "Unexpected 'content-disposition' header value"
666
+ filename = m.group(1)
667
+ path = os.path.join(os.path.dirname(path), filename)
773
668
 
774
- for param_name, param_value in kwargs.items():
775
- param_location = self.location_map.get(param_name)
776
- if param_location is None:
777
- continue
778
- if param_location:
779
- if param_location == 'body':
780
- params['body'] = param_value
781
- continue
782
- base_name = self.attribute_map[param_name]
783
- if (param_location == 'form' and
784
- self.openapi_types[param_name] == (file_type,)):
785
- params['file'][base_name] = [param_value]
786
- elif (param_location == 'form' and
787
- self.openapi_types[param_name] == ([file_type],)):
788
- # param_value is already a list
789
- params['file'][base_name] = param_value
790
- elif param_location in {'form', 'query'}:
791
- param_value_full = (base_name, param_value)
792
- params[param_location].append(param_value_full)
793
- if param_location not in {'form', 'query'}:
794
- params[param_location][base_name] = param_value
795
- collection_format = self.collection_format_map.get(param_name)
796
- if collection_format:
797
- params['collection_format'][base_name] = collection_format
669
+ with open(path, "wb") as f:
670
+ f.write(response.data)
798
671
 
799
- return params
672
+ return path
800
673
 
801
- def __call__(self, *args, **kwargs):
802
- """ This method is invoked when endpoints are called
803
- Example:
674
+ def __deserialize_primitive(self, data, klass):
675
+ """Deserializes string to primitive type.
804
676
 
805
- api_instance = CourierApi()
806
- api_instance.get_courier_message # this is an instance of the class Endpoint
807
- api_instance.get_courier_message() # this invokes api_instance.get_courier_message.__call__()
808
- which then invokes the callable functions stored in that endpoint at
809
- api_instance.get_courier_message.callable or self.callable in this class
677
+ :param data: str.
678
+ :param klass: class literal.
810
679
 
680
+ :return: int, long, float, str, bool.
811
681
  """
812
- return self.callable(self, *args, **kwargs)
682
+ try:
683
+ return klass(data)
684
+ except UnicodeEncodeError:
685
+ return str(data)
686
+ except TypeError:
687
+ return data
688
+
689
+ def __deserialize_object(self, value):
690
+ """Return an original value.
691
+
692
+ :return: object.
693
+ """
694
+ return value
813
695
 
814
- def call_with_http_info(self, **kwargs):
696
+ def __deserialize_date(self, string):
697
+ """Deserializes string to date.
815
698
 
699
+ :param string: str.
700
+ :return: date.
701
+ """
816
702
  try:
817
- index = self.api_client.configuration.server_operation_index.get(
818
- self.settings['operation_id'], self.api_client.configuration.server_index
819
- ) if kwargs['_host_index'] is None else kwargs['_host_index']
820
- server_variables = self.api_client.configuration.server_operation_variables.get(
821
- self.settings['operation_id'], self.api_client.configuration.server_variables
822
- )
823
- _host = self.api_client.configuration.get_host_from_settings(
824
- index, variables=server_variables, servers=self.settings['servers']
703
+ return parse(string).date()
704
+ except ImportError:
705
+ return string
706
+ except ValueError:
707
+ raise rest.ApiException(
708
+ status=0,
709
+ reason="Failed to parse `{0}` as date object".format(string)
825
710
  )
826
- except IndexError:
827
- if self.settings['servers']:
828
- raise ApiValueError(
829
- "Invalid host index. Must be 0 <= index < %s" %
830
- len(self.settings['servers'])
831
- )
832
- _host = None
833
-
834
- for key, value in kwargs.items():
835
- if key not in self.params_map['all']:
836
- raise ApiTypeError(
837
- "Got an unexpected parameter '%s'"
838
- " to method `%s`" %
839
- (key, self.settings['operation_id'])
840
- )
841
- # only throw this nullable ApiValueError if _check_input_type
842
- # is False, if _check_input_type==True we catch this case
843
- # in self.__validate_inputs
844
- if (key not in self.params_map['nullable'] and value is None
845
- and kwargs['_check_input_type'] is False):
846
- raise ApiValueError(
847
- "Value may not be None for non-nullable parameter `%s`"
848
- " when calling `%s`" %
849
- (key, self.settings['operation_id'])
850
- )
851
711
 
852
- for key in self.params_map['required']:
853
- if key not in kwargs.keys():
854
- raise ApiValueError(
855
- "Missing the required parameter `%s` when calling "
856
- "`%s`" % (key, self.settings['operation_id'])
712
+ def __deserialize_datetime(self, string):
713
+ """Deserializes string to datetime.
714
+
715
+ The string should be in iso8601 datetime format.
716
+
717
+ :param string: str.
718
+ :return: datetime.
719
+ """
720
+ try:
721
+ return parse(string)
722
+ except ImportError:
723
+ return string
724
+ except ValueError:
725
+ raise rest.ApiException(
726
+ status=0,
727
+ reason=(
728
+ "Failed to parse `{0}` as datetime object"
729
+ .format(string)
857
730
  )
731
+ )
732
+
733
+ def __deserialize_enum(self, data, klass):
734
+ """Deserializes primitive type to enum.
858
735
 
859
- self.__validate_inputs(kwargs)
736
+ :param data: primitive type.
737
+ :param klass: class literal.
738
+ :return: enum value.
739
+ """
740
+ try:
741
+ return klass(data)
742
+ except ValueError:
743
+ raise rest.ApiException(
744
+ status=0,
745
+ reason=(
746
+ "Failed to parse `{0}` as `{1}`"
747
+ .format(data, klass)
748
+ )
749
+ )
860
750
 
861
- params = self.__gather_params(kwargs)
751
+ def __deserialize_model(self, data, klass):
752
+ """Deserializes list or dict to model.
862
753
 
863
- accept_headers_list = self.headers_map['accept']
864
- if accept_headers_list:
865
- params['header']['Accept'] = self.api_client.select_header_accept(
866
- accept_headers_list)
754
+ :param data: dict, list.
755
+ :param klass: class literal.
756
+ :return: model object.
757
+ """
867
758
 
868
- if kwargs.get('_content_type'):
869
- params['header']['Content-Type'] = kwargs['_content_type']
870
- else:
871
- content_type_headers_list = self.headers_map['content_type']
872
- if content_type_headers_list:
873
- if params['body'] != "":
874
- content_types_list = self.api_client.select_header_content_type(
875
- content_type_headers_list, self.settings['http_method'],
876
- params['body'])
877
- if content_types_list:
878
- params['header']['Content-Type'] = content_types_list
879
-
880
- return self.api_client.call_api(
881
- self.settings['endpoint_path'], self.settings['http_method'],
882
- params['path'],
883
- params['query'],
884
- params['header'],
885
- body=params['body'],
886
- post_params=params['form'],
887
- files=params['file'],
888
- response_type=self.settings['response_type'],
889
- auth_settings=self.settings['auth'],
890
- async_req=kwargs['async_req'],
891
- _check_type=kwargs['_check_return_type'],
892
- _return_http_data_only=kwargs['_return_http_data_only'],
893
- _preload_content=kwargs['_preload_content'],
894
- _request_timeout=kwargs['_request_timeout'],
895
- _host=_host,
896
- _request_auths=kwargs['_request_auths'],
897
- collection_formats=params['collection_format'])
759
+ return klass.from_dict(data)