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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions src/archastro/platform/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Copyright (c) 2026 ArchAstro Inc. All Rights Reserved.
# This file is auto-generated by @archastro/sdk-generator. Do not edit.
# Content hash: 02004325aba1
# Content hash: 8c6cb3d00016

from importlib.metadata import version as _pkg_version

from .auth import AuthClient, AuthTokens # noqa: F401
from .client import PlatformClient # noqa: F401
from .v1 import V1 # noqa: F401
from .auth import AsyncAuthClient, AuthClient, AuthTokens # noqa: F401
from .client import AsyncPlatformClient, PlatformClient # noqa: F401
from .v1 import (
V1, # noqa: F401
AsyncV1, # noqa: F401
)

__version__ = _pkg_version("archastro-sdk")
175 changes: 172 additions & 3 deletions src/archastro/platform/auth.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Copyright (c) 2026 ArchAstro Inc. All Rights Reserved.
# This file is auto-generated by @archastro/sdk-generator. Do not edit.
# Content hash: e1c481420189
# Content hash: ac0e3a9724dc

from __future__ import annotations

from dataclasses import dataclass

from .runtime.http_client import HttpClient
from .runtime.http_client import HttpClient, SyncHttpClient


@dataclass
Expand All @@ -16,7 +16,7 @@ class AuthTokens:
access_token: str | None = None


class AuthClient:
class AsyncAuthClient:
def __init__(self, http: HttpClient):
self._http = http

Expand Down Expand Up @@ -185,3 +185,172 @@ async def verify_magic_link(self, token: str | None = None) -> AuthTokens:
refresh_token=data.get("refresh_token"),
access_token=data.get("token"),
)


class AuthClient:
def __init__(self, http: SyncHttpClient):
self._http = http

def allowed_auth_methods(self) -> dict:
data = self._http.request(
"/api/v1/auth/allowed_auth_methods",
method="GET",
)
return data

def login(self, email: str, password: str) -> AuthTokens:
body: dict[str, object] = {}
body["email"] = email
body["password"] = password

data = self._http.request(
"/api/v1/auth/login",
method="POST",
body=body,
)
return AuthTokens(
token_expiry=data.get("expires_in"),
refresh_token=data.get("refresh_token"),
access_token=data.get("token"),
)

def request_login_magic_link(
self, email: str | None = None, redirect_uri: str | None = None
) -> dict:
body: dict[str, object] = {}
if email is not None:
body["email"] = email
if redirect_uri is not None:
body["redirect_uri"] = redirect_uri

data = self._http.request(
"/api/v1/auth/login/link",
method="POST",
body=body,
)
return data

def refresh(self, refresh_token: str) -> AuthTokens:
body: dict[str, object] = {}
body["refresh_token"] = refresh_token

data = self._http.request(
"/api/v1/auth/refresh",
method="POST",
body=body,
)
return AuthTokens(
token_expiry=data.get("expires_in"),
refresh_token=data.get("refresh_token"),
access_token=data.get("token"),
)

def register(
self,
email: str,
alias: str | None = None,
full_name: str | None = None,
invite_code: str | None = None,
password: str | None = None,
team_invite: str | None = None,
timezone: str | None = None,
) -> AuthTokens:
body: dict[str, object] = {}
body["email"] = email
if alias is not None:
body["alias"] = alias
if full_name is not None:
body["full_name"] = full_name
if invite_code is not None:
body["invite_code"] = invite_code
if password is not None:
body["password"] = password
if team_invite is not None:
body["team_invite"] = team_invite
if timezone is not None:
body["timezone"] = timezone

data = self._http.request(
"/api/v1/auth/register",
method="POST",
body=body,
)
return AuthTokens(
token_expiry=data.get("expires_in"),
refresh_token=data.get("refresh_token"),
access_token=data.get("token"),
)

def request_register_magic_link(
self,
alias: str | None = None,
email: str | None = None,
full_name: str | None = None,
redirect_uri: str | None = None,
timezone: str | None = None,
) -> dict:
body: dict[str, object] = {}
if alias is not None:
body["alias"] = alias
if email is not None:
body["email"] = email
if full_name is not None:
body["full_name"] = full_name
if redirect_uri is not None:
body["redirect_uri"] = redirect_uri
if timezone is not None:
body["timezone"] = timezone

data = self._http.request(
"/api/v1/auth/register/link",
method="POST",
body=body,
)
return data

def request_magic_link(self, email: str | None = None, redirect_uri: str | None = None) -> dict:
body: dict[str, object] = {}
if email is not None:
body["email"] = email
if redirect_uri is not None:
body["redirect_uri"] = redirect_uri

data = self._http.request(
"/api/v1/auth/request/link",
method="POST",
body=body,
)
return data

def exchange_login_token(self, token: str, timezone: str | None = None) -> AuthTokens:
body: dict[str, object] = {}
body["token"] = token
if timezone is not None:
body["timezone"] = timezone

data = self._http.request(
"/api/v1/auth/token",
method="POST",
body=body,
)
return AuthTokens(
token_expiry=data.get("expires_in"),
refresh_token=data.get("refresh_token"),
access_token=data.get("token"),
)

def verify_magic_link(self, token: str | None = None) -> AuthTokens:
body: dict[str, object] = {}
if token is not None:
body["token"] = token

data = self._http.request(
"/api/v1/auth/verify/link",
method="POST",
body=body,
)
return AuthTokens(
token_expiry=data.get("expires_in"),
refresh_token=data.get("refresh_token"),
access_token=data.get("token"),
)
Loading
Loading