phasetwo-sdk 0.2.0__tar.gz

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 (73) hide show
  1. phasetwo_sdk-0.2.0/.github/workflows/ci.yml +24 -0
  2. phasetwo_sdk-0.2.0/.github/workflows/openapi-drift.yml +36 -0
  3. phasetwo_sdk-0.2.0/.github/workflows/release.yml +75 -0
  4. phasetwo_sdk-0.2.0/.gitignore +68 -0
  5. phasetwo_sdk-0.2.0/COPYING +202 -0
  6. phasetwo_sdk-0.2.0/PKG-INFO +109 -0
  7. phasetwo_sdk-0.2.0/README.md +87 -0
  8. phasetwo_sdk-0.2.0/phasetwo/__init__.py +19 -0
  9. phasetwo_sdk-0.2.0/phasetwo/openapi/__init__.py +244 -0
  10. phasetwo_sdk-0.2.0/phasetwo/openapi/api/__init__.py +13 -0
  11. phasetwo_sdk-0.2.0/phasetwo/openapi/api/attributes_api.py +1336 -0
  12. phasetwo_sdk-0.2.0/phasetwo/openapi/api/events_api.py +3507 -0
  13. phasetwo_sdk-0.2.0/phasetwo/openapi/api/identity_providers_api.py +3922 -0
  14. phasetwo_sdk-0.2.0/phasetwo/openapi/api/organization_domains_api.py +828 -0
  15. phasetwo_sdk-0.2.0/phasetwo/openapi/api/organization_invitations_api.py +1684 -0
  16. phasetwo_sdk-0.2.0/phasetwo/openapi/api/organization_memberships_api.py +2030 -0
  17. phasetwo_sdk-0.2.0/phasetwo/openapi/api/organization_roles_api.py +3067 -0
  18. phasetwo_sdk-0.2.0/phasetwo/openapi/api/organization_scim_api.py +1141 -0
  19. phasetwo_sdk-0.2.0/phasetwo/openapi/api/organizations_api.py +4212 -0
  20. phasetwo_sdk-0.2.0/phasetwo/openapi/api/users_api.py +1963 -0
  21. phasetwo_sdk-0.2.0/phasetwo/openapi/api_client.py +858 -0
  22. phasetwo_sdk-0.2.0/phasetwo/openapi/api_response.py +20 -0
  23. phasetwo_sdk-0.2.0/phasetwo/openapi/configuration.py +683 -0
  24. phasetwo_sdk-0.2.0/phasetwo/openapi/exceptions.py +220 -0
  25. phasetwo_sdk-0.2.0/phasetwo/openapi/models/__init__.py +109 -0
  26. phasetwo_sdk-0.2.0/phasetwo/openapi/models/access_token_response.py +115 -0
  27. phasetwo_sdk-0.2.0/phasetwo/openapi/models/auth_details_representation.py +104 -0
  28. phasetwo_sdk-0.2.0/phasetwo/openapi/models/bulk_response_item.py +91 -0
  29. phasetwo_sdk-0.2.0/phasetwo/openapi/models/credential_representation.py +84 -0
  30. phasetwo_sdk-0.2.0/phasetwo/openapi/models/event_representation.py +138 -0
  31. phasetwo_sdk-0.2.0/phasetwo/openapi/models/external_basic_scim_auth.py +103 -0
  32. phasetwo_sdk-0.2.0/phasetwo/openapi/models/external_jwt_scim_auth.py +108 -0
  33. phasetwo_sdk-0.2.0/phasetwo/openapi/models/external_secret_scim_auth.py +96 -0
  34. phasetwo_sdk-0.2.0/phasetwo/openapi/models/identity_provider_mapper_representation.py +105 -0
  35. phasetwo_sdk-0.2.0/phasetwo/openapi/models/identity_provider_representation.py +128 -0
  36. phasetwo_sdk-0.2.0/phasetwo/openapi/models/idp_initiated_client_representation.py +122 -0
  37. phasetwo_sdk-0.2.0/phasetwo/openapi/models/idp_initiated_client_representation_attributes.py +141 -0
  38. phasetwo_sdk-0.2.0/phasetwo/openapi/models/invitation_representation.py +110 -0
  39. phasetwo_sdk-0.2.0/phasetwo/openapi/models/invitation_request_representation.py +104 -0
  40. phasetwo_sdk-0.2.0/phasetwo/openapi/models/keycloak_scim_auth.py +90 -0
  41. phasetwo_sdk-0.2.0/phasetwo/openapi/models/link_identity_provider_representation.py +91 -0
  42. phasetwo_sdk-0.2.0/phasetwo/openapi/models/magic_link_request.py +137 -0
  43. phasetwo_sdk-0.2.0/phasetwo/openapi/models/magic_link_response.py +91 -0
  44. phasetwo_sdk-0.2.0/phasetwo/openapi/models/my_organization_representation.py +101 -0
  45. phasetwo_sdk-0.2.0/phasetwo/openapi/models/organization_config_representation.py +140 -0
  46. phasetwo_sdk-0.2.0/phasetwo/openapi/models/organization_domain_representation.py +98 -0
  47. phasetwo_sdk-0.2.0/phasetwo/openapi/models/organization_export_representation.py +168 -0
  48. phasetwo_sdk-0.2.0/phasetwo/openapi/models/organization_export_representation_all_of_members.py +91 -0
  49. phasetwo_sdk-0.2.0/phasetwo/openapi/models/organization_member_attribute_representation.py +83 -0
  50. phasetwo_sdk-0.2.0/phasetwo/openapi/models/organization_representation.py +107 -0
  51. phasetwo_sdk-0.2.0/phasetwo/openapi/models/organization_role_representation.py +91 -0
  52. phasetwo_sdk-0.2.0/phasetwo/openapi/models/organization_scim_auth.py +227 -0
  53. phasetwo_sdk-0.2.0/phasetwo/openapi/models/organization_scim_representation.py +113 -0
  54. phasetwo_sdk-0.2.0/phasetwo/openapi/models/organizations_config_representation.py +97 -0
  55. phasetwo_sdk-0.2.0/phasetwo/openapi/models/organizations_export_representation.py +132 -0
  56. phasetwo_sdk-0.2.0/phasetwo/openapi/models/organizations_import_representation.py +119 -0
  57. phasetwo_sdk-0.2.0/phasetwo/openapi/models/organizations_import_result_representation.py +115 -0
  58. phasetwo_sdk-0.2.0/phasetwo/openapi/models/organizations_import_result_representation_errors_inner.py +88 -0
  59. phasetwo_sdk-0.2.0/phasetwo/openapi/models/portal_link_representation.py +91 -0
  60. phasetwo_sdk-0.2.0/phasetwo/openapi/models/realm_attribute_representation.py +91 -0
  61. phasetwo_sdk-0.2.0/phasetwo/openapi/models/switch_organization_representation.py +83 -0
  62. phasetwo_sdk-0.2.0/phasetwo/openapi/models/user_brief_representation.py +115 -0
  63. phasetwo_sdk-0.2.0/phasetwo/openapi/models/user_representation.py +118 -0
  64. phasetwo_sdk-0.2.0/phasetwo/openapi/models/user_with_orgs_brief_representation.py +143 -0
  65. phasetwo_sdk-0.2.0/phasetwo/openapi/models/user_with_orgs_representation.py +146 -0
  66. phasetwo_sdk-0.2.0/phasetwo/openapi/models/webhook_representation.py +113 -0
  67. phasetwo_sdk-0.2.0/phasetwo/openapi/models/webhook_send_representation.py +125 -0
  68. phasetwo_sdk-0.2.0/phasetwo/openapi/py.typed +0 -0
  69. phasetwo_sdk-0.2.0/phasetwo/openapi/rest.py +323 -0
  70. phasetwo_sdk-0.2.0/phasetwo/py.typed +0 -0
  71. phasetwo_sdk-0.2.0/pyproject.toml +39 -0
  72. phasetwo_sdk-0.2.0/sdk-generator.json +11 -0
  73. phasetwo_sdk-0.2.0/uv.lock +568 -0
