Skip to content

Commit

Permalink
Implement Create and Read endpoints for App Passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
kiliczsh committed Apr 24, 2023
1 parent f61e148 commit e72de31
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
Expand Down
4 changes: 2 additions & 2 deletions gokyuzu/BlueskyEndpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
13 changes: 13 additions & 0 deletions gokyuzu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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ıç <[email protected]>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit e72de31

Please sign in to comment.