Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 26 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This library contains the generated API client and the SSO utilities to make wor
For the API client, there are three API modules, `api_default`, `api_public`, and `api_moderation`. The `api_default` contains methods that require your API key, and `api_public` contains api calls
that can be made directly from a browser/mobile device/etc without authentication. The `api_moderation` module contains methods for the moderator dashboard.

The `api_moderation` methods cover listing, counting, searching, and exporting comments and their logs; moderation actions like removing/restoring comments, flagging, setting review/spam/approval status, adjusting votes, and reopening/closing threads; bans (banning a user from a comment, undoing a ban, pre-ban summaries, ban status and preferences, and banned-user counts); and badges & trust (awarding/removing a badge, listing manual badges, getting/setting a user's trust factor, and fetching a user's internal profile). Every `api_moderation` method accepts an `sso` parameter so the call is authenticated as an SSO moderator.
The `api_moderation` module provides an extensive suite of live and fast moderation APIs. Every `api_moderation` method accepts an `sso` parameter and can authenticate via SSO or a FastComments.com session cookie.

## Quick Start

Expand All @@ -48,24 +48,16 @@ import fastcomments/models/model_comment_data
let client = newHttpClient()
client.headers["x-api-key"] = "your-api-key"

# Make authenticated API calls
# Make authenticated API calls.
# Required parameters (and the request body) are positional; optional
# parameters are passed via the operation's options object.
let (response, httpResponse) = getComments(
httpClient = client,
tenantId = "your-tenant-id",
page = 0,
limit = 0,
skip = 0,
asTree = false,
skipChildren = 0,
limitChildren = 0,
maxTreeDepth = 0,
urlId = "your-url-id",
userId = "",
anonUserId = "",
contextUserId = "",
hashTag = "",
parentId = "",
direction = SortDirections.DESC
options = GetCommentsOptions(
urlId: "your-url-id",
direction: SortDirections.DESC
)
)

if response.isSome:
Expand All @@ -85,37 +77,15 @@ import fastcomments/apis/api_public

let client = newHttpClient()

# Make public API calls
# Make public API calls.
# tenantId and urlId are required (positional); everything else is optional.
let (response, httpResponse) = getCommentsPublic(
httpClient = client,
tenantId = "your-tenant-id",
urlId = "your-url-id",
page = 0,
direction = SortDirections.DESC,
sso = "",
skip = 0,
skipChildren = 0,
limit = 0,
limitChildren = 0,
countChildren = false,
fetchPageForCommentId = "",
includeConfig = false,
countAll = false,
includei10n = false,
locale = "",
modules = "",
isCrawler = false,
includeNotificationCount = false,
asTree = false,
maxTreeDepth = 0,
useFullTranslationIds = false,
parentId = "",
searchText = "",
hashTags = @[],
userId = "",
customConfigStr = "",
afterCommentId = "",
beforeCommentId = ""
options = GetCommentsPublicOptions(
direction: SortDirections.DESC
)
)

if response.isSome:
Expand All @@ -135,18 +105,15 @@ import fastcomments/apis/api_moderation

let client = newHttpClient()

# List comments in the moderation dashboard
# List comments in the moderation dashboard.
# This operation has no required parameters, so everything is optional.
let (response, httpResponse) = getApiComments(
httpClient = client,
page = 0,
count = 30,
textSearch = "",
byIPFromComment = "",
filters = "",
searchFilters = "",
sorts = "",
demo = false,
sso = "your-sso-token"
options = GetApiCommentsOptions(
count: 30,
tenantId: "your-tenant-id",
sso: "your-sso-token"
)
)

if response.isSome:
Expand All @@ -163,6 +130,8 @@ if response.isSome:

All API methods in this SDK return tuples of `(Option[ResponseType], Response)`. The first element contains the parsed response if successful, and the second element is the raw HTTP response.

Required parameters and the request body are passed positionally. The remaining optional parameters are collected into a single `Api<Operation>Options` object, which is the last argument. Operations with no optional parameters take no options object.

### Example: Fetching Comments

