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

addDomainConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
addDomainConfigParams AddDomainConfigParams Yes

Response

Returns: AddDomainConfig_200_response

Example

addDomainConfig Example
Copy Copy
1
2AddDomainConfigParams params;
3params.domain = utility::string_t(U("comments.example.com"));
4params.contactEmail = utility::string_t(U("admin@example.com"));
5params.enforceHttps = boost::optional<bool>(true);
6params.notes = boost::optional<utility::string_t>(utility::string_t(U("Primary comments domain")));
7
8api->addDomainConfig(utility::string_t(U("my-tenant-123")), params)
9.then([](std::shared_ptr<AddDomainConfig_200_response> resp){
10 if (!resp) return;
11 auto result = std::make_shared<AddDomainConfig_200_response>(*resp);
12 std::wcout << U("Domain config added for tenant: my-tenant-123") << std::endl;
13});
14

addPage Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createAPIPageData CreateAPIPageData Yes

Response

Returns: AddPageAPIResponse

Example

addPage Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3auto createReq = std::make_shared<CreateAPIPageData>();
4createReq->url = U("https://docs.example.com/getting-started");
5createReq->title = U("Getting Started Guide");
6createReq->authorEmail = U("doc-owner@example.com");
7createReq->isPublished = boost::optional<bool>(true);
8createReq->summary = boost::optional<utility::string_t>(U("Introductory setup and usage"));
9api->addPage(tenantId, *createReq).then([](pplx::task<std::shared_ptr<AddPageAPIResponse>> task){
10 try {
11 auto resp = task.get();
12 if (resp) {
13 utility::string_t pageId = resp->pageId;
14 utility::string_t status = resp->status;
15 (void)pageId; (void)status;
16 }
17 } catch (const std::exception& e) {
18 (void)e;
19 }
20});
21

addSSOUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createAPISSOUserData CreateAPISSOUserData Yes

Response

Returns: AddSSOUserAPIResponse

Example

addSSOUser Example
Copy Copy
1
2auto payload = std::make_shared<CreateAPISSOUserData>();
3payload->email = utility::string_t(U("jane.doe@example.com"));
4payload->displayName = utility::string_t(U("Jane Doe"));
5payload->ssoId = utility::string_t(U("jdoe-azure-12345"));
6payload->roles = std::vector<utility::string_t>{ utility::string_t(U("moderator")) };
7payload->externalId = boost::optional<utility::string_t>(utility::string_t(U("ext-9876")));
8payload->sendInvite = boost::optional<bool>(true);
9
10api->addSSOUser(utility::string_t(U("my-tenant-123")), *payload)
11.then([](std::shared_ptr<AddSSOUserAPIResponse> resp){
12 if (resp) std::cout << "Added SSO user successfully\n";
13 else std::cout << "Failed to add SSO user\n";
14});
15

aggregate Internal Link

Parameters

Name Type Required Description
tenantId string Yes
aggregationRequest AggregationRequest Yes
parentTenantId string No
includeStats bool No

Response

Returns: AggregationResponse

Example

aggregate Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3auto aggregationRequest = std::make_shared<AggregationRequest>();
4boost::optional<utility::string_t> parentTenantId = boost::optional<utility::string_t>(U("parent-tenant-456"));
5boost::optional<bool> includeStats = boost::optional<bool>(true);
6api->aggregate(tenantId, *aggregationRequest, parentTenantId, includeStats)
7.then([](std::shared_ptr<AggregationResponse> resp) {
8 if (resp) {
9 return resp;
10 }
11 return std::shared_ptr<AggregationResponse>();
12});
13

aggregateQuestionResults Internal Link

Parameters

Name Type Required Description
tenantId string Yes
questionId string No
questionIds vector<string No
urlId string No
timeBucket AggregateTimeBucket No
startDate datetime No
forceRecalculate bool No

Response

Returns: AggregateQuestionResults_200_response

Example

aggregateQuestionResults Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3boost::optional<utility::string_t> questionId(U("question-456"));
4boost::optional<std::vector<utility::string_t>> questionIds(std::vector<utility::string_t>{U("question-456"), U("question-789")});
5boost::optional<utility::string_t> urlId(U("url-55"));
6boost::optional<AggregateTimeBucket> timeBucket;
7boost::optional<utility::datetime> startDate(utility::datetime::from_string(U("2024-01-01T00:00:00Z")));
8boost::optional<bool> forceRecalculate(true);
9api->aggregateQuestionResults(tenantId, questionId, questionIds, urlId, timeBucket, startDate, forceRecalculate)
10.then([](pplx::task<std::shared_ptr<AggregateQuestionResults_200_response>> t){
11 try {
12 auto resp = t.get();
13 if(!resp) resp = std::make_shared<AggregateQuestionResults_200_response>();
14 } catch(const std::exception&) {}
15});
16

blockFromCommentPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
publicBlockFromCommentParams PublicBlockFromCommentParams Yes
sso string No

Response

Returns: BlockFromCommentPublic_200_response

Example

blockFromCommentPublic Example
Copy Copy
1
2utility::string_t tenantId = utility::string_t(U("my-tenant-123"));
3utility::string_t commentId = utility::string_t(U("comment-456"));
4PublicBlockFromCommentParams params;
5boost::optional<utility::string_t> sso = utility::string_t(U("sso-token-abc123"));
6api->blockFromCommentPublic(tenantId, commentId, params, sso)
7.then([](pplx::task<std::shared_ptr<BlockFromCommentPublic_200_response>> task){
8 try {
9 auto resp = task.get();
10 if (!resp) resp = std::make_shared<BlockFromCommentPublic_200_response>();
11 std::cout << "BlockFromCommentPublic completed\n";
12 } catch (const std::exception& e) {
13 std::cerr << "BlockFromCommentPublic error: " << e.what() << '\n';
14 }
15});
16

blockUserFromComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
blockFromCommentParams BlockFromCommentParams Yes
userId string No
anonUserId string No

Response

Returns: BlockFromCommentPublic_200_response

Example

blockUserFromComment Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("comment-456");
4BlockFromCommentParams params;
5boost::optional<utility::string_t> userId = boost::optional<utility::string_t>(U("user@example.com"));
6boost::optional<utility::string_t> anonUserId = boost::none;
7api->blockUserFromComment(tenantId, commentId, params, userId, anonUserId)
8 .then([](pplx::task<std::shared_ptr<BlockFromCommentPublic_200_response>> t){
9 try {
10 auto resp = t.get();
11 if (resp) {
12 auto copy = std::make_shared<BlockFromCommentPublic_200_response>(*resp);
13 }
14 } catch (const std::exception&) {
15 }
16 });
17

bulkAggregateQuestionResults Internal Link

Parameters

Name Type Required Description
tenantId string Yes
bulkAggregateQuestionResultsRequest BulkAggregateQuestionResultsRequest Yes
forceRecalculate bool No

Response

Returns: BulkAggregateQuestionResults_200_response

Example

bulkAggregateQuestionResults Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3auto req = std::make_shared<BulkAggregateQuestionResultsRequest>();
4boost::optional<bool> forceRecalculate(true);
5api->bulkAggregateQuestionResults(tenantId, req, forceRecalculate)
6 .then([](pplx::task<std::shared_ptr<BulkAggregateQuestionResults_200_response>> t){
7 try {
8 auto resp = t.get();
9 (void)resp;
10 } catch (const std::exception& e) {
11 (void)e;
12 }
13 });
14

checkedCommentsForBlocked Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentIds string Yes
sso string No

Response

Returns: CheckedCommentsForBlocked_200_response

Example

checkedCommentsForBlocked Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentIds = U("cmt-456,cmt-789");
4boost::optional<utility::string_t> sso{ U("user@example.com") };
5api->checkedCommentsForBlocked(tenantId, commentIds, sso)
6.then([](std::shared_ptr<CheckedCommentsForBlocked_200_response> resp){
7 auto copied = std::make_shared<CheckedCommentsForBlocked_200_response>(*resp);
8 return copied;
9})
10.then([](std::shared_ptr<CheckedCommentsForBlocked_200_response> finalResult){
11 (void)finalResult;
12})
13.wait();
14

combineCommentsWithQuestionResults Internal Link

Parameters

Name Type Required Description
tenantId string Yes
questionId string No
questionIds vector<string No
urlId string No
startDate datetime No
forceRecalculate bool No
minValue double No
maxValue double No
limit double No

Response

Returns: CombineCommentsWithQuestionResults_200_response

Example

