Trust lists
This commit is contained in:
parent
ddec254a99
commit
d136f37b5f
9 changed files with 332 additions and 9 deletions
3
src/trustcafeapiwrapper/jobs/trust/__init__.py
Normal file
3
src/trustcafeapiwrapper/jobs/trust/__init__.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from .createorupdate import createorupdate
|
||||
from .listbyusersinit import listbyuserinit
|
||||
from .listbyuserhas import listbyuserhas
|
||||
12
src/trustcafeapiwrapper/jobs/trust/createorupdate.py
Normal file
12
src/trustcafeapiwrapper/jobs/trust/createorupdate.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
def createorupdate(API, payload: dict) -> dict:
|
||||
"""
|
||||
Creates or updates a trust relationship in the API.
|
||||
|
||||
Args:
|
||||
payload (dict): The data for the trust relationship.
|
||||
|
||||
Returns:
|
||||
dict: The trust relationship data.
|
||||
"""
|
||||
trust_data = API.make_request("POST", "content", "reltrust", data=payload, authenticate=True)
|
||||
return trust_data
|
||||
10
src/trustcafeapiwrapper/jobs/trust/listbyuserhas.py
Normal file
10
src/trustcafeapiwrapper/jobs/trust/listbyuserhas.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
def listbyuserhas(API, userId, lastEvaluatedKey=None) -> dict:
|
||||
"""
|
||||
Fetches a list of users who have trusted a specific user from the API by name.
|
||||
|
||||
Returns:
|
||||
dict: The list of users who have trusted the user.
|
||||
|
||||
"""
|
||||
trusted_users_list = API.make_request("GET", "content", f"reltrust/userhas/{userId}", authenticate=True, query_params=lastEvaluatedKey)
|
||||
return trusted_users_list
|
||||
9
src/trustcafeapiwrapper/jobs/trust/listbyusersinit.py
Normal file
9
src/trustcafeapiwrapper/jobs/trust/listbyusersinit.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
def listbyuserinit(API, userId, lastEvaluatedKey=None) -> dict:
|
||||
"""
|
||||
Fetches a list of a user's trusted users from the API by name.
|
||||
|
||||
Returns:
|
||||
dict: The list of trusted users for the user.
|
||||
"""
|
||||
trusted_users_list = API.make_request("GET", "content", f"reltrust/userinit/{userId}", authenticate=True, query_params=lastEvaluatedKey)
|
||||
return trusted_users_list
|
||||
|
|
@ -1 +1 @@
|
|||
from .votecast import votecast
|
||||
from .votecast import votecawst
|
||||
Loading…
Add table
Add a link
Reference in a new issue