stackmachine 0.3.0__py3-none-any.whl → 0.3.2__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.
- stackmachine/__init__.py +73 -1
- stackmachine/_async_client.py +98 -22
- stackmachine/_client.py +98 -22
- stackmachine/_config.py +4 -0
- stackmachine/_pagination.py +2 -1
- stackmachine/_transport.py +63 -35
- stackmachine/_types.py +268 -0
- stackmachine/_uploads.py +9 -8
- stackmachine/_utils.py +7 -5
- stackmachine/resources/_shared.py +3 -2
- stackmachine/resources/apps.py +39 -26
- stackmachine/resources/deployments.py +27 -20
- stackmachine/resources/domains.py +19 -16
- stackmachine/resources/files.py +8 -8
- stackmachine/resources/ssh.py +57 -41
- stackmachine/resources/versions.py +20 -12
- {stackmachine-0.3.0.dist-info → stackmachine-0.3.2.dist-info}/METADATA +19 -21
- stackmachine-0.3.2.dist-info/RECORD +25 -0
- stackmachine-0.3.0.dist-info/RECORD +0 -24
- {stackmachine-0.3.0.dist-info → stackmachine-0.3.2.dist-info}/WHEEL +0 -0
stackmachine/__init__.py
CHANGED
|
@@ -32,27 +32,97 @@ from ._models import (
|
|
|
32
32
|
Viewer,
|
|
33
33
|
)
|
|
34
34
|
from ._pagination import AsyncStackMachineList, StackMachineList
|
|
35
|
+
from ._types import (
|
|
36
|
+
AppAliasSortBy,
|
|
37
|
+
AppsDomainsCreateInput,
|
|
38
|
+
AppsDomainsListInput,
|
|
39
|
+
AppsSshAuthorizedKeysCreateInput,
|
|
40
|
+
AppsSshAuthorizedKeysDeleteInput,
|
|
41
|
+
AppsSshAuthorizedKeysListInput,
|
|
42
|
+
AppsSshServerUpdateInput,
|
|
43
|
+
AppsSshUsersListInput,
|
|
44
|
+
AppsSshUsersUpdateInput,
|
|
45
|
+
AppsVersionsListInput,
|
|
46
|
+
AppsVersionsLogsListInput,
|
|
47
|
+
AsyncStackMachineInitSettings,
|
|
48
|
+
CreateZipFiles,
|
|
49
|
+
DeployAppAutobuildExtraData,
|
|
50
|
+
DeployAppAutobuildInput,
|
|
51
|
+
DeployAppEnvVarInput,
|
|
52
|
+
DeployAppJobDefinitionInput,
|
|
53
|
+
DeployAppsListInput,
|
|
54
|
+
DeployAppsSortBy,
|
|
55
|
+
DeployAppVersionsSortBy,
|
|
56
|
+
DeployAppWordPressExtraData,
|
|
57
|
+
DeploymentProgressCallback,
|
|
58
|
+
FileInput,
|
|
59
|
+
Headers,
|
|
60
|
+
LogStream,
|
|
61
|
+
PaginationOptions,
|
|
62
|
+
Readable,
|
|
63
|
+
RequestOptionsInput,
|
|
64
|
+
RequestOptionsLike,
|
|
65
|
+
SshAuthenticationMethod,
|
|
66
|
+
SshTokenCreateResult,
|
|
67
|
+
SshUserPasswordRevealResult,
|
|
68
|
+
SshUserPasswordRotateResult,
|
|
69
|
+
StackMachineInitSettings,
|
|
70
|
+
UploadProgressCallback,
|
|
71
|
+
)
|
|
35
72
|
from ._uploads import create_zip
|
|
36
73
|
|
|
37
74
|
try:
|
|
38
75
|
__version__ = version("stackmachine")
|
|
39
76
|
except PackageNotFoundError:
|
|
40
|
-
__version__ = "0.3.
|
|
77
|
+
__version__ = "0.3.2"
|
|
41
78
|
|
|
42
79
|
__all__ = [
|
|
43
80
|
"AppAlias",
|
|
81
|
+
"AppAliasSortBy",
|
|
44
82
|
"AppSshServer",
|
|
83
|
+
"AppsDomainsCreateInput",
|
|
84
|
+
"AppsDomainsListInput",
|
|
85
|
+
"AppsSshAuthorizedKeysCreateInput",
|
|
86
|
+
"AppsSshAuthorizedKeysDeleteInput",
|
|
87
|
+
"AppsSshAuthorizedKeysListInput",
|
|
88
|
+
"AppsSshServerUpdateInput",
|
|
89
|
+
"AppsSshUsersListInput",
|
|
90
|
+
"AppsSshUsersUpdateInput",
|
|
91
|
+
"AppsVersionsListInput",
|
|
92
|
+
"AppsVersionsLogsListInput",
|
|
45
93
|
"AsyncStackMachine",
|
|
94
|
+
"AsyncStackMachineInitSettings",
|
|
46
95
|
"AsyncStackMachineList",
|
|
96
|
+
"CreateZipFiles",
|
|
47
97
|
"DeployApp",
|
|
98
|
+
"DeployAppAutobuildExtraData",
|
|
99
|
+
"DeployAppAutobuildInput",
|
|
100
|
+
"DeployAppEnvVarInput",
|
|
101
|
+
"DeployAppJobDefinitionInput",
|
|
48
102
|
"DeployAppKindWordPress",
|
|
49
103
|
"DeployAppVersion",
|
|
104
|
+
"DeployAppVersionsSortBy",
|
|
105
|
+
"DeployAppWordPressExtraData",
|
|
106
|
+
"DeployAppsListInput",
|
|
107
|
+
"DeployAppsSortBy",
|
|
50
108
|
"DeploymentProgress",
|
|
109
|
+
"DeploymentProgressCallback",
|
|
51
110
|
"ExpectedDNSRecord",
|
|
111
|
+
"FileInput",
|
|
112
|
+
"Headers",
|
|
52
113
|
"Log",
|
|
114
|
+
"LogStream",
|
|
115
|
+
"PaginationOptions",
|
|
116
|
+
"Readable",
|
|
53
117
|
"RequestOptions",
|
|
118
|
+
"RequestOptionsInput",
|
|
119
|
+
"RequestOptionsLike",
|
|
120
|
+
"SshAuthenticationMethod",
|
|
54
121
|
"SshAuthorizedKey",
|
|
122
|
+
"SshTokenCreateResult",
|
|
55
123
|
"SshUser",
|
|
124
|
+
"SshUserPasswordRevealResult",
|
|
125
|
+
"SshUserPasswordRotateResult",
|
|
56
126
|
"StackMachine",
|
|
57
127
|
"StackMachineAPIError",
|
|
58
128
|
"StackMachineAuthenticationError",
|
|
@@ -61,10 +131,12 @@ __all__ = [
|
|
|
61
131
|
"StackMachineGraphQLError",
|
|
62
132
|
"StackMachineInvalidRequestError",
|
|
63
133
|
"StackMachineList",
|
|
134
|
+
"StackMachineInitSettings",
|
|
64
135
|
"StackMachinePermissionError",
|
|
65
136
|
"StackMachineRateLimitError",
|
|
66
137
|
"StackMachineValidationError",
|
|
67
138
|
"UploadProgress",
|
|
139
|
+
"UploadProgressCallback",
|
|
68
140
|
"Viewer",
|
|
69
141
|
"__version__",
|
|
70
142
|
"create_zip",
|
stackmachine/_async_client.py
CHANGED
|
@@ -13,6 +13,7 @@ from ._config import (
|
|
|
13
13
|
from ._graphql import operations as gql
|
|
14
14
|
from ._models import Viewer
|
|
15
15
|
from ._transport import AsyncTransport
|
|
16
|
+
from ._types import AsyncStackMachineInitSettings, Headers, RequestOptionsLike
|
|
16
17
|
from ._uploads import AsyncUploader
|
|
17
18
|
from .resources.apps import AsyncDeployAppsResource
|
|
18
19
|
from .resources.deployments import AsyncDeploymentsResource
|
|
@@ -24,24 +25,36 @@ class AsyncStackMachine:
|
|
|
24
25
|
self,
|
|
25
26
|
api_key: str,
|
|
26
27
|
*,
|
|
27
|
-
api_url: str =
|
|
28
|
-
|
|
28
|
+
api_url: Optional[str] = None,
|
|
29
|
+
apiUrl: Optional[str] = None,
|
|
30
|
+
headers: Optional[Headers] = None,
|
|
29
31
|
timeout: float = DEFAULT_TIMEOUT,
|
|
30
|
-
max_network_retries: int =
|
|
32
|
+
max_network_retries: Optional[int] = None,
|
|
33
|
+
maxNetworkRetries: Optional[int] = None,
|
|
31
34
|
http_client: Optional[httpx.AsyncClient] = None,
|
|
32
35
|
http_transport: Optional[httpx.AsyncBaseTransport] = None,
|
|
33
36
|
) -> None:
|
|
37
|
+
resolved_api_url = (
|
|
38
|
+
api_url if api_url is not None else apiUrl or DEFAULT_API_URL
|
|
39
|
+
)
|
|
40
|
+
resolved_max_retries = (
|
|
41
|
+
max_network_retries
|
|
42
|
+
if max_network_retries is not None
|
|
43
|
+
else maxNetworkRetries
|
|
44
|
+
if maxNetworkRetries is not None
|
|
45
|
+
else DEFAULT_MAX_NETWORK_RETRIES
|
|
46
|
+
)
|
|
34
47
|
self.api_key = api_key
|
|
35
|
-
self.api_url =
|
|
36
|
-
self.apiUrl =
|
|
48
|
+
self.api_url = resolved_api_url
|
|
49
|
+
self.apiUrl = resolved_api_url
|
|
37
50
|
self.timeout = timeout
|
|
38
|
-
self.max_network_retries =
|
|
39
|
-
self.maxNetworkRetries =
|
|
51
|
+
self.max_network_retries = resolved_max_retries
|
|
52
|
+
self.maxNetworkRetries = resolved_max_retries
|
|
40
53
|
self._config = ClientConfig(
|
|
41
|
-
api_url=
|
|
54
|
+
api_url=resolved_api_url,
|
|
42
55
|
headers=headers,
|
|
43
56
|
timeout=timeout,
|
|
44
|
-
max_network_retries=
|
|
57
|
+
max_network_retries=resolved_max_retries,
|
|
45
58
|
)
|
|
46
59
|
self._transport = AsyncTransport(
|
|
47
60
|
api_key,
|
|
@@ -56,16 +69,79 @@ class AsyncStackMachine:
|
|
|
56
69
|
@classmethod
|
|
57
70
|
def init(
|
|
58
71
|
cls,
|
|
59
|
-
settings: Optional[
|
|
60
|
-
|
|
72
|
+
settings: Optional[AsyncStackMachineInitSettings] = None,
|
|
73
|
+
*,
|
|
74
|
+
api_key: Optional[str] = None,
|
|
75
|
+
apiKey: Optional[str] = None,
|
|
76
|
+
token: Optional[str] = None,
|
|
77
|
+
api_url: Optional[str] = None,
|
|
78
|
+
apiUrl: Optional[str] = None,
|
|
79
|
+
headers: Optional[Headers] = None,
|
|
80
|
+
timeout: Optional[float] = None,
|
|
81
|
+
max_network_retries: Optional[int] = None,
|
|
82
|
+
maxNetworkRetries: Optional[int] = None,
|
|
83
|
+
http_client: Optional[httpx.AsyncClient] = None,
|
|
84
|
+
http_transport: Optional[httpx.AsyncBaseTransport] = None,
|
|
61
85
|
) -> "AsyncStackMachine":
|
|
62
|
-
values = {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
86
|
+
values: AsyncStackMachineInitSettings = {} if settings is None else settings
|
|
87
|
+
resolved_api_key = (
|
|
88
|
+
api_key
|
|
89
|
+
if api_key is not None
|
|
90
|
+
else apiKey
|
|
91
|
+
if apiKey is not None
|
|
92
|
+
else token
|
|
93
|
+
if token is not None
|
|
94
|
+
else values.get("api_key")
|
|
95
|
+
or values.get("apiKey")
|
|
96
|
+
or values.get("token")
|
|
97
|
+
or ""
|
|
98
|
+
)
|
|
99
|
+
settings_timeout = values.get("timeout")
|
|
100
|
+
resolved_timeout = (
|
|
101
|
+
timeout
|
|
102
|
+
if timeout is not None
|
|
103
|
+
else settings_timeout
|
|
104
|
+
if settings_timeout is not None
|
|
105
|
+
else DEFAULT_TIMEOUT
|
|
106
|
+
)
|
|
107
|
+
resolved_api_url = (
|
|
108
|
+
api_url
|
|
109
|
+
if api_url is not None
|
|
110
|
+
else apiUrl
|
|
111
|
+
if apiUrl is not None
|
|
112
|
+
else values.get("api_url")
|
|
113
|
+
or values.get("apiUrl")
|
|
114
|
+
or DEFAULT_API_URL
|
|
115
|
+
)
|
|
116
|
+
settings_max_retries = (
|
|
117
|
+
values.get("max_network_retries")
|
|
118
|
+
if values.get("max_network_retries") is not None
|
|
119
|
+
else values.get("maxNetworkRetries")
|
|
120
|
+
)
|
|
121
|
+
resolved_max_retries = (
|
|
122
|
+
max_network_retries
|
|
123
|
+
if max_network_retries is not None
|
|
124
|
+
else maxNetworkRetries
|
|
125
|
+
if maxNetworkRetries is not None
|
|
126
|
+
else settings_max_retries
|
|
127
|
+
if settings_max_retries is not None
|
|
128
|
+
else DEFAULT_MAX_NETWORK_RETRIES
|
|
129
|
+
)
|
|
130
|
+
return cls(
|
|
131
|
+
resolved_api_key,
|
|
132
|
+
api_url=resolved_api_url,
|
|
133
|
+
headers=headers if headers is not None else values.get("headers"),
|
|
134
|
+
timeout=resolved_timeout,
|
|
135
|
+
max_network_retries=resolved_max_retries,
|
|
136
|
+
http_client=(
|
|
137
|
+
http_client if http_client is not None else values.get("http_client")
|
|
138
|
+
),
|
|
139
|
+
http_transport=(
|
|
140
|
+
http_transport
|
|
141
|
+
if http_transport is not None
|
|
142
|
+
else values.get("http_transport")
|
|
143
|
+
),
|
|
144
|
+
)
|
|
69
145
|
|
|
70
146
|
async def close(self) -> None:
|
|
71
147
|
await self._transport.close()
|
|
@@ -81,7 +157,7 @@ class AsyncStackMachine:
|
|
|
81
157
|
query: str,
|
|
82
158
|
variables: Optional[Mapping[str, Any]] = None,
|
|
83
159
|
*,
|
|
84
|
-
request_options: Optional[
|
|
160
|
+
request_options: Optional[RequestOptionsLike] = None,
|
|
85
161
|
) -> Any:
|
|
86
162
|
return await self._transport.execute(
|
|
87
163
|
query,
|
|
@@ -94,7 +170,7 @@ class AsyncStackMachine:
|
|
|
94
170
|
query: str,
|
|
95
171
|
variables: Optional[Mapping[str, Any]] = None,
|
|
96
172
|
*,
|
|
97
|
-
request_options: Optional[
|
|
173
|
+
request_options: Optional[RequestOptionsLike] = None,
|
|
98
174
|
) -> Any:
|
|
99
175
|
return await self._transport.execute(
|
|
100
176
|
query,
|
|
@@ -104,7 +180,7 @@ class AsyncStackMachine:
|
|
|
104
180
|
)
|
|
105
181
|
|
|
106
182
|
def _subscribe_deployment(
|
|
107
|
-
self, build_id: str, request_options: Optional[
|
|
183
|
+
self, build_id: str, request_options: Optional[RequestOptionsLike] = None
|
|
108
184
|
):
|
|
109
185
|
return self._transport.subscribe(
|
|
110
186
|
gql.AUTOBUILD_SUBSCRIPTION,
|
|
@@ -113,7 +189,7 @@ class AsyncStackMachine:
|
|
|
113
189
|
)
|
|
114
190
|
|
|
115
191
|
async def viewer(
|
|
116
|
-
self, *, request_options: Optional[
|
|
192
|
+
self, *, request_options: Optional[RequestOptionsLike] = None
|
|
117
193
|
) -> Optional[Viewer]:
|
|
118
194
|
response = await self._query(
|
|
119
195
|
gql.VIEWER_QUERY, {}, request_options=request_options
|
stackmachine/_client.py
CHANGED
|
@@ -13,6 +13,7 @@ from ._config import (
|
|
|
13
13
|
from ._graphql import operations as gql
|
|
14
14
|
from ._models import Viewer
|
|
15
15
|
from ._transport import SyncTransport
|
|
16
|
+
from ._types import Headers, RequestOptionsLike, StackMachineInitSettings
|
|
16
17
|
from ._uploads import SyncUploader
|
|
17
18
|
from .resources.apps import DeployAppsResource
|
|
18
19
|
from .resources.deployments import DeploymentsResource
|
|
@@ -24,24 +25,36 @@ class StackMachine:
|
|
|
24
25
|
self,
|
|
25
26
|
api_key: str,
|
|
26
27
|
*,
|
|
27
|
-
api_url: str =
|
|
28
|
-
|
|
28
|
+
api_url: Optional[str] = None,
|
|
29
|
+
apiUrl: Optional[str] = None,
|
|
30
|
+
headers: Optional[Headers] = None,
|
|
29
31
|
timeout: float = DEFAULT_TIMEOUT,
|
|
30
|
-
max_network_retries: int =
|
|
32
|
+
max_network_retries: Optional[int] = None,
|
|
33
|
+
maxNetworkRetries: Optional[int] = None,
|
|
31
34
|
http_client: Optional[httpx.Client] = None,
|
|
32
35
|
http_transport: Optional[httpx.BaseTransport] = None,
|
|
33
36
|
) -> None:
|
|
37
|
+
resolved_api_url = (
|
|
38
|
+
api_url if api_url is not None else apiUrl or DEFAULT_API_URL
|
|
39
|
+
)
|
|
40
|
+
resolved_max_retries = (
|
|
41
|
+
max_network_retries
|
|
42
|
+
if max_network_retries is not None
|
|
43
|
+
else maxNetworkRetries
|
|
44
|
+
if maxNetworkRetries is not None
|
|
45
|
+
else DEFAULT_MAX_NETWORK_RETRIES
|
|
46
|
+
)
|
|
34
47
|
self.api_key = api_key
|
|
35
|
-
self.api_url =
|
|
36
|
-
self.apiUrl =
|
|
48
|
+
self.api_url = resolved_api_url
|
|
49
|
+
self.apiUrl = resolved_api_url
|
|
37
50
|
self.timeout = timeout
|
|
38
|
-
self.max_network_retries =
|
|
39
|
-
self.maxNetworkRetries =
|
|
51
|
+
self.max_network_retries = resolved_max_retries
|
|
52
|
+
self.maxNetworkRetries = resolved_max_retries
|
|
40
53
|
self._config = ClientConfig(
|
|
41
|
-
api_url=
|
|
54
|
+
api_url=resolved_api_url,
|
|
42
55
|
headers=headers,
|
|
43
56
|
timeout=timeout,
|
|
44
|
-
max_network_retries=
|
|
57
|
+
max_network_retries=resolved_max_retries,
|
|
45
58
|
)
|
|
46
59
|
self._transport = SyncTransport(
|
|
47
60
|
api_key,
|
|
@@ -56,16 +69,79 @@ class StackMachine:
|
|
|
56
69
|
@classmethod
|
|
57
70
|
def init(
|
|
58
71
|
cls,
|
|
59
|
-
settings: Optional[
|
|
60
|
-
|
|
72
|
+
settings: Optional[StackMachineInitSettings] = None,
|
|
73
|
+
*,
|
|
74
|
+
api_key: Optional[str] = None,
|
|
75
|
+
apiKey: Optional[str] = None,
|
|
76
|
+
token: Optional[str] = None,
|
|
77
|
+
api_url: Optional[str] = None,
|
|
78
|
+
apiUrl: Optional[str] = None,
|
|
79
|
+
headers: Optional[Headers] = None,
|
|
80
|
+
timeout: Optional[float] = None,
|
|
81
|
+
max_network_retries: Optional[int] = None,
|
|
82
|
+
maxNetworkRetries: Optional[int] = None,
|
|
83
|
+
http_client: Optional[httpx.Client] = None,
|
|
84
|
+
http_transport: Optional[httpx.BaseTransport] = None,
|
|
61
85
|
) -> "StackMachine":
|
|
62
|
-
values = {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
86
|
+
values: StackMachineInitSettings = {} if settings is None else settings
|
|
87
|
+
resolved_api_key = (
|
|
88
|
+
api_key
|
|
89
|
+
if api_key is not None
|
|
90
|
+
else apiKey
|
|
91
|
+
if apiKey is not None
|
|
92
|
+
else token
|
|
93
|
+
if token is not None
|
|
94
|
+
else values.get("api_key")
|
|
95
|
+
or values.get("apiKey")
|
|
96
|
+
or values.get("token")
|
|
97
|
+
or ""
|
|
98
|
+
)
|
|
99
|
+
settings_timeout = values.get("timeout")
|
|
100
|
+
resolved_timeout = (
|
|
101
|
+
timeout
|
|
102
|
+
if timeout is not None
|
|
103
|
+
else settings_timeout
|
|
104
|
+
if settings_timeout is not None
|
|
105
|
+
else DEFAULT_TIMEOUT
|
|
106
|
+
)
|
|
107
|
+
resolved_api_url = (
|
|
108
|
+
api_url
|
|
109
|
+
if api_url is not None
|
|
110
|
+
else apiUrl
|
|
111
|
+
if apiUrl is not None
|
|
112
|
+
else values.get("api_url")
|
|
113
|
+
or values.get("apiUrl")
|
|
114
|
+
or DEFAULT_API_URL
|
|
115
|
+
)
|
|
116
|
+
settings_max_retries = (
|
|
117
|
+
values.get("max_network_retries")
|
|
118
|
+
if values.get("max_network_retries") is not None
|
|
119
|
+
else values.get("maxNetworkRetries")
|
|
120
|
+
)
|
|
121
|
+
resolved_max_retries = (
|
|
122
|
+
max_network_retries
|
|
123
|
+
if max_network_retries is not None
|
|
124
|
+
else maxNetworkRetries
|
|
125
|
+
if maxNetworkRetries is not None
|
|
126
|
+
else settings_max_retries
|
|
127
|
+
if settings_max_retries is not None
|
|
128
|
+
else DEFAULT_MAX_NETWORK_RETRIES
|
|
129
|
+
)
|
|
130
|
+
return cls(
|
|
131
|
+
resolved_api_key,
|
|
132
|
+
api_url=resolved_api_url,
|
|
133
|
+
headers=headers if headers is not None else values.get("headers"),
|
|
134
|
+
timeout=resolved_timeout,
|
|
135
|
+
max_network_retries=resolved_max_retries,
|
|
136
|
+
http_client=(
|
|
137
|
+
http_client if http_client is not None else values.get("http_client")
|
|
138
|
+
),
|
|
139
|
+
http_transport=(
|
|
140
|
+
http_transport
|
|
141
|
+
if http_transport is not None
|
|
142
|
+
else values.get("http_transport")
|
|
143
|
+
),
|
|
144
|
+
)
|
|
69
145
|
|
|
70
146
|
def close(self) -> None:
|
|
71
147
|
self._transport.close()
|
|
@@ -81,7 +157,7 @@ class StackMachine:
|
|
|
81
157
|
query: str,
|
|
82
158
|
variables: Optional[Mapping[str, Any]] = None,
|
|
83
159
|
*,
|
|
84
|
-
request_options: Optional[
|
|
160
|
+
request_options: Optional[RequestOptionsLike] = None,
|
|
85
161
|
) -> Any:
|
|
86
162
|
return self._transport.execute(
|
|
87
163
|
query,
|
|
@@ -94,7 +170,7 @@ class StackMachine:
|
|
|
94
170
|
query: str,
|
|
95
171
|
variables: Optional[Mapping[str, Any]] = None,
|
|
96
172
|
*,
|
|
97
|
-
request_options: Optional[
|
|
173
|
+
request_options: Optional[RequestOptionsLike] = None,
|
|
98
174
|
) -> Any:
|
|
99
175
|
return self._transport.execute(
|
|
100
176
|
query,
|
|
@@ -104,7 +180,7 @@ class StackMachine:
|
|
|
104
180
|
)
|
|
105
181
|
|
|
106
182
|
def _subscribe_deployment(
|
|
107
|
-
self, build_id: str, request_options: Optional[
|
|
183
|
+
self, build_id: str, request_options: Optional[RequestOptionsLike] = None
|
|
108
184
|
):
|
|
109
185
|
return self._transport.subscribe(
|
|
110
186
|
gql.AUTOBUILD_SUBSCRIPTION,
|
|
@@ -113,7 +189,7 @@ class StackMachine:
|
|
|
113
189
|
)
|
|
114
190
|
|
|
115
191
|
def viewer(
|
|
116
|
-
self, *, request_options: Optional[
|
|
192
|
+
self, *, request_options: Optional[RequestOptionsLike] = None
|
|
117
193
|
) -> Optional[Viewer]:
|
|
118
194
|
response = self._query(gql.VIEWER_QUERY, {}, request_options=request_options)
|
|
119
195
|
viewer = response.get("viewer") if response else None
|
stackmachine/_config.py
CHANGED
|
@@ -11,11 +11,15 @@ DEFAULT_MAX_NETWORK_RETRIES = 1
|
|
|
11
11
|
@dataclass
|
|
12
12
|
class RequestOptions:
|
|
13
13
|
api_key: Optional[str] = None
|
|
14
|
+
apiKey: Optional[str] = None
|
|
14
15
|
headers: Optional[Mapping[str, str]] = None
|
|
15
16
|
timeout: Optional[float] = None
|
|
16
17
|
max_network_retries: Optional[int] = None
|
|
18
|
+
maxNetworkRetries: Optional[int] = None
|
|
17
19
|
idempotency_key: Optional[str] = None
|
|
20
|
+
idempotencyKey: Optional[str] = None
|
|
18
21
|
client_mutation_id: Optional[str] = None
|
|
22
|
+
clientMutationId: Optional[str] = None
|
|
19
23
|
force: Optional[bool] = None
|
|
20
24
|
|
|
21
25
|
|
stackmachine/_pagination.py
CHANGED
|
@@ -12,6 +12,7 @@ from typing import (
|
|
|
12
12
|
Mapping,
|
|
13
13
|
Optional,
|
|
14
14
|
TypeVar,
|
|
15
|
+
cast,
|
|
15
16
|
)
|
|
16
17
|
|
|
17
18
|
from ._errors import StackMachineValidationError
|
|
@@ -299,7 +300,7 @@ class AsyncStackMachineList(Generic[T]):
|
|
|
299
300
|
async for item in self:
|
|
300
301
|
result = handler(item)
|
|
301
302
|
if hasattr(result, "__await__"):
|
|
302
|
-
result = await
|
|
303
|
+
result = await cast(Awaitable[Optional[bool]], result)
|
|
303
304
|
if result is False:
|
|
304
305
|
return
|
|
305
306
|
|