Skip to content

Commit f31d2f9

Browse files
authored
Regenerate SDK: Moderation API + grouped request parameters (#5)
* Regenerate SDK from latest OpenAPI spec (moderation tenantId + broadcastId params) Adds the optional tenantId query param to the SSO-gated Moderation API endpoints and the optional broadcastId query param to the mutating moderation endpoints. Backward-compatible. Mirrors fastcomments-sdk-js v5.0.2. * Regenerate against corrected spec (tsoa 6.6.8 splits X | APIError response unions) * Bump version to 2.0.1 (patch over the 2.0.0 Moderation API release) * Regenerate with grouped request objects; update.sh uses fork generator API methods now take a single Api<Op>Request pydantic object (useSingleRequestParameter). update.sh now uses the FastComments openapi-generator fork, since the stock generator ignores the option for python. Updated SSO tests and README examples. * Regenerate docs with grouped request-object examples API reference examples now construct the single Api<Op>Request object, matching the grouped method signatures. * Regenerate: required params + body positional, optionals in one object API methods now take required params + body positionally, with optional params in a single Api<Op>Options object (was: one Api<Op>Request for everything). Updated SSO tests + README. * Regenerate: single optional is a direct param (no options object for one value) Operations with exactly one optional now take it directly (e.g. deleteModerator(..., send_email)); the Api<Op>Options object is only used for 2+ optionals. * Regenerate: mod_api/ paths + PostRemoveCommentApiResponse rename; drop Api prefix from options types Options types renamed Api<Op>Options -> <Op>Options (e.g. ApiGetApiCommentsOptions -> GetApiCommentsOptions). Hand-written READMEs + SSO tests updated to match. * README: shorten ModerationApi description; regenerate docs (fix invalid options= synopsis) Doc-only. Method synopses now show a valid 'options' arg instead of 'options='. * Release v3.0.0: regenerate at 3.0.0 with fastcomments-build-20260630 jar Bump version to 3.0.0 and regenerate from the new generator fork release.
1 parent b7e1010 commit f31d2f9

373 files changed

Lines changed: 7222 additions & 6950 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,6 @@ Thumbs.db
158158
# Logs
159159
logs/
160160
*.log
161+
162+
# Local fork generator jar (downloaded on demand by update.sh)
163+
openapi-generator-cli.jar

README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This library contains two modules: the generated API client and the core Python
1818

1919
### Public vs Secured APIs
2020

21-
For the API client, there are three classes, `DefaultApi`, `PublicApi`, and `ModerationApi`. The `DefaultApi` contains methods that require your API key, and `PublicApi` contains methods that can be made directly from a browser/mobile device/etc without authentication. The `ModerationApi` powers the moderator dashboard and contains methods for moderating comments (list, count, search, logs, export), moderation actions (remove/restore, flag, set review/spam/approval status, votes, reopen/close thread), bans (ban from comment, undo, pre-ban summaries, ban status/preferences, banned-user counts), and badges & trust (award/remove badge, manual badges, get/set trust factor, user internal profile). Every `ModerationApi` method accepts an `sso` parameter so it can be called on behalf of an SSO-authenticated moderator.
21+
For the API client, there are three classes, `DefaultApi`, `PublicApi`, and `ModerationApi`. The `DefaultApi` contains methods that require your API key, and `PublicApi` contains methods that can be made directly from a browser/mobile device/etc without authentication. The `ModerationApi` provides an extensive suite of live and fast moderation APIs. Every `ModerationApi` method accepts an `sso` parameter and can authenticate via SSO or a FastComments.com session cookie.
2222

2323
## Quick Start
2424

@@ -50,10 +50,7 @@ try:
5050
display_name="John Doe"
5151
)
5252

53-
response = api.add_sso_user(
54-
tenant_id="YOUR_TENANT_ID",
55-
create_apisso_user_data=user_data
56-
)
53+
response = api.add_sso_user("YOUR_TENANT_ID", user_data)
5754
print(f"User created: {response}")
5855

5956
except Exception as e:
@@ -77,10 +74,7 @@ api_client = ApiClient(configuration=config)
7774
public_api = PublicApi(api_client)
7875

7976
try:
80-
response = public_api.get_comments_public(
81-
tenant_id="YOUR_TENANT_ID",
82-
url_id="page-url-id"
83-
)
77+
response = public_api.get_comments_public("YOUR_TENANT_ID", "page-url-id")
8478
print(response)
8579
except Exception as e:
8680
print(f"Error: {e}")
@@ -92,6 +86,7 @@ The `ModerationApi` powers the moderator dashboard. Methods are called on behalf
9286

