FastComments.com

FastComments C++ SDK

This is the official C++ SDK for FastComments.

Official C++ SDK for the FastComments API

Repository

View on GitHub

Requirements Internal Link

  • C++17 or later
  • CMake 3.14 or later
  • OpenSSL
  • C++ REST SDK (cpprestsdk)
  • Boost
  • Google Test (automatically downloaded for testing)

Installation Internal Link

Install Dependencies

sudo apt install libcpprest-dev libboost-all-dev

Building from Source

mkdir build
cd build
cmake ..
make

Installing

sudo make install

Library Contents

This library contains the generated API client and the SSO utilities to make working with the API easier.

Public vs Secured APIs

For the API client, there are two classes, DefaultAPI and PublicAPI. The DefaultAPI contains methods that require your API key, and PublicAPI contains api calls that can be made directly from a browser/mobile device/etc without authentication.

Notes Internal Link

Broadcast Ids

You'll see you're supposed to pass a broadcastId in some API calls. When you receive events, you'll get this ID back, so you know to ignore the event if you plan to optimistically apply changes on the client (which you'll probably want to do since it offers the best experience). Pass a UUID here. The ID should be unique enough to not occur twice in a browser session.

SSO (Single Sign-On)

For SSO examples, see below.

SSO Usage Internal Link

Simple SSO

#include <fastcomments/sso/fastcomments_sso.hpp>
#include <iostream>

using namespace fastcomments::sso;

int main() {
    SimpleSSOUserData user("user-123", "user@example.com", "https://example.com/avatar.jpg");
    FastCommentsSSO sso = FastCommentsSSO::newSimple(user);
    std::string token = sso.createToken();

    std::cout << "SSO Token: " << token << std::endl;
    return 0;
}

Secure SSO

#include <fastcomments/sso/fastcomments_sso.hpp>
#include <iostream>

using namespace fastcomments::sso;

int main() {
    SecureSSOUserData user("user-123", "user@example.com", "johndoe", "https://example.com/avatar.jpg");

    std::string apiKey = "your-api-key";
    FastCommentsSSO sso = FastCommentsSSO::newSecure(apiKey, user);
    std::string token = sso.createToken();

    std::cout << "Secure SSO Token: " << token << std::endl;
    return 0;
}

Testing Internal Link

Set the required environment variables:

export FASTCOMMENTS_API_KEY="your-api-key"
export FASTCOMMENTS_TENANT_ID="your-tenant-id"

Run the tests:

cd build
ctest

Development Internal Link

To update the generated client from the OpenAPI spec:

./update.sh

aggregate Internal Link

Aggregates documents by grouping them (if groupBy is provided) and applying multiple operations. Different operations (e.g. sum, countDistinct, avg, etc.) are supported.

Parameters

Name Type Location Required Description
tenantId string query Yes
parentTenantId string query No
includeStats boolean query No

Response

Returns: AggregationResponse

getAuditLogs Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
limit number query No
skip number query No
order string query No
after number query No
before number query No

Response

Returns: GetAuditLogs_200_response

blockFromCommentPublic Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
commentId string path Yes
sso string query No

Response

Returns: BlockFromCommentPublic_200_response

unBlockCommentPublic Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
commentId string path Yes
sso string query No

Response

Returns: UnBlockCommentPublic_200_response

checkedCommentsForBlocked Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
commentIds string query Yes A comma separated list of comment ids.
sso string query No

Response

Returns: CheckedCommentsForBlocked_200_response

blockUserFromComment Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes
userId string query No
anonUserId string query No

Response

Returns: BlockFromCommentPublic_200_response

createCommentPublic Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
urlId string query Yes
broadcastId string query Yes
sessionId string query No
sso string query No

Response

Returns: CreateCommentPublic_200_response

deleteComment Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes
contextUserId string query No
isLive boolean query No

Response

Returns: DeleteComment_200_response

