Added endpoints
This commit is contained in:
pare
9c923dc37a
commit
c19ea82741
S'han modificat 3 arxius amb 211 adicions i 31 eliminacions
13
README.md
13
README.md
|
@ -39,15 +39,4 @@ else:
|
|||
```
|
||||
|
||||
Store or write down in a safe place this last obtained `token` to further usage with any of the API endpoints that require it (param `i(token)`).
|
||||
|
||||
| **description** | **Misskey API endpoint** | **method** | **params** |
|
||||
|-----------------------|----------------------------|-----------------------|-----------------------------------------------------|
|
||||
| i | /api/i | account_i | i(token) |
|
||||
| create app | /api/app/create | app_create | name, description, permission, callbackUrl, session |
|
||||
| show app | /api/app/show | app_show | app_id, session |
|
||||
| generate auth session | /api/auth/session/generate | auth_session_generate | app_secret |
|
||||
| show auth session | /api/auth/session/show | auth_session_show | token |
|
||||
| auth session userkey | /api/auth/session/userkey | auth_session_userkey | app_secret, token |
|
||||
| create note | /api/notes/create | notes_create | i(token), visibility, text, local_only |
|
||||
| create group | /api/users/groups/create | users_groups_create | i(token), groupId |
|
||||
| delete group | /api/users/groups/delete | users_groups_delete | i(token), groupId |
|
||||
!(endpoints table)[endpoints/misskey_endpoints.md]
|
||||
|
|
|
@ -74,11 +74,11 @@ Misskey API endpoints table
|
|||
|antennas/notes| |{"params":[{"name":"antennaId","type":"String"},{"name":"limit","type":"Integer"},{"name":"sinceId","type":"String"},{"name":"untilId","type":"String"},{"name":"sinceDate","type":"Integer"},{"name":"untilDate","type":"Integer"}]}| |
|
||||
|antennas/show| |{"params":[{"name":"antennaId","type":"String"}]}| |
|
||||
|antennas/update| |{"params":[{"name":"antennaId","type":"String"},{"name":"name","type":"String"},{"name":"src","type":"String"},{"name":"userListId","type":"String"},{"name":"userGroupId","type":"String"},{"name":"keywords","type":"Array"},{"name":"excludeKeywords","type":"Array"},{"name":"users","type":"Array"},{"name":"caseSensitive","type":"Boolean"},{"name":"withReplies","type":"Boolean"},{"name":"withFile","type":"Boolean"},{"name":"notify","type":"Boolean"}]}| |
|
||||
|ap/get| |{"params":[{"name":"uri","type":"String"}]}| |
|
||||
|ap/show| |{"params":[{"name":"uri","type":"String"}]}| |
|
||||
|ap/get| |{"params":[{"name":"uri","type":"String"}]}|✅|
|
||||
|ap/show| |{"params":[{"name":"uri","type":"String"}]}|✅|
|
||||
|app/create| |{"params":[{"name":"name","type":"String"},{"name":"description","type":"String"},{"name":"permission","type":"Array"},{"name":"callbackUrl","type":"String"}]}|✅|
|
||||
|app/show| |{"params":[{"name":"appId","type":"String"}]}|✅|
|
||||
|auth/accept| |{"params":[{"name":"token","type":"String"}]}| |
|
||||
|auth/accept| |{"params":[{"name":"token","type":"String"}]}|✅|
|
||||
|auth/session/generate| |{"params":[{"name":"appSecret","type":"String"}]}|✅|
|
||||
|auth/session/show| |{"params":[{"name":"token","type":"String"}]}|✅|
|
||||
|auth/session/userkey| |{"params":[{"name":"appSecret","type":"String"},{"name":"token","type":"String"}]}|✅|
|
||||
|
@ -97,7 +97,7 @@ Misskey API endpoints table
|
|||
|charts/active-users| |{"params":[{"name":"span","type":"String"},{"name":"limit","type":"Integer"},{"name":"offset","type":"Integer"}]}| |
|
||||
|charts/ap-request| |{"params":[{"name":"span","type":"String"},{"name":"limit","type":"Integer"},{"name":"offset","type":"Integer"}]}| |
|
||||
|charts/drive| |{"params":[{"name":"span","type":"String"},{"name":"limit","type":"Integer"},{"name":"offset","type":"Integer"}]}| |
|
||||
|charts/federation| |{"params":[{"name":"span","type":"String"},{"name":"limit","type":"Integer"},{"name":"offset","type":"Integer"}]}| |
|
||||
|charts/federation| |{"params":[{"name":"span","type":"String"},{"name":"limit","type":"Integer"},{"name":"offset","type":"Integer"}]}|✅|
|
||||
|charts/hashtag| |{"params":[{"name":"span","type":"String"},{"name":"limit","type":"Integer"},{"name":"offset","type":"Integer"},{"name":"tag","type":"String"}]}| |
|
||||
|charts/instance| |{"params":[{"name":"span","type":"String"},{"name":"limit","type":"Integer"},{"name":"offset","type":"Integer"},{"name":"host","type":"String"}]}| |
|
||||
|charts/notes| |{"params":[{"name":"span","type":"String"},{"name":"limit","type":"Integer"},{"name":"offset","type":"Integer"}]}| |
|
||||
|
@ -133,16 +133,16 @@ Misskey API endpoints table
|
|||
|drive/folders/update| |{"params":[{"name":"folderId","type":"String"},{"name":"name","type":"String"},{"name":"parentId","type":"String"}]}| |
|
||||
|drive/stream| |{"params":[{"name":"limit","type":"Integer"},{"name":"sinceId","type":"String"},{"name":"untilId","type":"String"},{"name":"type","type":"String"}]}| |
|
||||
|email-address/available| |{"params":[{"name":"emailAddress","type":"String"}]}| |
|
||||
|endpoint| |{"params":[{"name":"endpoint","type":"String"}]}| |
|
||||
|endpoints| |{"params":[]}| |
|
||||
|endpoint| |{"params":[{"name":"endpoint","type":"String"}]}|✅|
|
||||
|endpoints| |{"params":[]}|✅|
|
||||
|export-custom-emojis| |{"params":[]}| |
|
||||
|federation/followers| |{"params":[{"name":"host","type":"String"},{"name":"sinceId","type":"String"},{"name":"untilId","type":"String"},{"name":"limit","type":"Integer"}]}| |
|
||||
|federation/following| |{"params":[{"name":"host","type":"String"},{"name":"sinceId","type":"String"},{"name":"untilId","type":"String"},{"name":"limit","type":"Integer"}]}| |
|
||||
|federation/instances| |{"params":[{"name":"host","type":"String"},{"name":"blocked","type":"Boolean"},{"name":"notResponding","type":"Boolean"},{"name":"suspended","type":"Boolean"},{"name":"federating","type":"Boolean"},{"name":"subscribing","type":"Boolean"},{"name":"publishing","type":"Boolean"},{"name":"limit","type":"Integer"},{"name":"offset","type":"Integer"},{"name":"sort","type":"String"}]}| |
|
||||
|federation/instances| |{"params":[{"name":"host","type":"String"},{"name":"blocked","type":"Boolean"},{"name":"notResponding","type":"Boolean"},{"name":"suspended","type":"Boolean"},{"name":"federating","type":"Boolean"},{"name":"subscribing","type":"Boolean"},{"name":"publishing","type":"Boolean"},{"name":"limit","type":"Integer"},{"name":"offset","type":"Integer"},{"name":"sort","type":"String"}]}|✅|
|
||||
|federation/show-instance| |{"params":[{"name":"host","type":"String"}]}| |
|
||||
|federation/update-remote-user| |{"params":[{"name":"userId","type":"String"}]}| |
|
||||
|federation/users| |{"params":[{"name":"host","type":"String"},{"name":"sinceId","type":"String"},{"name":"untilId","type":"String"},{"name":"limit","type":"Integer"}]}| |
|
||||
|federation/stats| |{"params":[{"name":"limit","type":"Integer"}]}| |
|
||||
|federation/stats| |{"params":[{"name":"limit","type":"Integer"}]}|✅|
|
||||
|following/create| |{"params":[{"name":"userId","type":"String"}]}| |
|
||||
|following/delete| |{"params":[{"name":"userId","type":"String"}]}| |
|
||||
|following/invalidate| |{"params":[{"name":"userId","type":"String"}]}| |
|
||||
|
@ -190,7 +190,7 @@ Misskey API endpoints table
|
|||
|i/import-following| |{"params":[{"name":"fileId","type":"String"}]}| |
|
||||
|i/import-muting| |{"params":[{"name":"fileId","type":"String"}]}| |
|
||||
|i/import-user-lists| |{"params":[{"name":"fileId","type":"String"}]}| |
|
||||
|i/notifications| |{"params":[{"name":"limit","type":"Integer"},{"name":"sinceId","type":"String"},{"name":"untilId","type":"String"},{"name":"following","type":"Boolean"},{"name":"unreadOnly","type":"Boolean"},{"name":"markAsRead","type":"Boolean"},{"name":"includeTypes","type":"Array"},{"name":"excludeTypes","type":"Array"}]}| |
|
||||
|i/notifications| |{"params":[{"name":"limit","type":"Integer"},{"name":"sinceId","type":"String"},{"name":"untilId","type":"String"},{"name":"following","type":"Boolean"},{"name":"unreadOnly","type":"Boolean"},{"name":"markAsRead","type":"Boolean"},{"name":"includeTypes","type":"Array"},{"name":"excludeTypes","type":"Array"}]}|✅|
|
||||
|i/page-likes| |{"params":[{"name":"limit","type":"Integer"},{"name":"sinceId","type":"String"},{"name":"untilId","type":"String"}]}| |
|
||||
|i/pages| |{"params":[{"name":"limit","type":"Integer"},{"name":"sinceId","type":"String"},{"name":"untilId","type":"String"}]}| |
|
||||
|i/pin| |{"params":[{"name":"noteId","type":"String"}]}| |
|
||||
|
@ -227,7 +227,7 @@ Misskey API endpoints table
|
|||
|mute/create| |{"params":[{"name":"userId","type":"String"},{"name":"expiresAt","type":"Integer"}]}| |
|
||||
|mute/delete| |{"params":[{"name":"userId","type":"String"}]}| |
|
||||
|mute/list| |{"params":[{"name":"limit","type":"Integer"},{"name":"sinceId","type":"String"},{"name":"untilId","type":"String"}]}| |
|
||||
|my/apps| |{"params":[{"name":"limit","type":"Integer"},{"name":"offset","type":"Integer"}]}| |
|
||||
|my/apps| |{"params":[{"name":"limit","type":"Integer"},{"name":"offset","type":"Integer"}]}|✅|
|
||||
|notes| |{"params":[{"name":"local","type":"Boolean"},{"name":"reply","type":"Boolean"},{"name":"renote","type":"Boolean"},{"name":"withFiles","type":"Boolean"},{"name":"poll","type":"Boolean"},{"name":"limit","type":"Integer"},{"name":"sinceId","type":"String"},{"name":"untilId","type":"String"}]}| |
|
||||
|notes/children| |{"params":[{"name":"noteId","type":"String"},{"name":"limit","type":"Integer"},{"name":"sinceId","type":"String"},{"name":"untilId","type":"String"}]}| |
|
||||
|notes/clips| |{"params":[{"name":"noteId","type":"String"}]}| |
|
||||
|
@ -262,7 +262,7 @@ Misskey API endpoints table
|
|||
|notes/watching/delete| |{"params":[{"name":"noteId","type":"String"}]}| |
|
||||
|notifications/create| |{"params":[{"name":"body","type":"String"},{"name":"header","type":"String"},{"name":"icon","type":"String"}]}| |
|
||||
|notifications/mark-all-as-read| |{"params":[]}| |
|
||||
|notifications/read| |{"params":[]}| |
|
||||
|notifications/read| |{"params":[]}|✅|
|
||||
|page-push| |{"params":[]}| |
|
||||
|pages/create| |{"params":[{"name":"title","type":"String"},{"name":"name","type":"String"},{"name":"summary","type":"String"},{"name":"content","type":"Array"},{"name":"variables","type":"Array"},{"name":"script","type":"String"},{"name":"eyeCatchingImageId","type":"String"},{"name":"font","type":"String"},{"name":"alignCenter","type":"Boolean"},{"name":"hideTitleWhenPinned","type":"Boolean"}]}| |
|
||||
|pages/delete| |{"params":[{"name":"pageId","type":"String"}]}| |
|
||||
|
@ -277,8 +277,8 @@ Misskey API endpoints table
|
|||
|request-reset-password| |{"params":[{"name":"username","type":"String"},{"name":"email","type":"String"}]}| |
|
||||
|reset-db| |{"params":[]}| |
|
||||
|reset-password| |{"params":[{"name":"token","type":"String"},{"name":"password","type":"String"}]}| |
|
||||
|server-info| |{"params":[]}| |
|
||||
|stats| |{"params":[]}| |
|
||||
|server-info| |{"params":[]}|✅|
|
||||
|stats| |{"params":[]}|✅|
|
||||
|sw/register| |{"params":[{"name":"endpoint","type":"String"},{"name":"auth","type":"String"},{"name":"publickey","type":"String"}]}| |
|
||||
|sw/unregister| |{"params":[{"name":"endpoint","type":"String"}]}| |
|
||||
|test| |{"params":[{"name":"required","type":"Boolean"},{"name":"string","type":"String"},{"name":"default","type":"String"},{"name":"nullableDefault","type":"String"},{"name":"id","type":"String"}]}| |
|
||||
|
|
|
@ -68,14 +68,48 @@ class MisskeyAPI:
|
|||
|
||||
self.__request_timeout = request_timeout
|
||||
|
||||
def account_i(self, i=None):
|
||||
def i(self, i=None):
|
||||
|
||||
params = {
|
||||
'i': i
|
||||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/i'
|
||||
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
||||
def i_notifications(self, i=None, limit=None, sinceId=None, untilId=None, following=False, unreadOnly=False, markAsRead=True, includeTypes=None, excludeTypes=None):
|
||||
|
||||
params = {
|
||||
'i': i,
|
||||
'limit': limit,
|
||||
'sinceId': sinceId,
|
||||
'untilId': untilId,
|
||||
'following': following,
|
||||
'unreadOnly': unreadOnly,
|
||||
'markAsRead': markAsRead,
|
||||
'includeTypes': includeTypes,
|
||||
'excludeTypes': excludeTypes
|
||||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/i/notifications'
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
||||
def my_apps(self, i=None, limit=None, offset=0):
|
||||
|
||||
params = {
|
||||
'i': i,
|
||||
'limit': limit,
|
||||
'offset': offset
|
||||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/my/apps'
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
@ -124,6 +158,18 @@ class MisskeyAPI:
|
|||
|
||||
return response
|
||||
|
||||
def auth_accept(self, token=None):
|
||||
|
||||
params = {
|
||||
'token': token,
|
||||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/auth/accept'
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
||||
def auth_session_generate(self, app_secret=None):
|
||||
|
||||
params = {
|
||||
|
@ -133,7 +179,7 @@ class MisskeyAPI:
|
|||
endpoint = self.api_base_url + '/api/auth/session/generate'
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
|
||||
return response
|
||||
|
||||
def auth_session_show(self, token=None):
|
||||
|
@ -143,7 +189,7 @@ class MisskeyAPI:
|
|||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/auth/session/show'
|
||||
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
@ -156,7 +202,115 @@ class MisskeyAPI:
|
|||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/auth/session/userkey'
|
||||
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
||||
def charts_federation(self, span=None, limit=None, offset=None):
|
||||
|
||||
params = {
|
||||
'span': span,
|
||||
'limit': limit,
|
||||
'offset': None
|
||||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/charts/federation'
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
||||
def ap_get(self, i=None, uri=None):
|
||||
|
||||
params = {
|
||||
'i': i,
|
||||
'uri': uri
|
||||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/ap/get'
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
||||
def ap_show(self, i=None, uri=None):
|
||||
|
||||
params = {
|
||||
'i': i,
|
||||
'uri': uri
|
||||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/ap/show'
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
||||
def federation_instances(self):
|
||||
|
||||
params = {
|
||||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/federation/instances'
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
||||
def federation_stats(self, limit=None):
|
||||
|
||||
params = {
|
||||
'limit': limit
|
||||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/federation/stats'
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
||||
def endpoint(self, endpoint=None):
|
||||
|
||||
params = {
|
||||
'endpoint': endpoint
|
||||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/endpoint'
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
||||
def endpoints(self):
|
||||
|
||||
params = {
|
||||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/endpoints'
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
||||
def serverinfo(self):
|
||||
|
||||
params = {
|
||||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/server-info'
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
||||
def stats(self):
|
||||
|
||||
params = {
|
||||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/stats'
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
@ -171,9 +325,39 @@ class MisskeyAPI:
|
|||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/notes/create'
|
||||
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
||||
def notifications_create(self, i=None, body=None, header=None, icon=None):
|
||||
|
||||
params = {
|
||||
'i': i,
|
||||
'body': body,
|
||||
'header': header,
|
||||
'icon': icon
|
||||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/notifications/create'
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
||||
def notifications_read(self, i=None, notificationIds=[]):
|
||||
|
||||
params = {
|
||||
'i': i,
|
||||
'notificationIds': notificationIds
|
||||
}
|
||||
|
||||
endpoint = self.api_base_url + '/api/notifications/read'
|
||||
|
||||
response = self.__api_request(endpoint, params)
|
||||
|
||||
return response
|
||||
|
||||
def users_groups_create(self, i=None, name=None):
|
||||
|
||||
params = {
|
||||
|
@ -233,6 +417,10 @@ class MisskeyAPI:
|
|||
# this is for compatibility with older versions
|
||||
# which raised MisskeyAPIError('Endpoint not found.')
|
||||
# on any 404
|
||||
elif response.status_code == 400:
|
||||
ex_type = MisskeyBadRequestError
|
||||
if not error_msg:
|
||||
error_msg = response.json()['error']['info']
|
||||
elif response.status_code == 401:
|
||||
ex_type = MisskeyUnauthorizedError
|
||||
elif response.status_code == 500:
|
||||
|
@ -265,6 +453,9 @@ class MisskeyAPI:
|
|||
class WrapperError(Exception):
|
||||
"""Wrapper base class"""
|
||||
|
||||
class MisskeyBadRequestError(Exception):
|
||||
"""Bad Request class"""
|
||||
|
||||
class MisskeyAPIConfigError(Exception):
|
||||
"""This class exception"""
|
||||
|
||||
|
|
Loading…
Referencia en una nova incidència