combineCommentsWithQuestionResults Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3boost::optional<utility::string_t> questionId = boost::optional<utility::string_t>(U("q-456"));
4boost::optional<std::vector<utility::string_t>> questionIds = std::vector<utility::string_t>{ U("q-456"), U("q-789") };
5boost::optional<utility::string_t> urlId = boost::optional<utility::string_t>(U("url-321"));
6utility::datetime sd = utility::datetime::from_string(U("2025-01-01T00:00:00Z"));
7boost::optional<utility::datetime> startDate = sd;
8boost::optional<bool> forceRecalculate = true;
9boost::optional<double> minValue = 0.0;
10boost::optional<double> maxValue = 5.0;
11boost::optional<double> limit = 100.0;
12api->combineCommentsWithQuestionResults(tenantId, questionId, questionIds, urlId, startDate, forceRecalculate, minValue, maxValue, limit)
13.then([](pplx::task<std::shared_ptr<CombineCommentsWithQuestionResults_200_response>> task){
14 try {
15 auto resp = task.get();
16 auto copy = std::make_shared<CombineCommentsWithQuestionResults_200_response>(*resp);
17 (void)copy;
18 } catch(const std::exception &){
19 }
20});
21

createCommentPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
broadcastId string Yes
commentData CommentData Yes
sessionId string No
sso string No

Response

Returns: CreateCommentPublic_200_response

Example

createCommentPublic Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t urlId = U("articles/how-to-cpprest");
4utility::string_t broadcastId = U("broadcast-987");
5auto commentDataPtr = std::make_shared<CommentData>();
6commentDataPtr->text = U("Great article! Learned a lot.");
7commentDataPtr->authorEmail = U("reader@example.com");
8boost::optional<utility::string_t> sessionId = boost::optional<utility::string_t>(U("session-abc-123"));
9boost::optional<utility::string_t> sso = boost::optional<utility::string_t>(U("sso-token-456"));
10api->createCommentPublic(tenantId, urlId, broadcastId, *commentDataPtr, sessionId, sso)
11.then([](std::shared_ptr<CreateCommentPublic_200_response> resp){
12 if (resp) {}
13});
14

createFeedPost Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createFeedPostParams CreateFeedPostParams Yes
broadcastId string No
isLive bool No
doSpamCheck bool No
skipDupCheck bool No

Response

Returns: CreateFeedPost_200_response

Example

createFeedPost Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3CreateFeedPostParams createFeedPostParams;
4createFeedPostParams.title = U("Product update: v2.1");
5createFeedPostParams.content = U("We are releasing version 2.1 with performance and stability improvements.");
6createFeedPostParams.authorEmail = U("author@example.com");
7boost::optional<utility::string_t> broadcastId = boost::optional<utility::string_t>(U("broadcast-789"));
8boost::optional<bool> isLive = boost::optional<bool>(true);
9boost::optional<bool> doSpamCheck = boost::optional<bool>(false);
10boost::optional<bool> skipDupCheck = boost::optional<bool>(false);
11
12api->createFeedPost(tenantId, createFeedPostParams, broadcastId, isLive, doSpamCheck, skipDupCheck)
13.then([](pplx::task<std::shared_ptr<CreateFeedPost_200_response>> t){
14 try {
15 auto resp = t.get();
16 if (resp) {
17 auto copy = std::make_shared<CreateFeedPost_200_response>(*resp);
18 std::cout << "Feed post created" << std::endl;
19 }
20 } catch (const std::exception& e) {
21 std::cerr << "CreateFeedPost failed: " << e.what() << std::endl;
22 }
23});
24

createFeedPostPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createFeedPostParams CreateFeedPostParams Yes
broadcastId string No
sso string No

Response

Returns: CreateFeedPostPublic_200_response

Example

createFeedPostPublic Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3CreateFeedPostParams feedParams = CreateFeedPostParams();
4boost::optional<utility::string_t> broadcastId = boost::optional<utility::string_t>(U("broadcast-456"));
5boost::optional<utility::string_t> sso = boost::optional<utility::string_t>(U("alice@example.com"));
6api->createFeedPostPublic(tenantId, feedParams, broadcastId, sso)
7.then([](pplx::task<std::shared_ptr<CreateFeedPostPublic_200_response>> t){
8 try {
9 auto resp = t.get();
10 auto respCopy = std::make_shared<CreateFeedPostPublic_200_response>(*resp);
11 (void)respCopy;
12 } catch (...) {}
13});
14

createSubscription Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createAPIUserSubscriptionData CreateAPIUserSubscriptionData Yes

Response

Returns: CreateSubscriptionAPIResponse

Example

createSubscription Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3CreateAPIUserSubscriptionData subscriptionData;
4subscriptionData.userEmail = U("user@example.com");
5subscriptionData.planId = U("pro-monthly");
6subscriptionData.autoRenew = boost::optional<bool>(true);
7subscriptionData.couponCode = boost::optional<utility::string_t>(U("WELCOME10"));
8auto task = api->createSubscription(tenantId, subscriptionData)
9.then([=](pplx::task<std::shared_ptr<CreateSubscriptionAPIResponse>> t) {
10 try {
11 return t.get();
12 } catch (const std::exception&) {
13 return std::make_shared<CreateSubscriptionAPIResponse>();
14 }
15});
16

createUserBadge Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createUserBadgeParams CreateUserBadgeParams Yes

Response

Returns: CreateUserBadge_200_response

Example

createUserBadge Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3auto params = std::make_shared<CreateUserBadgeParams>();
4params->userId = utility::string_t(U("user@example.com"));
5params->badgeId = utility::string_t(U("top-contributor"));
6params->awardedBy = boost::optional<utility::string_t>(utility::string_t(U("moderator@example.com")));
7params->expiresAt = boost::optional<utility::string_t>(utility::string_t(U("2026-12-31T23:59:59Z")));
8api->createUserBadge(tenantId, *params)
9 .then([](pplx::task<std::shared_ptr<CreateUserBadge_200_response>> t) {
10 try {
11 auto resp = t.get();
12 (void)resp;
13 } catch (const std::exception&) {
14 }
15 });
16

deleteComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
contextUserId string No
isLive bool No

Response

Returns: DeleteComment_200_response

Example

deleteComment Example
Copy Copy
1
2utility::string_t tenantId = utility::conversions::to_string_t("my-tenant-123");
3utility::string_t id = utility::conversions::to_string_t("comment-987654");
4boost::optional<utility::string_t> contextUserId = utility::conversions::to_string_t("user@example.com");
5boost::optional<bool> isLive = true;
6api->deleteComment(tenantId, id, contextUserId, isLive)
7.then([](pplx::task<std::shared_ptr<DeleteComment_200_response>> t){
8 try {
9 auto resp = t.get();
10 auto dummy = std::make_shared<DeleteComment_200_response>();
11 (void)resp;
12 (void)dummy;
13 } catch (...) {}
14});
15

deleteCommentPublic Internal Link

Parameters

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

Response

Returns: DeleteCommentPublic_200_response

Example

deleteCommentPublic Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("cmt-7890");
4utility::string_t broadcastId = U("bcast-456");
5boost::optional<utility::string_t> editKey = utility::string_t(U("editKey-abc123"));
6boost::optional<utility::string_t> sso = boost::none;
7
8api->deleteCommentPublic(tenantId, commentId, broadcastId, editKey, sso)
9.then([](std::shared_ptr<DeleteCommentPublic_200_response> resp) {
10 auto copy = std::make_shared<DeleteCommentPublic_200_response>(*resp);
11 (void)copy;
12});
13

deleteCommentVote Internal Link

Parameters

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

Response

Returns: DeleteCommentVote_200_response

Example

deleteCommentVote Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("comment-456");
4utility::string_t voteId = U("vote-789");
5utility::string_t urlId = U("article-2025-11-20");
6utility::string_t broadcastId = U("broadcast-001");
7boost::optional<utility::string_t> editKey = boost::optional<utility::string_t>(U("edit-KEY-xyz"));
8boost::optional<utility::string_t> sso = boost::optional<utility::string_t>(U("sso-token-abc"));
9api->deleteCommentVote(tenantId, commentId, voteId, urlId, broadcastId, editKey, sso)
10.then([](pplx::task<std::shared_ptr<DeleteCommentVote_200_response>> task){
11 try {
12 auto resp = task.get();
13 if (resp) {
14 std::cout << "Vote deleted successfully\n";
15 } else {
16 std::cout << "Delete returned empty response\n";
17 }
18 } catch (const std::exception &e) {
19 std::cerr << "Delete failed: " << e.what() << '\n';
20 }
21});
22

deleteDomainConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
domain string Yes

Response

Returns: DeleteDomainConfig_200_response

Example

deleteDomainConfig Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t domain = U("acme.com");
4boost::optional<utility::string_t> correlationId = U("corr-456");
5api->deleteDomainConfig(tenantId, domain)
6.then([correlationId](std::shared_ptr<DeleteDomainConfig_200_response> resp){
7 auto finalResp = resp ? resp : std::make_shared<DeleteDomainConfig_200_response>();
8 (void)correlationId;
9 (void)finalResp;
10});
11

deleteFeedPostPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
postId string Yes
broadcastId string No
sso string No

Response

Returns: DeleteFeedPostPublic_200_response

Example