9387
```python
9488
from client import ApiClient, Configuration, ModerationApi
89+
from client.api.moderation_api import GetCountOptions
9590

9691
config = Configuration()
9792
config.host = "https://fastcomments.com/api"
@@ -101,7 +96,7 @@ moderation_api = ModerationApi(api_client)
10196

10297
try:
10398
# Count the comments awaiting moderation
104-
response = moderation_api.get_count(sso="SSO_TOKEN")
99+
response = moderation_api.get_count(GetCountOptions(sso="SSO_TOKEN"))
105100
print(response)
106101
except Exception as e:
107102
print(f"Error: {e}")

client/.github/workflows/python.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ name: client Python package
77

88
on: [push, pull_request]
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
build:
1215

1316
runs-on: ubuntu-latest
1417
strategy:
1518
matrix:
16-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
19+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
1720

1821
steps:
1922
- uses: actions/checkout@v4
@@ -28,4 +31,4 @@ jobs:
2831
pip install -r test-requirements.txt
2932
- name: Test with pytest
3033
run: |
31-
pytest --cov={{packageName}}
34+
pytest --cov=client

client/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ docs/_build/
6262
# PyBuilder
6363
target/
6464

65-
#Ipython Notebook
65+
# Ipython Notebook
6666
.ipynb_checkpoints

client/.gitlab-ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ stages:
1414
- pip install -r test-requirements.txt
1515
- pytest --cov=client
1616

17-
pytest-3.8:
18-
extends: .pytest
19-
image: python:3.8-alpine
20-
pytest-3.9:
21-
extends: .pytest
22-
image: python:3.9-alpine
2317
pytest-3.10:
2418
extends: .pytest
2519
image: python:3.10-alpine
@@ -29,3 +23,9 @@ pytest-3.11:
2923
pytest-3.12:
3024
extends: .pytest
3125
image: python:3.12-alpine
26+
pytest-3.13:
27+
extends: .pytest
28+
image: python:3.13-alpine
29+
pytest-3.14:
30+
extends: .pytest
31+
image: python:3.14-alpine

client/.openapi-generator/FILES

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ client/models/patch_domain_config_response.py
273273
client/models/patch_page_api_response.py
274274
client/models/patch_sso_user_api_response.py
275275
client/models/pending_comment_to_sync_outbound.py
276-
client/models/post_remove_comment_response.py
276+
client/models/post_remove_comment_api_response.py
277277
client/models/pre_ban_summary.py
278278
client/models/pub_sub_comment.py
279279
client/models/pub_sub_comment_base.py
@@ -372,7 +372,6 @@ client/models/users_list_location.py
372372
client/models/vote_body_params.py
373373
client/models/vote_delete_response.py
374374
client/models/vote_response.py
375-
client/models/vote_response_status.py
376375
client/models/vote_response_user.py
377376
client/models/vote_style.py
378377
client/py.typed
@@ -638,7 +637,7 @@ docs/PatchDomainConfigResponse.md
638637
docs/PatchPageAPIResponse.md
639638
docs/PatchSSOUserAPIResponse.md
640639
docs/PendingCommentToSyncOutbound.md
641-
docs/PostRemoveCommentResponse.md
640+
docs/PostRemoveCommentApiResponse.md
642641
docs/PreBanSummary.md
643642
docs/PubSubComment.md
644643
docs/PubSubCommentBase.md
@@ -738,7 +737,6 @@ docs/UsersListLocation.md
738737
docs/VoteBodyParams.md
739738
docs/VoteDeleteResponse.md
740739
docs/VoteResponse.md
741-
docs/VoteResponseStatus.md
742740
docs/VoteResponseUser.md
743741
docs/VoteStyle.md
744742
git_push.sh
@@ -1009,7 +1007,7 @@ test/test_patch_domain_config_response.py
10091007
test/test_patch_page_api_response.py
10101008
test/test_patch_sso_user_api_response.py
10111009
test/test_pending_comment_to_sync_outbound.py
1012-
test/test_post_remove_comment_response.py
1010+
test/test_post_remove_comment_api_response.py
10131011
test/test_pre_ban_summary.py
10141012
test/test_pub_sub_comment.py
10151013
test/test_pub_sub_comment_base.py
@@ -1109,7 +1107,6 @@ test/test_users_list_location.py
11091107
test/test_vote_body_params.py
11101108
test/test_vote_delete_response.py
11111109
test/test_vote_response.py
1112-
test/test_vote_response_status.py
11131110
test/test_vote_response_user.py
11141111
test/test_vote_style.py
11151112
tox.ini

client/.openapi-generator/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.11.0
1+
7.23.0-SNAPSHOT

client/.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# ref: https://docs.travis-ci.com/user/languages/python
22
language: python
33
python:
4-
- "3.8"
5-
- "3.9"
64
- "3.10"
75
- "3.11"
86
- "3.12"
7+
- "3.13"
8+
- "3.14"
99
# uncomment the following if needed
10-
#- "3.12-dev" # 3.12 development branch
10+
#- "3.14-dev" # 3.14 development branch
1111
#- "nightly" # nightly build
1212
# command to install dependencies
1313
install:

0 commit comments

Comments
 (0)