@@ -0,0 +1,24 @@
1
+ name: ci
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ python: ["3.11", "3.12", "3.13", "3.14"]
17
+ steps:
18
+ - uses: actions/checkout@v7
19
+ - uses: astral-sh/setup-uv@v10.3.3
20
+ with:
21
+ python-version: ${{ matrix.python }}
22
+ - run: uv build
23
+ - name: Import check
24
+ run: uv run --no-project --with dist/*.whl python -I -c 'from phasetwo import OrganizationsApi, Configuration; print("ok")'
@@ -0,0 +1,36 @@
1
+ # Fails a PR that hand-edits generated code. Regenerates from the spec commit in
2
+ # sdk-generator.json with the generator's main branch and expects no diff.
3
+ # Fix generated code in p2-inc/phasetwo-sdk-generator, never here.
4
+ name: openapi-drift
5
+
6
+ on:
7
+ pull_request:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ env:
13
+ LANGUAGE: python
14
+
15
+ jobs:
16
+ drift:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v7
20
+ with:
21
+ repository: p2-inc/phasetwo-sdk-generator
22
+ - uses: actions/checkout@v7
23
+ with:
24
+ path: .work/sdks/${{ env.LANGUAGE }}
25
+ - uses: actions/setup-java@v6
26
+ with:
27
+ distribution: temurin
28
+ java-version: "21"
29
+ - uses: actions/setup-node@v7
30
+ with:
31
+ node-version: "24"
32
+ - uses: astral-sh/setup-uv@v10.3.3
33
+ - uses: actions/setup-go@v6
34
+ with:
35
+ go-version: stable
36
+ - run: scripts/check-drift.sh "$LANGUAGE" ".work/sdks/$LANGUAGE"
@@ -0,0 +1,75 @@
1
+ # On each merge to main, publish the next version of phasetwo-sdk to PyPI.
2
+ # Versions follow the API version in sdk-generator.json (the spec's info.version),
3
+ # shared by all Phase Two SDKs: the first release for API X.Y is X.Y.0, and later
4
+ # releases (e.g. SDK-only fixes) are X.Y.1, X.Y.2, ... based on this repo's tags.
5
+ # The version is set at build time and tagged vX.Y.Z; pyproject.toml's version in
6
+ # git isn't updated. Skip with [ci skip] in the commit message.
7
+ #
8
+ # Uses PyPI trusted publishing: add this repo, workflow (release.yml) and
9
+ # environment (pypi) as a trusted publisher for phasetwo-sdk on pypi.org.
10
+ name: release
11
+
12
+ on:
13
+ push:
14
+ branches: [main]
15
+
16
+ concurrency:
17
+ group: release-main
18
+ cancel-in-progress: false
19
+
20
+ permissions:
21
+ contents: read
22
+
23
+ jobs:
24
+ build:
25
+ if: "!contains(github.event.head_commit.message, '[ci skip]')"
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ contents: read
29
+ outputs:
30
+ next: ${{ steps.version.outputs.next }}
31
+ steps:
32
+ - uses: actions/checkout@v7
33
+ with:
34
+ fetch-depth: 0
35
+ - uses: astral-sh/setup-uv@v10.3.3
36
+ - name: Choose version
37
+ id: version
38
+ run: |
39
+ api=$(sed -n 's/.*"apiVersion": *"\([^"]*\)".*/\1/p' sdk-generator.json)
40
+ [ -n "$api" ] || { echo "::error::no apiVersion in sdk-generator.json"; exit 1; }
41
+ mm=${api%.*}
42
+ last=$(git tag --list "v$mm.*" --sort=-v:refname | head -1)
43
+ if [ -z "$last" ]; then next="$mm.0"; else next="$mm.$(( ${last##*.} + 1 ))"; fi
44
+ echo "next=$next" >> "$GITHUB_OUTPUT"
45
+ - run: uv version "${{ steps.version.outputs.next }}"
46
+ - run: uv build
47
+ - name: Smoke test the wheel
48
+ run: uv run --no-project --with dist/*.whl python -I -c 'import phasetwo; print(phasetwo.__version__)'
49
+ - uses: actions/upload-artifact@v7
50
+ with:
51
+ name: dist
52
+ path: dist/
53
+
54
+ publish:
55
+ needs: build
56
+ runs-on: ubuntu-latest
57
+ environment: pypi
58
+ permissions:
59
+ contents: write
60
+ id-token: write
61
+ steps:
62
+ - uses: actions/checkout@v7
63
+ - uses: actions/download-artifact@v8
64
+ with:
65
+ name: dist
66
+ path: dist/
67
+ - uses: pypa/gh-action-pypi-publish@release/v1
68
+ - name: Tag and GitHub release
69
+ env:
70
+ GH_TOKEN: ${{ github.token }}
71
+ NEXT: v${{ needs.build.outputs.next }}
72
+ run: |
73
+ git tag "$NEXT" "$GITHUB_SHA"
74
+ git push origin "$NEXT"
75
+ gh release create "$NEXT" --generate-notes --verify-tag dist/*
@@ -0,0 +1,68 @@
1
+ *~
2
+ # Byte-compiled / optimized / DLL files
3
+ __pycache__/
4
+ *.py[cod]
5
+ *$py.class
6
+
7
+ # C extensions
8
+ *.so
9
+
10
+ # Distribution / packaging
11
+ .Python
12
+ env/
13
+ build/
14
+ develop-eggs/
15
+ dist/
16
+ downloads/
17
+ eggs/
18
+ .eggs/
19
+ lib/
20
+ lib64/
21
+ parts/
22
+ sdist/
23
+ var/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+
28
+ # PyInstaller
29
+ # Usually these files are written by a python script from a template
30
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
31
+ *.manifest
32
+ *.spec
33
+
34
+ # Installer logs
35
+ pip-log.txt
36
+ pip-delete-this-directory.txt
37
+ dev-requirements.txt.log
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .coverage
43
+ .coverage.*
44
+ .cache
45
+ nosetests.xml
46
+ coverage.xml
47
+ *,cover
48
+ .hypothesis/
49
+ venv/
50
+ .venv/
51
+ .python-version
52
+ .pytest_cache
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+
61
+ # Sphinx documentation
62
+ docs/_build/
63
+
64
+ # PyBuilder
65
+ target/
66
+
67
+ #Ipython Notebook
68
+ .ipynb_checkpoints
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.5
2
+ Name: phasetwo-sdk
3
+ Version: 0.2.0
4
+ Summary: Python client for the Phase Two Admin REST API (organizations, SSO, webhooks and more for Keycloak)
5
+ Project-URL: Homepage, https://phasetwo.io/docs/api/sdks/
6
+ Project-URL: Repository, https://github.com/p2-inc/phasetwo-python
7
+ Project-URL: Issues, https://github.com/p2-inc/phasetwo-python/issues
8
+ Project-URL: API reference, https://phasetwo.io/api/phase-two-admin-rest-api
9
+ Author-email: "Phase Two, Inc." <support@phasetwo.io>
10
+ License-Expression: Apache-2.0
11
+ License-File: COPYING
12
+ Keywords: keycloak,openapi,organizations,phasetwo,sso
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Typing :: Typed
16
+ Requires-Python: >=3.11
17
+ Requires-Dist: pydantic>=2.11
18
+ Requires-Dist: python-dateutil>=2.8.2
19
+ Requires-Dist: typing-extensions>=4.7.1
20
+ Requires-Dist: urllib3<3.0.0,>=2.7.0
21
+ Description-Content-Type: text/markdown
22
+
23
+ # Phase Two Python SDK
24
+
25
+ <!-- phasetwo:banner:start - managed by p2-inc/shared-github-actions, edit there -->
26
+ [![license](https://img.shields.io/badge/license-Apache--2.0-blue)](COPYING) [![docs](https://img.shields.io/badge/docs-phasetwo.io-blue)](https://phasetwo.io/docs/api/sdks/)
27
+
28
+ 📚 [Documentation](https://phasetwo.io/docs/api/sdks/) • 🚀 [Hosted Keycloak](https://dash.phasetwo.io/?utm_source=github&utm_medium=readme&utm_campaign=phasetwo-python) • 🤖 [Keycloak Skills](https://github.com/p2-inc/keycloak-skills) • 💬 [Support](mailto:support@phasetwo.io)
29
+
30
+ > [!TIP]
31
+ > **Run this in our cloud, no setup needed.** Phase Two hosts Keycloak with all of our extensions built in. [Try it free with your own cluster →](https://dash.phasetwo.io/?utm_source=github&utm_medium=readme&utm_campaign=phasetwo-python)
32
+ >
33
+ > **Using a coding agent?** Add the Phase Two Keycloak skills ([launch post](https://phasetwo.io/blog/keycloak-skills-mcp-launch)) to Claude Code, Cursor or Codex so your agent can set up passwordless login, SSO, organizations and clusters for you:
34
+ >
35
+ > ```sh
36
+ > # Install the skills (connects to our hosted MCP server)
37
+ > claude plugin marketplace add p2-inc/keycloak-skills
38
+ > claude plugin install phasetwo@keycloak-skills
39
+ > # Or connect to the MCP server directly
40
+ > claude mcp add --transport http keycloak https://mcp.phasetwo.io/mcp
41
+ > ```
42
+ <!-- phasetwo:banner:end -->
43
+
44
+ The Phase Two Python SDK library provides access to the Phase Two API for server-side Python applications.
45
+
46
+ > [!NOTE]
47
+ > All Phase Two SDKs (Java, TypeScript, Python, Go) share the version of the Phase Two API they implement: every SDK release X.Y.* implements API X.Y, and patch releases are SDK-only fixes. While on 0.x, a new minor version can contain breaking changes from the API spec, so pin a version.
48
+
49
+ ## Documentation
50
+
51
+ See the [API Reference](https://phasetwo.io/api/phase-two-admin-rest-api)
52
+
53
+ ## Installation
54
+
55
+ ```sh
56
+ pip install phasetwo-sdk
57
+ ```
58
+
59
+ Requires Python 3.11 or later. The import name is `phasetwo`.
60
+
61
+ ## Use
62
+
63
+ Get an access token for a service account (client credentials grant) with any OIDC library, for example [python-keycloak](https://python-keycloak.readthedocs.io/en/latest/), and pass it to the SDK's `Configuration`. The host is your Keycloak base URL followed by `/realms`.
64
+
65
+ ```python
66
+ import json
67
+ import time
68
+
69
+ from phasetwo import (
70
+ ApiClient,
71
+ Configuration,
72
+ EventRepresentation,
73
+ EventsApi,
74
+ OrganizationRepresentation,
75
+ OrganizationsApi,
76
+ )
77
+
78
+ realm = "my-realm"
79
+ config = Configuration(
80
+ host="https://my-phasetwo-host/auth/realms",
81
+ access_token=get_access_token(), # e.g. KeycloakOpenID(...).token(grant_type="client_credentials")["access_token"]
82
+ )
83
+
84
+ with ApiClient(config) as client:
85
+ orgs = OrganizationsApi(client)
86
+
87
+ # Create an organization. The new id is in the Location header.
88
+ resp = orgs.create_organization_with_http_info(realm, OrganizationRepresentation(name="example"))
89
+ org_id = resp.headers["Location"].rsplit("/", 1)[-1]
90
+
91
+ # Create a link to the IdP Wizard for the organization
92
+ link = orgs.create_portal_link(realm, org_id).link
93
+
94
+ # Create and publish an audit event
95
+ EventsApi(client).create_event(
96
+ realm,
97
+ EventRepresentation(type="foo.bar", representation=json.dumps({"orgId": org_id}), time=int(time.time() * 1000)),
98
+ )
99
+ ```
100
+
101
+ ## Generated code
102
+
103
+ The API classes and models in `phasetwo/openapi` are generated from the [Phase Two OpenAPI spec](https://github.com/p2-inc/phasetwo-docs/blob/main/openapi.yaml) by [phasetwo-sdk-generator](https://github.com/p2-inc/phasetwo-sdk-generator) (generator: [python](https://openapi-generator.tech/docs/generators/python)) and re-exported from `phasetwo`. Don't edit them by hand; `sdk-generator.json` records the spec commit they came from. `phasetwo/__init__.py` and `pyproject.toml` are hand-written.
104
+
105
+ To build: `uv build`
106
+
107
+ ## License
108
+
109
+ Apache License 2.0, see [COPYING](COPYING).
@@ -0,0 +1,87 @@
1
+ # Phase Two Python SDK
2
+
3
+ <!-- phasetwo:banner:start - managed by p2-inc/shared-github-actions, edit there -->
4
+ [![license](https://img.shields.io/badge/license-Apache--2.0-blue)](COPYING) [![docs](https://img.shields.io/badge/docs-phasetwo.io-blue)](https://phasetwo.io/docs/api/sdks/)
5
+
6
+ 📚 [Documentation](https://phasetwo.io/docs/api/sdks/) • 🚀 [Hosted Keycloak](https://dash.phasetwo.io/?utm_source=github&utm_medium=readme&utm_campaign=phasetwo-python) • 🤖 [Keycloak Skills](https://github.com/p2-inc/keycloak-skills) • 💬 [Support](mailto:support@phasetwo.io)
7
+
8
+ > [!TIP]
9
+ > **Run this in our cloud, no setup needed.** Phase Two hosts Keycloak with all of our extensions built in. [Try it free with your own cluster →](https://dash.phasetwo.io/?utm_source=github&utm_medium=readme&utm_campaign=phasetwo-python)
10
+ >
11
+ > **Using a coding agent?** Add the Phase Two Keycloak skills ([launch post](https://phasetwo.io/blog/keycloak-skills-mcp-launch)) to Claude Code, Cursor or Codex so your agent can set up passwordless login, SSO, organizations and clusters for you:
12
+ >
13
+ > ```sh
14
+ > # Install the skills (connects to our hosted MCP server)
15
+ > claude plugin marketplace add p2-inc/keycloak-skills
16
+ > claude plugin install phasetwo@keycloak-skills
17
+ > # Or connect to the MCP server directly
18
+ > claude mcp add --transport http keycloak https://mcp.phasetwo.io/mcp
19
+ > ```
20
+ <!-- phasetwo:banner:end -->
21
+
22
+ The Phase Two Python SDK library provides access to the Phase Two API for server-side Python applications.
23
+
24
+ > [!NOTE]
25
+ > All Phase Two SDKs (Java, TypeScript, Python, Go) share the version of the Phase Two API they implement: every SDK release X.Y.* implements API X.Y, and patch releases are SDK-only fixes. While on 0.x, a new minor version can contain breaking changes from the API spec, so pin a version.
26
+
27
+ ## Documentation
28
+
29
+ See the [API Reference](https://phasetwo.io/api/phase-two-admin-rest-api)
30
+
31
+ ## Installation
32
+
33
+ ```sh
34
+ pip install phasetwo-sdk
35
+ ```
36
+
37
+ Requires Python 3.11 or later. The import name is `phasetwo`.
38
+
39
+ ## Use
40
+
41
+ Get an access token for a service account (client credentials grant) with any OIDC library, for example [python-keycloak](https://python-keycloak.readthedocs.io/en/latest/), and pass it to the SDK's `Configuration`. The host is your Keycloak base URL followed by `/realms`.
42
+
43
+ ```python
44
+ import json
45
+ import time
46
+
47
+ from phasetwo import (
48
+ ApiClient,
49
+ Configuration,
50
+ EventRepresentation,
51
+ EventsApi,
52
+ OrganizationRepresentation,
53
+ OrganizationsApi,
54
+ )
55
+
56
+ realm = "my-realm"
57
+ config = Configuration(
58
+ host="https://my-phasetwo-host/auth/realms",
59
+ access_token=get_access_token(), # e.g. KeycloakOpenID(...).token(grant_type="client_credentials")["access_token"]
60
+ )
61
+
62
+ with ApiClient(config) as client:
63
+ orgs = OrganizationsApi(client)
64
+
65
+ # Create an organization. The new id is in the Location header.
66
+ resp = orgs.create_organization_with_http_info(realm, OrganizationRepresentation(name="example"))
67
+ org_id = resp.headers["Location"].rsplit("/", 1)[-1]
68
+
69
+ # Create a link to the IdP Wizard for the organization
70
+ link = orgs.create_portal_link(realm, org_id).link
71
+
72
+ # Create and publish an audit event
73
+ EventsApi(client).create_event(
74
+ realm,
75
+ EventRepresentation(type="foo.bar", representation=json.dumps({"orgId": org_id}), time=int(time.time() * 1000)),
76
+ )
77
+ ```
78
+
79
+ ## Generated code
80
+
81
+ The API classes and models in `phasetwo/openapi` are generated from the [Phase Two OpenAPI spec](https://github.com/p2-inc/phasetwo-docs/blob/main/openapi.yaml) by [phasetwo-sdk-generator](https://github.com/p2-inc/phasetwo-sdk-generator) (generator: [python](https://openapi-generator.tech/docs/generators/python)) and re-exported from `phasetwo`. Don't edit them by hand; `sdk-generator.json` records the spec commit they came from. `phasetwo/__init__.py` and `pyproject.toml` are hand-written.
82
+
83
+ To build: `uv build`
84
+
85
+ ## License
86
+
87
+ Apache License 2.0, see [COPYING](COPYING).
@@ -0,0 +1,19 @@
1
+ """Python client for the Phase Two Admin REST API.
2
+
3
+ The API classes and models are generated into ``phasetwo.openapi`` by
4
+ https://github.com/p2-inc/phasetwo-sdk-generator and re-exported here, so
5
+ ``from phasetwo import OrganizationsApi`` works. Hand-written helpers live next to
6
+ this file; never edit ``phasetwo/openapi`` by hand.
7
+ """
8
+
9
+ from importlib.metadata import PackageNotFoundError, version as _version
10
+
11
+ from phasetwo.openapi import * # noqa: F401,F403
12
+ from phasetwo.openapi import __all__ as _generated_all
13
+
14
+ try:
15
+ __version__ = _version("phasetwo-sdk")
16
+ except PackageNotFoundError: # running from a source checkout
17
+ __version__ = "0.0.0"
18
+
19
+ __all__ = list(_generated_all)