From 636564b873bbd07899a47124f601ad71b77af4ee Mon Sep 17 00:00:00 2001 From: simonwt Date: Wed, 1 Apr 2026 23:32:09 +0100 Subject: [PATCH] Branch lists --- jobs/branch/__init__.py | 1 + jobs/branch/listbyname.py | 9 +++++++++ testing.py | 17 ++++++++++++++--- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 jobs/branch/listbyname.py diff --git a/jobs/branch/__init__.py b/jobs/branch/__init__.py index 766c40d..80470db 100644 --- a/jobs/branch/__init__.py +++ b/jobs/branch/__init__.py @@ -1 +1,2 @@ from .get import get +from .listbyname import listbyname \ No newline at end of file diff --git a/jobs/branch/listbyname.py b/jobs/branch/listbyname.py new file mode 100644 index 0000000..53117b1 --- /dev/null +++ b/jobs/branch/listbyname.py @@ -0,0 +1,9 @@ +def listbyname(API, lastEvaluatedKey=None) -> dict: + """ + Fetches a list of branchs from the API by name. + + Returns: + dict: The list of comments for the post. + """ + branch_list = API.make_request("GET", "content", f"subwiki", authenticate=True, query_params=lastEvaluatedKey) + return branch_list \ No newline at end of file diff --git a/testing.py b/testing.py index 21ff97a..117db5f 100644 --- a/testing.py +++ b/testing.py @@ -58,6 +58,17 @@ def save_response(response): # print("-----------------------------") # feed = API.run_job('post.listbybranch', "music") # print(feed) +# print("----------------------------z +# branchlist = API.run_job('branch.listbyname') +# print(branchlist) +# print("-----------------------------") +# branchlist = API.run_job('branch.listbyname', { +# 'GSIByName': 'boopscope test', +# 'sk': 'subwiki#boopscope-test', +# 'pk': 'subwiki#boopscope-test', +# 'entity': 'subwiki' +# }) +# print(branchlist) # print("-----------------------------") # feed = API.run_job('post.listbyuserprofile', "simon-little") # print(feed) @@ -145,6 +156,6 @@ from wrappers.post.create_post import create_post # ) # save_response(API.run_job(**wrapped)) -save_response(API.wrapped(create_post( - "This is a test post created via the create_post wrapper function.", -))) \ No newline at end of file +# save_response(API.wrapped(create_post( +# "This is a test post created via the create_post wrapper function.", +# ))) \ No newline at end of file