autoassembler 0.3.1__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.
- autoassembler/.fernignore +7 -0
- autoassembler/__init__.py +537 -0
- autoassembler/_custom/__init__.py +56 -0
- autoassembler/_custom/assemblies.py +226 -0
- autoassembler/_custom/assemblies_api.py +188 -0
- autoassembler/_custom/credentials.py +248 -0
- autoassembler/_custom/http.py +42 -0
- autoassembler/_custom/operations.py +258 -0
- autoassembler/_custom/planning.py +598 -0
- autoassembler/_custom/planning_api.py +225 -0
- autoassembler/_default_clients.py +32 -0
- autoassembler/_version.py +8 -0
- autoassembler/alpha/__init__.py +63 -0
- autoassembler/alpha/client.py +82 -0
- autoassembler/alpha/jobs/__init__.py +39 -0
- autoassembler/alpha/jobs/client.py +338 -0
- autoassembler/alpha/jobs/raw_client.py +641 -0
- autoassembler/alpha/jobs/types/__init__.py +42 -0
- autoassembler/alpha/jobs/types/cancel_job_jobs_response.py +12 -0
- autoassembler/alpha/jobs/types/list_jobs_jobs_response.py +30 -0
- autoassembler/alpha/jobs/types/list_jobs_jobs_response_pagination.py +22 -0
- autoassembler/alpha/jobs/types/retry_job_jobs_response.py +16 -0
- autoassembler/alpha/planning/__init__.py +49 -0
- autoassembler/alpha/planning/client.py +201 -0
- autoassembler/alpha/planning/raw_client.py +268 -0
- autoassembler/alpha/planning/types/__init__.py +47 -0
- autoassembler/alpha/planning/types/apply_ops_planning_request_namespace.py +5 -0
- autoassembler/alpha/planning/types/apply_ops_planning_request_ops_item.py +13 -0
- autoassembler/alpha/planning/types/apply_ops_planning_request_ops_item_op.py +58 -0
- autoassembler/alpha/planning/types/apply_ops_planning_response.py +13 -0
- autoassembler/alpha/raw_client.py +13 -0
- autoassembler/assemblies/__init__.py +73 -0
- autoassembler/assemblies/client.py +1177 -0
- autoassembler/assemblies/raw_client.py +1557 -0
- autoassembler/assemblies/types/__init__.py +71 -0
- autoassembler/assemblies/types/delete_assembly_response.py +12 -0
- autoassembler/assemblies/types/download_assembly_cad_request_namespace.py +5 -0
- autoassembler/assemblies/types/get_assembly_info_request_namespace.py +5 -0
- autoassembler/assemblies/types/get_status_request_namespace.py +5 -0
- autoassembler/assemblies/types/get_status_response.py +16 -0
- autoassembler/assemblies/types/get_status_response_progress.py +13 -0
- autoassembler/assemblies/types/get_status_response_status.py +7 -0
- autoassembler/assemblies/types/get_structure_request_namespace.py +5 -0
- autoassembler/assemblies/types/list_assembly_versions_request_namespace.py +5 -0
- autoassembler/assemblies/types/list_connections_request_namespace.py +5 -0
- autoassembler/assemblies/types/process_request_namespace.py +5 -0
- autoassembler/assemblies/types/update_assembly_info_request_namespace.py +5 -0
- autoassembler/auth/__init__.py +34 -0
- autoassembler/auth/client.py +282 -0
- autoassembler/auth/raw_client.py +413 -0
- autoassembler/auth/types/__init__.py +36 -0
- autoassembler/auth/types/create_access_token_request_grant_type.py +7 -0
- autoassembler/base_client.py +328 -0
- autoassembler/client.py +262 -0
- autoassembler/core/__init__.py +127 -0
- autoassembler/core/api_error.py +23 -0
- autoassembler/core/client_wrapper.py +147 -0
- autoassembler/core/datetime_utils.py +70 -0
- autoassembler/core/file.py +67 -0
- autoassembler/core/force_multipart.py +18 -0
- autoassembler/core/http_client.py +965 -0
- autoassembler/core/http_response.py +63 -0
- autoassembler/core/http_sse/__init__.py +42 -0
- autoassembler/core/http_sse/_api.py +455 -0
- autoassembler/core/http_sse/_decoders.py +74 -0
- autoassembler/core/http_sse/_exceptions.py +7 -0
- autoassembler/core/http_sse/_models.py +17 -0
- autoassembler/core/jsonable_encoder.py +133 -0
- autoassembler/core/logging.py +107 -0
- autoassembler/core/parse_error.py +36 -0
- autoassembler/core/pydantic_utilities.py +486 -0
- autoassembler/core/query_encoder.py +58 -0
- autoassembler/core/remove_none_from_dict.py +11 -0
- autoassembler/core/request_options.py +40 -0
- autoassembler/core/serialization.py +347 -0
- autoassembler/environment.py +7 -0
- autoassembler/errors/__init__.py +56 -0
- autoassembler/errors/bad_request_error.py +10 -0
- autoassembler/errors/conflict_error.py +10 -0
- autoassembler/errors/forbidden_error.py +11 -0
- autoassembler/errors/internal_server_error.py +11 -0
- autoassembler/errors/not_found_error.py +11 -0
- autoassembler/errors/unauthorized_error.py +10 -0
- autoassembler/errors/unprocessable_entity_error.py +11 -0
- autoassembler/operation.py +196 -0
- autoassembler/operations/__init__.py +4 -0
- autoassembler/operations/client.py +209 -0
- autoassembler/operations/raw_client.py +343 -0
- autoassembler/planning/__init__.py +70 -0
- autoassembler/planning/client.py +1174 -0
- autoassembler/planning/raw_client.py +1349 -0
- autoassembler/planning/types/__init__.py +68 -0
- autoassembler/planning/types/adapt_request_namespace.py +5 -0
- autoassembler/planning/types/create_mpp_request_body.py +8 -0
- autoassembler/planning/types/create_mpp_request_namespace.py +5 -0
- autoassembler/planning/types/delete_mpp_request_namespace.py +5 -0
- autoassembler/planning/types/delete_mpp_response.py +12 -0
- autoassembler/planning/types/evaluate_dfa_request_namespace.py +5 -0
- autoassembler/planning/types/get_mpp_request_namespace.py +5 -0
- autoassembler/planning/types/get_mpp_response.py +27 -0
- autoassembler/planning/types/list_mpps_request_namespace.py +5 -0
- autoassembler/planning/types/plan_request_namespace.py +5 -0
- autoassembler/planning/types/validate_request_namespace.py +5 -0
- autoassembler/py.typed +0 -0
- autoassembler/sessions/__init__.py +4 -0
- autoassembler/sessions/client.py +102 -0
- autoassembler/sessions/raw_client.py +126 -0
- autoassembler/types/__init__.py +344 -0
- autoassembler/types/access_token_response.py +14 -0
- autoassembler/types/active_session.py +25 -0
- autoassembler/types/active_session_namespace.py +5 -0
- autoassembler/types/adapt_mpp_accepted.py +26 -0
- autoassembler/types/assembly.py +30 -0
- autoassembler/types/assembly_connection.py +21 -0
- autoassembler/types/assembly_connection_relationship.py +5 -0
- autoassembler/types/assembly_connections_response.py +13 -0
- autoassembler/types/assembly_diff_metadata.py +35 -0
- autoassembler/types/assembly_diff_response.py +34 -0
- autoassembler/types/assembly_info.py +36 -0
- autoassembler/types/assembly_json_response.py +15 -0
- autoassembler/types/assembly_process_metadata.py +32 -0
- autoassembler/types/assembly_process_response.py +18 -0
- autoassembler/types/assembly_search_hit.py +31 -0
- autoassembler/types/assembly_version_summary.py +27 -0
- autoassembler/types/conflict_error_body.py +19 -0
- autoassembler/types/conflict_error_body_error.py +5 -0
- autoassembler/types/create_mpp_request.py +13 -0
- autoassembler/types/device_authorization_response.py +17 -0
- autoassembler/types/diff_accepted.py +42 -0
- autoassembler/types/diff_context_node.py +20 -0
- autoassembler/types/diff_details.py +73 -0
- autoassembler/types/diff_error_response.py +38 -0
- autoassembler/types/diff_flags.py +74 -0
- autoassembler/types/diff_ml_semantics.py +55 -0
- autoassembler/types/diff_node.py +26 -0
- autoassembler/types/diff_node_pair_with_parts.py +90 -0
- autoassembler/types/diff_node_with_parent.py +15 -0
- autoassembler/types/diff_reference_target_nodes.py +25 -0
- autoassembler/types/diff_report.py +24 -0
- autoassembler/types/diff_rigid_alignment.py +30 -0
- autoassembler/types/diff_summary.py +121 -0
- autoassembler/types/diff_summary_assembly_labels.py +44 -0
- autoassembler/types/diff_summary_geometric_diffs.py +24 -0
- autoassembler/types/diff_summary_persistent_edges_congruence.py +24 -0
- autoassembler/types/diff_summary_persistent_edges_congruence_pose.py +24 -0
- autoassembler/types/diff_summary_persistent_nodes_congruence.py +24 -0
- autoassembler/types/diff_summary_persistent_nodes_congruence_pose.py +24 -0
- autoassembler/types/diff_summary_total_parts.py +24 -0
- autoassembler/types/diff_swap.py +65 -0
- autoassembler/types/diff_swap_confidence.py +5 -0
- autoassembler/types/diff_swap_group.py +92 -0
- autoassembler/types/diff_validation_issue.py +38 -0
- autoassembler/types/diff_validation_issue_severity.py +5 -0
- autoassembler/types/diff_validation_result.py +35 -0
- autoassembler/types/diff_warning.py +79 -0
- autoassembler/types/diff_warning_reason.py +18 -0
- autoassembler/types/diff_warning_severity.py +5 -0
- autoassembler/types/error_response.py +30 -0
- autoassembler/types/filter.py +19 -0
- autoassembler/types/filter_field.py +7 -0
- autoassembler/types/filter_operator.py +5 -0
- autoassembler/types/job.py +123 -0
- autoassembler/types/job_progress.py +24 -0
- autoassembler/types/job_status.py +5 -0
- autoassembler/types/list_operations_response.py +25 -0
- autoassembler/types/manufacturing_process_plan.py +57 -0
- autoassembler/types/mpp_adapt_metadata.py +48 -0
- autoassembler/types/mpp_adapt_response.py +22 -0
- autoassembler/types/mpp_evaluate_dfa_metadata.py +47 -0
- autoassembler/types/mpp_evaluate_dfa_response.py +22 -0
- autoassembler/types/mpp_plan_metadata.py +47 -0
- autoassembler/types/mpp_plan_response.py +22 -0
- autoassembler/types/mpp_summary.py +20 -0
- autoassembler/types/mpp_validate_metadata.py +47 -0
- autoassembler/types/mpp_validate_response.py +22 -0
- autoassembler/types/o_auth_error_response.py +14 -0
- autoassembler/types/o_auth_error_response_error.py +18 -0
- autoassembler/types/operation.py +27 -0
- autoassembler/types/operation_error.py +21 -0
- autoassembler/types/operation_metadata.py +148 -0
- autoassembler/types/operation_response.py +94 -0
- autoassembler/types/process_assembly_accepted.py +14 -0
- autoassembler/types/process_assembly_response.py +55 -0
- autoassembler/types/process_assembly_skipped.py +14 -0
- autoassembler/types/search_assemblies_response.py +14 -0
- autoassembler/types/seq_plan_accepted.py +24 -0
- autoassembler/types/sever.py +33 -0
- autoassembler/types/sever_kind.py +5 -0
- autoassembler/types/sever_source.py +5 -0
- autoassembler/types/sort.py +8 -0
- autoassembler/types/upload_response.py +19 -0
- autoassembler/types/user_info.py +19 -0
- autoassembler/types/user_info_response.py +23 -0
- autoassembler/types/user_info_response_providers.py +14 -0
- autoassembler-0.3.1.dist-info/METADATA +209 -0
- autoassembler-0.3.1.dist-info/RECORD +198 -0
- autoassembler-0.3.1.dist-info/WHEEL +4 -0
- autoassembler-0.3.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
import typing
|
|
6
|
+
from importlib import import_module
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from .delete_assembly_response import DeleteAssemblyResponse
|
|
10
|
+
from .download_assembly_cad_request_namespace import DownloadAssemblyCadRequestNamespace
|
|
11
|
+
from .get_assembly_info_request_namespace import GetAssemblyInfoRequestNamespace
|
|
12
|
+
from .get_status_request_namespace import GetStatusRequestNamespace
|
|
13
|
+
from .get_status_response import GetStatusResponse
|
|
14
|
+
from .get_status_response_progress import GetStatusResponseProgress
|
|
15
|
+
from .get_status_response_status import GetStatusResponseStatus
|
|
16
|
+
from .get_structure_request_namespace import GetStructureRequestNamespace
|
|
17
|
+
from .list_assembly_versions_request_namespace import ListAssemblyVersionsRequestNamespace
|
|
18
|
+
from .list_connections_request_namespace import ListConnectionsRequestNamespace
|
|
19
|
+
from .process_request_namespace import ProcessRequestNamespace
|
|
20
|
+
from .update_assembly_info_request_namespace import UpdateAssemblyInfoRequestNamespace
|
|
21
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
22
|
+
"DeleteAssemblyResponse": ".delete_assembly_response",
|
|
23
|
+
"DownloadAssemblyCadRequestNamespace": ".download_assembly_cad_request_namespace",
|
|
24
|
+
"GetAssemblyInfoRequestNamespace": ".get_assembly_info_request_namespace",
|
|
25
|
+
"GetStatusRequestNamespace": ".get_status_request_namespace",
|
|
26
|
+
"GetStatusResponse": ".get_status_response",
|
|
27
|
+
"GetStatusResponseProgress": ".get_status_response_progress",
|
|
28
|
+
"GetStatusResponseStatus": ".get_status_response_status",
|
|
29
|
+
"GetStructureRequestNamespace": ".get_structure_request_namespace",
|
|
30
|
+
"ListAssemblyVersionsRequestNamespace": ".list_assembly_versions_request_namespace",
|
|
31
|
+
"ListConnectionsRequestNamespace": ".list_connections_request_namespace",
|
|
32
|
+
"ProcessRequestNamespace": ".process_request_namespace",
|
|
33
|
+
"UpdateAssemblyInfoRequestNamespace": ".update_assembly_info_request_namespace",
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
38
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
39
|
+
if module_name is None:
|
|
40
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
41
|
+
try:
|
|
42
|
+
module = import_module(module_name, __package__)
|
|
43
|
+
if module_name == f".{attr_name}":
|
|
44
|
+
return module
|
|
45
|
+
else:
|
|
46
|
+
return getattr(module, attr_name)
|
|
47
|
+
except ImportError as e:
|
|
48
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
49
|
+
except AttributeError as e:
|
|
50
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def __dir__():
|
|
54
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
55
|
+
return sorted(lazy_attrs)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
__all__ = [
|
|
59
|
+
"DeleteAssemblyResponse",
|
|
60
|
+
"DownloadAssemblyCadRequestNamespace",
|
|
61
|
+
"GetAssemblyInfoRequestNamespace",
|
|
62
|
+
"GetStatusRequestNamespace",
|
|
63
|
+
"GetStatusResponse",
|
|
64
|
+
"GetStatusResponseProgress",
|
|
65
|
+
"GetStatusResponseStatus",
|
|
66
|
+
"GetStructureRequestNamespace",
|
|
67
|
+
"ListAssemblyVersionsRequestNamespace",
|
|
68
|
+
"ListConnectionsRequestNamespace",
|
|
69
|
+
"ProcessRequestNamespace",
|
|
70
|
+
"UpdateAssemblyInfoRequestNamespace",
|
|
71
|
+
]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class DeleteAssemblyResponse(UniversalBaseModel):
|
|
10
|
+
message: typing.Optional[str] = None
|
|
11
|
+
|
|
12
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
7
|
+
from .get_status_response_progress import GetStatusResponseProgress
|
|
8
|
+
from .get_status_response_status import GetStatusResponseStatus
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class GetStatusResponse(UniversalBaseModel):
|
|
12
|
+
status: typing.Optional[GetStatusResponseStatus] = None
|
|
13
|
+
error: typing.Optional[str] = None
|
|
14
|
+
progress: typing.Optional[GetStatusResponseProgress] = None
|
|
15
|
+
|
|
16
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class GetStatusResponseProgress(UniversalBaseModel):
|
|
10
|
+
stage: typing.Optional[str] = None
|
|
11
|
+
fraction: typing.Optional[float] = None
|
|
12
|
+
|
|
13
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
import typing
|
|
6
|
+
from importlib import import_module
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from .types import CreateAccessTokenRequestGrantType
|
|
10
|
+
_dynamic_imports: typing.Dict[str, str] = {"CreateAccessTokenRequestGrantType": ".types"}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
14
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
15
|
+
if module_name is None:
|
|
16
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
17
|
+
try:
|
|
18
|
+
module = import_module(module_name, __package__)
|
|
19
|
+
if module_name == f".{attr_name}":
|
|
20
|
+
return module
|
|
21
|
+
else:
|
|
22
|
+
return getattr(module, attr_name)
|
|
23
|
+
except ImportError as e:
|
|
24
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
25
|
+
except AttributeError as e:
|
|
26
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def __dir__():
|
|
30
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
31
|
+
return sorted(lazy_attrs)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
__all__ = ["CreateAccessTokenRequestGrantType"]
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
|
+
from ..core.request_options import RequestOptions
|
|
7
|
+
from ..types.access_token_response import AccessTokenResponse
|
|
8
|
+
from ..types.device_authorization_response import DeviceAuthorizationResponse
|
|
9
|
+
from ..types.user_info_response import UserInfoResponse
|
|
10
|
+
from .raw_client import AsyncRawAuthClient, RawAuthClient
|
|
11
|
+
from .types.create_access_token_request_grant_type import CreateAccessTokenRequestGrantType
|
|
12
|
+
|
|
13
|
+
# this is used as the default value for optional parameters
|
|
14
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class AuthClient:
|
|
18
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
19
|
+
self._raw_client = RawAuthClient(client_wrapper=client_wrapper)
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def with_raw_response(self) -> RawAuthClient:
|
|
23
|
+
"""
|
|
24
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
25
|
+
|
|
26
|
+
Returns
|
|
27
|
+
-------
|
|
28
|
+
RawAuthClient
|
|
29
|
+
"""
|
|
30
|
+
return self._raw_client
|
|
31
|
+
|
|
32
|
+
def create_device_authorization(
|
|
33
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
34
|
+
) -> DeviceAuthorizationResponse:
|
|
35
|
+
"""
|
|
36
|
+
Starts the OAuth 2.0 device authorization grant (RFC 8628). Show the user `verification_uri_complete`, then poll `POST /oauth/token` with `device_code` every `interval` seconds until it returns a token or a terminal error.
|
|
37
|
+
|
|
38
|
+
Parameters
|
|
39
|
+
----------
|
|
40
|
+
request_options : typing.Optional[RequestOptions]
|
|
41
|
+
Request-specific configuration.
|
|
42
|
+
|
|
43
|
+
Returns
|
|
44
|
+
-------
|
|
45
|
+
DeviceAuthorizationResponse
|
|
46
|
+
Successful initiation of device authorization
|
|
47
|
+
|
|
48
|
+
Examples
|
|
49
|
+
--------
|
|
50
|
+
from autoassembler import AutoAssembler
|
|
51
|
+
|
|
52
|
+
client = AutoAssembler(
|
|
53
|
+
token="YOUR_TOKEN",
|
|
54
|
+
)
|
|
55
|
+
client.auth.create_device_authorization()
|
|
56
|
+
"""
|
|
57
|
+
_response = self._raw_client.create_device_authorization(request_options=request_options)
|
|
58
|
+
return _response.data
|
|
59
|
+
|
|
60
|
+
def create_access_token(
|
|
61
|
+
self,
|
|
62
|
+
*,
|
|
63
|
+
grant_type: CreateAccessTokenRequestGrantType,
|
|
64
|
+
device_code: typing.Optional[str] = OMIT,
|
|
65
|
+
client_id: typing.Optional[str] = OMIT,
|
|
66
|
+
client_secret: typing.Optional[str] = OMIT,
|
|
67
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
68
|
+
) -> AccessTokenResponse:
|
|
69
|
+
"""
|
|
70
|
+
Follows OAuth 2.0 token endpoint (RFC 6749 §5). Device flow §4.3.3; client_credentials grant §4.4. Send the resulting token as `Authorization: Bearer <token>`.
|
|
71
|
+
|
|
72
|
+
Parameters
|
|
73
|
+
----------
|
|
74
|
+
grant_type : CreateAccessTokenRequestGrantType
|
|
75
|
+
`client_credentials` uses an API key for machine-to-machine access. `urn:ietf:params:oauth:grant-type:device_code` completes the device authorization flow.
|
|
76
|
+
|
|
77
|
+
device_code : typing.Optional[str]
|
|
78
|
+
Code returned by `POST /oauth/device/code`. Required for the device authorization flow.
|
|
79
|
+
|
|
80
|
+
client_id : typing.Optional[str]
|
|
81
|
+
API key ID. Required for machine-to-machine access.
|
|
82
|
+
|
|
83
|
+
client_secret : typing.Optional[str]
|
|
84
|
+
API key secret shown once when the key was created. Required for machine-to-machine access.
|
|
85
|
+
|
|
86
|
+
request_options : typing.Optional[RequestOptions]
|
|
87
|
+
Request-specific configuration.
|
|
88
|
+
|
|
89
|
+
Returns
|
|
90
|
+
-------
|
|
91
|
+
AccessTokenResponse
|
|
92
|
+
Access token granted. Send it as `Authorization: Bearer <token>`.
|
|
93
|
+
|
|
94
|
+
Examples
|
|
95
|
+
--------
|
|
96
|
+
from autoassembler import AutoAssembler
|
|
97
|
+
|
|
98
|
+
client = AutoAssembler(
|
|
99
|
+
token="YOUR_TOKEN",
|
|
100
|
+
)
|
|
101
|
+
client.auth.create_access_token(
|
|
102
|
+
grant_type="client_credentials",
|
|
103
|
+
)
|
|
104
|
+
"""
|
|
105
|
+
_response = self._raw_client.create_access_token(
|
|
106
|
+
grant_type=grant_type,
|
|
107
|
+
device_code=device_code,
|
|
108
|
+
client_id=client_id,
|
|
109
|
+
client_secret=client_secret,
|
|
110
|
+
request_options=request_options,
|
|
111
|
+
)
|
|
112
|
+
return _response.data
|
|
113
|
+
|
|
114
|
+
def get_current_user(self, *, request_options: typing.Optional[RequestOptions] = None) -> UserInfoResponse:
|
|
115
|
+
"""
|
|
116
|
+
Parameters
|
|
117
|
+
----------
|
|
118
|
+
request_options : typing.Optional[RequestOptions]
|
|
119
|
+
Request-specific configuration.
|
|
120
|
+
|
|
121
|
+
Returns
|
|
122
|
+
-------
|
|
123
|
+
UserInfoResponse
|
|
124
|
+
Successful retrieval of user info
|
|
125
|
+
|
|
126
|
+
Examples
|
|
127
|
+
--------
|
|
128
|
+
from autoassembler import AutoAssembler
|
|
129
|
+
|
|
130
|
+
client = AutoAssembler(
|
|
131
|
+
token="YOUR_TOKEN",
|
|
132
|
+
)
|
|
133
|
+
client.auth.get_current_user()
|
|
134
|
+
"""
|
|
135
|
+
_response = self._raw_client.get_current_user(request_options=request_options)
|
|
136
|
+
return _response.data
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class AsyncAuthClient:
|
|
140
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
141
|
+
self._raw_client = AsyncRawAuthClient(client_wrapper=client_wrapper)
|
|
142
|
+
|
|
143
|
+
@property
|
|
144
|
+
def with_raw_response(self) -> AsyncRawAuthClient:
|
|
145
|
+
"""
|
|
146
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
147
|
+
|
|
148
|
+
Returns
|
|
149
|
+
-------
|
|
150
|
+
AsyncRawAuthClient
|
|
151
|
+
"""
|
|
152
|
+
return self._raw_client
|
|
153
|
+
|
|
154
|
+
async def create_device_authorization(
|
|
155
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
156
|
+
) -> DeviceAuthorizationResponse:
|
|
157
|
+
"""
|
|
158
|
+
Starts the OAuth 2.0 device authorization grant (RFC 8628). Show the user `verification_uri_complete`, then poll `POST /oauth/token` with `device_code` every `interval` seconds until it returns a token or a terminal error.
|
|
159
|
+
|
|
160
|
+
Parameters
|
|
161
|
+
----------
|
|
162
|
+
request_options : typing.Optional[RequestOptions]
|
|
163
|
+
Request-specific configuration.
|
|
164
|
+
|
|
165
|
+
Returns
|
|
166
|
+
-------
|
|
167
|
+
DeviceAuthorizationResponse
|
|
168
|
+
Successful initiation of device authorization
|
|
169
|
+
|
|
170
|
+
Examples
|
|
171
|
+
--------
|
|
172
|
+
import asyncio
|
|
173
|
+
|
|
174
|
+
from autoassembler import AsyncAutoAssembler
|
|
175
|
+
|
|
176
|
+
client = AsyncAutoAssembler(
|
|
177
|
+
token="YOUR_TOKEN",
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
async def main() -> None:
|
|
182
|
+
await client.auth.create_device_authorization()
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
asyncio.run(main())
|
|
186
|
+
"""
|
|
187
|
+
_response = await self._raw_client.create_device_authorization(request_options=request_options)
|
|
188
|
+
return _response.data
|
|
189
|
+
|
|
190
|
+
async def create_access_token(
|
|
191
|
+
self,
|
|
192
|
+
*,
|
|
193
|
+
grant_type: CreateAccessTokenRequestGrantType,
|
|
194
|
+
device_code: typing.Optional[str] = OMIT,
|
|
195
|
+
client_id: typing.Optional[str] = OMIT,
|
|
196
|
+
client_secret: typing.Optional[str] = OMIT,
|
|
197
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
198
|
+
) -> AccessTokenResponse:
|
|
199
|
+
"""
|
|
200
|
+
Follows OAuth 2.0 token endpoint (RFC 6749 §5). Device flow §4.3.3; client_credentials grant §4.4. Send the resulting token as `Authorization: Bearer <token>`.
|
|
201
|
+
|
|
202
|
+
Parameters
|
|
203
|
+
----------
|
|
204
|
+
grant_type : CreateAccessTokenRequestGrantType
|
|
205
|
+
`client_credentials` uses an API key for machine-to-machine access. `urn:ietf:params:oauth:grant-type:device_code` completes the device authorization flow.
|
|
206
|
+
|
|
207
|
+
device_code : typing.Optional[str]
|
|
208
|
+
Code returned by `POST /oauth/device/code`. Required for the device authorization flow.
|
|
209
|
+
|
|
210
|
+
client_id : typing.Optional[str]
|
|
211
|
+
API key ID. Required for machine-to-machine access.
|
|
212
|
+
|
|
213
|
+
client_secret : typing.Optional[str]
|
|
214
|
+
API key secret shown once when the key was created. Required for machine-to-machine access.
|
|
215
|
+
|
|
216
|
+
request_options : typing.Optional[RequestOptions]
|
|
217
|
+
Request-specific configuration.
|
|
218
|
+
|
|
219
|
+
Returns
|
|
220
|
+
-------
|
|
221
|
+
AccessTokenResponse
|
|
222
|
+
Access token granted. Send it as `Authorization: Bearer <token>`.
|
|
223
|
+
|
|
224
|
+
Examples
|
|
225
|
+
--------
|
|
226
|
+
import asyncio
|
|
227
|
+
|
|
228
|
+
from autoassembler import AsyncAutoAssembler
|
|
229
|
+
|
|
230
|
+
client = AsyncAutoAssembler(
|
|
231
|
+
token="YOUR_TOKEN",
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
async def main() -> None:
|
|
236
|
+
await client.auth.create_access_token(
|
|
237
|
+
grant_type="client_credentials",
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
asyncio.run(main())
|
|
242
|
+
"""
|
|
243
|
+
_response = await self._raw_client.create_access_token(
|
|
244
|
+
grant_type=grant_type,
|
|
245
|
+
device_code=device_code,
|
|
246
|
+
client_id=client_id,
|
|
247
|
+
client_secret=client_secret,
|
|
248
|
+
request_options=request_options,
|
|
249
|
+
)
|
|
250
|
+
return _response.data
|
|
251
|
+
|
|
252
|
+
async def get_current_user(self, *, request_options: typing.Optional[RequestOptions] = None) -> UserInfoResponse:
|
|
253
|
+
"""
|
|
254
|
+
Parameters
|
|
255
|
+
----------
|
|
256
|
+
request_options : typing.Optional[RequestOptions]
|
|
257
|
+
Request-specific configuration.
|
|
258
|
+
|
|
259
|
+
Returns
|
|
260
|
+
-------
|
|
261
|
+
UserInfoResponse
|
|
262
|
+
Successful retrieval of user info
|
|
263
|
+
|
|
264
|
+
Examples
|
|
265
|
+
--------
|
|
266
|
+
import asyncio
|
|
267
|
+
|
|
268
|
+
from autoassembler import AsyncAutoAssembler
|
|
269
|
+
|
|
270
|
+
client = AsyncAutoAssembler(
|
|
271
|
+
token="YOUR_TOKEN",
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
async def main() -> None:
|
|
276
|
+
await client.auth.get_current_user()
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
asyncio.run(main())
|
|
280
|
+
"""
|
|
281
|
+
_response = await self._raw_client.get_current_user(request_options=request_options)
|
|
282
|
+
return _response.data
|