Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ indent_size = 2
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120
max_line_length = 120

[*.py]
indent_size = 4
20 changes: 0 additions & 20 deletions .openapi-generator-ignore

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import zitadel_client as zitadel
zitadel = zitadel.Zitadel.with_private_key("https://example.us1.zitadel.cloud", "path/to/jwt-key.json")

try:
response = zitadel.users.add_human_user({
response = zitadel.users.user_service_add_human_user({
"username": "john.doe",
"profile": {"givenName": "John", "familyName": "Doe"},
"email": {"email": "john@doe.com"}
Expand Down Expand Up @@ -107,7 +107,7 @@ import zitadel_client as zitadel
zitadel = zitadel.Zitadel.with_client_credentials("https://example.us1.zitadel.cloud", "id", "secret")

try:
response = zitadel.users.add_human_user({
response = zitadel.users.user_service_add_human_user({
"username": "john.doe",
"profile": {"givenName": "John", "familyName": "Doe"},
"email": {"email": "john@doe.com"}
Expand Down Expand Up @@ -141,7 +141,7 @@ import zitadel_client as zitadel
zitadel = zitadel.Zitadel.with_access_token("https://example.us1.zitadel.cloud", "token")

try:
response = zitadel.users.add_human_user({
response = zitadel.users.user_service_add_human_user({
"username": "john.doe",
"profile": {"givenName": "John", "familyName": "Doe"},
"email": {"email": "john@doe.com"}
Expand Down
16 changes: 0 additions & 16 deletions nexus.json

This file was deleted.

19 changes: 0 additions & 19 deletions proc.yml

This file was deleted.

21 changes: 10 additions & 11 deletions spec/sdk_test_using_client_credentials_authentication_spec.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import os
import pprint
import uuid

import pytest

import zitadel_client as zitadel
from zitadel_client.auth.client_credentials_authenticator import (
ClientCredentialsAuthenticator,
)


@pytest.fixture
Expand All @@ -32,13 +30,14 @@ def user_id(client_id: str, client_secret: str, base_url: str) -> str | None:
"""Fixture to create a user and return their ID."""
with zitadel.Zitadel.with_client_credentials(base_url, client_id, client_secret) as client:
try:
response = client.users.add_human_user(
body=zitadel.models.V2AddHumanUserRequest(
response = client.users.user_service_add_human_user(
zitadel.models.UserServiceAddHumanUserRequest(
username=uuid.uuid4().hex,
profile=zitadel.models.V2SetHumanProfile(given_name="John", family_name="Doe"), # type: ignore[call-arg]
email=zitadel.models.V2SetHumanEmail(email=f"johndoe{uuid.uuid4().hex}@caos.ag"),
profile=zitadel.models.UserServiceSetHumanProfile(given_name="John", family_name="Doe"), # type: ignore[call-arg]
email=zitadel.models.UserServiceSetHumanEmail(email=f"johndoe{uuid.uuid4().hex}@caos.ag"),
)
)
pprint.pprint(response)
return response.user_id
except Exception as e:
pytest.fail(f"Exception while creating user: {e}")
Expand All @@ -50,10 +49,10 @@ def test_should_deactivate_and_reactivate_user_with_valid_token(
"""Test to (de)activate the user with a valid token."""
with zitadel.Zitadel.with_client_credentials(base_url, client_id, client_secret) as client:
try:
deactivate_response = client.users.deactivate_user(user_id=user_id)
deactivate_response = client.users.user_service_deactivate_user(user_id=user_id)
assert deactivate_response is not None, "Deactivation response is None"

reactivate_response = client.users.reactivate_user(user_id=user_id)
reactivate_response = client.users.user_service_reactivate_user(user_id=user_id)
assert reactivate_response is not None, "Reactivation response is None"
except Exception as e:
pytest.fail(f"Exception when calling deactivate_user or reactivate_user with valid token: {e}")
Expand All @@ -63,7 +62,7 @@ def test_should_not_deactivate_or_reactivate_user_with_invalid_token(user_id: st
"""Test to attempt (de)activating the user with an invalid token."""
with zitadel.Zitadel.with_client_credentials(base_url, "id", "secret") as client:
with pytest.raises(Exception, match="Failed to refresh token: invalid_client: client not found"):
client.users.deactivate_user(user_id=user_id)
client.users.user_service_deactivate_user(user_id=user_id)

with pytest.raises(Exception, match="Failed to refresh token: invalid_client: client not found"):
client.users.reactivate_user(user_id=user_id)
client.users.user_service_reactivate_user(user_id=user_id)
19 changes: 8 additions & 11 deletions spec/sdk_test_using_personal_access_token_authentication_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
import pytest

import zitadel_client as zitadel
from zitadel_client.auth.personal_access_token_authenticator import (
PersonalAccessTokenAuthenticator,
)
from zitadel_client.exceptions import UnauthorizedException


Expand All @@ -33,11 +30,11 @@ def user_id(valid_token: str, base_url: str) -> str | None:
"""Fixture to create a user and return their ID."""
with zitadel.Zitadel.with_access_token(base_url, valid_token) as client:
try:
response = client.users.add_human_user(
body=zitadel.models.V2AddHumanUserRequest(
response = client.users.user_service_add_human_user(
zitadel.models.UserServiceAddHumanUserRequest(
username=uuid.uuid4().hex,
profile=zitadel.models.V2SetHumanProfile(given_name="John", family_name="Doe"), # type: ignore[call-arg]
email=zitadel.models.V2SetHumanEmail(email=f"johndoe{uuid.uuid4().hex}@caos.ag"),
profile=zitadel.models.UserServiceSetHumanProfile(given_name="John", family_name="Doe"), # type: ignore[call-arg]
email=zitadel.models.UserServiceSetHumanEmail(email=f"johndoe{uuid.uuid4().hex}@caos.ag"),
)
)
return response.user_id
Expand All @@ -49,10 +46,10 @@ def test_should_deactivate_and_reactivate_user_with_valid_token(user_id: str, va
"""Test to (de)activate the user with a valid token."""
with zitadel.Zitadel.with_access_token(base_url, valid_token) as client:
try:
deactivate_response = client.users.deactivate_user(user_id=user_id)
deactivate_response = client.users.user_service_deactivate_user(user_id=user_id)
assert deactivate_response is not None, "Deactivation response is None"

reactivate_response = client.users.reactivate_user(user_id=user_id)
reactivate_response = client.users.user_service_reactivate_user(user_id=user_id)
assert reactivate_response is not None, "Reactivation response is None"
except Exception as e:
pytest.fail(f"Exception when calling deactivate_user or reactivate_user with valid token: {e}")
Expand All @@ -62,7 +59,7 @@ def test_should_not_deactivate_or_reactivate_user_with_invalid_token(user_id: st
"""Test to attempt (de)activating the user with an invalid token."""
with zitadel.Zitadel.with_access_token(base_url, invalid_token) as client:
with pytest.raises(UnauthorizedException):
client.users.deactivate_user(user_id=user_id)
client.users.user_service_deactivate_user(user_id=user_id)

with pytest.raises(UnauthorizedException):
client.users.reactivate_user(user_id=user_id)
client.users.user_service_reactivate_user(user_id=user_id)
13 changes: 6 additions & 7 deletions spec/sdk_test_using_web_token_authentication_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pytest

import zitadel_client as zitadel
from zitadel_client.auth.web_token_authenticator import WebTokenAuthenticator


@pytest.fixture
Expand All @@ -29,11 +28,11 @@ def user_id(key_file: str, base_url: str) -> str | None:
"""Fixture to create a user and return their ID."""
with zitadel.Zitadel.with_private_key(base_url, key_file) as client:
try:
response = client.users.add_human_user(
body=zitadel.models.V2AddHumanUserRequest(
response = client.users.user_service_add_human_user(
zitadel.models.UserServiceAddHumanUserRequest(
username=uuid.uuid4().hex,
profile=zitadel.models.V2SetHumanProfile(given_name="John", family_name="Doe"), # type: ignore[call-arg]
email=zitadel.models.V2SetHumanEmail(email=f"johndoe{uuid.uuid4().hex}@caos.ag"),
profile=zitadel.models.UserServiceSetHumanProfile(given_name="John", family_name="Doe"), # type: ignore[call-arg]
email=zitadel.models.UserServiceSetHumanEmail(email=f"johndoe{uuid.uuid4().hex}@caos.ag"),
)
)
return response.user_id
Expand All @@ -45,10 +44,10 @@ def test_should_deactivate_and_reactivate_user_with_valid_token(user_id: str, ke
"""Test to (de)activate the user with a valid token."""
with zitadel.Zitadel.with_private_key(base_url, key_file) as client:
try:
deactivate_response = client.users.deactivate_user(user_id=user_id)
deactivate_response = client.users.user_service_deactivate_user(user_id=user_id)
assert deactivate_response is not None, "Deactivation response is None"

reactivate_response = client.users.reactivate_user(user_id=user_id)
reactivate_response = client.users.user_service_reactivate_user(user_id=user_id)
assert reactivate_response is not None, "Reactivation response is None"
except Exception as e:
pytest.fail(f"Exception when calling deactivate_user or reactivate_user with valid token: {e}")
1 change: 1 addition & 0 deletions zitadel_client/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from zitadel_client.api.identity_provider_service_api import IdentityProviderServiceApi
from zitadel_client.api.oidc_service_api import OIDCServiceApi
from zitadel_client.api.organization_service_api import OrganizationServiceApi
from zitadel_client.api.saml_service_api import SAMLServiceApi
from zitadel_client.api.session_service_api import SessionServiceApi
from zitadel_client.api.settings_api import SettingsApi
from zitadel_client.api.settings_service_api import SettingsServiceApi
Expand Down
Loading