pipeline-analytics-sdk 0.1.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.
Files changed (65) hide show
  1. pipeline_analytics/__init__.py +27 -0
  2. pipeline_analytics/_generated/README.md +10 -0
  3. pipeline_analytics/_generated/__init__.py +8 -0
  4. pipeline_analytics/_generated/api/__init__.py +1 -0
  5. pipeline_analytics/_generated/api/auth/__init__.py +1 -0
  6. pipeline_analytics/_generated/api/auth/webauthn_login.py +186 -0
  7. pipeline_analytics/_generated/api/auth/webauthn_login_options.py +158 -0
  8. pipeline_analytics/_generated/api/auth/webauthn_logout.py +154 -0
  9. pipeline_analytics/_generated/api/auth/webauthn_register.py +193 -0
  10. pipeline_analytics/_generated/api/auth/webauthn_register_options.py +158 -0
  11. pipeline_analytics/_generated/api/insights/__init__.py +1 -0
  12. pipeline_analytics/_generated/api/insights/get_git_hub_rate_limit_insights.py +191 -0
  13. pipeline_analytics/_generated/api/meta/__init__.py +1 -0
  14. pipeline_analytics/_generated/api/meta/get_version.py +162 -0
  15. pipeline_analytics/_generated/api/pipelines/__init__.py +1 -0
  16. pipeline_analytics/_generated/api/pipelines/get_pipeline.py +208 -0
  17. pipeline_analytics/_generated/api/pipelines/get_pipeline_steps.py +213 -0
  18. pipeline_analytics/_generated/api/pipelines/list_pipelines.py +163 -0
  19. pipeline_analytics/_generated/api/pipelines/list_unhealthy_steps.py +193 -0
  20. pipeline_analytics/_generated/api/repos/__init__.py +1 -0
  21. pipeline_analytics/_generated/api/repos/discover_repos.py +209 -0
  22. pipeline_analytics/_generated/api/repos/get_repo_usage.py +213 -0
  23. pipeline_analytics/_generated/api/repos/list_repos.py +223 -0
  24. pipeline_analytics/_generated/api/repos/register_repo.py +205 -0
  25. pipeline_analytics/_generated/api/repos/untrack_repo.py +194 -0
  26. pipeline_analytics/_generated/api/webhooks/__init__.py +1 -0
  27. pipeline_analytics/_generated/api/webhooks/forgejo_webhook.py +212 -0
  28. pipeline_analytics/_generated/api/webhooks/github_webhook.py +212 -0
  29. pipeline_analytics/_generated/client.py +271 -0
  30. pipeline_analytics/_generated/errors.py +14 -0
  31. pipeline_analytics/_generated/models/__init__.py +53 -0
  32. pipeline_analytics/_generated/models/error.py +84 -0
  33. pipeline_analytics/_generated/models/forge.py +8 -0
  34. pipeline_analytics/_generated/models/forgejo_webhook_body.py +66 -0
  35. pipeline_analytics/_generated/models/git_hub_token_usage.py +112 -0
  36. pipeline_analytics/_generated/models/github_webhook_body.py +66 -0
  37. pipeline_analytics/_generated/models/health_status.py +8 -0
  38. pipeline_analytics/_generated/models/ingestion_status.py +9 -0
  39. pipeline_analytics/_generated/models/pipeline_detail.py +196 -0
  40. pipeline_analytics/_generated/models/pipeline_steps_group.py +118 -0
  41. pipeline_analytics/_generated/models/pipeline_summary.py +154 -0
  42. pipeline_analytics/_generated/models/pipeline_summary_triggered_signals_item.py +9 -0
  43. pipeline_analytics/_generated/models/rate_limit_status.py +105 -0
  44. pipeline_analytics/_generated/models/repo.py +136 -0
  45. pipeline_analytics/_generated/models/repo_discovery_request.py +98 -0
  46. pipeline_analytics/_generated/models/repo_list.py +102 -0
  47. pipeline_analytics/_generated/models/repo_registration.py +106 -0
  48. pipeline_analytics/_generated/models/step.py +134 -0
  49. pipeline_analytics/_generated/models/trend.py +134 -0
  50. pipeline_analytics/_generated/models/usage_entry.py +84 -0
  51. pipeline_analytics/_generated/models/version.py +76 -0
  52. pipeline_analytics/_generated/models/web_authn_assertion_response.py +66 -0
  53. pipeline_analytics/_generated/models/web_authn_attestation_response.py +66 -0
  54. pipeline_analytics/_generated/models/web_authn_creation_options.py +66 -0
  55. pipeline_analytics/_generated/models/web_authn_request_options.py +66 -0
  56. pipeline_analytics/_generated/types.py +53 -0
  57. pipeline_analytics/client.py +139 -0
  58. pipeline_analytics/errors.py +107 -0
  59. pipeline_analytics/pagination.py +95 -0
  60. pipeline_analytics/py.typed +0 -0
  61. pipeline_analytics/retry.py +178 -0
  62. pipeline_analytics_sdk-0.1.2.dist-info/METADATA +146 -0
  63. pipeline_analytics_sdk-0.1.2.dist-info/RECORD +65 -0
  64. pipeline_analytics_sdk-0.1.2.dist-info/WHEEL +4 -0
  65. pipeline_analytics_sdk-0.1.2.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,27 @@