deleteFeedPostPublic Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t postId = U("post-9876");
4boost::optional<utility::string_t> broadcastId = boost::optional<utility::string_t>(U("broadcast-42"));
5boost::optional<utility::string_t> sso = boost::optional<utility::string_t>(U("user@example.com"));
6auto placeholder = std::make_shared<DeleteFeedPostPublic_200_response>();
7api->deleteFeedPostPublic(tenantId, postId, broadcastId, sso)
8.then([&placeholder](pplx::task<std::shared_ptr<DeleteFeedPostPublic_200_response>> task) {
9 try {
10 placeholder = task.get();
11 if (placeholder) std::cout << "Feed post deleted for tenant\n";
12 else std::cout << "DeleteFeedPostPublic returned no content\n";
13 } catch (const std::exception& e) {
14 std::cerr << "Delete failed: " << e.what() << '\n';
15 }
16});
17

deletePage Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: DeletePageAPIResponse

Example

deletePage Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t pageId = U("page-456");
4boost::optional<utility::string_t> requestTag = boost::none;
5api->deletePage(tenantId, pageId)
6.then([](std::shared_ptr<DeletePageAPIResponse> resp) {
7 if (resp) {
8 auto copy = std::make_shared<DeletePageAPIResponse>(*resp);
9 (void)copy;
10 }
11}).wait();
12

deleteSSOUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
deleteComments bool No
commentDeleteMode string No

Response

Returns: DeleteSSOUserAPIResponse

Example

deleteSSOUser Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t id = U("user@example.com");
4boost::optional<bool> deleteComments = boost::optional<bool>(true);
5boost::optional<utility::string_t> commentDeleteMode = boost::optional<utility::string_t>(U("cascade"));
6api->deleteSSOUser(tenantId, id, deleteComments, commentDeleteMode)
7 .then([](std::shared_ptr<DeleteSSOUserAPIResponse> resp){
8 if(!resp) return;
9 auto resultCopy = std::make_shared<DeleteSSOUserAPIResponse>(*resp);
10 (void)resultCopy;
11 });
12

deleteSubscription Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
userId string No

Response

Returns: DeleteSubscriptionAPIResponse

Example

deleteSubscription Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t subscriptionId = U("sub-987654");
4boost::optional<utility::string_t> userId = boost::optional<utility::string_t>(U("user@example.com"));
5
6api->deleteSubscription(tenantId, subscriptionId, userId)
7.then([](pplx::task<std::shared_ptr<DeleteSubscriptionAPIResponse>> task) {
8 try {
9 auto resp = task.get();
10 if (!resp) resp = std::make_shared<DeleteSubscriptionAPIResponse>();
11 std::cout << "Subscription deleted for tenant\n";
12 } catch (const std::exception& e) {
13 std::cerr << "Error deleting subscription: " << e.what() << '\n';
14 }
15});
16

deleteUserBadge Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: UpdateUserBadge_200_response

Example

deleteUserBadge Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t badgeId = U("badge-abc123");
4boost::optional<utility::string_t> maybeTenant = tenantId;
5api->deleteUserBadge(maybeTenant.value(), badgeId)
6.then([](pplx::task<std::shared_ptr<UpdateUserBadge_200_response>> prevTask){
7 try {
8 auto resp = prevTask.get();
9 if (resp) return std::make_shared<UpdateUserBadge_200_response>(*resp);
10 return std::make_shared<UpdateUserBadge_200_response>();
11 } catch (...) {
12 return std::make_shared<UpdateUserBadge_200_response>();
13 }
14});
15

flagComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
userId string No
anonUserId string No

Response

Returns: FlagComment_200_response

Example

flagComment Example
Copy Copy
1
2utility::string_t tenantId = utility::conversions::to_string_t("my-tenant-123");
3utility::string_t commentId = utility::conversions::to_string_t("cmt-456789");
4boost::optional<utility::string_t> userId = boost::optional<utility::string_t>(utility::conversions::to_string_t("user@example.com"));
5boost::optional<utility::string_t> anonUserId = boost::optional<utility::string_t>(utility::conversions::to_string_t("anon-uuid-789"));
6auto t = api->flagComment(tenantId, commentId, userId, anonUserId)
7.then([](pplx::task<std::shared_ptr<FlagComment_200_response>> task){
8 try {
9 auto resp = task.get();
10 auto marker = std::make_shared<utility::string_t>(utility::conversions::to_string_t("comment_flagged"));
11 (void)resp;
12 (void)marker;
13 } catch (const std::exception&) {
14 }
15});
16

flagCommentPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
isFlagged bool Yes
sso string No

Response

Returns: FlagCommentPublic_200_response

Example

flagCommentPublic Example
Copy Copy
1
2boost::optional<utility::string_t> sso = utility::string_t(U("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.token"));
3auto task = api->flagCommentPublic(utility::string_t(U("my-tenant-123")), utility::string_t(U("cmt-456")), true, sso)
4 .then([](pplx::task<std::shared_ptr<FlagCommentPublic_200_response>> t) {
5 try {
6 auto resp = t.get();
7 auto result = std::make_shared<FlagCommentPublic_200_response>(*resp);
8 return result;
9 } catch (const std::exception&) {
10 return std::make_shared<FlagCommentPublic_200_response>();
11 }
12 });
13

getAuditLogs Internal Link

Parameters

Name Type Required Description
tenantId string Yes
limit double No
skip double No
order SORT_DIR No
after double No
before double No

Response

Returns: GetAuditLogs_200_response

Example

getAuditLogs Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3boost::optional<double> limit = 50.0;
4boost::optional<double> skip = 0.0;
5boost::optional<SORT_DIR> order = SORT_DIR::DESC;
6boost::optional<double> after = 1630454400.0;
7boost::optional<double> before = 1633046400.0;
8auto result_holder = std::make_shared<GetAuditLogs_200_response>();
9
10api->getAuditLogs(tenantId, limit, skip, order, after, before)
11 .then([result_holder](pplx::task<std::shared_ptr<GetAuditLogs_200_response>> t) {
12 try {
13 auto resp = t.get();
14 if (resp) *result_holder = *resp;
15 } catch (...) {
16 }
17 });
18

getComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetComment_200_response

Example

getComment Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("comment-456");
4boost::optional<utility::string_t> requestedBy = boost::optional<utility::string_t>(U("moderator@example.com"));
5api->getComment(tenantId, commentId)
6.then([](pplx::task<std::shared_ptr<GetComment_200_response>> task) {
7 try {
8 auto resp = task.get();
9 if (resp) {
10 auto copy = std::make_shared<GetComment_200_response>(*resp);
11 }
12 } catch (const std::exception&) {
13 }
14});
15

getComments Internal Link

Parameters

Name Type Required Description
tenantId string Yes
page int32_t No
limit int32_t No
skip int32_t No
asTree bool No
skipChildren int32_t No
limitChildren int32_t No
maxTreeDepth int32_t No
urlId string No
userId string No
anonUserId string No
contextUserId string No
hashTag string No
parentId string No
direction SortDirections No

Response

Returns: GetComments_200_response

Example

getComments Example
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3auto page = boost::optional<int32_t>(1);
4auto limit = boost::optional<int32_t>(25);
5auto asTree = boost::optional<bool>(true);
6auto maxDepth = boost::optional<int32_t>(3);
7auto urlId = boost::optional<utility::string_t>(utility::string_t(U("/articles/2025/cpp-async")));
8auto userId = boost::optional<utility::string_t>(utility::string_t(U("user@example.com")));
9auto contextUserId = boost::optional<utility::string_t>(utility::string_t(U("ctx-user-42")));
10auto direction = boost::optional<SortDirections>(SortDirections::DESC);
11
12api->getComments(
13 tenantId,
14 page,
15 limit,
16 boost::optional<int32_t>(),
17 asTree,
18 boost::optional<int32_t>(),
19 boost::optional<int32_t>(),
20 maxDepth,
21 urlId,
22 userId,
23 boost::optional<utility::string_t>(),
24 contextUserId,
25 boost::optional<utility::string_t>(),
26 boost::optional<utility::string_t>(),
27 direction
28).then([](std::shared_ptr<GetComments_200_response> resp){
29 if (!resp) return;
30 auto copy = std::make_shared<GetComments_200_response>(*resp);
31});
32

getCommentsPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
page int32_t No
direction SortDirections No
sso string No
skip int32_t No
skipChildren int32_t No
limit int32_t No
limitChildren int32_t No
countChildren bool No
fetchPageForCommentId string No
includeConfig bool No
countAll bool No
includei10n bool No
locale string No
modules string No
isCrawler bool No
includeNotificationCount bool No
asTree bool No
maxTreeDepth int32_t No
useFullTranslationIds bool No
parentId string No
searchText string No
hashTags vector<string No
userId string No
customConfigStr string No
afterCommentId string No
beforeCommentId string No

Response

Returns: GetCommentsPublic_200_response

Example