```nim
Expand All @@ -177,20 +146,10 @@ client.headers["x-api-key"] = "your-api-key"
let (response, httpResponse) = getComments(
httpClient = client,
tenantId = "your-tenant-id",
page = 0,
limit = 0,
skip = 0,
asTree = false,
skipChildren = 0,
limitChildren = 0,
maxTreeDepth = 0,
urlId = "your-url-id",
userId = "",
anonUserId = "",
contextUserId = "",
hashTag = "",
parentId = "",
direction = SortDirections.DESC
options = GetCommentsOptions(
urlId: "your-url-id",
direction: SortDirections.DESC
)
)

if httpResponse.code == Http200:
Expand Down
88 changes: 44 additions & 44 deletions client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ No description provided (generated by Openapi Generator https://github.com/opena
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client.

- API version: 0.0.0
- Package version: 1.1.1
- Package version: 3.0.0
- Generator version: 7.23.0-SNAPSHOT
- Build package: org.openapitools.codegen.languages.NimClientCodegen

Expand Down Expand Up @@ -139,49 +139,49 @@ api_default | updateTenant | **PATCH** /api/v1/tenants/{id} |
api_default | updateTenantPackage | **PATCH** /api/v1/tenant-packages/{id} |
api_default | updateTenantUser | **PATCH** /api/v1/tenant-users/{id} |
api_default | updateUserBadge | **PUT** /api/v1/user-badges/{id} |
api_moderation | deleteModerationVote | **DELETE** /auth/my-account/moderate-comments/vote/{commentId}/{voteId} |
api_moderation | getApiComments | **GET** /auth/my-account/moderate-comments/api/comments |
api_moderation | getApiExportStatus | **GET** /auth/my-account/moderate-comments/api/export/status |
api_moderation | getApiIds | **GET** /auth/my-account/moderate-comments/api/ids |
api_moderation | getBanUsersFromComment | **GET** /auth/my-account/moderate-comments/ban-users/from-comment/{commentId} |
api_moderation | getCommentBanStatus | **GET** /auth/my-account/moderate-comments/get-comment-ban-status/{commentId} |
api_moderation | getCommentChildren | **GET** /auth/my-account/moderate-comments/comment-children/{commentId} |
api_moderation | getCount | **GET** /auth/my-account/moderate-comments/count |
api_moderation | getCounts | **GET** /auth/my-account/moderate-comments/banned-users/counts |
api_moderation | getLogs | **GET** /auth/my-account/moderate-comments/logs/{commentId} |
api_moderation | getManualBadges | **GET** /auth/my-account/moderate-comments/get-manual-badges |
api_moderation | getManualBadgesForUser | **GET** /auth/my-account/moderate-comments/get-manual-badges-for-user |
api_moderation | getModerationComment | **GET** /auth/my-account/moderate-comments/comment/{commentId} |
api_moderation | getModerationCommentText | **GET** /auth/my-account/moderate-comments/get-comment-text/{commentId} |
api_moderation | getPreBanSummary | **GET** /auth/my-account/moderate-comments/pre-ban-summary/{commentId} |
api_moderation | getSearchCommentsSummary | **GET** /auth/my-account/moderate-comments/search/comments/summary |
api_moderation | getSearchPages | **GET** /auth/my-account/moderate-comments/search/pages |
api_moderation | getSearchSites | **GET** /auth/my-account/moderate-comments/search/sites |
api_moderation | getSearchSuggest | **GET** /auth/my-account/moderate-comments/search/suggest |
api_moderation | getSearchUsers | **GET** /auth/my-account/moderate-comments/search/users |
api_moderation | getTrustFactor | **GET** /auth/my-account/moderate-comments/get-trust-factor |
api_moderation | getUserBanPreference | **GET** /auth/my-account/moderate-comments/user-ban-preference |
api_moderation | getUserInternalProfile | **GET** /auth/my-account/moderate-comments/get-user-internal-profile |
api_moderation | postAdjustCommentVotes | **POST** /auth/my-account/moderate-comments/adjust-comment-votes/{commentId} |
api_moderation | postApiExport | **POST** /auth/my-account/moderate-comments/api/export |
api_moderation | postBanUserFromComment | **POST** /auth/my-account/moderate-comments/ban-user/from-comment/{commentId} |
api_moderation | postBanUserUndo | **POST** /auth/my-account/moderate-comments/ban-user/undo |
api_moderation | postBulkPreBanSummary | **POST** /auth/my-account/moderate-comments/bulk-pre-ban-summary |
api_moderation | postCommentsByIds | **POST** /auth/my-account/moderate-comments/comments-by-ids |
api_moderation | postFlagComment | **POST** /auth/my-account/moderate-comments/flag-comment/{commentId} |
api_moderation | postRemoveComment | **POST** /auth/my-account/moderate-comments/remove-comment/{commentId} |
api_moderation | postRestoreDeletedComment | **POST** /auth/my-account/moderate-comments/restore-deleted-comment/{commentId} |
api_moderation | postSetCommentApprovalStatus | **POST** /auth/my-account/moderate-comments/set-comment-approval-status/{commentId} |
api_moderation | postSetCommentReviewStatus | **POST** /auth/my-account/moderate-comments/set-comment-review-status/{commentId} |
api_moderation | postSetCommentSpamStatus | **POST** /auth/my-account/moderate-comments/set-comment-spam-status/{commentId} |
api_moderation | postSetCommentText | **POST** /auth/my-account/moderate-comments/set-comment-text/{commentId} |
api_moderation | postUnFlagComment | **POST** /auth/my-account/moderate-comments/un-flag-comment/{commentId} |
api_moderation | postVote | **POST** /auth/my-account/moderate-comments/vote/{commentId} |
api_moderation | putAwardBadge | **PUT** /auth/my-account/moderate-comments/award-badge |
api_moderation | putCloseThread | **PUT** /auth/my-account/moderate-comments/close-thread |
api_moderation | putRemoveBadge | **PUT** /auth/my-account/moderate-comments/remove-badge |
api_moderation | putReopenThread | **PUT** /auth/my-account/moderate-comments/reopen-thread |
api_moderation | setTrustFactor | **PUT** /auth/my-account/moderate-comments/set-trust-factor |
api_moderation | deleteModerationVote | **DELETE** /auth/my-account/moderate-comments/mod_api/vote/{commentId}/{voteId} |
api_moderation | getApiComments | **GET** /auth/my-account/moderate-comments/mod_api/api/comments |
api_moderation | getApiExportStatus | **GET** /auth/my-account/moderate-comments/mod_api/api/export/status |
api_moderation | getApiIds | **GET** /auth/my-account/moderate-comments/mod_api/api/ids |
api_moderation | getBanUsersFromComment | **GET** /auth/my-account/moderate-comments/mod_api/ban-users/from-comment/{commentId} |
api_moderation | getCommentBanStatus | **GET** /auth/my-account/moderate-comments/mod_api/get-comment-ban-status/{commentId} |
api_moderation | getCommentChildren | **GET** /auth/my-account/moderate-comments/mod_api/comment-children/{commentId} |
api_moderation | getCount | **GET** /auth/my-account/moderate-comments/mod_api/count |
api_moderation | getCounts | **GET** /auth/my-account/moderate-comments/banned-users/mod_api/counts |
api_moderation | getLogs | **GET** /auth/my-account/moderate-comments/mod_api/logs/{commentId} |
api_moderation | getManualBadges | **GET** /auth/my-account/moderate-comments/mod_api/get-manual-badges |
api_moderation | getManualBadgesForUser | **GET** /auth/my-account/moderate-comments/mod_api/get-manual-badges-for-user |
api_moderation | getModerationComment | **GET** /auth/my-account/moderate-comments/mod_api/comment/{commentId} |
api_moderation | getModerationCommentText | **GET** /auth/my-account/moderate-comments/mod_api/get-comment-text/{commentId} |
api_moderation | getPreBanSummary | **GET** /auth/my-account/moderate-comments/mod_api/pre-ban-summary/{commentId} |
api_moderation | getSearchCommentsSummary | **GET** /auth/my-account/moderate-comments/mod_api/search/comments/summary |
api_moderation | getSearchPages | **GET** /auth/my-account/moderate-comments/mod_api/search/pages |
api_moderation | getSearchSites | **GET** /auth/my-account/moderate-comments/mod_api/search/sites |
api_moderation | getSearchSuggest | **GET** /auth/my-account/moderate-comments/mod_api/search/suggest |
api_moderation | getSearchUsers | **GET** /auth/my-account/moderate-comments/mod_api/search/users |
api_moderation | getTrustFactor | **GET** /auth/my-account/moderate-comments/mod_api/get-trust-factor |
api_moderation | getUserBanPreference | **GET** /auth/my-account/moderate-comments/mod_api/user-ban-preference |
api_moderation | getUserInternalProfile | **GET** /auth/my-account/moderate-comments/mod_api/get-user-internal-profile |
api_moderation | postAdjustCommentVotes | **POST** /auth/my-account/moderate-comments/mod_api/adjust-comment-votes/{commentId} |
api_moderation | postApiExport | **POST** /auth/my-account/moderate-comments/mod_api/api/export |
api_moderation | postBanUserFromComment | **POST** /auth/my-account/moderate-comments/mod_api/ban-user/from-comment/{commentId} |
api_moderation | postBanUserUndo | **POST** /auth/my-account/moderate-comments/mod_api/ban-user/undo |
api_moderation | postBulkPreBanSummary | **POST** /auth/my-account/moderate-comments/mod_api/bulk-pre-ban-summary |
api_moderation | postCommentsByIds | **POST** /auth/my-account/moderate-comments/mod_api/comments-by-ids |
api_moderation | postFlagComment | **POST** /auth/my-account/moderate-comments/mod_api/flag-comment/{commentId} |
api_moderation | postRemoveComment | **POST** /auth/my-account/moderate-comments/mod_api/remove-comment/{commentId} |
api_moderation | postRestoreDeletedComment | **POST** /auth/my-account/moderate-comments/mod_api/restore-deleted-comment/{commentId} |
api_moderation | postSetCommentApprovalStatus | **POST** /auth/my-account/moderate-comments/mod_api/set-comment-approval-status/{commentId} |
api_moderation | postSetCommentReviewStatus | **POST** /auth/my-account/moderate-comments/mod_api/set-comment-review-status/{commentId} |
api_moderation | postSetCommentSpamStatus | **POST** /auth/my-account/moderate-comments/mod_api/set-comment-spam-status/{commentId} |
api_moderation | postSetCommentText | **POST** /auth/my-account/moderate-comments/mod_api/set-comment-text/{commentId} |
api_moderation | postUnFlagComment | **POST** /auth/my-account/moderate-comments/mod_api/un-flag-comment/{commentId} |
api_moderation | postVote | **POST** /auth/my-account/moderate-comments/mod_api/vote/{commentId} |
api_moderation | putAwardBadge | **PUT** /auth/my-account/moderate-comments/mod_api/award-badge |
api_moderation | putCloseThread | **PUT** /auth/my-account/moderate-comments/mod_api/close-thread |
api_moderation | putRemoveBadge | **PUT** /auth/my-account/moderate-comments/mod_api/remove-badge |
api_moderation | putReopenThread | **PUT** /auth/my-account/moderate-comments/mod_api/reopen-thread |
api_moderation | setTrustFactor | **PUT** /auth/my-account/moderate-comments/mod_api/set-trust-factor |
api_public | blockFromCommentPublic | **POST** /block-from-comment/{commentId} |
api_public | checkedCommentsForBlocked | **GET** /check-blocked-comments |
api_public | createCommentPublic | **POST** /comments/{tenantId} |
Expand Down
4 changes: 2 additions & 2 deletions client/fastcomments.nim
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ import fastcomments/models/model_patch_domain_config_response
import fastcomments/models/model_patch_page_api_response
import fastcomments/models/model_patch_sso_user_api_response
import fastcomments/models/model_pending_comment_to_sync_outbound
import fastcomments/models/model_post_remove_comment_response
import fastcomments/models/model_post_remove_comment_api_response
import fastcomments/models/model_pre_ban_summary
import fastcomments/models/model_pub_sub_comment
import fastcomments/models/model_pub_sub_comment_base
Expand Down Expand Up @@ -628,7 +628,7 @@ export model_patch_domain_config_response
export model_patch_page_api_response
export model_patch_sso_user_api_response
export model_pending_comment_to_sync_outbound
export model_post_remove_comment_response
export model_post_remove_comment_api_response
export model_pre_ban_summary
export model_pub_sub_comment
export model_pub_sub_comment_base
Expand Down
Loading
Loading