deleteCommentPublic Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
commentId string path Yes
broadcastId string query Yes
editKey string query No
sso string query No

Response

Returns: DeleteCommentPublic_200_response

deleteCommentVote Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
commentId string path Yes
voteId string path Yes
urlId string query Yes
broadcastId string query Yes
editKey string query No
sso string query No

Response

Returns: DeleteCommentVote_200_response

flagComment Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes
userId string query No
anonUserId string query No

Response

Returns: FlagComment_200_response

getComment Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes

Response

Returns: GetComment_200_response

getComments Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
page integer query No
limit integer query No
skip integer query No
asTree boolean query No
skipChildren integer query No
limitChildren integer query No
maxTreeDepth integer query No
urlId string query No
userId string query No
anonUserId string query No
contextUserId string query No
hashTag string query No
parentId string query No
direction string query No

Response

Returns: GetComments_200_response

getCommentsPublic Internal Link

req tenantId urlId

Parameters

Name Type Location Required Description
tenantId string path Yes
urlId string query Yes
page integer query No
direction string query No
sso string query No
skip integer query No
skipChildren integer query No
limit integer query No
limitChildren integer query No
countChildren boolean query No
fetchPageForCommentId string query No
includeConfig boolean query No
countAll boolean query No
includei10n boolean query No
locale string query No
modules string query No
isCrawler boolean query No
includeNotificationCount boolean query No
asTree boolean query No
maxTreeDepth integer query No
useFullTranslationIds boolean query No
parentId string query No
searchText string query No
hashTags array query No
userId string query No
customConfigStr string query No
afterCommentId string query No
beforeCommentId string query No

Response

Returns: GetCommentsPublic_200_response

getCommentText Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
commentId string path Yes
editKey string query No
sso string query No

Response

Returns: GetCommentText_200_response

getCommentVoteUserNames Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
commentId string path Yes
dir integer query Yes
sso string query No

Response

Returns: GetCommentVoteUserNames_200_response

lockComment Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
commentId string path Yes
broadcastId string query Yes
sso string query No

Response

Returns: LockComment_200_response

pinComment Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
commentId string path Yes
broadcastId string query Yes
sso string query No

Response

Returns: PinComment_200_response

saveComment Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
isLive boolean query No
doSpamCheck boolean query No
sendEmails boolean query No
populateNotifications boolean query No

Response

Returns: SaveComment_200_response

saveCommentsBulk Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
isLive boolean query No
doSpamCheck boolean query No
sendEmails boolean query No
populateNotifications boolean query No

Response

Returns: List

setCommentText Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
commentId string path Yes
broadcastId string query Yes
editKey string query No
sso string query No

Response

Returns: SetCommentText_200_response

unBlockUserFromComment Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes
userId string query No
anonUserId string query No

Response

Returns: UnBlockCommentPublic_200_response

unFlagComment Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes
userId string query No
anonUserId string query No

Response

Returns: FlagComment_200_response

unLockComment Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
commentId string path Yes
broadcastId string query Yes
sso string query No

Response

Returns: LockComment_200_response

unPinComment Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
commentId string path Yes
broadcastId string query Yes
sso string query No

Response

Returns: PinComment_200_response

updateComment Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes
contextUserId string query No
doSpamCheck boolean query No
isLive boolean query No

Response

Returns: FlagCommentPublic_200_response

voteComment Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
commentId string path Yes
urlId string query Yes
broadcastId string query Yes
sessionId string query No
sso string query No

Response

Returns: VoteComment_200_response

addDomainConfig Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes

Response

Returns: AddDomainConfig_200_response

deleteDomainConfig Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
domain string path Yes

Response

Returns: DeleteDomainConfig_200_response

getDomainConfig Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
domain string path Yes

Response

Returns: GetDomainConfig_200_response

getDomainConfigs Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes

Response

Returns: GetDomainConfigs_200_response

patchDomainConfig Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
domainToUpdate string path Yes

Response

Returns: GetDomainConfig_200_response

putDomainConfig Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
domainToUpdate string path Yes

