Skip to content

Commit 27cd7bd

Browse files
committed
chore(docs): Updated the Readme
1 parent 4b8c11e commit 27cd7bd

1 file changed

Lines changed: 54 additions & 32 deletions

File tree

README.md

Lines changed: 54 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,29 @@ JSON file. This process creates a secure token.
7272

7373
```python
7474
import zitadel_client as zitadel
75+
from zitadel_client.exceptions import ApiError
76+
from zitadel_client.models import (
77+
UserServiceAddHumanUserRequest,
78+
UserServiceSetHumanEmail,
79+
UserServiceSetHumanProfile,
80+
)
7581

7682
zitadel = zitadel.Zitadel.with_private_key("https://example.us1.zitadel.cloud", "path/to/jwt-key.json")
7783

7884
try:
79-
response = zitadel.users.user_service_add_human_user({
80-
"username": "john.doe",
81-
"profile": {"givenName": "John", "familyName": "Doe"},
82-
"email": {"email": "john@doe.com"}
83-
})
85+
request = UserServiceAddHumanUserRequest(
86+
username="john.doe",
87+
profile=UserServiceSetHumanProfile(
88+
givenName="John",
89+
familyName="Doe"
90+
),
91+
email=UserServiceSetHumanEmail(
92+
email="john@doe.com"
93+
),
94+
)
95+
response = zitadel.users.add_human_user(request)
8496
print("User created:", response)
85-
except Exception as e:
97+
except ApiError as e:
8698
print("Error:", e)
8799
```
88100

@@ -106,17 +118,29 @@ which is then used to authenticate.
106118

107119
```python
108120
import zitadel_client as zitadel
121+
from zitadel_client.exceptions import ApiError
122+
from zitadel_client.models import (
123+
UserServiceAddHumanUserRequest,
124+
UserServiceSetHumanEmail,
125+
UserServiceSetHumanProfile,
126+
)
109127

110128
zitadel = zitadel.Zitadel.with_client_credentials("https://example.us1.zitadel.cloud", "id", "secret")
111129

112130
try:
113-
response = zitadel.users.user_service_add_human_user({
114-
"username": "john.doe",
115-
"profile": {"givenName": "John", "familyName": "Doe"},
116-
"email": {"email": "john@doe.com"}
117-
})
131+
request = UserServiceAddHumanUserRequest(
132+
username="john.doe",
133+
profile=UserServiceSetHumanProfile(
134+
givenName="John",
135+
familyName="Doe"
136+
),
137+
email=UserServiceSetHumanEmail(
138+
email="john@doe.com"
139+
),
140+
)
141+
response = zitadel.users.add_human_user(request)
118142
print("User created:", response)
119-
except Exception as e:
143+
except ApiError as e:
120144
print("Error:", e)
121145
```
122146

@@ -140,17 +164,29 @@ authenticate without exchanging credentials every time.
140164

141165
```python
142166
import zitadel_client as zitadel
167+
from zitadel_client.exceptions import ApiError
168+
from zitadel_client.models import (
169+
UserServiceAddHumanUserRequest,
170+
UserServiceSetHumanEmail,
171+
UserServiceSetHumanProfile,
172+
)
143173

144174
zitadel = zitadel.Zitadel.with_access_token("https://example.us1.zitadel.cloud", "token")
145175

146176
try:
147-
response = zitadel.users.user_service_add_human_user({
148-
"username": "john.doe",
149-
"profile": {"givenName": "John", "familyName": "Doe"},
150-
"email": {"email": "john@doe.com"}
151-
})
177+
request = UserServiceAddHumanUserRequest(
178+
username="john.doe",
179+
profile=UserServiceSetHumanProfile(
180+
givenName="John",
181+
familyName="Doe"
182+
),
183+
email=UserServiceSetHumanEmail(
184+
email="john@doe.com"
185+
),
186+
)
187+
response = zitadel.users.add_human_user(request)
152188
print("User created:", response)
153-
except Exception as e:
189+
except ApiError as e:
154190
print("Error:", e)
155191
```
156192

@@ -160,20 +196,6 @@ Choose the authentication method that best suits your needs based on your
160196
environment and security requirements. For more details, please refer to the
161197
[Zitadel documentation on authenticating service users](https://zitadel.com/docs/guides/integrate/service-users/authenticate-service-users).
162198

163-
### Debugging
164-
165-
The SDK supports debug logging, which can be enabled for troubleshooting
166-
and debugging purposes. You can enable debug logging by setting the `debug`
167-
flag to `true` when initializing the `Zitadel` client, like this:
168-
169-
```python
170-
zitadel = zitadel.Zitadel("your-zitadel-base-url", 'your-valid-token', lambda config: config.debug = True)
171-
```
172-
173-
When enabled, the SDK will log additional information, such as HTTP request
174-
and response details, which can be useful for identifying issues in the
175-
integration or troubleshooting unexpected behavior.
176-
177199
## Design and Dependencies
178200

179201
This SDK is designed to be lean and efficient, focusing on providing a

0 commit comments

Comments
 (0)