getCommentsPublic Example
Copy Copy
1
2api->getCommentsPublic(
3 utility::string_t(U("my-tenant-123")),
4 utility::string_t(U("/articles/how-to-cpp-async")),
5 boost::optional<int32_t>(1),
6 boost::optional<SortDirections>(SortDirections::DESC)
7).then([](pplx::task<std::shared_ptr<GetCommentsPublic_200_response>> t){
8 try {
9 auto resp = t.get();
10 auto copy = std::make_shared<GetCommentsPublic_200_response>(*resp);
11 } catch (...) {}
12});
13

getCommentText Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
editKey string No
sso string No

Response

Returns: GetCommentText_200_response

Example

getCommentText Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("cmt-987654321");
4boost::optional<utility::string_t> editKey = boost::optional<utility::string_t>(U("editkey-456"));
5boost::optional<utility::string_t> sso = boost::optional<utility::string_t>(U("sso-token-abc123"));
6api->getCommentText(tenantId, commentId, editKey, sso)
7.then([](pplx::task<std::shared_ptr<GetCommentText_200_response>> t){
8 try {
9 auto resp = t.get();
10 auto safeResp = resp ? resp : std::make_shared<GetCommentText_200_response>();
11 } catch (const std::exception &e) {
12 auto fallback = std::make_shared<GetCommentText_200_response>();
13 }
14});
15

getCommentVoteUserNames Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
dir int32_t Yes
sso string No

Response

Returns: GetCommentVoteUserNames_200_response

Example

getCommentVoteUserNames Example
Copy Copy
1
2utility::string_t tenantId = utility::conversions::to_string_t("my-tenant-123");
3utility::string_t commentId = utility::conversions::to_string_t("cmt-987654321");
4int32_t dir = 1;
5boost::optional<utility::string_t> sso = boost::optional<utility::string_t>(utility::conversions::to_string_t("user@example.com"));
6api->getCommentVoteUserNames(tenantId, commentId, dir, sso)
7.then([](pplx::task<std::shared_ptr<GetCommentVoteUserNames_200_response>> t) {
8 try {
9 auto resp = t.get();
10 if (resp) {
11 auto result = std::make_shared<GetCommentVoteUserNames_200_response>(*resp);
12 }
13 } catch (const std::exception& e) {
14 auto fallback = std::make_shared<GetCommentVoteUserNames_200_response>();
15 }
16});
17

getDomainConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
domain string Yes

Response

Returns: GetDomainConfig_200_response

Example

getDomainConfig Example
Copy Copy
1
2boost::optional<utility::string_t> tenantOpt = boost::optional<utility::string_t>(U("my-tenant-123"));
3utility::string_t domain = U("blog.example.com");
4api->getDomainConfig(*tenantOpt, domain)
5 .then([=](std::shared_ptr<GetDomainConfig_200_response> resp){
6 auto cfg = resp ? resp : std::make_shared<GetDomainConfig_200_response>();
7 (void)cfg;
8 });
9

getDomainConfigs Internal Link

Parameters

Name Type Required Description
tenantId string Yes

Response

Returns: GetDomainConfigs_200_response

Example

getDomainConfigs Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3boost::optional<utility::string_t> environment = boost::optional<utility::string_t>(U("production"));
4api->getDomainConfigs(tenantId).then([environment](std::shared_ptr<GetDomainConfigs_200_response> resp) -> pplx::task<std::shared_ptr<GetDomainConfigs_200_response>> {
5 if (!resp) return pplx::task_from_result<std::shared_ptr<GetDomainConfigs_200_response>>(nullptr);
6 auto resultCopy = std::make_shared<GetDomainConfigs_200_response>(*resp);
7 return pplx::task_from_result(resultCopy);
8});
9

getEventLog Internal Link

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
userIdWS string Yes
startTime int64_t Yes
endTime int64_t Yes

Response

Returns: GetEventLog_200_response

Example

getEventLog Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t urlId = U("post-789");
4utility::string_t userIdWS = U("alice@example.com");
5auto now = std::chrono::system_clock::now();
6int64_t endTime = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
7int64_t startTime = endTime - int64_t(24 * 60 * 60 * 1000);
8boost::optional<std::shared_ptr<GetEventLog_200_response>> optResponse = std::make_shared<GetEventLog_200_response>();
9api->getEventLog(tenantId, urlId, userIdWS, startTime, endTime)
10 .then([&optResponse](pplx::task<std::shared_ptr<GetEventLog_200_response>> t) {
11 try {
12 auto resp = t.get();
13 optResponse = resp ? resp : std::make_shared<GetEventLog_200_response>();
14 } catch (...) {
15 optResponse = std::make_shared<GetEventLog_200_response>();
16 }
17 });
18

getFeedPosts Internal Link

Parameters

Name Type Required Description
tenantId string Yes
afterId string No
limit int32_t No
tags vector<string No

Response

Returns: GetFeedPosts_200_response

Example

getFeedPosts Example
Copy Copy
1
2utility::string_t tenantId("my-tenant-123");
3boost::optional<utility::string_t> afterId(utility::string_t("post_98765"));
4boost::optional<int32_t> limit(25);
5std::vector<utility::string_t> tagVec{ utility::string_t("news"), utility::string_t("featured") };
6boost::optional<std::vector<utility::string_t>> tags(tagVec);
7api->getFeedPosts(tenantId, afterId, limit, tags).then([](pplx::task<std::shared_ptr<GetFeedPosts_200_response>> t) {
8 try {
9 auto resp = t.get();
10 auto respCopy = std::make_shared<GetFeedPosts_200_response>(*resp);
11 (void)respCopy;
12 } catch (const std::exception& e) {
13 (void)e;
14 }
15});
16

getFeedPostsPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
afterId string No
limit int32_t No
tags vector<string No
sso string No
isCrawler bool No
includeUserInfo bool No

Response

Returns: GetFeedPostsPublic_200_response

Example

getFeedPostsPublic Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3boost::optional<utility::string_t> afterId{ utility::string_t(U("post_abcdef")) };
4boost::optional<int32_t> limit{ 20 };
5boost::optional<std::vector<utility::string_t>> tags{ std::vector<utility::string_t>{ U("news"), U("announcement") } };
6boost::optional<utility::string_t> sso{ utility::string_t(U("user@example.com")) };
7boost::optional<bool> isCrawler{ false };
8boost::optional<bool> includeUserInfo{ true };
9
10api->getFeedPostsPublic(tenantId, afterId, limit, tags, sso, isCrawler, includeUserInfo)
11.then([](pplx::task<std::shared_ptr<GetFeedPostsPublic_200_response>> t){
12 try {
13 auto resp = t.get();
14 auto copy = std::make_shared<GetFeedPostsPublic_200_response>(*resp);
15 } catch(const std::exception&) {
16 }
17});
18

getFeedPostsStats Internal Link

Parameters

Name Type Required Description
tenantId string Yes
postIds vector<string Yes
sso string No

Response

Returns: GetFeedPostsStats_200_response

Example

getFeedPostsStats Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3std::vector<utility::string_t> postIds = { U("post-001"), U("post-002"), U("post-003") };
4boost::optional<utility::string_t> sso = boost::optional<utility::string_t>(U("user@example.com"));
5api->getFeedPostsStats(tenantId, postIds, sso)
6 .then([](pplx::task<std::shared_ptr<GetFeedPostsStats_200_response>> task)
7 {
8 try {
9 auto resp = task.get();
10 auto safeResp = resp ? resp : std::make_shared<GetFeedPostsStats_200_response>();
11 (void)safeResp;
12 } catch (const std::exception& e) {
13 (void)e;
14 }
15 });
16

getGlobalEventLog Internal Link

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
userIdWS string Yes
startTime int64_t Yes
endTime int64_t Yes

Response

Returns: GetEventLog_200_response

Example

getGlobalEventLog Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t urlId = U("page-456");
4utility::string_t userIdWS = U("user@example.com");
5int64_t startTime = 1700000000000LL;
6int64_t endTime = 1700003600000LL;
7boost::optional<utility::string_t> optionalFilter = boost::none;
8auto task = api->getGlobalEventLog(tenantId, urlId, userIdWS, startTime, endTime)
9.then([](pplx::task<std::shared_ptr<GetEventLog_200_response>> t){
10 try {
11 auto resp = t.get();
12 if (resp) {
13 auto result = resp;
14 (void)result;
15 }
16 } catch (const std::exception& e) {
17 auto fallback = std::make_shared<GetEventLog_200_response>();
18 (void)fallback;
19 }
20});
21

getPageByURLId Internal Link

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes

Response

Returns: GetPageByURLIdAPIResponse

Example

getPageByURLId Example
Copy Copy
1
2utility::string_t tenantId = utility::conversions::to_string_t("my-tenant-123");
3boost::optional<utility::string_t> optUrlId = utility::conversions::to_string_t("page-9f8b7c6e");
4auto reqTask = api->getPageByURLId(tenantId, *optUrlId)
5 .then([](pplx::task<std::shared_ptr<GetPageByURLIdAPIResponse>> task)
6 {
7 try
8 {
9 auto resp = task.get();
10 if (!resp) resp = std::make_shared<GetPageByURLIdAPIResponse>();
11 }
12 catch (const std::exception&)
13 {
14 auto resp = std::make_shared<GetPageByURLIdAPIResponse>();
15 }
16 });
17