Response

Returns: GetDomainConfig_200_response

getEventLog Internal Link

req tenantId urlId userIdWS

Parameters

Name Type Location Required Description
tenantId string path Yes
urlId string query Yes
userIdWS string query Yes
startTime integer query Yes
endTime integer query Yes

Response

Returns: GetEventLog_200_response

getGlobalEventLog Internal Link

req tenantId urlId userIdWS

Parameters

Name Type Location Required Description
tenantId string path Yes
urlId string query Yes
userIdWS string query Yes
startTime integer query Yes
endTime integer query Yes

Response

Returns: GetEventLog_200_response

createFeedPost Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
broadcastId string query No
isLive boolean query No
doSpamCheck boolean query No
skipDupCheck boolean query No

Response

Returns: CreateFeedPost_200_response

createFeedPostPublic Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
broadcastId string query No
sso string query No

Response

Returns: CreateFeedPostPublic_200_response

deleteFeedPostPublic Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
postId string path Yes
broadcastId string query No
sso string query No

Response

Returns: DeleteFeedPostPublic_200_response

getFeedPosts Internal Link

req tenantId afterId

Parameters

Name Type Location Required Description
tenantId string query Yes
afterId string query No
limit integer query No
tags array query No

Response

Returns: GetFeedPosts_200_response

getFeedPostsPublic Internal Link

req tenantId afterId

Parameters

Name Type Location Required Description
tenantId string path Yes
afterId string query No
limit integer query No
tags array query No
sso string query No
isCrawler boolean query No
includeUserInfo boolean query No

Response

Returns: GetFeedPostsPublic_200_response

getFeedPostsStats Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
postIds array query Yes
sso string query No

Response

Returns: GetFeedPostsStats_200_response

getUserReactsPublic Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
postIds array query No
sso string query No

Response

Returns: GetUserReactsPublic_200_response

reactFeedPostPublic Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
postId string path Yes
isUndo boolean query No
broadcastId string query No
sso string query No

Response

Returns: ReactFeedPostPublic_200_response

updateFeedPost Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes

Response

Returns: FlagCommentPublic_200_response

updateFeedPostPublic Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
postId string path Yes
broadcastId string query No
sso string query No

Response

Returns: CreateFeedPostPublic_200_response

flagCommentPublic Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
commentId string path Yes
isFlagged boolean query Yes
sso string query No

Response

Returns: FlagCommentPublic_200_response

addPage Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes

Response

Returns: AddPageAPIResponse

deletePage Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes

Response

Returns: DeletePageAPIResponse

getPageByURLId Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
urlId string query Yes

Response

Returns: GetPageByURLIdAPIResponse

getPages Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes

Response

Returns: GetPagesAPIResponse

patchPage Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes

Response

Returns: PatchPageAPIResponse

aggregateQuestionResults Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
questionId string query No
questionIds array query No
urlId string query No
timeBucket string query No
startDate string query No
forceRecalculate boolean query No

Response

Returns: AggregateQuestionResults_200_response

bulkAggregateQuestionResults Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
forceRecalculate boolean query No

Response

Returns: BulkAggregateQuestionResults_200_response

combineCommentsWithQuestionResults Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
questionId string query No
questionIds array query No
urlId string query No
startDate string query No
forceRecalculate boolean query No
minValue number query No
maxValue number query No
limit number query No

Response

Returns: CombineCommentsWithQuestionResults_200_response

addSSOUser Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes

Response

Returns: AddSSOUserAPIResponse

deleteSSOUser Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes
deleteComments boolean query No
commentDeleteMode string query No

Response

Returns: DeleteSSOUserAPIResponse

getSSOUserByEmail Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
email string path Yes

Response

Returns: GetSSOUserByEmailAPIResponse

getSSOUserById Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes

Response

Returns: GetSSOUserByIdAPIResponse

getSSOUsers Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
skip integer query No

Response

Returns: GetSSOUsers_200_response