1
+ """A Python client for pipeline-analytics's REST API
2
+ (github.com/alrayyes/pipeline-analytics), generated from its OpenAPI spec
3
+ with openapi-python-client.
4
+
5
+ Every operation except ``get_version`` and the two webhook receivers
6
+ requires an authenticated session -- see :class:`PipelineAnalyticsClient`
7
+ for the WebAuthn-only auth story.
8
+ """
9
+
10
+ from .client import SESSION_COOKIE_ENV_VAR, PipelineAnalyticsClient
11
+ from .errors import APIError, decode_error
12
+ from .pagination import DEFAULT_PAGE_SIZE, aiter_repos, iter_repos
13
+ from .retry import DEFAULT_RETRY_CONFIG, AsyncRetryTransport, RetryConfig, RetryTransport
14
+
15
+ __all__ = [
16
+ "DEFAULT_PAGE_SIZE",
17
+ "DEFAULT_RETRY_CONFIG",
18
+ "SESSION_COOKIE_ENV_VAR",
19
+ "APIError",
20
+ "AsyncRetryTransport",
21
+ "PipelineAnalyticsClient",
22
+ "RetryConfig",
23
+ "RetryTransport",
24
+ "aiter_repos",
25
+ "decode_error",
26
+ "iter_repos",
27
+ ]
@@ -0,0 +1,10 @@
1
+ # Generated -- do not edit
2
+
3
+ Everything under this directory is produced by
4
+ [openapi-python-client](https://github.com/openapi-generators/openapi-python-client)
5
+ from `openapi/openapi.yaml`. A hand-edit here is silently overwritten the
6
+ next time the client is regenerated (`CONTRIBUTING.md`, `hack/fetch-spec.sh`,
7
+ `.github/workflows/regenerate.yml`).
8
+
9
+ The hand-written layer -- auth injection, retry, typed errors, pagination --
10
+ lives one directory up, in `pipeline_analytics/*.py`.
@@ -0,0 +1,8 @@
1
+
2
+ """ A client library for accessing pipeline-analytics API """
3
+ from .client import AuthenticatedClient, Client
4
+
5
+ __all__ = (
6
+ "AuthenticatedClient",
7
+ "Client",
8
+ )
@@ -0,0 +1 @@
1
+ """ Contains methods for accessing the API """
@@ -0,0 +1 @@
1
+ """ Contains endpoint functions for accessing the API """
@@ -0,0 +1,186 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, cast
3
+ from urllib.parse import quote
4
+
5
+ import httpx
6
+
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...types import Response, UNSET
9
+ from ... import errors
10
+
11
+ from ...models.error import Error
12
+ from ...models.web_authn_assertion_response import WebAuthnAssertionResponse
13
+ from typing import cast
14
+
15
+
16
+
17
+ def _get_kwargs(
18
+ *,
19
+ body: WebAuthnAssertionResponse,
20
+
21
+ ) -> dict[str, Any]:
22
+ headers: dict[str, Any] = {}
23
+
24
+
25
+
26
+
27
+
28
+
29
+ _kwargs: dict[str, Any] = {
30
+ "method": "post",
31
+ "url": "/api/auth/login",
32
+ }
33
+
34
+ _kwargs["json"] = body.to_dict()
35
+
36
+ headers["Content-Type"] = "application/json"
37
+
38
+ _kwargs["headers"] = headers
39
+ return _kwargs
40
+
41
+
42
+
43
+ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | Error | None:
44
+ if response.status_code == 200:
45
+ response_200 = cast(Any, None)
46
+ return response_200
47
+
48
+ if response.status_code == 401:
49
+ response_401 = Error.from_dict(response.json())
50
+
51
+
52
+
53
+ return response_401
54
+
55
+ if client.raise_on_unexpected_status:
56
+ raise errors.UnexpectedStatus(response.status_code, response.content)
57
+ else:
58
+ return None
59
+
60
+
61
+ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | Error]:
62
+ return Response(
63
+ status_code=HTTPStatus(response.status_code),
64
+ content=response.content,
65
+ headers=response.headers,
66
+ parsed=_parse_response(client=client, response=response),
67
+ )
68
+
69
+
70
+ def sync_detailed(
71
+ *,
72
+ client: AuthenticatedClient | Client,
73
+ body: WebAuthnAssertionResponse,
74
+
75
+ ) -> Response[Any | Error]:
76
+ """ Complete WebAuthn login
77
+
78
+ Args:
79
+ body (WebAuthnAssertionResponse): The browser's AuthenticatorAssertionResponse, JSON-
80
+ encoded.
81
+
82
+ Raises:
83
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
84
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
85
+
86
+ Returns:
87
+ Response[Any | Error]
88
+ """
89
+
90
+
91
+ kwargs = _get_kwargs(
92
+ body=body,
93
+
94
+ )
95
+
96
+ response = client.get_httpx_client().request(
97
+ **kwargs,
98
+ )
99
+
100
+ return _build_response(client=client, response=response)
101
+
102
+ def sync(
103
+ *,
104
+ client: AuthenticatedClient | Client,
105
+ body: WebAuthnAssertionResponse,
106
+
107
+ ) -> Any | Error | None:
108
+ """ Complete WebAuthn login
109
+
110
+ Args:
111
+ body (WebAuthnAssertionResponse): The browser's AuthenticatorAssertionResponse, JSON-
112
+ encoded.
113
+
114
+ Raises:
115
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
116
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
117
+
118
+ Returns:
119
+ Any | Error
120
+ """
121
+
122
+
123
+ return sync_detailed(
124
+ client=client,
125
+ body=body,
126
+
127
+ ).parsed
128
+
129
+ async def asyncio_detailed(
130
+ *,
131
+ client: AuthenticatedClient | Client,
132
+ body: WebAuthnAssertionResponse,
133
+
134
+ ) -> Response[Any | Error]:
135
+ """ Complete WebAuthn login
136
+
137
+ Args:
138
+ body (WebAuthnAssertionResponse): The browser's AuthenticatorAssertionResponse, JSON-
139
+ encoded.
140
+
141
+ Raises:
142
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
143
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
144
+
145
+ Returns:
146
+ Response[Any | Error]
147
+ """
148
+
149
+
150
+ kwargs = _get_kwargs(
151
+ body=body,
152
+
153
+ )
154
+
155
+ response = await client.get_async_httpx_client().request(
156
+ **kwargs
157
+ )
158
+
159
+ return _build_response(client=client, response=response)
160
+
161
+ async def asyncio(
162
+ *,
163
+ client: AuthenticatedClient | Client,
164
+ body: WebAuthnAssertionResponse,
165
+
166
+ ) -> Any | Error | None:
167
+ """ Complete WebAuthn login
168
+
169
+ Args:
170
+ body (WebAuthnAssertionResponse): The browser's AuthenticatorAssertionResponse, JSON-
171
+ encoded.
172
+
173
+ Raises:
174
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
175
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
176
+
177
+ Returns:
178
+ Any | Error
179
+ """
180
+
181
+
182
+ return (await asyncio_detailed(
183
+ client=client,
184
+ body=body,
185
+
186
+ )).parsed
@@ -0,0 +1,158 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, cast
3
+ from urllib.parse import quote
4
+
5
+ import httpx
6
+
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...types import Response, UNSET
9
+ from ... import errors
10
+
11
+ from ...models.error import Error
12
+ from ...models.web_authn_request_options import WebAuthnRequestOptions
13
+ from typing import cast
14
+
15
+
16
+
17
+ def _get_kwargs(
18
+
19
+ ) -> dict[str, Any]:
20
+
21
+
22
+
23
+
24
+
25
+
26
+ _kwargs: dict[str, Any] = {
27
+ "method": "post",
28
+ "url": "/api/auth/login/options",
29
+ }
30
+
31
+
32
+ return _kwargs
33
+
34
+
35
+
36
+ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | WebAuthnRequestOptions | None:
37
+ if response.status_code == 200:
38
+ response_200 = WebAuthnRequestOptions.from_dict(response.json())
39
+
40
+
41
+
42
+ return response_200
43
+
44
+ if response.status_code == 404:
45
+ response_404 = Error.from_dict(response.json())
46
+
47
+
48
+
49
+ return response_404
50
+
51
+ if client.raise_on_unexpected_status:
52
+ raise errors.UnexpectedStatus(response.status_code, response.content)
53
+ else:
54
+ return None
55
+
56
+
57
+ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Error | WebAuthnRequestOptions]:
58
+ return Response(
59
+ status_code=HTTPStatus(response.status_code),
60
+ content=response.content,
61
+ headers=response.headers,
62
+ parsed=_parse_response(client=client, response=response),
63
+ )
64
+
65
+
66
+ def sync_detailed(
67
+ *,
68
+ client: AuthenticatedClient | Client,
69
+
70
+ ) -> Response[Error | WebAuthnRequestOptions]:
71
+ """ Begin WebAuthn login
72
+
73
+ Raises:
74
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
75
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
76
+
77
+ Returns:
78
+ Response[Error | WebAuthnRequestOptions]
79
+ """
80
+
81
+
82
+ kwargs = _get_kwargs(
83
+
84
+ )
85
+
86
+ response = client.get_httpx_client().request(
87
+ **kwargs,
88
+ )
89
+
90
+ return _build_response(client=client, response=response)
91
+
92
+ def sync(
93
+ *,
94
+ client: AuthenticatedClient | Client,
95
+
96
+ ) -> Error | WebAuthnRequestOptions | None:
97
+ """ Begin WebAuthn login
98
+
99
+ Raises:
100
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
101
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
102
+
103
+ Returns:
104
+ Error | WebAuthnRequestOptions
105
+ """
106
+
107
+
108
+ return sync_detailed(
109
+ client=client,
110
+
111
+ ).parsed
112
+
113
+ async def asyncio_detailed(
114
+ *,
115
+ client: AuthenticatedClient | Client,
116
+
117
+ ) -> Response[Error | WebAuthnRequestOptions]:
118
+ """ Begin WebAuthn login
119
+
120
+ Raises:
121
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
122
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
123
+
124
+ Returns:
125
+ Response[Error | WebAuthnRequestOptions]
126
+ """
127
+
128
+
129
+ kwargs = _get_kwargs(
130
+
131
+ )
132
+
133
+ response = await client.get_async_httpx_client().request(
134
+ **kwargs
135
+ )
136
+
137
+ return _build_response(client=client, response=response)
138
+
139
+ async def asyncio(
140
+ *,
141
+ client: AuthenticatedClient | Client,
142
+
143
+ ) -> Error | WebAuthnRequestOptions | None:
144
+ """ Begin WebAuthn login
145
+
146
+ Raises:
147
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
148
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
149
+
150
+ Returns:
151
+ Error | WebAuthnRequestOptions
152
+ """
153
+
154
+
155
+ return (await asyncio_detailed(
156
+ client=client,
157
+
158
+ )).parsed
@@ -0,0 +1,154 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, cast
3
+ from urllib.parse import quote
4
+
5
+ import httpx
6
+
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...types import Response, UNSET
9
+ from ... import errors
10
+
11
+ from ...models.error import Error
12
+ from typing import cast
13
+
14
+
15
+
16
+ def _get_kwargs(
17
+
18
+ ) -> dict[str, Any]:
19
+
20
+
21
+
22
+
23
+
24
+
25
+ _kwargs: dict[str, Any] = {
26
+ "method": "post",
27
+ "url": "/api/auth/logout",
28
+ }
29
+
30
+
31
+ return _kwargs
32
+
33
+
34
+
35
+ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | Error | None:
36
+ if response.status_code == 204:
37
+ response_204 = cast(Any, None)
38
+ return response_204
39
+
40
+ if response.status_code == 401:
41
+ response_401 = Error.from_dict(response.json())
42
+
43
+
44
+
45
+ return response_401
46
+
47
+ if client.raise_on_unexpected_status:
48
+ raise errors.UnexpectedStatus(response.status_code, response.content)
49
+ else:
50
+ return None
51
+
52
+
53
+ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | Error]:
54
+ return Response(
55
+ status_code=HTTPStatus(response.status_code),
56
+ content=response.content,
57
+ headers=response.headers,
58
+ parsed=_parse_response(client=client, response=response),
59
+ )
60
+
61
+
62
+ def sync_detailed(
63
+ *,
64
+ client: AuthenticatedClient | Client,
65
+
66
+ ) -> Response[Any | Error]:
67
+ """ End the current session
68
+
69
+ Raises:
70
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
71
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
72
+
73
+ Returns:
74
+ Response[Any | Error]
75
+ """
76
+
77
+
78
+ kwargs = _get_kwargs(
79
+
80
+ )
81
+
82
+ response = client.get_httpx_client().request(
83
+ **kwargs,
84
+ )
85
+
86
+ return _build_response(client=client, response=response)
87
+
88
+ def sync(
89
+ *,
90
+ client: AuthenticatedClient | Client,
91
+
92
+ ) -> Any | Error | None:
93
+ """ End the current session
94
+
95
+ Raises:
96
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
97
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
98
+
99
+ Returns:
100
+ Any | Error
101
+ """
102
+
103
+
104
+ return sync_detailed(
105
+ client=client,
106
+
107
+ ).parsed
108
+
109
+ async def asyncio_detailed(
110
+ *,
111
+ client: AuthenticatedClient | Client,
112
+
113
+ ) -> Response[Any | Error]:
114
+ """ End the current session
115
+
116
+ Raises:
117
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
118
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
119
+
120
+ Returns:
121
+ Response[Any | Error]
122
+ """
123
+
124
+
125
+ kwargs = _get_kwargs(
126
+
127
+ )
128
+
129
+ response = await client.get_async_httpx_client().request(
130
+ **kwargs
131
+ )
132
+
133
+ return _build_response(client=client, response=response)
134
+
135
+ async def asyncio(
136
+ *,
137
+ client: AuthenticatedClient | Client,
138
+
139
+ ) -> Any | Error | None:
140
+ """ End the current session
141
+
142
+ Raises:
143
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
144
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
145
+
146
+ Returns:
147
+ Any | Error
148
+ """
149
+
150
+
151
+ return (await asyncio_detailed(
152
+ client=client,
153
+
154
+ )).parsed