getPages Internal Link

Parameters

Name Type Required Description
tenantId string Yes

Response

Returns: GetPagesAPIResponse

Example

getPages Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3boost::optional<utility::string_t> pageToken = U("cursor_456");
4auto pagesTask = api->getPages(tenantId).then([pageToken](pplx::task<std::shared_ptr<GetPagesAPIResponse>> t){
5 try {
6 auto resp = t.get();
7 if (!resp) resp = std::make_shared<GetPagesAPIResponse>();
8 return resp;
9 } catch (...) {
10 return std::make_shared<GetPagesAPIResponse>();
11 }
12});
13

getSSOUserByEmail Internal Link

Parameters

Name Type Required Description
tenantId string Yes
email string Yes

Response

Returns: GetSSOUserByEmailAPIResponse

Example

getSSOUserByEmail Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t email = U("user@example.com");
4boost::optional<utility::string_t> emailOpt = email;
5api->getSSOUserByEmail(tenantId, emailOpt.value()).then([](std::shared_ptr<GetSSOUserByEmailAPIResponse> resp) {
6 auto safeResp = resp ? resp : std::make_shared<GetSSOUserByEmailAPIResponse>();
7 std::cout << "SSO user fetch " << (resp ? "succeeded" : "failed") << std::endl;
8}).wait();
9

getSSOUserById Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetSSOUserByIdAPIResponse

Example

getSSOUserById Example
Copy Copy
1
2utility::string_t tenantId = utility::conversions::to_string_t("my-tenant-123");
3utility::string_t userId = utility::conversions::to_string_t("user@example.com");
4boost::optional<utility::string_t> tenantOpt = tenantId;
5api->getSSOUserById(tenantOpt.value(), userId)
6 .then([](std::shared_ptr<GetSSOUserByIdAPIResponse> resp){
7 if(!resp) return;
8 auto responseCopy = std::make_shared<GetSSOUserByIdAPIResponse>(*resp);
9 });
10

getSSOUsers Internal Link

Parameters

Name Type Required Description
tenantId string Yes
skip int32_t No

Response

Returns: GetSSOUsers_200_response

Example

getSSOUsers Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3boost::optional<int32_t> skip = boost::optional<int32_t>{10};
4api->getSSOUsers(tenantId, skip)
5.then([](pplx::task<std::shared_ptr<GetSSOUsers_200_response>> t) {
6 try {
7 auto resp = t.get();
8 auto result = resp ? resp : std::make_shared<GetSSOUsers_200_response>();
9 } catch (const std::exception&) {
10 }
11});
12

getSubscriptions Internal Link

Parameters

Name Type Required Description
tenantId string Yes
userId string No

Response

Returns: GetSubscriptionsAPIResponse

Example

getSubscriptions Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3boost::optional<utility::string_t> userId = boost::optional<utility::string_t>(U("user@example.com"));
4auto fallback = std::make_shared<GetSubscriptionsAPIResponse>();
5api->getSubscriptions(tenantId, userId)
6 .then([fallback](std::shared_ptr<GetSubscriptionsAPIResponse> resp) {
7 auto result = resp ? resp : fallback;
8 return result;
9 });
10

getUserBadge Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetUserBadge_200_response

Example

getUserBadge Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t userId = U("alice@example.com");
4boost::optional<utility::string_t> locale = boost::none;
5auto defaultResp = std::make_shared<GetUserBadge_200_response>();
6api->getUserBadge(tenantId, userId)
7 .then([defaultResp](std::shared_ptr<GetUserBadge_200_response> resp) {
8 auto result = resp ? resp : defaultResp;
9 return result;
10 })
11 .then([](std::shared_ptr<GetUserBadge_200_response> finalResp) {
12 if (finalResp) {
13 std::cout << "User badge retrieved successfully\n";
14 } else {
15 std::cout << "Failed to retrieve user badge\n";
16 }
17 });
18

getUserBadgeProgressById Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetUserBadgeProgressById_200_response

Example

getUserBadgeProgressById Example
Copy Copy
1
2boost::optional<utility::string_t> maybeTenant = utility::string_t(U("my-tenant-123"));
3utility::string_t tenantId = maybeTenant ? maybeTenant.value() : utility::string_t(U("my-tenant-123"));
4utility::string_t id = utility::string_t(U("user@example.com"));
5
6api->getUserBadgeProgressById(tenantId, id)
7.then([](pplx::task<std::shared_ptr<GetUserBadgeProgressById_200_response>> task) {
8 try {
9 auto resp = task.get();
10 if (resp) {
11 auto copy = std::make_shared<GetUserBadgeProgressById_200_response>(*resp);
12 }
13 } catch (const std::exception&) {
14 }
15});
16

getUserBadgeProgressByUserId Internal Link

Parameters

Name Type Required Description
tenantId string Yes
userId string Yes

Response

Returns: GetUserBadgeProgressById_200_response

Example

getUserBadgeProgressByUserId Example
Copy Copy
1
2utility::string_t tenantId = utility::conversions::to_string_t("my-tenant-123");
3utility::string_t userId = utility::conversions::to_string_t("user@example.com");
4boost::optional<utility::string_t> tenantOpt(tenantId);
5boost::optional<utility::string_t> userOpt;
6api->getUserBadgeProgressByUserId(tenantOpt.value_or(tenantId), userOpt.value_or(userId))
7 .then([](pplx::task<std::shared_ptr<GetUserBadgeProgressById_200_response>> t){
8 try {
9 auto resp = t.get();
10 if (!resp) resp = std::make_shared<GetUserBadgeProgressById_200_response>();
11 } catch (const std::exception&) {}
12 });
13

getUserBadgeProgressList Internal Link

Parameters

Name Type Required Description
tenantId string Yes
userId string No
limit double No
skip double No

Response

Returns: GetUserBadgeProgressList_200_response

Example

getUserBadgeProgressList Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3boost::optional<utility::string_t> userId(U("user@example.com"));
4boost::optional<double> limit(25);
5boost::optional<double> skip(0);
6api->getUserBadgeProgressList(tenantId, userId, limit, skip)
7.then([](pplx::task<std::shared_ptr<GetUserBadgeProgressList_200_response>> t)
8{
9 try {
10 auto resp = t.get();
11 return resp ? resp : std::make_shared<GetUserBadgeProgressList_200_response>();
12 } catch(...) {
13 return std::make_shared<GetUserBadgeProgressList_200_response>();
14 }
15});
16

getUserBadges Internal Link

Parameters

Name Type Required Description
tenantId string Yes
userId string No
badgeId string No
type double No
displayedOnComments bool No
limit double No
skip double No

Response

Returns: GetUserBadges_200_response

Example

getUserBadges Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3boost::optional<utility::string_t> userId = boost::optional<utility::string_t>(U("alice@example.com"));
4boost::optional<utility::string_t> badgeId = boost::optional<utility::string_t>(U("community-expert"));
5boost::optional<double> type = boost::optional<double>(1.0);
6boost::optional<bool> displayedOnComments = boost::optional<bool>(true);
7boost::optional<double> limit = boost::optional<double>(20);
8boost::optional<double> skip = boost::optional<double>(0);
9auto ctx = std::make_shared<utility::string_t>(U("req-98765"));
10api->getUserBadges(tenantId, userId, badgeId, type, displayedOnComments, limit, skip)
11 .then([ctx](std::shared_ptr<GetUserBadges_200_response> resp){
12 if (resp) {
13 size_t marker = ctx->size();
14 (void)marker;
15 }
16 }).wait();
17

getUserNotificationCount Internal Link

Parameters

Name Type Required Description
tenantId string Yes
sso string No

Response

Returns: GetUserNotificationCount_200_response

Example

getUserNotificationCount Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3boost::optional<utility::string_t> sso = boost::optional<utility::string_t>(U("user@example.com"));
4api->getUserNotificationCount(tenantId, sso).then([](pplx::task<std::shared_ptr<GetUserNotificationCount_200_response>> t){
5 try {
6 auto resp = t.get();
7 if (resp) {
8 std::cout << "User notification count retrieved successfully" << std::endl;
9 } else {
10 std::cout << "No notification count returned" << std::endl;
11 }
12 } catch (const std::exception& e) {
13 std::cerr << "Failed to get notification count: " << e.what() << std::endl;
14 }
15});
16

getUserNotifications Internal Link

Parameters

Name Type Required Description
tenantId string Yes
pageSize int32_t No
afterId string No
includeContext bool No
afterCreatedAt int64_t No
unreadOnly bool No
dmOnly bool No
noDm bool No
includeTranslations bool No
sso string No

Response

