118 lines
5.3 KiB
Python
118 lines
5.3 KiB
Python
from ProjectCfg import DOMAIN
|
|
from CallServer import _make_request
|
|
|
|
###==========================贴纸==========================
|
|
|
|
def GetStickerPackageList(Authorization: str,offset:int=0,take:int=20,pub:str='',order:str='',query:str="") -> dict:
|
|
"""获取贴纸包列表"""
|
|
url = f"{DOMAIN}/stickers"
|
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
|
params = {"offset":offset,"take":take,"pub":pub,"order":order,"query":query}
|
|
return _make_request('GET', url, headers,params=params)
|
|
|
|
def CreateStickerPackage(Authorization: str,pub:str,name:str,description:str,prefix:str) -> dict:
|
|
"""创建贴纸包"""
|
|
url = f"{DOMAIN}/stickers"
|
|
RequestsBody={
|
|
"name":name,
|
|
"description": description,
|
|
"prefix": prefix
|
|
}
|
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
|
return _make_request('POST', url, headers,request_body=RequestsBody,params={"pub":pub},normal_codes=[201])
|
|
|
|
def GetMyStickerList(Authorization: str) -> dict:
|
|
"""获取我的贴纸列表"""
|
|
url = f"{DOMAIN}/stickers/me"
|
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
|
return _make_request('GET', url, headers)
|
|
|
|
def GetAStickerPackageInfo(Authorization: str,sticker_id:str) -> dict:
|
|
"""获取贴纸包信息"""
|
|
url = f"{DOMAIN}/stickers/{sticker_id}"
|
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
|
return _make_request('GET', url, headers)
|
|
|
|
def ModifyStickerPackage(Authorization: str,sticker_id:str,name:str,description:str,prefix:str) -> dict:
|
|
"""修改贴纸包"""
|
|
url = f"{DOMAIN}/stickers/{sticker_id}"
|
|
RequestsBody={
|
|
"name":name,
|
|
"description": description,
|
|
"prefix": prefix
|
|
}
|
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
|
return _make_request('PATCH', url, headers,request_body=RequestsBody,normal_codes=[201])
|
|
|
|
def DeleteStickerPackage(Authorization: str,sticker_id:str) -> dict:
|
|
"""删除贴纸包"""
|
|
url = f"{DOMAIN}/stickers/{sticker_id}"
|
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
|
return _make_request('DELETE', url, headers,normal_codes=[204])
|
|
|
|
def GetStickerPackageContent(Authorization: str,sticker_id:str) -> dict:
|
|
"""获取贴纸包内容"""
|
|
url = f"{DOMAIN}/stickers/{sticker_id}/content"
|
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
|
return _make_request('GET', url, headers)
|
|
|
|
def ModifyStickerPackageContent(Authorization: str,sticker_id:str,slug:str,image_id:str) -> dict:
|
|
"""修改贴纸包内容"""
|
|
url = f"{DOMAIN}/stickers/{sticker_id}/content"
|
|
RequestsBody={
|
|
"slug":slug,
|
|
"image_id": image_id
|
|
}
|
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
|
return _make_request('POST', url, headers,request_body=RequestsBody,normal_codes=[201])
|
|
def GetStickerInfo(Authorization: str,sticker_id:str) -> dict:
|
|
"""获取贴纸信息"""
|
|
url = f"{DOMAIN}/stickers/lookup/{sticker_id}"
|
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
|
return _make_request('GET', url, headers)
|
|
|
|
def GetStickerImg(Authorization: str,sticker_id:str) -> dict:
|
|
"""获取贴纸图片"""
|
|
url = f"{DOMAIN}/stickers/lookup/{sticker_id}/open"
|
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
|
return _make_request('GET', url, headers)
|
|
|
|
def GetPackageStickerInfo(Authorization: str,packid:str,id:str) -> dict:
|
|
"""获取贴纸包信息"""
|
|
url = f"{DOMAIN}/stickers/{packid}/content/{id}"
|
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
|
return _make_request('GET', url, headers)
|
|
|
|
def CreateStickerImageInPackage(Authorization: str,packid:str,slug:str,image_id:str) -> dict:
|
|
"""创建贴纸包图片"""
|
|
url = f"{DOMAIN}/stickers/{packid}/content"
|
|
RequestsBody={
|
|
"slug":slug,
|
|
"image_id": image_id
|
|
}
|
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
|
return _make_request('PATCH', url, headers,request_body=RequestsBody,normal_codes=[201])
|
|
|
|
def DeleteStickerImageInPackage(Authorization: str,packid:str,id:str) -> dict:
|
|
"""删除贴纸包图片"""
|
|
url = f"{DOMAIN}/stickers/{packid}/content/{id}"
|
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
|
return _make_request('DELETE', url, headers,normal_codes=[204])
|
|
|
|
def GetSelfHadStickerPackageInfo(Authorization: str,packid:str) -> dict:
|
|
"""获取自己已拥有的贴纸包信息"""
|
|
url = f"{DOMAIN}/stickers/{packid}/own"
|
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
|
return _make_request('GET', url, headers)
|
|
|
|
def AddStickerPackage(Authorization: str,packid:str) -> dict:
|
|
"""添加贴纸包"""
|
|
url = f"{DOMAIN}/stickers/{packid}/own"
|
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
|
return _make_request('POST', url, headers,normal_codes=[201])
|
|
|
|
def RemoveStickerPackage(Authorization: str,packid:str) -> dict:
|
|
"""移除贴纸包"""
|
|
url = f"{DOMAIN}/stickers/{packid}/own"
|
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
|
return _make_request('DELETE', url, headers,normal_codes=[204]) |