patchSSOUser Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes
updateComments boolean query No

Response

Returns: PatchSSOUserAPIResponse

putSSOUser Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes
updateComments boolean query No

Response

Returns: PutSSOUserAPIResponse

createSubscription Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes

Response

Returns: CreateSubscriptionAPIResponse

deleteSubscription Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes
userId string query No

Response

Returns: DeleteSubscriptionAPIResponse

getSubscriptions Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
userId string query No

Response

Returns: GetSubscriptionsAPIResponse

uploadImage Internal Link

Upload and resize an image

Parameters

Name Type Location Required Description
tenantId string path Yes
sizePreset string query No Size preset: "Default" (1000x1000px) or "CrossPlatform" (creates sizes for popular devices)
urlId string query No Page id that upload is happening from, to configure

Response

Returns: UploadImageResponse

getUserBadgeProgressById Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes

Response

Returns: GetUserBadgeProgressById_200_response

getUserBadgeProgressByUserId Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
userId string path Yes

Response

Returns: GetUserBadgeProgressById_200_response

getUserBadgeProgressList Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
userId string query No
limit number query No
skip number query No

Response

Returns: GetUserBadgeProgressList_200_response

createUserBadge Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes

Response

Returns: CreateUserBadge_200_response

deleteUserBadge Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes

Response

Returns: UpdateUserBadge_200_response

getUserBadge Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes

Response

Returns: GetUserBadge_200_response

getUserBadges Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
userId string query No
badgeId string query No
type number query No
displayedOnComments boolean query No
limit number query No
skip number query No

Response

Returns: GetUserBadges_200_response

updateUserBadge Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
id string path Yes

Response

Returns: UpdateUserBadge_200_response

getUserNotificationCount Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
sso string query No

Response

Returns: GetUserNotificationCount_200_response

getUserNotifications Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
pageSize integer query No
afterId string query No
includeContext boolean query No
afterCreatedAt integer query No
unreadOnly boolean query No
dmOnly boolean query No
noDm boolean query No
includeTranslations boolean query No
sso string query No

Response

Returns: GetUserNotifications_200_response

resetUserNotificationCount Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
sso string query No

Response

Returns: ResetUserNotifications_200_response

resetUserNotifications Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
afterId string query No
afterCreatedAt integer query No
unreadOnly boolean query No
dmOnly boolean query No
noDm boolean query No
sso string query No

Response

Returns: ResetUserNotifications_200_response

updateUserNotificationCommentSubscriptionStatus Internal Link

Enable or disable notifications for a specific comment.

Parameters

Name Type Location Required Description
tenantId string query Yes
notificationId string path Yes
optedInOrOut string path Yes
commentId string query Yes
sso string query No

Response

Returns: UpdateUserNotificationStatus_200_response

updateUserNotificationPageSubscriptionStatus Internal Link

Enable or disable notifications for a page. When users are subscribed to a page, notifications are created for new root comments, and also

Parameters

Name Type Location Required Description
tenantId string query Yes
urlId string query Yes
url string query Yes
pageTitle string query Yes
subscribedOrUnsubscribed string path Yes
sso string query No

Response

Returns: UpdateUserNotificationStatus_200_response

updateUserNotificationStatus Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
notificationId string path Yes
newStatus string path Yes
sso string query No

Response

Returns: UpdateUserNotificationStatus_200_response

getUserPresenceStatuses Internal Link

Parameters

Name Type Location Required Description
tenantId string query Yes
urlIdWS string query Yes
userIds string query Yes

Response

Returns: GetUserPresenceStatuses_200_response

searchUsers Internal Link

Parameters

Name Type Location Required Description
tenantId string path Yes
urlId string query Yes
usernameStartsWith string query Yes
mentionGroupIds array query No
sso string query No

Response

Returns: SearchUsers_200_response

Need Help?

If you encounter any issues or have questions about the C++ SDK, please:

Contributing

Contributions are welcome! Please visit the GitHub repository for contribution guidelines.