Returns: GetUserNotifications_200_response

Example

getUserNotifications Example
Copy Copy
1
2utility::string_t tenantId(U("my-tenant-123"));
3boost::optional<int32_t> pageSize = 25;
4boost::optional<utility::string_t> afterId = utility::string_t(U("notif_456"));
5boost::optional<bool> includeContext = true;
6boost::optional<int64_t> afterCreatedAt = 1625097600000LL;
7boost::optional<bool> unreadOnly = true;
8boost::optional<bool> dmOnly = false;
9boost::optional<bool> noDm = false;
10boost::optional<bool> includeTranslations = true;
11boost::optional<utility::string_t> sso = utility::string_t(U("user@example.com"));
12
13api->getUserNotifications(tenantId, pageSize, afterId, includeContext, afterCreatedAt, unreadOnly, dmOnly, noDm, includeTranslations, sso)
14.then([](pplx::task<std::shared_ptr<GetUserNotifications_200_response>> t){
15 try {
16 auto resp = t.get();
17 if (!resp) resp = std::make_shared<GetUserNotifications_200_response>();
18 std::cout << "Notifications fetched\n";
19 } catch (const std::exception &e) {
20 std::cerr << "Failed: " << e.what() << '\n';
21 }
22});
23

getUserPresenceStatuses Internal Link

Parameters

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

Response

Returns: GetUserPresenceStatuses_200_response

Example

getUserPresenceStatuses Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t urlIdWS = U("wss://comments.fastcomments.com/ws/room-456");
4boost::optional<utility::string_t> optUserIds = U("alice@example.com,bob@example.com");
5utility::string_t userIds = optUserIds ? *optUserIds : utility::string_t();
6
7api->getUserPresenceStatuses(tenantId, urlIdWS, userIds)
8 .then([](pplx::task<std::shared_ptr<GetUserPresenceStatuses_200_response>> task){
9 try {
10 auto resp = task.get();
11 if(!resp) resp = std::make_shared<GetUserPresenceStatuses_200_response>();
12 // use resp as needed
13 } catch (const std::exception&) {
14 auto resp = std::make_shared<GetUserPresenceStatuses_200_response>();
15 }
16 });
17

getUserReactsPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
postIds vector<string No
sso string No

Response

Returns: GetUserReactsPublic_200_response

Example

getUserReactsPublic Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3std::vector<utility::string_t> postIdsVec = { U("post-abc-001"), U("post-def-002") };
4boost::optional<std::vector<utility::string_t>> postIdsOpt = postIdsVec;
5boost::optional<utility::string_t> ssoOpt = U("user@example.com");
6auto fallback = std::make_shared<GetUserReactsPublic_200_response>();
7api->getUserReactsPublic(tenantId, postIdsOpt, ssoOpt).then([fallback](std::shared_ptr<GetUserReactsPublic_200_response> resp){
8 auto result = resp ? resp : fallback;
9 std::wcout << U("Received user reacts (public)") << std::endl;
10 return result;
11});
12

lockComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
broadcastId string Yes
sso string No

Response

Returns: LockComment_200_response

Example

lockComment Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("cmt-987654");
4utility::string_t broadcastId = U("broadcast-2025-11-20");
5boost::optional<utility::string_t> sso = boost::optional<utility::string_t>(U("sso-token-abc123"));
6
7api->lockComment(tenantId, commentId, broadcastId, sso)
8.then([](pplx::task<std::shared_ptr<LockComment_200_response>> task){
9 try {
10 auto resp = task.get();
11 if (!resp) resp = std::make_shared<LockComment_200_response>();
12 } catch (const std::exception&) {
13 }
14});
15

patchDomainConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
domainToUpdate string Yes
patchDomainConfigParams PatchDomainConfigParams Yes

Response

Returns: GetDomainConfig_200_response

Example

patchDomainConfig Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t domainToUpdate = U("comments.example.com");
4PatchDomainConfigParams patchParams;
5patchParams.allowComments = boost::optional<bool>(true);
6patchParams.moderationMode = boost::optional<utility::string_t>(U("pre-moderation"));
7auto fallback = std::make_shared<GetDomainConfig_200_response>();
8api->patchDomainConfig(tenantId, domainToUpdate, patchParams)
9.then([fallback](pplx::task<std::shared_ptr<GetDomainConfig_200_response>> t)
10{
11 try
12 {
13 auto resp = t.get();
14 if(!resp) resp = fallback;
15 (void)resp;
16 }
17 catch(const std::exception &)
18 {
19 auto resp = fallback;
20 (void)resp;
21 }
22});
23

patchPage Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateAPIPageData UpdateAPIPageData Yes

Response

Returns: PatchPageAPIResponse

Example

patchPage Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t pageId = U("page-987");
4UpdateAPIPageData updateData;
5updateData.title = boost::optional<utility::string_t>(U("Updated Comments Page"));
6updateData.path = boost::optional<utility::string_t>(U("/products/widget-123/comments"));
7updateData.isPublished = boost::optional<bool>(true);
8api->patchPage(tenantId, pageId, updateData)
9.then([](std::shared_ptr<PatchPageAPIResponse> resp) {
10 if (resp) {
11 auto updatedCopy = std::make_shared<PatchPageAPIResponse>(*resp);
12 }
13});
14

patchSSOUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateAPISSOUserData UpdateAPISSOUserData Yes
updateComments bool No

Response

Returns: PatchSSOUserAPIResponse

Example

patchSSOUser Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t id = U("user@example.com");
4auto updatePtr = std::make_shared<UpdateAPISSOUserData>();
5updatePtr->setEmail(U("user@example.com"));
6updatePtr->setDisplayName(U("Jane Doe"));
7boost::optional<bool> updateComments = boost::optional<bool>(true);
8api->patchSSOUser(tenantId, id, *updatePtr, updateComments)
9.then([](pplx::task<std::shared_ptr<PatchSSOUserAPIResponse>> task){
10 try {
11 auto resp = task.get();
12 (void)resp;
13 } catch (const std::exception &e) {
14 (void)e;
15 }
16});
17

pinComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
broadcastId string Yes
sso string No

Response

Returns: PinComment_200_response

Example

pinComment Example
Copy Copy
1
2boost::optional<utility::string_t> sso(U("user@example.com"));
3api->pinComment(U("my-tenant-123"), U("cmt-456"), U("broadcast-789"), sso)
4.then([](pplx::task<std::shared_ptr<PinComment_200_response>> task){
5 try {
6 auto resp = task.get();
7 auto result = resp ? resp : std::make_shared<PinComment_200_response>();
8 std::cout << "pinComment completed successfully\n";
9 } catch (const std::exception& e) {
10 std::cerr << "pinComment failed: " << e.what() << '\n';
11 }
12});
13

putDomainConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
domainToUpdate string Yes
updateDomainConfigParams UpdateDomainConfigParams Yes

Response

Returns: GetDomainConfig_200_response

Example

putDomainConfig Example
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3auto domainToUpdate = utility::string_t(U("mydomain.com"));
4auto updateParams = std::make_shared<UpdateDomainConfigParams>();
5updateParams->enabled = true;
6updateParams->contactEmail = boost::optional<utility::string_t>(U("admin@mydomain.com"));
7updateParams->allowedOrigins = std::vector<utility::string_t>{ U("https://www.mydomain.com"), U("https://dashboard.mydomain.com") };
8
9api->putDomainConfig(tenantId, domainToUpdate, *updateParams)
10.then([](pplx::task<std::shared_ptr<GetDomainConfig_200_response>> task){
11 try {
12 auto resp = task.get();
13 if (resp) {
14 std::cout << "Domain config updated for tenant\n";
15 }
16 } catch (const std::exception& e) {
17 std::cerr << "Failed to update domain config: " << e.what() << '\n';
18 }
19});
20

putSSOUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateAPISSOUserData UpdateAPISSOUserData Yes
updateComments bool No

Response

Returns: PutSSOUserAPIResponse

Example

putSSOUser Example
Copy Copy
1
2UpdateAPISSOUserData ssoData;
3ssoData.email = utility::string_t("user@example.com");
4ssoData.name = utility::string_t("Jane Doe");
5boost::optional<bool> updateComments = true;
6api->putSSOUser(utility::string_t("my-tenant-123"), utility::string_t("user@example.com"), ssoData, updateComments)
7.then([](pplx::task<std::shared_ptr<PutSSOUserAPIResponse>> task){
8 try {
9 auto resp = task.get();
10 auto result = resp ? std::make_shared<PutSSOUserAPIResponse>(*resp) : std::shared_ptr<PutSSOUserAPIResponse>();
11 (void)result;
12 } catch(const std::exception &e) {
13 (void)e;
14 }
15});
16

reactFeedPostPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
postId string Yes
reactBodyParams ReactBodyParams Yes
isUndo bool No
broadcastId string No
sso string No

Response

Returns: ReactFeedPostPublic_200_response

Example

