Skip to content

Commit

Permalink
fix: include modules page
Browse files Browse the repository at this point in the history
  • Loading branch information
joel@joellee.org committed Oct 30, 2022
1 parent afc563a commit 8dab491
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 50 deletions.
14 changes: 14 additions & 0 deletions docs/source/examples/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Examples(WIP)
=============

.. note::
The library offers both synchronous and asynchronous clients.
Note that the synchronous and asynchronous classes all provide the exact same interface.
Only the async client and it's methods are documented here.

.. toctree::
:maxdepth: 2
:caption: API Reference:

API </api/api>
Client </api/client>
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Welcome to gotrue's documentation!

API Reference </api/index>
Examples </examples/index>
Miscellaneous Modules <modules>



Expand Down
68 changes: 34 additions & 34 deletions gotrue/_async/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ async def create_user(self, *, attributes: UserAttributes) -> User:
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
headers = self.headers
data = attributes.dict()
Expand All @@ -82,8 +82,8 @@ async def list_users(self) -> List[User]:
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
headers = self.headers
url = f"{self.url}/admin/users"
Expand Down Expand Up @@ -125,8 +125,8 @@ async def sign_up_with_email(
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
headers = self.headers
query_string = ""
Expand Down Expand Up @@ -164,8 +164,8 @@ async def sign_in_with_email(
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
headers = self.headers
query_string = "?grant_type=password"
Expand Down Expand Up @@ -203,8 +203,8 @@ async def sign_up_with_phone(
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
headers = self.headers
data = {"phone": phone, "password": password, "data": data}
Expand Down Expand Up @@ -235,8 +235,8 @@ async def sign_in_with_phone(
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
data = {"phone": phone, "password": password}
url = f"{self.url}/token?grant_type=password"
Expand All @@ -262,8 +262,8 @@ async def send_magic_link_email(
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
headers = self.headers
query_string = ""
Expand All @@ -285,8 +285,8 @@ async def send_mobile_otp(self, *, phone: str, create_user: bool) -> None:
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
headers = self.headers
data = {"phone": phone, "create_user": create_user}
Expand Down Expand Up @@ -320,8 +320,8 @@ async def verify_mobile_otp(
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
headers = self.headers
data = {
Expand Down Expand Up @@ -362,8 +362,8 @@ async def invite_user_by_email(
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
headers = self.headers
query_string = ""
Expand Down Expand Up @@ -392,8 +392,8 @@ async def reset_password_for_email(
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
headers = self.headers
query_string = ""
Expand Down Expand Up @@ -463,8 +463,8 @@ async def get_url_for_provider(
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
url_params = [f"provider={encode_uri_component(provider)}"]
if redirect_to:
Expand All @@ -489,8 +489,8 @@ async def get_user(self, *, jwt: str) -> User:
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
headers = self._create_request_headers(jwt=jwt)
url = f"{self.url}/user"
Expand Down Expand Up @@ -520,8 +520,8 @@ async def update_user(
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
headers = self._create_request_headers(jwt=jwt)
data = attributes.dict()
Expand Down Expand Up @@ -549,8 +549,8 @@ async def delete_user(self, *, uid: str, jwt: str) -> None:
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
headers = self._create_request_headers(jwt=jwt)
url = f"{self.url}/admin/users/{uid}"
Expand All @@ -572,8 +572,8 @@ async def refresh_access_token(self, *, refresh_token: str) -> Session:
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
data = {"refresh_token": refresh_token}
url = f"{self.url}/token?grant_type=refresh_token"
Expand Down Expand Up @@ -614,8 +614,8 @@ async def generate_link(
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
headers = self.headers
data = {
Expand Down
32 changes: 16 additions & 16 deletions gotrue/_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ async def sign_up(
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
await self._remove_session()

Expand Down Expand Up @@ -202,8 +202,8 @@ async def sign_in(
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
await self._remove_session()
if email:
Expand Down Expand Up @@ -270,8 +270,8 @@ async def verify_otp(
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
await self._remove_session()
response = await self.api.verify_mobile_otp(
Expand Down Expand Up @@ -319,8 +319,8 @@ async def update(
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
if not self.current_session:
raise ValueError("Not logged in.")
Expand Down Expand Up @@ -354,8 +354,8 @@ async def set_session(self, *, refresh_token: str) -> Session:
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
response = await self.api.refresh_access_token(refresh_token=refresh_token)
await self._save_session(session=response)
Expand All @@ -378,8 +378,8 @@ async def set_auth(self, *, access_token: str) -> Session:
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
session = Session(
access_token=access_token,
Expand Down Expand Up @@ -420,8 +420,8 @@ async def get_session_from_url(
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
data = urlparse(url)
query = parse_qs(data.query)
Expand Down Expand Up @@ -496,8 +496,8 @@ def on_auth_state_change(
Raises
------
error : APIError
If an error occurs
APIError
If an error occurs.
"""
unique_id = uuid4()
subscription = Subscription(
Expand Down

0 comments on commit 8dab491

Please sign in to comment.