From e72de319a897af4b19057024f87e2ec08852f4ef Mon Sep 17 00:00:00 2001 From: kiliczsh Date: Mon, 24 Apr 2023 21:03:18 +0300 Subject: [PATCH] Implement Create and Read endpoints for App Passwords --- README.md | 2 ++ gokyuzu/BlueskyEndpoints.py | 4 ++-- gokyuzu/__init__.py | 13 +++++++++++++ pyproject.toml | 2 +- setup.py | 2 +- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f01ee81..385ece8 100644 --- a/README.md +++ b/README.md @@ -68,11 +68,13 @@ List of Implemented API Calls: #### com.atproto.server - `def createAccount( email, handle, password, inviteCode)` +- `def createAppPassword( name)` - `def createInviteCode( useCount, user_did=None)` - `def createInviteCodes( useCount, codeCount=1, user_did=None)` - `def deleteAccount( token, password, handle=None, user_did=None)` - `def describeServer()` - `def deleteSession()` +- `def listAppPassword()` - `def getAccountInviteCodes( limit=10, includeUsed=True, create_available=True)` - `def getSession()` - `def requestAccountDelete()` diff --git a/gokyuzu/BlueskyEndpoints.py b/gokyuzu/BlueskyEndpoints.py index 11a4204..b9cbd8e 100644 --- a/gokyuzu/BlueskyEndpoints.py +++ b/gokyuzu/BlueskyEndpoints.py @@ -128,8 +128,8 @@ def getAccountInviteCodes(self): def getSession(self): return self.get_url("/xrpc/com.atproto.server.getSession") - def listAppPassword(self): - return self.get_url("/xrpc/com.atproto.server.listAppPassword") + def listAppPasswords(self): + return self.get_url("/xrpc/com.atproto.server.listAppPasswords") def resetPassword(self): return self.get_url("/xrpc/com.atproto.server.resetPassword") diff --git a/gokyuzu/__init__.py b/gokyuzu/__init__.py index fc59c37..7d08a2f 100644 --- a/gokyuzu/__init__.py +++ b/gokyuzu/__init__.py @@ -347,6 +347,14 @@ def createAccount(self, email, handle, password, inviteCode): response = self.SESSION.postJson(request_url, json=request_data) return response + def createAppPassword(self, app_name): + request_url = self.ENDPOINTS.createAppPassword() + request_data = { + "name": app_name + } + response = self.SESSION.postJson(request_url, json=request_data) + return response + def createInviteCode(self, useCount, user_did=None): request_url = self.ENDPOINTS.createInviteCode() if user_did is None: @@ -407,6 +415,11 @@ def getSession(self): response = self.SESSION.get(request_url) return response + def listAppPasswords(self): + request_url = self.ENDPOINTS.listAppPasswords() + response = self.SESSION.get(request_url) + return response + def requestAccountDelete(self): request_url = self.ENDPOINTS.requestAccountDelete() response = self.SESSION.post(request_url) diff --git a/pyproject.toml b/pyproject.toml index 7efe63f..0e36e71 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [tool.poetry] name = "gokyuzu" -version = "2.0.0" +version = "2.0.1" description = "bsky.social client library" authors = ["Muhammed Kılıç "] license = "MIT" diff --git a/setup.py b/setup.py index db6dc9d..f90d558 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='gokyuzu', - version='2.0.0', + version='2.0.1', description='bsky.social client library', long_description=open('README.md', 'r', encoding='utf-8').read(), long_description_content_type='text/markdown',