reactFeedPostPublic Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t postId = U("post-9876");
4auto reactBodyPtr = std::make_shared<ReactBodyParams>();
5boost::optional<bool> isUndo = false;
6boost::optional<utility::string_t> broadcastId = U("broadcast-2025");
7boost::optional<utility::string_t> sso = U("user@example.com");
8api->reactFeedPostPublic(tenantId, postId, *reactBodyPtr, isUndo, broadcastId, sso)
9.then([](std::shared_ptr<ReactFeedPostPublic_200_response> resp){
10 (void)resp;
11});
12

resetUserNotificationCount Internal Link

Parameters

Name Type Required Description
tenantId string Yes
sso string No

Response

Returns: ResetUserNotifications_200_response

Example

resetUserNotificationCount Example
Copy Copy
1
2utility::string_t tenantId = utility::conversions::to_string_t("my-tenant-123");
3boost::optional<utility::string_t> sso = utility::conversions::to_string_t("user@example.com");
4auto result = api->resetUserNotificationCount(tenantId, sso)
5 .then([](std::shared_ptr<ResetUserNotifications_200_response> resp){
6 if (!resp) resp = std::make_shared<ResetUserNotifications_200_response>();
7 return resp;
8 }).get();
9

resetUserNotifications Internal Link

Parameters

Name Type Required Description
tenantId string Yes
afterId string No
afterCreatedAt int64_t No
unreadOnly bool No
dmOnly bool No
noDm bool No
sso string No

Response

Returns: ResetUserNotifications_200_response

Example

resetUserNotifications Example
Copy Copy
1
2utility::string_t tenantId = utility::conversions::to_string_t("my-tenant-123");
3boost::optional<utility::string_t> afterId(utility::conversions::to_string_t("notification-987"));
4boost::optional<int64_t> afterCreatedAt(1672531200LL);
5boost::optional<bool> unreadOnly(true);
6boost::optional<bool> dmOnly(false);
7boost::optional<bool> noDm;
8boost::optional<utility::string_t> sso(utility::conversions::to_string_t("sso-jwt-abc123"));
9auto defaultResp = std::make_shared<ResetUserNotifications_200_response>();
10api->resetUserNotifications(tenantId, afterId, afterCreatedAt, unreadOnly, dmOnly, noDm, sso)
11.then([defaultResp](std::shared_ptr<ResetUserNotifications_200_response> resp){
12 auto result = resp ? resp : defaultResp;
13 (void)result;
14});
15

saveComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createCommentParams CreateCommentParams Yes
isLive bool No
doSpamCheck bool No
sendEmails bool No
populateNotifications bool No

Response

Returns: SaveComment_200_response

Example

saveComment Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3CreateCommentParams createParams;
4createParams.body = U("This is a test comment from the C++ SDK");
5createParams.authorEmail = U("user@example.com");
6createParams.threadId = U("thread-456");
7boost::optional<bool> isLive(true);
8boost::optional<bool> doSpamCheck(false);
9boost::optional<bool> sendEmails(true);
10boost::optional<bool> populateNotifications(true);
11api->saveComment(tenantId, createParams, isLive, doSpamCheck, sendEmails, populateNotifications)
12.then([](pplx::task<std::shared_ptr<SaveComment_200_response>> task){
13 try {
14 auto resp = task.get();
15 if (resp) {
16 auto copy = std::make_shared<SaveComment_200_response>(*resp);
17 }
18 } catch (...) {
19 }
20});
21

searchUsers Internal Link

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
usernameStartsWith string Yes
mentionGroupIds vector<string No
sso string No

Response

Returns: SearchUsers_200_response

Example

searchUsers Example
Copy Copy
1
2utility::string_t tenantId = utility::conversions::to_string_t("my-tenant-123");
3utility::string_t urlId = utility::conversions::to_string_t("article-456");
4utility::string_t usernameStartsWith = utility::conversions::to_string_t("john");
5boost::optional<std::vector<utility::string_t>> mentionGroupIds = std::vector<utility::string_t>{
6 utility::conversions::to_string_t("editors"),
7 utility::conversions::to_string_t("staff")
8};
9boost::optional<utility::string_t> sso = utility::conversions::to_string_t("google");
10api->searchUsers(tenantId, urlId, usernameStartsWith, mentionGroupIds, sso)
11.then([](pplx::task<std::shared_ptr<SearchUsers_200_response>> task){
12 try {
13 auto resp = task.get();
14 (void)resp;
15 } catch (const std::exception& e) {
16 auto fallback = std::make_shared<SearchUsers_200_response>();
17 (void)fallback; (void)e;
18 }
19});
20

setCommentText Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
broadcastId string Yes
commentTextUpdateRequest CommentTextUpdateRequest Yes
editKey string No
sso string No

Response

Returns: SetCommentText_200_response

Example

setCommentText Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("cmt-456789");
4utility::string_t broadcastId = U("broadcast-001");
5CommentTextUpdateRequest req;
6req.text = U("Thanks — updated comment text with additional context.");
7boost::optional<utility::string_t> editKey = boost::optional<utility::string_t>(U("editKey-abc123"));
8boost::optional<utility::string_t> sso = boost::none;
9api->setCommentText(tenantId, commentId, broadcastId, req, editKey, sso)
10.then([](std::shared_ptr<SetCommentText_200_response> resp){
11 std::cout << "SetCommentText completed, response present: " << (resp ? "yes" : "no") << std::endl;
12});
13

unBlockCommentPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
publicBlockFromCommentParams PublicBlockFromCommentParams Yes
sso string No

Response

Returns: UnBlockCommentPublic_200_response

Example

unBlockCommentPublic Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("comment-456");
4PublicBlockFromCommentParams publicBlockFromCommentParams;
5boost::optional<utility::string_t> sso = boost::optional<utility::string_t>(utility::string_t(U("sso-token-abc123")));
6
7api->unBlockCommentPublic(tenantId, commentId, publicBlockFromCommentParams, sso)
8.then([](pplx::task<std::shared_ptr<UnBlockCommentPublic_200_response>> t) {
9 try {
10 auto response = t.get();
11 if (!response) {
12 response = std::make_shared<UnBlockCommentPublic_200_response>();
13 }
14 } catch (const std::exception& e) {
15 }
16});
17

unBlockUserFromComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
unBlockFromCommentParams UnBlockFromCommentParams Yes
userId string No
anonUserId string No

Response

Returns: UnBlockCommentPublic_200_response

Example

unBlockUserFromComment Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t id = U("comment-789");
4auto params = std::make_shared<UnBlockFromCommentParams>();
5boost::optional<utility::string_t> userId(U("user@example.com"));
6boost::optional<utility::string_t> anonUserId(U("anon-abc-123"));
7api->unBlockUserFromComment(tenantId, id, *params, userId, anonUserId)
8.then([](pplx::task<std::shared_ptr<UnBlockCommentPublic_200_response>> t){
9 try {
10 auto resp = t.get();
11 (void)resp;
12 } catch (const std::exception &e) {
13 (void)e;
14 }
15});
16

unFlagComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
userId string No
anonUserId string No

Response

Returns: FlagComment_200_response

Example

unFlagComment Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("cmt-456789");
4boost::optional<utility::string_t> userId = boost::optional<utility::string_t>(U("user@example.com"));
5boost::optional<utility::string_t> anonUserId = boost::none;
6auto task = api->unFlagComment(tenantId, commentId, userId, anonUserId)
7 .then([](pplx::task<std::shared_ptr<FlagComment_200_response>> t){
8 try {
9 auto resp = t.get();
10 auto finalResp = resp ? resp : std::make_shared<FlagComment_200_response>();
11 (void)finalResp;
12 } catch (const std::exception& e) {
13 (void)e;
14 }
15 });
16

unLockComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
broadcastId string Yes
sso string No

Response

Returns: LockComment_200_response

Example

unLockComment Example
Copy Copy
1
2boost::optional<utility::string_t> sso(U("sso-token-abc123"));
3api->unLockComment(U("my-tenant-123"), U("cmt-456"), U("broadcast-789"), sso)
4.then([](pplx::task<std::shared_ptr<LockComment_200_response>> t){
5 try {
6 auto resp = t.get();
7 auto result = resp ? resp : std::make_shared<LockComment_200_response>();
8 (void)result;
9 } catch (...) {
10 }
11});
12

unPinComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
broadcastId string Yes
sso string No

Response

Returns: PinComment_200_response

Example

unPinComment Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("cmt-98765");
4utility::string_t broadcastId = U("broadcast-2025-11-20");
5boost::optional<utility::string_t> sso = boost::optional<utility::string_t>(U("user@example.com"));
6api->unPinComment(tenantId, commentId, broadcastId, sso)
7.then([](pplx::task<std::shared_ptr<PinComment_200_response>> task){
8 try {
9 auto resp = task.get();
10 auto result = resp ? resp : std::make_shared<PinComment_200_response>();
11 (void)result;
12 } catch (const std::exception&) {
13 }
14});
15

updateComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updatableCommentParams UpdatableCommentParams Yes
contextUserId string No
doSpamCheck bool No
isLive bool No

Response

Returns: FlagCommentPublic_200_response

Example

updateComment Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("cmt-456789");
4auto paramsPtr = std::make_shared<UpdatableCommentParams>();
5paramsPtr->content = U("Clarified the point about API usage and fixed a typo.");
6boost::optional<utility::string_t> contextUserId = U("moderator@example.com");
7boost::optional<bool> doSpamCheck = true;
8boost::optional<bool> isLive = false;
9api->updateComment(tenantId, commentId, *paramsPtr, contextUserId, doSpamCheck, isLive)
10.then([](pplx::task<std::shared_ptr<FlagCommentPublic_200_response>> t){
11 try {
12 auto resp = t.get();
13 if (resp) std::cout << "Comment updated successfully\n";
14 else std::cout << "No response received\n";
15 } catch (const std::exception &e) {
16 std::cerr << "Update failed: " << e.what() << std::endl;
17 }
18});
19

updateFeedPost Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
feedPost FeedPost Yes

Response

Returns: FlagCommentPublic_200_response

Example

updateFeedPost Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t postId = U("post-456");
4FeedPost feedPost;
5feedPost.title = U("Scheduled maintenance");
6feedPost.content = U("We'll be updating servers at 00:00 UTC.");
7feedPost.authorEmail = U("admin@my-domain.com");
8feedPost.authorDisplayName = boost::optional<utility::string_t>(U("Site Admin"));
9feedPost.pinned = boost::optional<bool>(false);
10api->updateFeedPost(tenantId, postId, feedPost)
11.then([](pplx::task<std::shared_ptr<FlagCommentPublic_200_response>> t){
12 try {
13 auto resp = t.get();
14 auto safeResp = resp ? resp : std::make_shared<FlagCommentPublic_200_response>();
15 if (safeResp) std::cout << "Feed post updated successfully\n";
16 else std::cout << "Update returned empty response\n";
17 } catch (const std::exception &e) {
18 std::cerr << "Update failed: " << e.what() << '\n';
19 }
20});
21

updateFeedPostPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
postId string Yes
updateFeedPostParams UpdateFeedPostParams Yes
broadcastId string No
sso string No

Response

Returns: CreateFeedPostPublic_200_response

Example

updateFeedPostPublic Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t postId = U("post-456");
4auto updateParams = std::make_shared<UpdateFeedPostParams>();
5boost::optional<utility::string_t> broadcastId = boost::optional<utility::string_t>(U("broadcast-789"));
6boost::optional<utility::string_t> sso = boost::optional<utility::string_t>(U("user@example.com"));
7
8api->updateFeedPostPublic(tenantId, postId, *updateParams, broadcastId, sso)
9.then([](pplx::task<std::shared_ptr<CreateFeedPostPublic_200_response>> task) {
10 try {
11 auto response = task.get();
12 (void)response;
13 } catch (const std::exception &e) {
14 throw;
15 }
16});
17

updateUserBadge Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateUserBadgeParams UpdateUserBadgeParams Yes

Response

Returns: UpdateUserBadge_200_response

Example

updateUserBadge Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t id = U("user-9876");
4auto paramsPtr = std::make_shared<UpdateUserBadgeParams>();
5paramsPtr->name = utility::string_t(U("Community Moderator"));
6paramsPtr->color = utility::string_t(U("#4CAF50"));
7boost::optional<utility::string_t> note = boost::optional<utility::string_t>(U("Recognized contributor"));
8paramsPtr->note = note;
9paramsPtr->active = true;
10api->updateUserBadge(tenantId, id, *paramsPtr)
11 .then([](pplx::task<std::shared_ptr<UpdateUserBadge_200_response>> task) {
12 try {
13 auto resp = task.get();
14 (void)resp;
15 } catch (...) {
16 }
17 });
18

updateUserNotificationCommentSubscriptionStatus Internal Link

Parameters

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

Response

Returns: UpdateUserNotificationStatus_200_response

Example

updateUserNotificationCommentSubscriptionStatus Example
Copy Copy
1
2utility::string_t tenantId = utility::conversions::to_string_t("my-tenant-123");
3utility::string_t notificationId = utility::conversions::to_string_t("notif-456");
4utility::string_t optedInOrOut = utility::conversions::to_string_t("opted_in");
5utility::string_t commentId = utility::conversions::to_string_t("comment-789");
6boost::optional<utility::string_t> sso = boost::optional<utility::string_t>(utility::conversions::to_string_t("sso-jwt-token-abc123"));
7api->updateUserNotificationCommentSubscriptionStatus(tenantId, notificationId, optedInOrOut, commentId, sso)
8.then([](pplx::task<std::shared_ptr<UpdateUserNotificationStatus_200_response>> t) {
9 try {
10 auto resp = t.get();
11 if (resp) std::cout << "Subscription updated successfully\n";
12 else std::cout << "No response\n";
13 } catch (const std::exception& e) {
14 std::cout << "Error: " << e.what() << '\n';
15 }
16});
17

updateUserNotificationPageSubscriptionStatus Internal Link

Parameters

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

Response

Returns: UpdateUserNotificationStatus_200_response

Example

updateUserNotificationPageSubscriptionStatus Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t urlId = U("page-456");
4utility::string_t url = U("https://www.example.com/articles/fastcomments-integration");
5utility::string_t pageTitle = U("FastComments Integration Guide");
6utility::string_t subscribedOrUnsubscribed = U("subscribed");
7boost::optional<utility::string_t> sso = boost::optional<utility::string_t>(U("sso-token-74a9"));
8api->updateUserNotificationPageSubscriptionStatus(tenantId, urlId, url, pageTitle, subscribedOrUnsubscribed, sso)
9 .then([](pplx::task<std::shared_ptr<UpdateUserNotificationStatus_200_response>> task){
10 try {
11 auto resp = task.get();
12 if (!resp) {
13 auto fallback = std::make_shared<UpdateUserNotificationStatus_200_response>();
14 (void)fallback;
15 } else {
16 (void)resp;
17 }
18 } catch (const std::exception& e) {
19 (void)e;
20 }
21 });
22

updateUserNotificationStatus Internal Link

Parameters

Name Type Required Description
tenantId string Yes
notificationId string Yes
newStatus string Yes
sso string No

Response

Returns: UpdateUserNotificationStatus_200_response

Example

updateUserNotificationStatus Example
Copy Copy
1
2utility::string_t tenantId = utility::string_t("my-tenant-123");
3utility::string_t notificationId = utility::string_t("notif-98765");
4utility::string_t newStatus = utility::string_t("read");
5boost::optional<utility::string_t> sso = boost::optional<utility::string_t>(utility::string_t("user@example.com"));
6
7api->updateUserNotificationStatus(tenantId, notificationId, newStatus, sso)
8.then([](pplx::task<std::shared_ptr<UpdateUserNotificationStatus_200_response>> task) {
9 try {
10 auto resp = task.get();
11 auto safeResp = resp ? resp : std::make_shared<UpdateUserNotificationStatus_200_response>();
12 (void)safeResp;
13 } catch (...) {
14 }
15}).wait();
16

uploadImage Internal Link

Parameters

Name Type Required Description
tenantId string Yes
file HttpContent Yes
sizePreset SizePreset No
urlId string No

Response

Returns: UploadImageResponse

Example

uploadImage Example
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3auto fileContent = std::make_shared<HttpContent>(U("avatar.png"), U("image/png"));
4boost::optional<SizePreset> sizePreset = boost::optional<SizePreset>(SizePreset::MEDIUM);
5boost::optional<utility::string_t> urlId = boost::optional<utility::string_t>(U("profile-avatar"));
6api->uploadImage(tenantId, *fileContent, sizePreset, urlId)
7.then([](std::shared_ptr<UploadImageResponse> resp){
8 if (resp) std::cout << "Image uploaded successfully" << std::endl;
9 else std::cerr << "Image upload returned no response" << std::endl;
10});
11

voteComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
urlId string Yes
broadcastId string Yes
voteBodyParams VoteBodyParams Yes
sessionId string No
sso string No

Response

Returns: VoteComment_200_response

Example

voteComment Example
Copy Copy
1
2VoteBodyParams voteBodyParams;
3boost::optional<utility::string_t> sessionId(U("sess-7f8e-7a9b"));
4boost::optional<utility::string_t> sso(U("user@example.com"));
5api->voteComment(U("my-tenant-123"), U("cmt-98765"), U("url-456"), U("br-222"), voteBodyParams, sessionId, sso)
6.then([](pplx::task<std::shared_ptr<VoteComment_200_response>> task){
7 try {
8 auto resp = task.get();
9 auto ack = std::make_shared<utility::string_t>(U("vote-recorded"));
10 (void)ack;
11 } catch(...) {
12 }
13});
14

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.