FastComments.com

FastComments C++ SDK


Това е официалното C++ SDK за FastComments.

Официално C++ SDK за FastComments API

Репозитория

Преглед в GitHub


Изисквания Internal Link


  • C++17 или по-нова версия
  • CMake 3.14 или по-нова версия
  • OpenSSL
  • C++ REST SDK (cpprestsdk)
  • Boost
  • Google Test (автоматично се изтегля за тестване)

Инсталиране 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

Тази библиотека съдържа генерирания API клиент и SSO инструментите, които улесняват работата с API-то.

Public vs Secured APIs

За API клиента има три класа, DefaultApi, PublicApi и ModerationApi. DefaultApi съдържа методи, които изискват вашия API ключ, а PublicApi съдържа методи, които могат да бъдат извикани директно от браузър/мобилно устройство и т.н. без автентикация. ModerationApi предоставя обширен набор от живи и бързи API за модериране. Всеки метод на ModerationApi приема параметър sso и може да се автентицира чрез SSO или бисквитка за сесия от FastComments.com.

Забележки Internal Link

Идентификатори на излъчване

Ще видите, че трябва да подадете broadcastId в някои API повиквания. Когато получавате събития, ще получите този идентификатор обратно, така че да знаете да игнорирате събитието, ако планирате да приложите промените оптимистично на клиента (което вероятно ще искате да направите, тъй като това осигурява най-доброто изживяване). Подайте UUID тук. Идентификаторът трябва да бъде достатъчно уникален, за да не се появи два пъти в една браузърна сесия.

SSO (Единно влизане)

За примери за SSO вижте по-долу.

Използване на SSO Internal Link

Просто 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;
}

Сигурно 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;
}

Агрегиране Internal Link

Агрегира документи чрез групиране (ако се предостави groupBy) и прилагане на множество операции.
Поддържат се различни операции (напр. sum, countDistinct, avg и др.).

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
aggregationRequestAggregationRequestYes
optionsconst AggregateOptions&Yes

Отговор

Връща: AggregateResponse

Пример

Пример за агрегиране
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3
4AggregationRequest aggregationRequest;
5aggregationRequest.setMetric(U("commentCount"));
6aggregationRequest.setStartDate(U("2023-01-01T00:00:00Z"));
7aggregationRequest.setEndDate(U("2023-12-31T23:59:59Z"));
8aggregationRequest.setFilters({ U("status:approved") });
9
10AggregateOptions options;
11options.limit = boost::optional<int>(100);
12options.includeMetadata = boost::optional<bool>(true);
13
14api->aggregate(tenantId, aggregationRequest, options)
15 .then([](pplx::task<std::shared_ptr<AggregateResponse>> task) {
16 try {
17 auto response = task.get();
18 // обработи отговора
19 } catch (const std::exception& e) {
20 // обработи грешка
21 }
22 });
23

Вземи одитни записи Internal Link

Parameters

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetAuditLogsOptions&Да

Response

Връща: GetAuditLogsResponse

Example

getAuditLogs Пример
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3
4GetAuditLogsOptions options;
5options.startDate = boost::optional<utility::datetime>(utility::datetime::from_string(U("2023-01-01T00:00:00Z"), utility::datetime::RFC_1123));
6options.endDate = boost::optional<utility::datetime>(utility::datetime::from_string(U("2023-01-31T23:59:59Z"), utility::datetime::RFC_1123));
7options.limit = boost::optional<int>(100);
8
9api->getAuditLogs(tenantId, options).then([](pplx::task<std::shared_ptr<GetAuditLogsResponse>> t) {
10 try {
11 auto response = t.get();
12 // използвайте отговора
13 } catch (const std::exception& e) {
14 // обработете грешката
15 }
16});
17

Излизане (публично) Internal Link

Отговор

Връща: APIEmptyResponse

Пример

Пример за logoutPublic
Copy Copy
1
2api->logoutPublic()
3 .then([](std::shared_ptr<APIEmptyResponse> /*resp*/) {
4 std::cout << "Logout successful\n";
5 })
6 .then([](pplx::task<void> t) {
7 try {
8 t.get();
9 } catch (const std::exception& e) {
10 std::cerr << "Logout failed: " << e.what() << std::endl;
11 }
12 });
13

Блокирай по коментар (публично) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
commentIdstringДа
publicBlockFromCommentParamsPublicBlockFromCommentParamsДа
ssostringНе

Отговор

Връща: BlockSuccess

Пример

blockFromCommentPublic Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto commentId = utility::conversions::to_string_t("comment-987654");
4PublicBlockFromCommentParams blockParams;
5blockParams.reason = utility::conversions::to_string_t("spam");
6blockParams.durationHours = 24;
7boost::optional<utility::string_t> sso = utility::conversions::to_string_t("sso-token-abc123");
8api->blockFromCommentPublic(tenantId, commentId, blockParams, sso)
9 .then([](std::shared_ptr<BlockSuccess> result){
10 auto successCopy = std::make_shared<BlockSuccess>(*result);
11 });
12

Премахни блокиране на коментар (публично) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
commentIdstringДа
publicBlockFromCommentParamsPublicBlockFromCommentParamsДа
ssostringНе

Отговор

Връща: UnblockSuccess

Пример

unBlockCommentPublic Пример
Copy Copy
1
2auto blockParams = PublicBlockFromCommentParams();
3blockParams.reason = U("spam");
4api->unBlockCommentPublic(
5 U("my-tenant-123"),
6 U("comment-789"),
7 blockParams,
8 boost::optional<utility::string_t>(U("sso-token-abc"))
9).then([](std::shared_ptr<UnblockSuccess> result){ });
10

Проверка за блокирани коментари Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
commentIdsstringДа
ssostringНе

Отговор

Връща: CheckBlockedCommentsResponse

Пример

checkedCommentsForBlocked Пример
Copy Copy
1
2auto tenantId = U("my-tenant-123");
3auto commentIds = U("cmt-001,cmt-002");
4boost::optional<utility::string_t> sso = U("user@example.com");
5
6api->checkedCommentsForBlocked(tenantId, commentIds, sso).then([](std::shared_ptr<CheckBlockedCommentsResponse> resp){
7 (void)resp;
8});
9

Блокирай потребител от коментар Internal Link

Parameters

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа
blockFromCommentParamsBlockFromCommentParamsДа
optionsconst BlockUserFromCommentOptions&Да

Отговор

Връща: BlockSuccess

Пример

blockUserFromComment пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto commentId = utility::conversions::to_string_t("comment-789");
4BlockFromCommentParams params;
5params.reason = utility::conversions::to_string_t("Inappropriate content");
6params.durationDays = boost::optional<int>(30);
7BlockUserFromCommentOptions options;
8options.notifyUser = boost::optional<bool>(true);
9
10api->blockUserFromComment(tenantId, commentId, params, options)
11 .then([](std::shared_ptr<BlockSuccess> result){ })
12 .then([](pplx::task<void> t){ try { t.get(); } catch (const std::exception&) { } });
13

Създай коментар (публично) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
urlIdstringYes
broadcastIdstringYes
commentDataCommentDataYes
optionsconst CreateCommentPublicOptions&Yes

Отговор

Връща: SaveCommentsResponseWithPresence

Пример

createCommentPublic Пример
Copy Copy
1
2auto comment = CommentData();
3comment.body = U("This is a test comment");
4comment.authorName = U("John Doe");
5comment.authorEmail = U("john.doe@example.com");
6
7CreateCommentPublicOptions opts;
8opts.replyToCommentId = boost::optional<utility::string_t>(U("parent-123"));
9
10api->createCommentPublic(
11 U("my-tenant-123"),
12 U("article-456"),
13 U("broadcast-789"),
14 comment,
15 opts).then([](std::shared_ptr<SaveCommentsResponseWithPresence> res){
16 auto commentId = res->commentId;
17 });
18

Изтрий коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа
optionsconst DeleteCommentOptions&Да

Отговор

Връща: DeleteCommentResult

Пример

Пример за deleteComment
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto commentId = utility::conversions::to_string_t("comment-789");
4DeleteCommentOptions options;
5options.reason = boost::optional<utility::string_t>(utility::conversions::to_string_t("Inappropriate content"));
6options.force = boost::optional<bool>(true);
7api->deleteComment(tenantId, commentId, options).then([](pplx::task<std::shared_ptr<DeleteCommentResult>> task){
8 try{
9 auto result = task.get();
10 }catch(const std::exception&){
11 }
12});
13

Изтрий коментар (публично) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
commentIdstringYes
broadcastIdstringYes
optionsconst DeleteCommentPublicOptions&Yes

Отговор

Връща: PublicAPIDeleteCommentResponse

Пример

deleteCommentPublic Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3auto commentId = utility::string_t(U("comment-456"));
4auto broadcastId = utility::string_t(U("broadcast-789"));
5DeleteCommentPublicOptions options;
6options.force = boost::optional<bool>(true);
7options.reason = boost::optional<utility::string_t>(U("Inappropriate content"));
8api->deleteCommentPublic(tenantId, commentId, broadcastId, options)
9 .then([](pplx::task<std::shared_ptr<PublicAPIDeleteCommentResponse>> t){
10 try{
11 auto resp = t.get();
12 }catch(const std::exception& e){
13 }
14 });
15

Изтрий глас за коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
commentIdstringДа
voteIdstringДа
urlIdstringДа
broadcastIdstringДа
optionsconst DeleteCommentVoteOptions&Да

Отговор

Връща: VoteDeleteResponse

Пример

deleteCommentVote Пример
Copy Copy
1
2auto options = DeleteCommentVoteOptions{};
3options.reason = boost::optional<utility::string_t>(U("spam"));
4options.adminOverride = boost::optional<bool>(true);
5
6api->deleteCommentVote(
7 U("my-tenant-123"),
8 U("cmt-456789"),
9 U("vote-987"),
10 U("url-abc123"),
11 U("broadcast-001"),
12 options
13).then([](std::shared_ptr<VoteDeleteResponse> resp){
14 if (resp) {
15 std::cout << "Deleted vote, code: " << resp->code << std::endl;
16 }
17});
18

Маркирай коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа
optionsconst FlagCommentOptions&Да

Отговор

Връща: FlagCommentResponse

Пример

Пример за flagComment
Copy Copy
1
2auto opts = std::make_shared<FlagCommentOptions>();
3opts->reason = utility::conversions::to_string_t("spam");
4opts->note = boost::optional<utility::string_t>(utility::conversions::to_string_t("User posted duplicate links"));
5
6api->flagComment(utility::conversions::to_string_t("my-tenant-123"),
7 utility::conversions::to_string_t("comment-456"),
8 *opts)
9 .then([](pplx::task<std::shared_ptr<FlagCommentResponse>> t) {
10 auto resp = t.get();
11 });
12

Вземи коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа

Отговор

Връща: APIGetCommentResponse

Пример

Пример за getComment
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto commentId = utility::conversions::to_string_t("comment-456");
4boost::optional<int> maxDepth = boost::none;
5api->getComment(tenantId, commentId).then([](pplx::task<std::shared_ptr<APIGetCommentResponse>> t){
6 try{
7 auto resp = t.get();
8 }catch(const std::exception&){
9 }
10});
11

Вземи коментари Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
optionsconst GetCommentsOptions&Yes

Отговор

Връща: APIGetCommentsResponse

Пример

Пример getComments
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3GetCommentsOptions options;
4options.page = 1;
5options.limit = 50;
6options.sort = U("newest");
7options.authorEmail = boost::optional<utility::string_t>(U("user@example.com"));
8api->getComments(tenantId, options).then([](pplx::task<std::shared_ptr<APIGetCommentsResponse>> task) {
9 try {
10 auto response = task.get();
11 // използвайте отговора по необходимост
12 } catch (const std::exception& e) {
13 // обработете грешката
14 }
15});
16

Вземи коментари (публично) Internal Link

req tenantId urlId

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
urlIdstringYes
optionsconst GetCommentsPublicOptions&Yes

Отговор

Връща: GetCommentsResponseWithPresence_PublicComment_

Пример

getCommentsPublic Пример
Copy Copy
1
2auto tenantId = U("my-tenant-123");
3auto urlId = U("article-456");
4GetCommentsPublicOptions opts;
5opts.pageSize = 20;
6opts.includeDeleted = false;
7api->getCommentsPublic(tenantId, urlId, opts).then([](std::shared_ptr<GetCommentsResponseWithPresence_PublicComment_> resp) {
8 (void)resp;
9});
10

Вземи текст на коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
commentIdstringYes
optionsconst GetCommentTextOptions&Yes

Отговор

Връща: PublicAPIGetCommentTextResponse

Пример

getCommentText Пример
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("cmt-456789");
4auto options = std::make_shared<GetCommentTextOptions>();
5options->language = boost::optional<utility::string_t>(U("en"));
6options->includeDeleted = boost::optional<bool>(false);
7api->getCommentText(tenantId, commentId, *options).then([](pplx::task<std::shared_ptr<PublicAPIGetCommentTextResponse>> task){
8 try{
9 auto response = task.get();
10 (void)response;
11 }catch(...){}
12});
13

Вземи имена на потребители, гласували за коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
commentIdstringYes
dirint32_tYes
ssostringNo

Отговор

Връща: GetCommentVoteUserNamesSuccessResponse

Пример

Пример за getCommentVoteUserNames
Copy Copy
1
2auto task = api->getCommentVoteUserNames(
3 utility::conversions::to_string_t("my-tenant-123"),
4 utility::conversions::to_string_t("comment-456"),
5 static_cast<int32_t>(1),
6 boost::optional<utility::string_t>(utility::conversions::to_string_t("sso-token"))
7).then([](pplx::task<std::shared_ptr<GetCommentVoteUserNamesSuccessResponse>> t){
8 try{
9 auto response = t.get();
10 }catch(const std::exception&){ }
11});
12

Заключи коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
commentIdstringYes
broadcastIdstringYes
ssostringNo

Отговор

Връща: APIEmptyResponse

Пример

Пример за lockComment
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto commentId = utility::conversions::to_string_t("comment-987");
4auto broadcastId = utility::conversions::to_string_t("broadcast-654");
5boost::optional<utility::string_t> sso = utility::conversions::to_string_t("sso-token-xyz");
6
7api->lockComment(tenantId, commentId, broadcastId, sso).then([](pplx::task<std::shared_ptr<APIEmptyResponse>> task){
8 try{
9 auto response = task.get();
10 }catch(const std::exception&){
11 }
12});
13

Закачи коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
commentIdstringДа
broadcastIdstringДа
ssostringНе

Отговор

Връща: ChangeCommentPinStatusResponse

Пример

Пример за pinComment
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("comment-456");
4utility::string_t broadcastId = U("broadcast-789");
5boost::optional<utility::string_t> sso = U("sso-token-abc");
6
7api->pinComment(tenantId, commentId, broadcastId, sso)
8 .then([](pplx::task<std::shared_ptr<ChangeCommentPinStatusResponse>> task) {
9 try {
10 auto response = task.get();
11 } catch (const std::exception&) {
12 }
13 });
14

Запази коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
createCommentParamsCreateCommentParamsYes
optionsconst SaveCommentOptions&Yes

Отговор

Връща: APISaveCommentResponse

Пример

пример за saveComment
Copy Copy
1
2CreateCommentParams commentParams;
3commentParams.body = utility::string_t(U("Great article!"));
4commentParams.author = utility::string_t(U("jane.doe@example.com"));
5commentParams.parentId = boost::optional<utility::string_t>(utility::string_t(U("parent-789")));
6
7SaveCommentOptions options;
8options.preview = boost::optional<bool>(false);
9
10api->saveComment(utility::string_t(U("my-tenant-123")), commentParams, options)
11 .then([](std::shared_ptr<APISaveCommentResponse> response) {
12 auto commentId = response->commentId;
13 });
14

Задай текст на коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
commentIdstringДа
broadcastIdstringДа
commentTextUpdateRequestCommentTextUpdateRequestДа
optionsconst SetCommentTextOptions&Да

Отговор

Връща: PublicAPISetCommentTextResponse

Пример

setCommentText Пример
Copy Copy
1
2auto tenantId = U("my-tenant-123");
3auto commentId = U("cmt-456");
4auto broadcastId = U("brd-789");
5
6CommentTextUpdateRequest updateReq;
7updateReq.text = U("Updated comment content");
8updateReq.isEdited = boost::make_optional(true);
9
10SetCommentTextOptions opts;
11opts.notifySubscribers = boost::make_optional(true);
12
13api->setCommentText(tenantId, commentId, broadcastId, updateReq, opts)
14 .then([](std::shared_ptr<PublicAPISetCommentTextResponse> resp) {
15 });
16

Разблокирай потребител от коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes
unBlockFromCommentParamsUnBlockFromCommentParamsYes
optionsconst UnBlockUserFromCommentOptions&Yes

Отговор

Връща: UnblockSuccess

Пример

unBlockUserFromComment Пример
Copy Copy
1
2auto params = std::make_shared<UnBlockFromCommentParams>();
3params->commentId = U("cmt-12345");
4params->reason = U("resolved");
5UnBlockUserFromCommentOptions opts;
6opts.notifyUser = boost::optional<bool>(true);
7api->unBlockUserFromComment(U("my-tenant-123"), U("user-456"), *params, opts)
8 .then([](pplx::task<std::shared_ptr<UnblockSuccess>> t){
9 try{
10 auto result = t.get();
11 }catch(...){}
12 });
13

Премахни маркировка на коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа
optionsconst UnFlagCommentOptions&Да

Отговор

Връща: FlagCommentResponse

Пример

unFlagComment Пример
Copy Copy
1
2auto options = UnFlagCommentOptions{};
3options.reason = boost::optional<utility::string_t>(U("Resolved by moderator"));
4api->unFlagComment(U("my-tenant-123"), U("comment-456"), options)
5 .then([](std::shared_ptr<FlagCommentResponse> response) {
6 if (response) {
7 auto status = response->status;
8 // обработете статуса, ако е необходимо
9 }
10 })
11 .then([](pplx::task<void> previous) {
12 try {
13 previous.get();
14 } catch (const std::exception& e) {
15 // обработете грешката
16 }
17 });
18

Отключи коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
commentIdstringYes
broadcastIdstringYes
ssostringNo

Отговор

Връща: APIEmptyResponse

Пример

Пример за unLockComment
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto commentId = utility::conversions::to_string_t("cmt-456789");
4auto broadcastId = utility::conversions::to_string_t("broadcast-001");
5boost::optional<utility::string_t> sso = utility::conversions::to_string_t("john.doe@example.com");
6
7api->unLockComment(tenantId, commentId, broadcastId, sss).then([](pplx::task<std::shared_ptr<APIEmptyResponse>> task) {
8 try {
9 auto response = task.get();
10 } catch (const std::exception&) {
11 }
12});
13

Откачи коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
commentIdstringДа
broadcastIdstringДа
ssostringНе

Отговор

Връща: ChangeCommentPinStatusResponse

Пример

Пример за unPinComment
Copy Copy
1
2auto task = api->unPinComment(
3 utility::conversions::to_string_t("my-tenant-123"),
4 utility::conversions::to_string_t("cmt-456789"),
5 utility::conversions::to_string_t("broadcast-001"),
6 boost::optional<utility::string_t>(utility::conversions::to_string_t("user@example.com"))
7);
8task.then([](std::shared_ptr<ChangeCommentPinStatusResponse> resp){
9 auto result = std::make_shared<ChangeCommentPinStatusResponse>(*resp);
10});
11

Обнови коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes
updatableCommentParamsUpdatableCommentParamsYes
optionsconst UpdateCommentOptions&Yes

Отговор

Връща: APIEmptyResponse

Пример

Пример за updateComment
Copy Copy
1
2auto tenantId = utility::string_t("my-tenant-123");
3auto commentId = utility::string_t("cmt-789");
4UpdatableCommentParams updatable;
5updatable.body = utility::string_t("Edited comment content");
6updatable.isSpam = boost::optional<bool>(false);
7UpdateCommentOptions options;
8options.notify = boost::optional<bool>(true);
9api->updateComment(tenantId, commentId, updatable, options)
10 .then([](std::shared_ptr<APIEmptyResponse>) {})
11 .then([](pplx::task<void> t) { try { t.get(); } catch(const std::exception&) {} });
12

Гласувай за коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
commentIdstringДа
urlIdstringДа
broadcastIdstringДа
voteBodyParamsVoteBodyParamsДа
optionsconst VoteCommentOptions&Да

Отговор

Връща: VoteResponse

Пример

Пример за voteComment
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto commentId = utility::conversions::to_string_t("comment-7890");
4auto urlId = utility::conversions::to_string_t("article-456");
5auto broadcastId = utility::conversions::to_string_t("broadcast-321");
6
7VoteBodyParams voteParams;
8voteParams.upvote = true;
9voteParams.note = boost::optional<utility::string_t>(utility::conversions::to_string_t("Great insight"));
10
11VoteCommentOptions options;
12options.dryRun = boost::optional<bool>(false);
13
14api->voteComment(tenantId, commentId, urlId, broadcastId, voteParams, options)
15 .then([](pplx::task<std::shared_ptr<VoteResponse>> t) {
16 try {
17 auto response = t.get();
18 // обработка на отговора
19 } catch (const std::exception&) {
20 }
21 });
22

Вземи коментари за потребител Internal Link

Параметри

NameTypeRequiredDescription
optionsconst GetCommentsForUserOptions&Yes

Отговор

Връща: GetCommentsForUserResponse

Пример

Пример за getCommentsForUser
Copy Copy
1
2auto options = GetCommentsForUserOptions{
3 utility::conversions::to_string_t("my-tenant-123"),
4 utility::conversions::to_string_t("user@example.com"),
5 boost::optional<int>(50),
6 boost::optional<utility::string_t>(utility::conversions::to_string_t("next-page-token"))
7};
8
9api->getCommentsForUser(options).then([](pplx::task<std::shared_ptr<GetCommentsForUserResponse>> task){
10 try{
11 auto response = task.get();
12 }catch(const std::exception&){}
13});
14

Добави конфигурация на домейн Internal Link

Parameters

ИмеТипЗадължителноОписание
tenantIdstringДа
addDomainConfigParamsAddDomainConfigParamsДа

Response

Връща: AddDomainConfigResponse

Example

addDomainConfig Пример
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3AddDomainConfigParams params;
4params.domain = U("example.com");
5params.adminEmail = U("admin@example.com");
6params.notes = boost::optional<utility::string_t>(U("Primary domain"));
7api->addDomainConfig(tenantId, params).then([](pplx::task<std::shared_ptr<AddDomainConfigResponse>> task){
8 try{
9 auto response = task.get();
10 }catch(const std::exception&){
11 }
12});
13

Изтрий конфигурация на домейн Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
domainstringYes

Отговор

Връща: DeleteDomainConfigResponse

Пример

deleteDomainConfig Пример
Copy Copy
1
2boost::optional<utility::string_t> optTenant = U("my-tenant-123");
3boost::optional<utility::string_t> optDomain = U("example.com");
4
5api->deleteDomainConfig(optTenant.value(), optDomain.value())
6 .then([](pplx::task<std::shared_ptr<DeleteDomainConfigResponse>> task) {
7 try {
8 auto response = task.get();
9 } catch (const std::exception&) {
10 }
11 });
12

Вземи конфигурация на домейн Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
domainstringДа

Отговор

Връща: GetDomainConfigResponse

Пример

Пример за getDomainConfig
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t domain = U("myblog.example.com");
4
5api->getDomainConfig(tenantId, domain)
6 .then([](std::shared_ptr<GetDomainConfigResponse> response) {
7 if (!response) return;
8 boost::optional<bool> moderationEnabled = response->moderationEnabled;
9 boost::optional<std::string> theme = response->theme;
10 if (moderationEnabled && *moderationEnabled) {
11 // обработка на активирана модерация
12 }
13 if (theme) {
14 // използване на стойността на темата
15 }
16 })
17 .wait();
18

Вземи конфигурации на домейн Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа

Отговор

Връща: GetDomainConfigsResponse

Пример

Пример за getDomainConfigs
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3boost::optional<utility::string_t> optionalTenant = tenantId;
4api->getDomainConfigs(optionalTenant.value())
5 .then([](std::shared_ptr<GetDomainConfigsResponse> response) {
6 auto domains = response->getDomainList();
7 for (const auto& d : domains) {
8 std::cout << d << std::endl;
9 }
10 });
11

Частично обнови конфигурация на домейн Internal Link

Параметри

ИмеТипЗадължителенОписание
tenantIdstringДа
domainToUpdatestringДа
patchDomainConfigParamsPatchDomainConfigParamsДа

Отговор

Връща: PatchDomainConfigResponse

Пример

patchDomainConfig Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto domainToUpdate = utility::conversions::to_string_t("example.com");
4PatchDomainConfigParams patchDomainConfigParams;
5patchDomainConfigParams.enableComments = boost::optional<bool>(true);
6patchDomainConfigParams.moderationLevel = boost::optional<int>(2);
7patchDomainConfigParams.customHeader = boost::optional<utility::string_t>(utility::conversions::to_string_t("X-Custom-Header"));
8
9api->patchDomainConfig(tenantId, domainToUpdate, patchDomainConfigParams)
10 .then([](std::shared_ptr<PatchDomainConfigResponse> resp) {
11 // успешно обработване
12 })
13 .then([](pplx::task<void> t) {
14 try { t.get(); } catch (const std::exception& e) { /* обработка на грешка */ }
15 });
16

Задай конфигурация на домейн (PUT) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
domainToUpdatestringYes
updateDomainConfigParamsUpdateDomainConfigParamsYes

Отговор

Връща: PutDomainConfigResponse

Пример

putDomainConfig Пример
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t domainToUpdate = U("example.com");
4UpdateDomainConfigParams updateParams;
5updateParams.enableComments = true;
6updateParams.moderationLevel = boost::optional<int>(2);
7updateParams.customCss = boost::optional<utility::string_t>(U(".fc-comment{color:red;}"));
8api->putDomainConfig(tenantId, domainToUpdate, updateParams)
9 .then([](std::shared_ptr<PutDomainConfigResponse> resp) {
10 });
11

Създай имейл шаблон Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
createEmailTemplateBodyCreateEmailTemplateBodyДа

Отговор

Връща: CreateEmailTemplateResponse

Пример

createEmailTemplate Пример
Copy Copy
1
2auto body = std::make_shared<CreateEmailTemplateBody>();
3body->subject = utility::string_t("Welcome Email");
4body->htmlContent = utility::string_t("<h1>Welcome!</h1><p>Thanks for joining.</p>");
5body->fromEmail = utility::string_t("no-reply@myapp.com");
6body->replyTo = boost::optional<utility::string_t>(utility::string_t("support@myapp.com"));
7body->cc = boost::none;
8api->createEmailTemplate(utility::string_t("my-tenant-123"), *body)
9 .then([](std::shared_ptr<CreateEmailTemplateResponse> resp) {
10 std::cout << "Created template ID: " << resp->id << std::endl;
11 });
12

Изтрий имейл шаблон Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа

Отговор

Връща: APIEmptyResponse

Пример

deleteEmailTemplate Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto templateId = utility::conversions::to_string_t("welcome-email-template");
4boost::optional<utility::string_t> optTenantId = tenantId;
5boost::optional<utility::string_t> optTemplateId = templateId;
6api->deleteEmailTemplate(optTenantId.value(), optTemplateId.value())
7 .then([](pplx::task<std::shared_ptr<APIEmptyResponse>> t) {
8 try { t.get(); }
9 catch (const std::exception&) {}
10 });
11

Изтрий грешка при рендер на имейл шаблон Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes
errorIdstringYes

Отговор

Връща: APIEmptyResponse

Пример

Пример за deleteEmailTemplateRenderError
Copy Copy
1
2boost::optional<utility::string_t> optTemplateId = utility::conversions::to_string_t("template-456");
3api->deleteEmailTemplateRenderError(
4 utility::conversions::to_string_t("my-tenant-123"),
5 *optTemplateId,
6 utility::conversions::to_string_t("error-789"))
7 .then([](std::shared_ptr<APIEmptyResponse>) {})
8 .then([](pplx::task<void> t) {
9 try { t.get(); } catch (...) {}
10 });
11

Вземи имейл шаблон Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа

Отговор

Връща: GetEmailTemplateResponse

Пример

getEmailTemplate Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto templateId = utility::conversions::to_string_t("welcome-email");
4boost::optional<utility::string_t> language = utility::conversions::to_string_t("en-US");
5
6api->getEmailTemplate(tenantId, templateId)
7 .then([=](pplx::task<std::shared_ptr<GetEmailTemplateResponse>> task) {
8 try {
9 auto response = task.get();
10 } catch (const std::exception&) {
11 }
12 });
13

Вземи дефиниции на имейл шаблони Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа

Отговор

Връща: GetEmailTemplateDefinitionsResponse

Пример

Пример за getEmailTemplateDefinitions
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3api->getEmailTemplateDefinitions(tenantId).then([](pplx::task<std::shared_ptr<GetEmailTemplateDefinitionsResponse>> t) {
4 try {
5 auto resp = t.get();
6 boost::optional<utility::string_t> tmplName = resp ? resp->templateName : boost::none;
7 if (tmplName) {
8 std::cout << *tmplName << std::endl;
9 }
10 } catch (const std::exception& e) {
11 std::cerr << e.what() << std::endl;
12 }
13});
14

Вземи грешки при рендер на имейл шаблони Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes
skipdoubleNo

Отговор

Връща: GetEmailTemplateRenderErrorsResponse

Пример

Пример за getEmailTemplateRenderErrors
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t id = U("email-template-789");
4boost::optional<double> skip = 20.0;
5
6api->getEmailTemplateRenderErrors(tenantId, id, skip)
7 .then([](pplx::task<std::shared_ptr<GetEmailTemplateRenderErrorsResponse>> task) {
8 try {
9 auto response = task.get();
10 // Използвайте отговора според нужда
11 } catch (const std::exception& ex) {
12 // Обработете грешката
13 }
14 });
15

Вземи имейл шаблони Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
skipdoubleНе

Отговор

Връща: GetEmailTemplatesResponse

Пример

getEmailTemplates Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3boost::optional<double> skip = 10.0;
4api->getEmailTemplates(tenantId, skip)
5 .then([](std::shared_ptr<GetEmailTemplatesResponse> resp) {
6 (void)resp;
7 });
8

Рендерирай имейл шаблон Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
renderEmailTemplateBodyRenderEmailTemplateBodyДа
localestringНе

Отговор

Връща: RenderEmailTemplateResponse

Пример

Пример за renderEmailTemplate
Copy Copy
1
2auto body = RenderEmailTemplateBody();
3body.templateId = U("welcome-email");
4body.recipientEmail = U("user@example.com");
5boost::optional<utility::string_t> locale = U("en-US");
6
7api->renderEmailTemplate(U("my-tenant-123"), body, locale)
8 .then([](std::shared_ptr<RenderEmailTemplateResponse> resp) {
9 std::cout << "Email template rendered successfully\n";
10 });
11

Обнови имейл шаблон Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа
updateEmailTemplateBodyUpdateEmailTemplateBodyДа

Отговор

Връща: APIEmptyResponse

Пример

Пример за updateEmailTemplate
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t templateId = U("welcome-email");
4UpdateEmailTemplateBody body;
5body.subject = U("Welcome to Our Platform");
6body.content = U("<p>Hello \{{userName}}, welcome aboard!</p>");
7body.isActive = boost::optional<bool>(true);
8api->updateEmailTemplate(tenantId, templateId, body)
9 .then([](std::shared_ptr<APIEmptyResponse> response) {
10 // обработка при успех
11 })
12 .then([](pplx::task<void> t) {
13 try { t.get(); } catch (const std::exception &) { /* обработка на грешка */ }
14 });
15

Вземи регистър на събития Internal Link

req tenantId urlId userIdWS

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
urlIdstringYes
userIdWSstringYes
startTimeint64_tYes
endTimeint64_tNo

Отговор

Връща: GetEventLogResponse

Пример

getEventLog Пример
Copy Copy
1
2auto startTime = int64_t(1622505600);
3boost::optional<int64_t> endTime = int64_t(1622592000);
4api->getEventLog(U("my-tenant-123"), U("article-456"), U("user@example.com"), startTime, endTime)
5 .then([](std::shared_ptr<GetEventLogResponse> response){
6 auto copy = std::make_shared<GetEventLogResponse>(*response);
7 (void)copy;
8 });
9

Вземи глобален регистър на събития Internal Link

req tenantId urlId userIdWS

Параметри

ИмеТипЗадължителенОписание
tenantIdstringДа
urlIdstringДа
userIdWSstringДа
startTimeint64_tДа
endTimeint64_tНе

Отговор

Връща: GetEventLogResponse

Пример

Пример за getGlobalEventLog
Copy Copy
1
2api->getGlobalEventLog(
3 U("my-tenant-123"),
4 U("article-456"),
5 U("user@example.com"),
6 1622505600,
7 boost::optional<int64_t>(1625097600)
8).then([](std::shared_ptr<GetEventLogResponse> resp) {
9 (void)resp;
10});
11

Създай публикация във фийда Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
createFeedPostParamsCreateFeedPostParamsДа
optionsconst CreateFeedPostOptions&Да

Отговор

Връща: CreateFeedPostsResponse

Пример

createFeedPost Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3CreateFeedPostParams postParams;
4postParams.content = utility::conversions::to_string_t("Excited to join FastComments!");
5postParams.authorEmail = utility::conversions::to_string_t("user@example.com");
6postParams.title = utility::conversions::to_string_t("My First Post");
7postParams.tags = boost::optional<std::vector<utility::string_t>>({ utility::conversions::to_string_t("intro") });
8
9CreateFeedPostOptions options;
10options.notifyFollowers = boost::optional<bool>(true);
11options.scheduledAt = boost::optional<utility::datetime>(utility::datetime::utc_now());
12
13api->createFeedPost(tenantId, postParams, options).then([](std::shared_ptr<CreateFeedPostsResponse> resp) {
14 auto postId = resp->postId;
15});
16

Създай публикация във фийда (публично) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
createFeedPostParamsCreateFeedPostParamsДа
optionsconst CreateFeedPostPublicOptions&Да

Отговор

Връща: CreateFeedPostResponse

Пример

createFeedPostPublic Пример
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3
4CreateFeedPostParams params;
5params.title = U("Introducing Our New Feature");
6params.content = U("We are excited to announce the release of our latest update.");
7params.authorEmail = boost::optional<utility::string_t>(U("user@example.com"));
8params.tags = boost::optional<std::vector<utility::string_t>>({U("announcement"), U("release")});
9
10CreateFeedPostPublicOptions options;
11
12api->createFeedPostPublic(tenantId, params, options)
13 .then([](std::shared_ptr<CreateFeedPostResponse> resp) {
14 if (resp) {
15 std::wcout << U("Post created with ID: ") << resp->postId << std::endl;
16 }
17 });
18

Изтрий публикация във фийда (публично) Internal Link

Параметри

ИмеТипЗадължителенОписание
tenantIdstringДа
postIdstringДа
optionsconst DeleteFeedPostPublicOptions&Да

Отговор

Връща: DeleteFeedPostPublicResponse

Пример

Пример за deleteFeedPostPublic
Copy Copy
1
2auto opts = std::make_shared<DeleteFeedPostPublicOptions>();
3opts->reason = boost::optional<utility::string_t>(U("Inappropriate content"));
4api->deleteFeedPostPublic(U("my-tenant-123"), U("post-789"), *opts)
5 .then([](std::shared_ptr<DeleteFeedPostPublicResponse> resp) {
6 if (resp && resp->isSuccess()) {
7 // логика за успех
8 }
9 });
10

Вземи публикации във фийда Internal Link

req tenantId afterId

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetFeedPostsOptions&Да

Отговор

Връща: GetFeedPostsResponse

Пример

getFeedPosts Пример
Copy Copy
1
2auto opts = std::make_shared<GetFeedPostsOptions>();
3opts->maxResults = boost::optional<int>(50);
4opts->cursor = boost::optional<utility::string_t>(U("next-cursor"));
5api->getFeedPosts(U("my-tenant-123"), *opts).then([](std::shared_ptr<GetFeedPostsResponse> resp) {
6 auto count = resp->posts.size();
7});
8

Вземи публикации във фийда (публично) Internal Link

req tenantId afterId

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
optionsconst GetFeedPostsPublicOptions&Yes

Отговор

Връща: PublicFeedPostsResponse

Пример

Пример за getFeedPostsPublic
Copy Copy
1
2auto options = GetFeedPostsPublicOptions{};
3options.limit = boost::optional<int>{20};
4options.before = boost::optional<utility::string_t>{U("2023-01-01T00:00:00Z")};
5
6api->getFeedPostsPublic(U("my-tenant-123"), options).then([](pplx::task<std::shared_ptr<PublicFeedPostsResponse>> task){
7 try{
8 auto response = task.get();
9 auto processed = std::make_shared<PublicFeedPostsResponse>(*response);
10 // Използвайте processed, както е необходимо
11 }catch(const std::exception&){
12 // Обработете грешката
13 }
14});
15

Вземи статистики за публикации във фийда Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
postIdsvector<stringYes
ssostringNo

Отговор

Връща: FeedPostsStatsResponse

Пример

Пример за getFeedPostsStats
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3std::vector<utility::string_t> postIds = {
4 utility::conversions::to_string_t("post-001"),
5 utility::conversions::to_string_t("post-002")
6};
7boost::optional<utility::string_t> sso = utility::conversions::to_string_t("user@example.com");
8
9api->getFeedPostsStats(tenantId, postIds, sso)
10 .then([](std::shared_ptr<FeedPostsStatsResponse> response) {
11 (void)response;
12 });
13

Вземи реакции на потребителя (публично) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetUserReactsPublicOptions&Да

Отговор

Връща: UserReactsResponse

Пример

Пример за getUserReactsPublic
Copy Copy
1
2auto options = GetUserReactsPublicOptions{};
3options.userId = boost::optional<utility::string_t>(U("user@example.com"));
4options.limit = boost::optional<int>(50);
5api->getUserReactsPublic(U("my-tenant-123"), options).then([](pplx::task<std::shared_ptr<UserReactsResponse>> t){
6 auto response = t.get();
7});
8

Реагирай на публикация във фийда (публично) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
postIdstringДа
reactBodyParamsReactBodyParamsДа
optionsconst ReactFeedPostPublicOptions&Да

Отговор

Връща: ReactFeedPostResponse

Пример

reactFeedPostPublic Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto postId = utility::conversions::to_string_t("post-987");
4ReactBodyParams reactBody;
5reactBody.reaction = utility::conversions::to_string_t("love");
6reactBody.userId = utility::conversions::to_string_t("user@example.com");
7ReactFeedPostPublicOptions options;
8options.metadata = boost::optional<utility::string_t>(utility::conversions::to_string_t("mobile"));
9api->reactFeedPostPublic(tenantId, postId, reactBody, options)
10 .then([](std::shared_ptr<ReactFeedPostResponse> resp) {
11 });
12

Обнови публикация във фийда Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes
feedPostFeedPostYes

Отговор

Връща: APIEmptyResponse

Пример

Пример за updateFeedPost
Copy Copy
1
2utility::string_t tenantId = U"my-tenant-123";
3utility::string_t postId = U"post-456";
4
5FeedPost feedPost;
6feedPost.title = U"Breaking News";
7feedPost.content = U"Details of the update go here.";
8feedPost.imageUrl = boost::optional<utility::string_t>(U"https://example.com/image.jpg");
9
10api->updateFeedPost(tenantId, postId, feedPost)
11 .then([](pplx::task<std::shared_ptr<APIEmptyResponse>> task) {
12 try {
13 auto response = task.get();
14 } catch (const std::exception& ex) {
15 }
16 });
17

Обнови публикация във фийда (публично) Internal Link


Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
postIdstringYes
updateFeedPostParamsUpdateFeedPostParamsYes
optionsconst UpdateFeedPostPublicOptions&Yes

Отговор

Връща: CreateFeedPostResponse

Пример

Пример за updateFeedPostPublic
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t postId = U("post-456");
4UpdateFeedPostParams params;
5params.title = boost::optional<utility::string_t>(U("Updated Title"));
6params.body = boost::optional<utility::string_t>(U("Updated content of the post."));
7UpdateFeedPostPublicOptions options;
8options.notifyFollowers = boost::optional<bool>(true);
9api->updateFeedPostPublic(tenantId, postId, params, options)
10 .then([](std::shared_ptr<CreateFeedPostResponse> resp) {
11 auto result = resp;
12 });
13

Маркирай коментар (публично) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
commentIdstringYes
isFlaggedboolYes
ssostringNo

Отговор

Връща: APIEmptyResponse

Пример

Пример за flagCommentPublic
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto commentId = utility::conversions::to_string_t("cmt-456789");
4bool isFlagged = true;
5boost::optional<utility::string_t> sso = utility::conversions::to_string_t("sso-token-abc");
6
7api->flagCommentPublic(tenantId, commentId, isFlagged, sso)
8 .then([](pplx::task<std::shared_ptr<APIEmptyResponse>> t){
9 try{
10 auto resp = t.get();
11 }catch(const std::exception&){
12 }
13 });
14

Вземи голям GIF Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
largeInternalURLSanitizedstringYes

Отговор

Връща: GifGetLargeResponse

Пример

Пример за getGifLarge
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto largeUrl = utility::conversions::to_string_t("https://cdn.example.com/gifs/large/abc123.gif");
4
5api->getGifLarge(tenantId, largeUrl)
6 .then([&](std::shared_ptr<GifGetLargeResponse> resp) {
7 boost::optional<utility::string_t> maybeUrl;
8 if (resp && resp->url) {
9 maybeUrl = resp->url;
10 }
11 if (maybeUrl) {
12 std::wcout << *maybeUrl << std::endl;
13 }
14 });
15

Търси GIF-ове Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
searchstringДа
optionsconst GetGifsSearchOptions&Да

Отговор

Връща: GetGifsSearchResponse

Пример

Пример за getGifsSearch
Copy Copy
1
2auto tenantId = U("my-tenant-123");
3auto search = U("funny cats");
4GetGifsSearchOptions options;
5options.limit = boost::optional<int>(10);
6options.rating = boost::optional<utility::string_t>(U("pg"));
7api->getGifsSearch(tenantId, search, options).then([](pplx::task<std::shared_ptr<GetGifsSearchResponse>> task){
8 try{
9 auto response = task.get();
10 }catch(const std::exception&){
11 }
12});
13

Популярни GIF-ове Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetGifsTrendingOptions&Да

Отговор

Връща: GetGifsTrendingResponse

Пример

Пример за getGifsTrending
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3GetGifsTrendingOptions options;
4options.limit = 10;
5options.rating = boost::optional<utility::string_t>(U("G"));
6api->getGifsTrending(tenantId, options).then([](std::shared_ptr<GetGifsTrendingResponse> response) {
7 for (const auto& gif : response->gifs) {
8 auto url = gif.url;
9 }
10});
11

Добави хаштаг Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
createHashTagBodyCreateHashTagBodyДа

Отговор

Връща: CreateHashTagResponse

Пример

addHashTag Пример
Copy Copy
1
2CreateHashTagBody request;
3request.tag = utility::conversions::to_string_t("feature-request");
4request.description = utility::conversions::to_string_t("Requests for new features");
5request.relatedUrl = boost::optional<utility::string_t>(utility::conversions::to_string_t("https://example.com/feature-request"));
6
7api->addHashTag(utility::conversions::to_string_t("my-tenant-123"), request)
8 .then([](std::shared_ptr<CreateHashTagResponse> resp) {
9 (void)resp;
10 });
11

Добави хаштагове масово Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
bulkCreateHashTagsBodyBulkCreateHashTagsBodyДа

Отговор

Връща: BulkCreateHashTagsResponse

Пример

addHashTagsBulk Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3BulkCreateHashTagsBody bulkBody;
4bulkBody.tags = { utility::string_t(U("announcement")), utility::string_t(U("feature-request")) };
5bulkBody.description = boost::optional<utility::string_t>(U("Bulk tag creation"));
6api->addHashTagsBulk(tenantId, bulkBody).then([](pplx::task<std::shared_ptr<BulkCreateHashTagsResponse>> task){
7 try{
8 auto resp = task.get();
9 }catch(const std::exception&){
10 }
11});
12

Изтрий хаштаг Internal Link


Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
tagstringYes
deleteHashTagRequestBodyDeleteHashTagRequestBodyYes

Отговор

Връща: APIEmptyResponse

Пример

Пример за deleteHashTag
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-001");
3auto tag = utility::conversions::to_string_t("news");
4DeleteHashTagRequestBody requestBody;
5requestBody.userId = utility::conversions::to_string_t("user-42");
6requestBody.reason = boost::optional<utility::string_t>(utility::conversions::to_string_t("User request"));
7api->deleteHashTag(tenantId, tag, requestBody)
8 .then([](std::shared_ptr<APIEmptyResponse> resp) {
9 });
10

Вземи хаштагове Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
pagedoubleНе

Отговор

Връща: GetHashTagsResponse

Пример

getHashTags Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3boost::optional<double> page = 2.0;
4
5api->getHashTags(tenantId, page).then([](pplx::task<std::shared_ptr<GetHashTagsResponse>> task) {
6 try {
7 auto resultPtr = task.get();
8 auto response = std::make_shared<GetHashTagsResponse>(*resultPtr);
9 // use response
10 } catch (const std::exception&) {
11 // handle error
12 }
13});
14

Частично обнови хаштаг Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
tagstringДа
updateHashTagBodyUpdateHashTagBodyДа

Отговор

Връща: UpdateHashTagResponse

Пример

Пример за patchHashTag
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t tag = U("important");
4auto body = std::make_shared<UpdateHashTagBody>();
5body->name = U("important-updated");
6body->description = boost::optional<utility::string_t>(U("Updated description"));
7api->patchHashTag(tenantId, tag, *body)
8 .then([](pplx::task<std::shared_ptr<UpdateHashTagResponse>> t){
9 try{
10 auto response = t.get();
11 std::cout << "Updated tag ID: " << response->id << std::endl;
12 }catch(const std::exception& e){
13 std::cerr << "Patch failed: " << e.what() << std::endl;
14 }
15 });
16

Изтрий глас за модериране Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
commentIdstringДа
voteIdstringДа
optionsconst DeleteModerationVoteOptions&Да

Отговор

Връща: VoteDeleteResponse

Пример

Пример за deleteModerationVote
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto commentId = utility::conversions::to_string_t("comment-abc123");
4auto voteId = utility::conversions::to_string_t("vote-xyz789");
5DeleteModerationVoteOptions opts;
6opts.reason = utility::conversions::to_string_t("Offensive language");
7opts.hardDelete = boost::optional<bool>(true);
8api->deleteModerationVote(tenantId, commentId, voteId, opts)
9 .then([](std::shared_ptr<VoteDeleteResponse> resp){});
10

Вземи API коментари Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
optionsconst GetApiCommentsOptions&Yes

Отговор

Връща: ModerationAPIGetCommentsResponse

Пример

Пример за getApiComments
Copy Copy
1
2auto options = GetApiCommentsOptions{};
3options.page = boost::make_optional(2);
4options.authorEmail = boost::make_optional<utility::string_t>(U("user@example.com"));
5options.includeDeleted = boost::make_optional(false);
6
7api->getApiComments(U("my-tenant-123"), options).then([](pplx::task<std::shared_ptr<ModerationAPIGetCommentsResponse>> task){
8 try{
9 auto response = task.get();
10 }catch(const std::exception&){
11 }
12});
13

Вземи статус на API експорт Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetApiExportStatusOptions&Да

Отговор

Връща: ModerationExportStatusResponse

Пример

Пример за getApiExportStatus
Copy Copy
1
2auto opts = GetApiExportStatusOptions{};
3opts.exportId = boost::make_optional<utility::string_t>(U("export-456"));
4api->getApiExportStatus(U("my-tenant-123"), opts)
5 .then([](pplx::task<std::shared_ptr<ModerationExportStatusResponse>> t){
6 try{
7 auto status = t.get();
8 }catch(const std::exception&){
9 }
10 });
11

Вземи API идентификатори Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetApiIdsOptions&Да

Отговор

Връща: ModerationAPIGetCommentIdsResponse

Пример

Пример за getApiIds
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3GetApiIdsOptions options;
4options.limit = boost::optional<int>(100);
5options.cursor = boost::optional<utility::string_t>(U("next-page-token"));
6api->getApiIds(tenantId, options).then([](pplx::task<std::shared_ptr<ModerationAPIGetCommentIdsResponse>> t){
7 try{
8 auto response = t.get();
9 auto ids = response->commentIds;
10 }catch(const std::exception&){
11 }
12});
13

Вземи забранени потребители от коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
commentIdstringYes
ssostringNo

Отговор

Връща: GetBannedUsersFromCommentResponse

Пример

Пример за getBanUsersFromComment
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3auto commentId = utility::string_t(U("comment-456"));
4boost::optional<utility::string_t> sso = boost::make_optional(utility::string_t(U("sso-token-abc")));
5
6api->getBanUsersFromComment(tenantId, commentId, sso).then([](pplx::task<std::shared_ptr<GetBannedUsersFromCommentResponse>> task) {
7 try {
8 auto response = task.get();
9 } catch (const std::exception&) {
10 }
11});
12

Вземи статус на забрана за коментар Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
commentIdstringДа
ssostringНе

Отговор

Връща: GetCommentBanStatusResponse

Пример

getCommentBanStatus Пример
Copy Copy
1
2auto tenantId = utility::string_t(U"my-tenant-123");
3auto commentId = utility::string_t(U"comment-456");
4boost::optional<utility::string_t> sso = utility::string_t(U"user@example.com");
5
6api->getCommentBanStatus(tenantId, commentId, sso).then([](pplx::task<std::shared_ptr<GetCommentBanStatusResponse>> t){
7 try{
8 auto response = t.get();
9 }catch(const std::exception&){ }
10});
11

Вземи дъщерни коментари Internal Link

Parameters

ИмеТипЗадължителноОписание
tenantIdstringДа
commentIdstringДа
ssostringНе

Отговор

Връща: ModerationAPIChildCommentsResponse

Пример

Пример за getCommentChildren
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("comment-456");
4boost::optional<utility::string_t> sso = U("sso-token-abc");
5
6api->getCommentChildren(tenantId, commentId, sso)
7 .then([](pplx::task<std::shared_ptr<ModerationAPIChildCommentsResponse>> task) {
8 try {
9 auto response = task.get();
10 } catch (const std::exception&) {
11 }
12 });
13

Вземи брой Internal Link

Parameters

NameTypeRequiredDescription
tenantIdstringДа
optionsconst GetCountOptions&Да

Response

Връща: ModerationAPICountCommentsResponse

Пример

getCount Пример
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3GetCountOptions options;
4options.userEmail = boost::optional<utility::string_t>(U("user@example.com"));
5options.maxResults = boost::optional<int>(100);
6api->getCount(tenantId, options).then([](pplx::task<std::shared_ptr<ModerationAPICountCommentsResponse>> task){
7 try{
8 auto resp = task.get();
9 auto copy = std::make_shared<ModerationAPICountCommentsResponse>(*resp);
10 std::cout << "Count: " << copy->count << std::endl;
11 }catch(const std::exception& e){
12 std::cerr << "Error: " << e.what() << std::endl;
13 }
14});
15

Вземи броеве Internal Link

Параметри

ИмеТипЗадължителенОписание
tenantIdstringYes
ssostringNo

Отговор

Връща: GetBannedUsersCountResponse

Пример

Пример за getCounts
Copy Copy
1
2api->getCounts(
3 utility::conversions::to_string_t("my-tenant-123"),
4 boost::optional<utility::string_t>(utility::conversions::to_string_t("john.doe@example.com"))
5).then([](pplx::task<std::shared_ptr<GetBannedUsersCountResponse>> t){
6 try{
7 auto response = t.get();
8 }catch(const std::exception&){
9 }
10});
11

Вземи логове Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
commentIdstringYes
ssostringNo

Отговор

Връща: ModerationAPIGetLogsResponse

Пример

Пример за getLogs
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("comment-456");
4boost::optional<utility::string_t> sso = U("sso-token-abc");
5
6api->getLogs(tenantId, commentId, sso).then([](pplx::task<std::shared_ptr<ModerationAPIGetLogsResponse>> t){
7 try{
8 auto response = t.get();
9 }catch(...){
10 }
11});
12

Вземи ръчни значки Internal Link

Parameters

ИмеТипЗадължителноОписание
tenantIdstringДа
ssostringНе

Response

Връща: GetTenantManualBadgesResponse

Example

Пример за getManualBadges
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3boost::optional<utility::string_t> sso = boost::make_optional(U("user@example.com"));
4
5api->getManualBadges(tenantId, sso)
6 .then([](pplx::task<std::shared_ptr<GetTenantManualBadgesResponse>> t) {
7 try {
8 auto response = t.get();
9 // обработете отговора, напр., response->badgeList
10 } catch (const std::exception& ex) {
11 // обработете грешката
12 }
13 });
14

Вземи ръчни значки за потребител Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetManualBadgesForUserOptions&Да

Отговор

Връща: GetUserManualBadgesResponse

Пример

Пример за getManualBadgesForUser
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3GetManualBadgesForUserOptions options;
4options.userEmail = boost::optional<utility::string_t>(U("user@example.com"));
5options.includeInactive = boost::optional<bool>(true);
6api->getManualBadgesForUser(tenantId, options).then([](pplx::task<std::shared_ptr<GetUserManualBadgesResponse>> task){
7 try{
8 auto response = task.get();
9 }catch(const std::exception&){
10 }
11});
12

Вземи модерационен коментар Internal Link

Parameters

ИмеТипЗадължителноОписание
tenantIdstringYes
commentIdstringYes
optionsconst GetModerationCommentOptions&Yes

Response

Връща: ModerationAPICommentResponse

Пример

getModerationComment Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto commentId = utility::conversions::to_string_t("comment-456");
4GetModerationCommentOptions options;
5options.includeDeleted = boost::optional<bool>(true);
6options.locale = boost::optional<utility::string_t>(utility::conversions::to_string_t("en-US"));
7api->getModerationComment(tenantId, commentId, options)
8 .then([](pplx::task<std::shared_ptr<ModerationAPICommentResponse>> task) {
9 try {
10 auto response = task.get();
11 // Обработете отговора, както е необходимо
12 } catch (const std::exception& ex) {
13 // Обработете грешката
14 }
15 });
16

Вземи текст на модерационен коментар Internal Link

Параметри

ИмеТипRequiredОписание
tenantIdstringYes
commentIdstringYes
ssostringNo

Отговор

Връща: GetCommentTextResponse

Пример

Пример за getModerationCommentText
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("cmt-987654");
4boost::optional<utility::string_t> sso = U("sso-token-abc");
5
6api->getModerationCommentText(tenantId, commentId, sso)
7 .then([](pplx::task<std::shared_ptr<GetCommentTextResponse>> t) {
8 try {
9 auto resp = t.get();
10 auto text = std::make_shared<std::string>(resp->commentText);
11 } catch (const std::exception&) {
12 }
13 });
14

Вземи предварително резюме за забрана Internal Link

Parameters

ИмеТипЗадължителноОписание
tenantIdstringДа
commentIdstringДа
optionsconst GetPreBanSummaryOptions&Да

Отговор

Връща: PreBanSummary

Пример

Пример за getPreBanSummary
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto commentId = utility::conversions::to_string_t("cmt-456789");
4GetPreBanSummaryOptions options;
5options.locale = boost::optional<utility::string_t>{utility::conversions::to_string_t("en-US")};
6
7api->getPreBanSummary(tenantId, commentId, options)
8 .then([](pplx::task<std::shared_ptr<PreBanSummary>> t) {
9 try {
10 auto summary = t.get();
11 // обработи резюме
12 } catch (const std::exception&) {
13 // обработи грешка
14 }
15 });
16

Резюме на търсене за коментари Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetSearchCommentsSummaryOptions&Да

Отговор

Връща: ModerationCommentSearchResponse

Пример

Пример за getSearchCommentsSummary
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto options = std::make_shared<GetSearchCommentsSummaryOptions>();
4options->query = utility::conversions::to_string_t("spam");
5options->pageSize = boost::optional<int>(50);
6options->pageNumber = boost::optional<int>(1);
7options->fromDate = boost::none;
8api->getSearchCommentsSummary(tenantId, *options).then([](pplx::task<std::shared_ptr<ModerationCommentSearchResponse>> task){
9 try{
10 auto response = task.get();
11 }catch(const std::exception&){
12 }
13});
14

Търсене на страници Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetSearchPagesOptions&Да

Отговор

Връща: ModerationPageSearchResponse

Пример

Пример за getSearchPages
Copy Copy
1
2GetSearchPagesOptions options;
3options.pageNumber = boost::optional<int>(1);
4options.pageSize = boost::optional<int>(50);
5options.searchTerm = boost::optional<utility::string_t>(U("spam"));
6
7api->getSearchPages(U("my-tenant-123"), options)
8 .then([](pplx::task<std::shared_ptr<ModerationPageSearchResponse>> task) {
9 try {
10 auto response = task.get();
11 // използвайте отговора
12 } catch (const std::exception& e) {
13 // обработете грешката
14 }
15 });
16

Търсене на сайтове Internal Link

Parameters

NameTypeRequiredDescription
tenantIdstringYes
optionsconst GetSearchSitesOptions&Yes

Response

Returns: ModerationSiteSearchResponse

Example

getSearchSites Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3GetSearchSitesOptions options;
4options.query = boost::make_optional(utility::string_t(U("example query")));
5options.limit = boost::make_optional(25);
6
7api->getSearchSites(tenantId, options)
8 .then([](pplx::task<std::shared_ptr<ModerationSiteSearchResponse>> t) {
9 try {
10 auto response = t.get();
11 auto respPtr = std::make_shared<ModerationSiteSearchResponse>(*response);
12 for (const auto& site : respPtr->sites) {
13 // обработка
14 }
15 } catch (const std::exception&) {
16 // обработка на грешки
17 }
18 });
19

Предложения за търсене Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetSearchSuggestOptions&Да

Отговор

Връща: ModerationSuggestResponse

Пример

Пример за getSearchSuggest
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3GetSearchSuggestOptions opts;
4opts.query = U("search term");
5opts.limit = boost::optional<int>(5);
6opts.includeInactive = boost::optional<bool>(false);
7api->getSearchSuggest(tenantId, opts).then([](pplx::task<std::shared_ptr<ModerationSuggestResponse>> t){
8 try{
9 auto resp = t.get();
10 }catch(const std::exception&){ }
11}).wait();
12

Търси потребители Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetSearchUsersOptions&Да

Отговор

Връща: ModerationUserSearchResponse

Пример

getSearchUsers Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3GetSearchUsersOptions opts;
4opts.query = utility::string_t(U("john.doe@example.com"));
5opts.page = boost::optional<int>(1);
6opts.pageSize = boost::optional<int>(20);
7
8api->getSearchUsers(tenantId, opts)
9 .then([](std::shared_ptr<ModerationUserSearchResponse> resp) {
10 for (const auto& user : resp->users) {
11 std::wcout << user.id << L" - " << user.email << std::endl;
12 }
13 });
14

Вземи фактор на доверието Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetTrustFactorOptions&Да

Отговор

Връща: GetUserTrustFactorResponse

Пример

Пример за getTrustFactor
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3GetTrustFactorOptions options;
4options.userEmail = boost::optional<utility::string_t>(U("user@example.com"));
5options.ipAddress = boost::optional<utility::string_t>(U("203.0.113.42"));
6api->getTrustFactor(tenantId, options).then([](std::shared_ptr<GetUserTrustFactorResponse> resp) {
7 if (resp) {
8 std::cout << "Trust factor: " << resp->trustFactor << std::endl;
9 }
10});
11

Вземи предпочитания за забрана на потребител Internal Link

Parameters

ИмеТипЗадължителноОписание
tenantIdstringДа
ssostringНе

Отговор

Връща: APIModerateGetUserBanPreferencesResponse

Пример

Пример за getUserBanPreference
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3boost::optional<utility::string_t> sso = boost::optional<utility::string_t>(U("user@example.com"));
4
5api->getUserBanPreference(tenantId, sno)
6 .then([](pplx::task<std::shared_ptr<APIModerateGetUserBanPreferencesResponse>> t) {
7 try {
8 auto resp = t.get();
9 } catch (const std::exception&) {
10 }
11 });
12

Вземи вътрешен профил на потребител Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
optionsconst GetUserInternalProfileOptions&Yes

Отговор

Връща: GetUserInternalProfileResponse

Пример

Пример getUserInternalProfile
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3GetUserInternalProfileOptions options;
4options.email = boost::optional<utility::string_t>(U("user@example.com"));
5options.includeDetails = boost::optional<bool>(true);
6
7api->getUserInternalProfile(tenantId, options)
8 .then([](std::shared_ptr<GetUserInternalProfileResponse> response) {
9 if (response) {
10 auto name = response->displayName;
11 auto id = response->userId;
12 }
13 });
14

Адаптирай гласове за коментари (POST) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
commentIdstringДа
adjustCommentVotesParamsAdjustCommentVotesParamsДа
optionsconst PostAdjustCommentVotesOptions&Да

Отговор

Връща: AdjustVotesResponse

Пример

postAdjustCommentVotes Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto commentId = utility::conversions::to_string_t("cmt-456789");
4AdjustCommentVotesParams params;
5params.voteDelta = 1;
6params.userIdentifier = utility::conversions::to_string_t("user@example.com");
7params.reason = boost::optional<utility::string_t>(utility::conversions::to_string_t("Helpful"));
8PostAdjustCommentVotesOptions opts;
9opts.timeout = boost::optional<int>(30);
10api->postAdjustCommentVotes(tenantId, commentId, params, opts).then([](pplx::task<std::shared_ptr<AdjustVotesResponse>> t){
11 try{
12 auto resp = t.get();
13 }catch(const std::exception& e){
14 }
15});
16

Стартирай API експорт (POST) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
optionsconst PostApiExportOptions&Yes

Отговор

Връща: ModerationExportResponse

Пример

postApiExport Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3PostApiExportOptions options;
4options.format = utility::string_t(U("json"));
5options.email = utility::string_t(U("reports@example.com"));
6options.startDate = boost::optional<utility::datetime>(utility::datetime::from_string(U("2023-01-01T00:00:00Z")));
7options.endDate = boost::optional<utility::datetime>(utility::datetime::from_string(U("2023-01-31T23:59:59Z")));
8
9api->postApiExport(tenantId, options)
10 .then([](std::shared_ptr<ModerationExportResponse> response) {
11 if (response) {
12 // обработване на успешен отговор от експорта
13 }
14 })
15 .wait();
16

Забрани потребител от коментар (POST) Internal Link

Parameters

ИмеТипЗадължителноОписание
tenantIdstringYes
commentIdstringYes
optionsconst PostBanUserFromCommentOptions&Yes

Response

Връща: BanUserFromCommentResult

Example

postBanUserFromComment Пример
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("comment-456789");
4PostBanUserFromCommentOptions options;
5options.reason = boost::optional<utility::string_t>(U("spam"));
6options.durationDays = boost::optional<int>(30);
7
8api->postBanUserFromComment(tenantId, commentId, options)
9 .then([](std::shared_ptr<BanUserFromCommentResult> result) {
10 // обработка на резултата
11 })
12 .then([](pplx::task<void> t) {
13 try { t.get(); } catch (const std::exception& e) { /* обработка на грешка */ }
14 });
15

Отмени забрана на потребител (POST) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
banUserUndoParamsBanUserUndoParamsYes
ssostringNo

Отговор

Връща: APIEmptyResponse

Пример

postBanUserUndo Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3BanUserUndoParams banParams;
4banParams.userId = utility::string_t(U("user-567"));
5banParams.reason = utility::string_t(U("reinstated"));
6boost::optional<utility::string_t> sso = utility::string_t(U("sso-token-abc"));
7
8api->postBanUserUndo(tenantId, banParams, sso).then([](std::shared_ptr<APIEmptyResponse> resp){
9 // обработи успеха
10});
11

Масово предварително резюме за забрана (POST) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
bulkPreBanParamsBulkPreBanParamsДа
optionsconst PostBulkPreBanSummaryOptions&Да

Отговор

Връща: BulkPreBanSummary

Пример

postBulkPreBanSummary пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3BulkPreBanParams bulkPreBanParams;
4bulkPreBanParams.emails = {
5 utility::conversions::to_string_t("spam1@example.com"),
6 utility::conversions::to_string_t("spam2@example.com")
7};
8bulkPreBanParams.reason = utility::conversions::to_string_t("spam");
9PostBulkPreBanSummaryOptions options;
10options.requestId = boost::optional<utility::string_t>(utility::conversions::to_string_t("req-456"));
11api->postBulkPreBanSummary(tenantId, bulkPreBanParams, options)
12 .then([](std::shared_ptr<BulkPreBanSummary> result) {
13 (void)result;
14 });
15

Вземи коментари по ID (POST) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
commentsByIdsParamsCommentsByIdsParamsДа
ssostringНе

Отговор

Връща: ModerationAPIChildCommentsResponse

Пример

postCommentsByIds Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3CommentsByIdsParams params;
4params.commentIds = {U("cmt-001"), U("cmt-002")};
5boost::optional<utility::string_t> sso = U("sso-token-abc");
6api->postCommentsByIds(tenantId, params, sso).then([](pplx::task<std::shared_ptr<ModerationAPIChildCommentsResponse>> t){
7 try{
8 auto resp = t.get();
9 auto copy = std::make_shared<ModerationAPIChildCommentsResponse>(*resp);
10 }catch(const std::exception&){ }
11});
12

Маркирай коментар (POST) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
commentIdstringYes
optionsconst PostFlagCommentOptions&Yes

Отговор

Връща: APIEmptyResponse

Пример

postFlagComment Пример
Copy Copy
1
2PostFlagCommentOptions options;
3options.reason = boost::optional<utility::string_t>(U("spam"));
4options.reportedBy = boost::optional<utility::string_t>(U("moderator@example.com"));
5
6api->postFlagComment(U("my-tenant-123"), U("comment-456"), options)
7 .then([](std::shared_ptr<APIEmptyResponse> resp){
8 (void)resp;
9 })
10 .then([](pplx::task<void> t){
11 try{
12 t.get();
13 }catch(const std::exception&){
14 }
15 });
16

Премахни коментар (POST) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
commentIdstringДа
optionsconst PostRemoveCommentOptions&Да

Отговор

Връща: PostRemoveCommentApiResponse

Пример

postRemoveComment Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3auto commentId = utility::string_t(U("cmt-456789"));
4PostRemoveCommentOptions options;
5options.permanent = boost::optional<bool>(true);
6api->postRemoveComment(tenantId, commentId, options)
7 .then([](pplx::task<std::shared_ptr<PostRemoveCommentApiResponse>> task) {
8 try {
9 auto response = task.get();
10 // Обработете отговора
11 } catch (const std::exception& ex) {
12 // Обработете грешката
13 }
14 });
15

Възстанови изтрит коментар (POST) Internal Link

Parameters

ИмеТипЗадължителноОписание
tenantIdstringYes
commentIdstringYes
optionsconst PostRestoreDeletedCommentOptions&Yes

Response

Връща: APIEmptyResponse

Example

postRestoreDeletedComment Пример
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("cmt-987654");
4PostRestoreDeletedCommentOptions options;
5options.reason = boost::optional<utility::string_t>(U("Restoring after accidental delete"));
6options.notifyUser = boost::optional<bool>(true);
7api->postRestoreDeletedComment(tenantId, commentId, options)
8 .then([](std::shared_ptr<APIEmptyResponse> resp){
9 });
10

Задай статус на одобрение на коментар (POST) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
commentIdstringYes
optionsconst PostSetCommentApprovalStatusOptions&Yes

Отговор

Връща: SetCommentApprovedResponse

Пример

postSetCommentApprovalStatus Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto commentId = utility::conversions::to_string_t("comment-abc123");
4auto options = std::make_shared<PostSetCommentApprovalStatusOptions>();
5options->approved = boost::optional<bool>(true);
6options->reason = boost::optional<utility::string_t>(utility::conversions::to_string_t("Inappropriate content"));
7api->postSetCommentApprovalStatus(tenantId, commentId, *options)
8 .then([](pplx::task<std::shared_ptr<SetCommentApprovedResponse>> task) {
9 try {
10 auto response = task.get();
11 } catch (const std::exception& ex) {
12 }
13 });
14

Задай статус на преглед на коментар (POST) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
commentIdstringДа
optionsconst PostSetCommentReviewStatusOptions&Да

Отговор

Връща: APIEmptyResponse

Пример

postSetCommentReviewStatus Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto commentId = utility::conversions::to_string_t("cmt-456789");
4PostSetCommentReviewStatusOptions opts;
5opts.status = utility::conversions::to_string_t("approved");
6opts.note = boost::optional<utility::string_t>(utility::conversions::to_string_t("Looks good"));
7api->postSetCommentReviewStatus(tenantId, commentId, opts)
8 .then([](pplx::task<std::shared_ptr<APIEmptyResponse>> t){
9 try{
10 auto resp = t.get();
11 }catch(const std::exception& e){
12 }
13 });
14

Задай статус на спам за коментар (POST) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
commentIdstringYes
optionsconst PostSetCommentSpamStatusOptions&Yes

Отговор

Връща: APIEmptyResponse

Пример

postSetCommentSpamStatus Пример
Copy Copy
1
2auto options = PostSetCommentSpamStatusOptions{};
3options.isSpam = true;
4options.reason = boost::optional<utility::string_t>{U"User reported spam"};
5
6api->postSetCommentSpamStatus(U("my-tenant-123"), U("comment-789"), options)
7 .then([](std::shared_ptr<APIEmptyResponse> resp) {
8 auto copy = std::make_shared<APIEmptyResponse>(*resp);
9 })
10 .then([](pplx::task<void> t) {
11 try { t.get(); } catch(const std::exception&) {}
12 });
13

Задай текст на коментар (POST) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
commentIdstringYes
setCommentTextParamsSetCommentTextParamsYes
optionsconst PostSetCommentTextOptions&Yes

Отговор

Връща: SetCommentTextResponse

Пример

postSetCommentText Пример
Copy Copy
1
2auto tenantId = U("my-tenant-123");
3auto commentId = U("comment-456");
4SetCommentTextParams params;
5params.text = U("Revised comment content");
6PostSetCommentTextOptions options;
7options.requestId = boost::optional<utility::string_t>(U("req-987"));
8api->postSetCommentText(tenantId, commentId, params, options)
9 .then([](std::shared_ptr<SetCommentTextResponse> resp) {
10 auto updatedId = resp->commentId;
11 })
12 .then([](pplx::task<void> t) {
13 try { t.get(); } catch (const std::exception&) {}
14 });
15

Премахни маркировка на коментар (POST) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
commentIdstringДа
optionsconst PostUnFlagCommentOptions&Да

Отговор

Връща: APIEmptyResponse

Пример

postUnFlagComment Пример
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("cmt-456789");
4PostUnFlagCommentOptions opts;
5opts.notifyUser = boost::optional<bool>(true);
6api->postUnFlagComment(tenantId, commentId, opts)
7 .then([](std::shared_ptr<APIEmptyResponse> resp) {
8 // обработка може да се извърши тук
9 })
10 .then([](pplx::task<void> t) {
11 try { t.get(); } catch (const std::exception&) {}
12 });
13

Подай глас (POST) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
commentIdstringYes
optionsconst PostVoteOptions&Yes

Отговор

Връща: VoteResponse

Пример

postVote Пример
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t commentId = U("cmt-456789");
4PostVoteOptions options;
5options.upvote = boost::make_optional(true);
6options.reason = boost::make_optional<std::string>("Inappropriate content");
7api->postVote(tenantId, commentId, options)
8 .then([](pplx::task<std::shared_ptr<VoteResponse>> t) {
9 try {
10 auto resp = t.get();
11 auto count = resp->voteCount;
12 } catch (const std::exception& e) {
13 }
14 });
15

Възнагради със значка (PUT) Internal Link

Parameters

ИмеТипЗадължителноОписание
tenantIdstringYes
badgeIdstringYes
optionsconst PutAwardBadgeOptions&Yes

Response

Връща: AwardUserBadgeResponse

Example

Пример за putAwardBadge
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto badgeId = utility::conversions::to_string_t("badge-456");
4PutAwardBadgeOptions opts;
5opts.userId = utility::conversions::to_string_t("user-42");
6opts.note = boost::optional<utility::string_t>(utility::conversions::to_string_t("Excellent comment"));
7api->putAwardBadge(tenantId, badgeId, opts).then([](pplx::task<std::shared_ptr<AwardUserBadgeResponse>> t){
8 try{
9 auto resp = t.get();
10 auto respCopy = std::make_shared<AwardUserBadgeResponse>(*resp);
11 }catch(const std::exception& e){
12 }
13});
14

Затвори тема (PUT) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
urlIdstringДа
ssostringНе

Отговор

Връща: APIEmptyResponse

Пример

putCloseThread Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-4321"));
3auto urlId = utility::string_t(U("article-9876"));
4boost::optional<utility::string_t> sso = boost::make_optional<utility::string_t>(U("user@example.com"));
5
6api->putCloseThread(tenantId, urlId, sso).then([](pplx::task<std::shared_ptr<APIEmptyResponse>> task){
7 try{
8 auto response = task.get();
9 }catch(const std::exception&){
10 }
11});
12

Премахни значка (PUT) Internal Link

Параметри

ИмеТипЗадължителенОписание
tenantIdstringДа
badgeIdstringДа
optionsconst PutRemoveBadgeOptions&Да

Отговор

Връща: RemoveUserBadgeResponse

Пример

putRemoveBadge Пример
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t badgeId = U("badge-abc-456");
4PutRemoveBadgeOptions options;
5options.reason = boost::optional<utility::string_t>(U("Spamming"));
6api->putRemoveBadge(tenantId, badgeId, options).then([](std::shared_ptr<RemoveUserBadgeResponse> resp) {
7 (void)resp;
8});
9

Преотвори тема (PUT) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
urlIdstringДа
ssostringНе

Отговор

Връща: APIEmptyResponse

Пример

Пример за putReopenThread
Copy Copy
1
2api->putReopenThread(utility::string_t(U("my-tenant-123")), utility::string_t(U("thread-456")), boost::make_optional<utility::string_t>(U("user@example.com")))
3 .then([](std::shared_ptr<APIEmptyResponse> result){
4 std::cout << "Thread reopened" << std::endl;
5 });
6

Задай фактор на доверие Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst SetTrustFactorOptions&Да

Отговор

Връща: SetUserTrustFactorResponse

Пример

Пример за setTrustFactor
Copy Copy
1
2SetTrustFactorOptions opts;
3opts.userId = utility::conversions::to_string_t("user@example.com");
4opts.trustFactor = 8;
5opts.reason = boost::optional<utility::string_t>(utility::conversions::to_string_t("Spam check passed"));
6api->setTrustFactor(utility::conversions::to_string_t("my-tenant-123"), opts)
7 .then([](pplx::task<std::shared_ptr<SetUserTrustFactorResponse>> task) {
8 try {
9 auto response = task.get();
10 } catch (const std::exception&) {
11 }
12 });
13

Създай модератор Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
createModeratorBodyCreateModeratorBodyYes

Отговор

Връща: CreateModeratorResponse

Пример

Пример за createModerator
Copy Copy
1
2CreateModeratorBody moderatorBody;
3moderatorBody.email = utility::conversions::to_string_t("moderator@example.com");
4moderatorBody.name = utility::conversions::to_string_t("John Moderator");
5moderatorBody.notes = boost::optional<utility::string_t>(utility::conversions::to_string_t("Community moderator"));
6api->createModerator(utility::conversions::to_string_t("my-tenant-123"), moderatorBody)
7 .then([](std::shared_ptr<CreateModeratorResponse> resp) {});
8

Изтрий модератор Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes
sendEmailstringNo

Отговор

Връща: APIEmptyResponse

Пример

Пример за deleteModerator
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto moderatorId = utility::conversions::to_string_t("mod-456");
4boost::optional<utility::string_t> sendEmail = utility::conversions::to_string_t("admin@example.com");
5api->deleteModerator(tenantId, moderatorId, sendEmail)
6 .then([](std::shared_ptr<APIEmptyResponse> resp) {
7 // обработване на успеха
8 });
9

Вземи модератор Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes

Отговор

Връща: GetModeratorResponse

Пример

Пример за getModerator
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3auto moderatorId = utility::string_t(U("moderator-789"));
4api->getModerator(tenantId, moderatorId)
5 .then([](pplx::task<std::shared_ptr<GetModeratorResponse>> t) {
6 try {
7 auto response = t.get();
8 } catch (const std::exception&) {
9 }
10 });
11

Вземи модератори Internal Link

Параметри

NameTypeRequiredDescription
tenantIdstringYes
skipdoubleNo

Отговор

Връща: GetModeratorsResponse

Пример

getModerators Пример
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3boost::optional<double> skip = 10.0;
4api->getModerators(tenantId, skip).then([](pplx::task<std::shared_ptr<GetModeratorsResponse>> t){
5 auto response = t.get();
6});
7

Изпрати покана Internal Link

Parameters

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes
fromNamestringYes

Response

Връща: APIEmptyResponse

Example

Пример за sendInvite
Copy Copy
1
2boost::optional<utility::string_t> cc = utility::conversions::to_string_t("cc@example.com");
3api->sendInvite(
4 utility::conversions::to_string_t("my-tenant-123"),
5 utility::conversions::to_string_t("invitee@example.com"),
6 utility::conversions::to_string_t("John Doe")
7).then([](std::shared_ptr<APIEmptyResponse> resp) {
8 // обработи успешно поканата
9});
10

Обнови модератор Internal Link


Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes
updateModeratorBodyUpdateModeratorBodyYes

Отговор

Връща: APIEmptyResponse

Пример

updateModerator Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto moderatorId = utility::conversions::to_string_t("mod-789");
4UpdateModeratorBody body;
5body.email = utility::conversions::to_string_t("moderator@example.com");
6body.isActive = true;
7body.notes = boost::optional<utility::string_t>(utility::conversions::to_string_t("Senior moderator"));
8api->updateModerator(tenantId, moderatorId, body)
9 .then([](std::shared_ptr<APIEmptyResponse>) {})
10 .then([](pplx::task<void> t) { try { t.get(); } catch (const std::exception&) {} });
11

Изтрий брой на уведомленията Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа

Отговор

Връща: APIEmptyResponse

Пример

Пример deleteNotificationCount
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto notificationId = utility::conversions::to_string_t("notif-789");
4
5api->deleteNotificationCount(tenantId, notificationId)
6 .then([](std::shared_ptr<APIEmptyResponse> resp) {})
7 .then([](pplx::task<void> t) { try { t.get(); } catch (const std::exception&) {} });
8

Вземи кеширан брой известия Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа

Отговор

Returns: GetCachedNotificationCountResponse

Пример

Пример за getCachedNotificationCount
Copy Copy
1
2auto tenantId = boost::optional<utility::string_t>(utility::conversions::to_string_t("my-tenant-123"));
3auto userId = boost::optional<utility::string_t>(utility::conversions::to_string_t("user-456"));
4
5api->getCachedNotificationCount(tenantId.value(), userId.value())
6 .then([](pplx::task<std::shared_ptr<GetCachedNotificationCountResponse>> task) {
7 try {
8 auto response = task.get();
9 // process response
10 } catch (const std::exception&) {
11 // handle error
12 }
13 });
14

Вземи брой известия Internal Link

Параметри

NameTypeRequiredDescription
tenantIdstringYes
optionsconst GetNotificationCountOptions&Yes

Отговор

Връща: GetNotificationCountResponse

Пример

Пример за getNotificationCount
Copy Copy
1
2auto tenantId = U("my-tenant-123");
3GetNotificationCountOptions options;
4options.filter = boost::optional<utility::string_t>(U("unread"));
5options.maxCount = boost::optional<int>(10);
6api->getNotificationCount(tenantId, options)
7 .then([](pplx::task<std::shared_ptr<GetNotificationCountResponse>> t) {
8 try {
9 auto response = t.get();
10 } catch (const std::exception& ex) {
11 }
12 });
13

Вземи известия Internal Link


Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetNotificationsOptions&Да

Отговор

Връща: GetNotificationsResponse

Пример

getNotifications Пример
Copy Copy
1
2GetNotificationsOptions options;
3options.limit = 20;
4options.after = U("cursor-123");
5api->getNotifications(U("my-tenant-123"), options)
6 .then([](std::shared_ptr<GetNotificationsResponse> resp) {
7 (void)resp;
8 });
9

Обнови известие Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа
updateNotificationBodyUpdateNotificationBodyДа
userIdstringНе

Отговор

Връща: APIEmptyResponse

Пример

updateNotification Пример
Copy Copy
1
2auto updateBody = std::make_shared<UpdateNotificationBody>();
3updateBody->title = utility::conversions::to_string_t("System Maintenance");
4updateBody->message = utility::conversions::to_string_t("Scheduled downtime at 02:00 UTC.");
5api->updateNotification(
6 utility::conversions::to_string_t("my-tenant-123"),
7 utility::conversions::to_string_t("notif-456"),
8 updateBody,
9 boost::optional<utility::string_t>(utility::conversions::to_string_t("admin-user"))
10).then([](std::shared_ptr<APIEmptyResponse>){});
11

Създай реакция на страница V1 Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
urlIdstringYes
titlestringNo

Отговор

Връща: CreateV1PageReact

Пример

createV1PageReact Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3auto urlId = utility::string_t(U("https://example.com/articles/789"));
4boost::optional<utility::string_t> title = utility::string_t(U("Understanding Async C++"));
5api->createV1PageReact(tenantId, urlId, title).then([](pplx::task<std::shared_ptr<CreateV1PageReact>> task) {
6 try {
7 auto response = task.get();
8 } catch (const std::exception&) {
9 }
10});
11

Създай реакция на страница V2 Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
urlIdstringYes
idstringYes
titlestringNo

Отговор

Връща: CreateV1PageReact

Пример

Пример за createV2PageReact
Copy Copy
1
2api->createV2PageReact(
3 utility::string_t(U("my-tenant-789")),
4 utility::string_t(U("https://example.com/articles/12345")),
5 utility::string_t(U("user-42")),
6 boost::optional<utility::string_t>(U("Helpful"))
7).then([](pplx::task<std::shared_ptr<CreateV1PageReact>> task){
8 try{
9 auto response = task.get();
10 }catch(const std::exception&){ }
11});
12

Изтрий реакция на страница V1 Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
urlIdstringДа

Отговор

Връща: CreateV1PageReact

Пример

deleteV1PageReact Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto urlId = utility::conversions::to_string_t("page-abc-456");
4api->deleteV1PageReact(tenantId, urlId).then([](pplx::task<std::shared_ptr<CreateV1PageReact>> task){
5 try{
6 auto response = task.get();
7 boost::optional<std::shared_ptr<CreateV1PageReact>> optResponse = response;
8 }catch(...){
9 }
10});
11

Изтрий реакция на страница V2 Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
urlIdstringДа
idstringДа

Отговор

Връща: CreateV1PageReact

Пример

Пример за deleteV2PageReact
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto urlId = utility::conversions::to_string_t("page-456");
4auto reactId = utility::conversions::to_string_t("react-789");
5boost::optional<utility::string_t> correlationId = utility::conversions::to_string_t("corr-001");
6
7api->deleteV2PageReact(tenantId, urlId, reactId)
8 .then([](pplx::task<std::shared_ptr<CreateV1PageReact>> t) {
9 auto result = t.get();
10 });
11

Вземи харесвания на страница V1 Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
urlIdstringYes

Отговор

Връща: GetV1PageLikes

Пример

getV1PageLikes Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto urlId = utility::conversions::to_string_t("article-789");
4boost::optional<utility::string_t> filter;
5
6api->getV1PageLikes(tenantId, urlId).then([=](pplx::task<std::shared_ptr<GetV1PageLikes>> task){
7 try{
8 auto raw = task.get();
9 auto likes = std::make_shared<GetV1PageLikes>(*raw);
10 auto total = likes->totalLikes;
11 }catch(...){
12 }
13});
14

Вземи реакции на страница V2 Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
urlIdstringДа

Отговор

Връща: GetV2PageReacts

Пример

Пример за getV2PageReacts
Copy Copy
1
2auto tenantId = utility::string_t("my-tenant-123");
3auto urlId = utility::string_t("https://example.com/article/42");
4boost::optional<utility::string_t> locale = utility::string_t("en-US");
5api->getV2PageReacts(tenantId, urlId)
6 .then([locale](std::shared_ptr<GetV2PageReacts> reacts){
7 if (locale) {}
8 })
9 .then([](pplx::task<void> t){
10 try { t.get(); } catch (...) {}
11 });
12

Вземи потребители, които реагираха на страница V2 Internal Link

Параметри

NameTypeRequiredDescription
tenantIdstringДа
urlIdstringДа
idstringДа

Отговор

Връща: GetV2PageReactUsersResponse

Пример

getV2PageReactUsers Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto urlId = utility::conversions::to_string_t("page-456");
4auto id = utility::conversions::to_string_t("react-789");
5boost::optional<utility::string_t> maybeFilter;
6api->getV2PageReactUsers(tenantId, urlId, id).then([](pplx::task<std::shared_ptr<GetV2PageReactUsersResponse>> task){
7 try{
8 auto response = task.get();
9 // Използвайте отговора при нужда
10 }catch(const std::exception&){
11 // Обработете грешка
12 }
13});
14

Добави страница Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
createAPIPageDataCreateAPIPageDataДа

Отговор

Връща: AddPageAPIResponse

Пример

addPage Пример
Copy Copy
1
2auto createData = CreateAPIPageData{};
3createData.title = utility::string_t(U("Welcome Page"));
4createData.url = utility::string_t(U("https://example.com/welcome"));
5createData.description = boost::optional<utility::string_t>(utility::string_t(U("Landing page for new users")));
6
7api->addPage(utility::string_t(U("my-tenant-123")), createData)
8 .then([](std::shared_ptr<AddPageAPIResponse> response) {
9 if (response && response->success) {
10 // обработка на успешно добавяне
11 } else {
12 // обработка на грешка
13 }
14 });
15

Изтрий страница Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа

Отговор

Връща: DeletePageAPIResponse

Пример

deletePage Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto pageId = utility::conversions::to_string_t("page-456");
4
5api->deletePage(tenantId, pageId)
6 .then([](pplx::task<std::shared_ptr<DeletePageAPIResponse>> t) {
7 try {
8 auto response = t.get();
9 // обработете отговора, както е необходимо
10 } catch (const std::exception& ex) {
11 // обработете грешката
12 }
13 });
14

Вземи офлайн потребители Internal Link

Past коментатори на страницата, които НЕ са онлайн в момента. Подредени по displayName.
Използвайте това след изчерпване на /users/online, за да рендерирате раздел „Members“.
Курсорно пагиниране по commenterName: сървърът обхожда частичния {tenantId, urlId, commenterName}
индекс от afterName напред чрез $gt, без разход за $skip.

Parameters

NameTypeRequiredDescription
tenantIdstringYes
urlIdstringYes
optionsconst GetOfflineUsersOptions&Yes

Response

Връща: PageUsersOfflineResponse

Пример

Пример за getOfflineUsers
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t urlId = U("page-456");
4GetOfflineUsersOptions options;
5options.limit = boost::optional<int>(50);
6options.includeDetails = boost::optional<bool>(true);
7
8api->getOfflineUsers(tenantId, urlId, options)
9 .then([](pplx::task<std::shared_ptr<PageUsersOfflineResponse>> t) {
10 try {
11 auto response = t.get();
12 } catch (const std::exception&) {
13 }
14 });
15

Вземи онлайн потребители Internal Link

Текущо онлайн зрители на страница: хора, чиято уебсокет сесия е абонирана за страницата в момента.
Връща anonCount + totalCount (абонати в цялата стая, включително анонимни зрители, които не изброяваме).

Parameters

ИмеТипЗадължителноОписание
tenantIdstringДа
urlIdstringДа
optionsconst GetOnlineUsersOptions&Да

Response

Връща: PageUsersOnlineResponse

Пример

Пример за getOnlineUsers
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t urlId = U("article-456");
4auto options = std::make_shared<GetOnlineUsersOptions>();
5options->maxResults = boost::optional<int>(100);
6options->includeInactive = boost::optional<bool>(false);
7api->getOnlineUsers(tenantId, urlId, *options).then([](pplx::task<std::shared_ptr<PageUsersOnlineResponse>> task){
8 try{
9 auto response = task.get();
10 }catch(const std::exception&){
11 }
12});
13

Вземи страница по URL ID Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
urlIdstringДа

Отговор

Връща: GetPageByURLIdAPIResponse

Пример

Пример за getPageByURLId
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto urlId = utility::conversions::to_string_t("page-456");
4boost::optional<utility::string_t> correlationId = boost::make_optional(utility::conversions::to_string_t("corr-789"));
5
6api->getPageByURLId(tenantId, urlId)
7 .then([correlationId](pplx::task<std::shared_ptr<GetPageByURLIdAPIResponse>> task) {
8 try {
9 auto response = task.get();
10 } catch (const std::exception&) {
11 }
12 });
13

Вземи страници Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes

Отговор

Връща: GetPagesAPIResponse

Пример

getPages Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3api->getPages(tenantId)
4 .then([](pplx::task<std::shared_ptr<GetPagesAPIResponse>> task) {
5 try {
6 auto response = task.get();
7 boost::optional<utility::string_t> nextCursor = response->nextCursor;
8 } catch (const std::exception&) {
9 }
10 });
11

Вземи страници (публично) Internal Link

List pages for a tenant. Used by the FChat desktop client to populate its room list.
Requires enableFChat to be true on the resolved custom config for each page.
Pages that require SSO are filtered against the requesting user's group access.

Parameters

ИмеТипЗадължителноОписание
tenantIdstringYes
optionsconst GetPagesPublicOptions&Yes

Response

Връща: GetPublicPagesResponse

Example

getPagesPublic Пример
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3GetPagesPublicOptions options;
4options.limit = boost::optional<int>(50);
5options.cursor = boost::optional<utility::string_t>(U("cursor-token"));
6api->getPagesPublic(tenantId, options).then([](pplx::task<std::shared_ptr<GetPublicPagesResponse>> task){
7 try{
8 auto response = task.get();
9 // обработете отговора, ако е необходимо
10 }catch(const std::exception&){
11 // обработете грешката, ако е необходимо
12 }
13});
14

Вземи информация за потребители Internal Link

Bulk user info for a tenant. Given userIds, return display info from User / SSOUser.
Used by the comment widget to enrich users that just appeared via a presence event.
No page context: privacy is enforced uniformly (private profiles are masked).

Parameters

NameTypeRequiredDescription
tenantIdstringYes
idsstringYes

Response

Returns: PageUsersInfoResponse

Example

Пример за getUsersInfo
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t ids = U("alice@example.com,bob@example.com");
4boost::optional<utility::string_t> locale = boost::make_optional(U("en-US"));
5
6api->getUsersInfo(tenantId, ids).then([](pplx::task<std::shared_ptr<PageUsersInfoResponse>> t){
7 try{
8 auto response = t.get();
9 // process response
10 }catch(const std::exception&){
11 // handle error
12 }
13});
14

Частично обнови страница Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа
updateAPIPageDataUpdateAPIPageDataДа

Отговор

Връща: PatchPageAPIResponse

Пример

patchPage Пример
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t pageId = U("page-789");
4UpdateAPIPageData update;
5update.title = boost::optional<utility::string_t>(U("Updated Page Title"));
6update.metadata = boost::optional<utility::string_t>(U("{\"author\":\"jane.doe@example.com\"}"));
7api->patchPage(tenantId, pageId, update)
8 .then([](std::shared_ptr<PatchPageAPIResponse> response) {
9 if (response && response->isSuccess) {
10 // обработи успеха
11 }
12 })
13 .then([](pplx::task<void> t) {
14 try { t.get(); } catch (const std::exception&) {}
15 });
16

Изтрий чакащо уебхук събитие Internal Link


Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes

Отговор

Връща: APIEmptyResponse

Пример

deletePendingWebhookEvent Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto eventId = utility::conversions::to_string_t("event-987654");
4boost::optional<utility::string_t> optTenant = tenantId;
5
6api->deletePendingWebhookEvent(optTenant.value(), eventId)
7 .then([](std::shared_ptr<APIEmptyResponse> resp) {
8 (void)resp;
9 })
10 .then([](pplx::task<void> t) {
11 try { t.get(); } catch (const std::exception& e) { }
12 });
13

Вземи брой чакащи уебхук събития Internal Link


Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
optionsconst GetPendingWebhookEventCountOptions&Yes

Отговор

Връща: GetPendingWebhookEventCountResponse

Пример

Пример за getPendingWebhookEventCount
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3GetPendingWebhookEventCountOptions opts;
4opts.filter = boost::optional<utility::string_t>(utility::conversions::to_string_t("active"));
5api->getPendingWebhookEventCount(tenantId, opts)
6 .then([](std::shared_ptr<GetPendingWebhookEventCountResponse> resp){
7 auto count = resp->getCount();
8 });
9

Вземи чакащи уебхук събития Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetPendingWebhookEventsOptions&Да

Отговор

Връща: GetPendingWebhookEventsResponse

Пример

getPendingWebhookEvents Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3GetPendingWebhookEventsOptions opts;
4opts.pageSize = boost::optional<int>(100);
5opts.startAfter = boost::optional<utility::string_t>(U("event-abc-456"));
6api->getPendingWebhookEvents(tenantId, opts)
7 .then([](pplx::task<std::shared_ptr<GetPendingWebhookEventsResponse>> task) {
8 try {
9 auto resp = task.get();
10 auto copy = std::make_shared<GetPendingWebhookEventsResponse>(*resp);
11 } catch (const std::exception&) {}
12 });
13

Създай конфигурация на въпрос Internal Link


Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
createQuestionConfigBodyCreateQuestionConfigBodyYes

Отговор

Връща: CreateQuestionConfigResponse

Пример

Пример за createQuestionConfig
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3CreateQuestionConfigBody configBody;
4configBody.question = utility::string_t(U("How satisfied are you with our service?"));
5configBody.required = true;
6configBody.defaultAnswer = boost::optional<utility::string_t>(utility::string_t(U("Very satisfied")));
7api->createQuestionConfig(tenantId, configBody).then([](pplx::task<std::shared_ptr<CreateQuestionConfigResponse>> task){
8 try{
9 auto response = task.get();
10 }catch(const std::exception&){}
11});
12

Изтрий конфигурация на въпрос Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes

Отговор

Връща: APIEmptyResponse

Пример

deleteQuestionConfig Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto configId = utility::conversions::to_string_t("question-config-456");
4
5api->deleteQuestionConfig(tenantId, configId)
6 .then([](std::shared_ptr<APIEmptyResponse> resp) {
7 // обработка на успешно изтриване
8 })
9 .then([](pplx::task<void> t) {
10 try {
11 t.get();
12 } catch (const std::exception&) {
13 // обработка на грешка
14 }
15 });
16

Вземи конфигурация на въпрос Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes

Отговор

Връща: GetQuestionConfigResponse

Пример

getQuestionConfig Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto questionId = utility::conversions::to_string_t("question-456");
4
5api->getQuestionConfig(tenantId, questionId)
6 .then([](pplx::task<std::shared_ptr<GetQuestionConfigResponse>> task) {
7 try {
8 auto response = task.get();
9 // Използвайте отговора, както е необходимо
10 } catch (const std::exception&) {
11 // Обработете грешката
12 }
13 });
14

Вземи конфигурации на въпроси Internal Link

Parameters

NameTypeRequiredDescription
tenantIdstringYes
skipdoubleNo

Response

Връща: GetQuestionConfigsResponse

Example

Пример за getQuestionConfigs
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3boost::optional<double> skip = 10.0;
4api->getQuestionConfigs(tenantId, skip).then([](std::shared_ptr<GetQuestionConfigsResponse> resp){
5 auto config = std::make_shared<GetQuestionConfigsResponse>(*resp);
6});
7

Обнови конфигурация на въпрос Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes
updateQuestionConfigBodyUpdateQuestionConfigBodyYes

Отговор

Връща: APIEmptyResponse

Пример

updateQuestionConfig Пример
Copy Copy
1
2UpdateQuestionConfigBody updateBody;
3updateBody.enabled = true;
4updateBody.maxResponses = boost::optional<int>{10};
5updateBody.notes = boost::optional<utility::string_t>{U("Config updated via SDK")};
6
7api->updateQuestionConfig(U("my-tenant-123"), U("config-789"), updateBody)
8 .then([](std::shared_ptr<APIEmptyResponse> resp) {
9 })
10 .then([](pplx::task<void> t) {
11 try { t.get(); } catch (const std::exception&) {}
12 });
13

Създай резултат от въпрос Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
createQuestionResultBodyCreateQuestionResultBodyYes

Отговор

Връща: CreateQuestionResultResponse

Пример

Пример за createQuestionResult
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3CreateQuestionResultBody body;
4body.questionId = U("question-456");
5body.result = U("approved");
6body.comment = boost::optional<utility::string_t>(U("Looks good"));
7api->createQuestionResult(tenantId, body)
8 .then([=](pplx::task<std::shared_ptr<CreateQuestionResultResponse>> t) {
9 try {
10 auto resp = t.get();
11 } catch (const std::exception&) {
12 }
13 });
14

Изтрий резултат от въпрос Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes

Отговор

Връща: APIEmptyResponse

Пример

Пример за deleteQuestionResult
Copy Copy
1
2boost::optional<utility::string_t> optTenant = utility::conversions::to_string_t( "my-tenant-123" );
3utility::string_t questionId = utility::conversions::to_string_t( "question-456" );
4
5if ( optTenant )
6{
7 api->deleteQuestionResult( *optTenant, questionId )
8 .then( []( pplx::task<std::shared_ptr<APIEmptyResponse>> t )
9 {
10 try
11 {
12 auto resp = t.get();
13 // обработка на успеха
14 }
15 catch ( const std::exception& e )
16 {
17 // обработка на грешки
18 }
19 } );
20}
21

Вземи резултат от въпрос Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа

Отговор

Връща: GetQuestionResultResponse

Пример

getQuestionResult Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3auto questionId = utility::string_t(U("question-789"));
4boost::optional<utility::string_t> optionalParam = boost::none;
5
6api->getQuestionResult(tenantId, questionId)
7 .then([](pplx::task<std::shared_ptr<GetQuestionResultResponse>> task) {
8 try {
9 auto response = task.get();
10 } catch (const std::exception&) {
11 }
12 });
13

Вземи резултати от въпроси Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
optionsconst GetQuestionResultsOptions&Yes

Отговор

Връща: GetQuestionResultsResponse

Пример

Пример за getQuestionResults
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3GetQuestionResultsOptions options;
4options.questionId = boost::optional<utility::string_t>(U("question-456"));
5options.includeDeleted = boost::optional<bool>(false);
6api->getQuestionResults(tenantId, options)
7 .then([](pplx::task<std::shared_ptr<GetQuestionResultsResponse>> t) {
8 auto response = t.get();
9 // обработка на отговора
10 });
11

Обнови резултат от въпрос Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа
updateQuestionResultBodyUpdateQuestionResultBodyДа

Отговор

Връща: APIEmptyResponse

Пример

updateQuestionResult Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3auto questionId = utility::string_t(U("question-456"));
4UpdateQuestionResultBody body;
5body.result = U("approved");
6body.note = boost::optional<utility::string_t>(U("Reviewed by admin"));
7api->updateQuestionResult(tenantId, questionId, body)
8 .then([](pplx::task<std::shared_ptr<APIEmptyResponse>> t) {
9 try {
10 auto respPtr = std::make_shared<APIEmptyResponse>(*t.get());
11 } catch (const std::exception&) {
12 }
13 });
14

Агрегирай резултати от въпроси Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst AggregateQuestionResultsOptions&Да

Отговор

Връща: AggregateQuestionResultsResponse

Пример

aggregateQuestionResults Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3AggregateQuestionResultsOptions opts;
4opts.questionId = utility::conversions::to_string_t("question-789");
5opts.startDate = boost::optional<utility::datetime>(utility::datetime::from_string(U("2023-01-01T00:00:00Z"), utility::datetime::ISO_8601));
6opts.endDate = boost::optional<utility::datetime>(utility::datetime::from_string(U("2023-01-31T23:59:59Z"), utility::datetime::ISO_8601));
7api->aggregateQuestionResults(tenantId, opts)
8 .then([](std::shared_ptr<AggregateQuestionResultsResponse> resp) {
9 static_cast<void>(resp);
10 });
11

Масово агрегиране на резултати от въпроси Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
bulkAggregateQuestionResultsRequestBulkAggregateQuestionResultsRequestYes
forceRecalculateboolNo

Отговор

Връща: BulkAggregateQuestionResultsResponse

Пример

bulkAggregateQuestionResults Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3BulkAggregateQuestionResultsRequest request;
4request.questionIds = {
5 utility::conversions::to_string_t("q123"),
6 utility::conversions::to_string_t("q456")
7};
8request.startDate = utility::datetime::from_string(U("2023-01-01T00:00:00Z"));
9request.endDate = utility::datetime::from_string(U("2023-01-31T23:59:59Z"));
10boost::optional<bool> forceRecalc = true;
11api->bulkAggregateQuestionResults(tenantId, request, forceRecalc)
12 .then([](pplx::task<std::shared_ptr<BulkAggregateQuestionResultsResponse>> t) {
13 auto resp = t.get();
14 });
15

Съчетай коментари с резултати от въпроси Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst CombineCommentsWithQuestionResultsOptions&Да

Отговор

Връща: CombineQuestionResultsWithCommentsResponse

Пример

combineCommentsWithQuestionResults Пример
Copy Copy
1
2utility::string_t tenantId = utility::string_t("my-tenant-123");
3CombineCommentsWithQuestionResultsOptions options;
4options.questionId = utility::string_t("question-789");
5options.maxComments = boost::optional<int>(50);
6api->combineCommentsWithQuestionResults(tenantId, options).then(
7 [](pplx::task<std::shared_ptr<CombineQuestionResultsWithCommentsResponse>> task){
8 try{
9 auto respPtr = task.get();
10 auto combined = std::make_shared<CombineQuestionResultsWithCommentsResponse>(*respPtr);
11 // Използвайте комбинираното, както е необходимо
12 }catch(const std::exception&){
13 }
14 });
15

Добави SSO потребител Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
createAPISSOUserDataCreateAPISSOUserDataДа

Отговор

Връща: AddSSOUserAPIResponse

Пример

addSSOUser Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3CreateAPISSOUserData createAPISSOUserData;
4createAPISSOUserData.email = utility::conversions::to_string_t("john.doe@example.com");
5createAPISSOUserData.externalId = utility::conversions::to_string_t("ext-9876");
6createAPISSOUserData.firstName = boost::optional<utility::string_t>(utility::conversions::to_string_t("John"));
7createAPISSOUserData.lastName = boost::optional<utility::string_t>(utility::conversions::to_string_t("Doe"));
8api->addSSOUser(tenantId, createAPISSOUserData)
9 .then([](std::shared_ptr<AddSSOUserAPIResponse> resp) {
10 });
11

Изтрий SSO потребител Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа
optionsconst DeleteSSOUserOptions&Да

Отговор

Връща: DeleteSSOUserAPIResponse

Пример

Пример за deleteSSOUser
Copy Copy
1
2auto tenantId = U("my-tenant-123");
3auto userId = U("user-456");
4DeleteSSOUserOptions options;
5options.dryRun = boost::optional<bool>(true);
6api->deleteSSOUser(tenantId, userId, options).then([](std::shared_ptr<DeleteSSOUserAPIResponse> resp) {
7 if (resp) {
8 (void)resp;
9 }
10});
11

Вземи SSO потребител по имейл Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
emailstringДа

Отговор

Връща: GetSSOUserByEmailAPIResponse

Пример

getSSOUserByEmail Пример
Copy Copy
1
2auto correlationId = boost::optional<utility::string_t>(utility::conversions::to_string_t("corr-001"));
3
4api->getSSOUserByEmail(
5 utility::conversions::to_string_t("my-tenant-123"),
6 utility::conversions::to_string_t("user@example.com")
7).then([](pplx::task<std::shared_ptr<GetSSOUserByEmailAPIResponse>> t) {
8 try {
9 auto response = t.get();
10 } catch (const std::exception&) {
11 }
12});
13

Вземи SSO потребител по ID Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа

Отговор

Връща: GetSSOUserByIdAPIResponse

Пример

Пример за getSSOUserById
Copy Copy
1
2auto tenantId = U("my-tenant-123");
3auto ssoUserId = U("user-789");
4api->getSSOUserById(tenantId, ssoUserId)
5 .then([](std::shared_ptr<GetSSOUserByIdAPIResponse> resp) {
6 boost::optional<utility::string_t> email;
7 if (resp && resp->email) email = resp->email;
8 if (email) {
9 auto e = *email;
10 }
11 });
12

Вземи SSO потребители Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
skipint32_tНе

Отговор

Връща: GetSSOUsersResponse

Пример

Пример getSSOUsers
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3boost::optional<int32_t> skip = 25;
4api->getSSOUsers(tenantId, skip).then([](pplx::task<std::shared_ptr<GetSSOUsersResponse>> t) {
5 try {
6 auto response = t.get();
7 } catch (const std::exception&) {
8 }
9});
10

Частично обнови SSO потребител Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes
updateAPISSOUserDataUpdateAPISSOUserDataYes
updateCommentsboolNo

Отговор

Връща: PatchSSOUserAPIResponse

Пример

Пример за patchSSOUser
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t userId = U("user-456");
4UpdateAPISSOUserData updateData;
5updateData.email = U("jane.doe@example.com");
6updateData.displayName = U("Jane Doe");
7boost::optional<bool> updateComments = true;
8
9api->patchSSOUser(tenantId, userId, updateData, updateComments)
10 .then([](pplx::task<std::shared_ptr<PatchSSOUserAPIResponse>> t){
11 try{
12 auto resp = t.get();
13 (void)resp;
14 }catch(const std::exception&){
15 }
16 });
17

Задай SSO потребител (PUT) Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes
updateAPISSOUserDataUpdateAPISSOUserDataYes
updateCommentsboolNo

Отговор

Връща: PutSSOUserAPIResponse

Пример

putSSOUser Пример
Copy Copy
1
2UpdateAPISSOUserData userData;
3userData.email = utility::conversions::to_string_t("alice@example.com");
4userData.first_name = utility::conversions::to_string_t("Alice");
5userData.last_name = utility::conversions::to_string_t("Smith");
6userData.role = utility::conversions::to_string_t("moderator");
7
8api->putSSOUser(
9 utility::conversions::to_string_t("my-tenant-123"),
10 utility::conversions::to_string_t("alice.smith"),
11 userData,
12 boost::optional<bool>(true)
13).then([](pplx::task<std::shared_ptr<PutSSOUserAPIResponse>> t) {
14 auto response = t.get();
15});
16

Създай абонамент Internal Link


Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
createAPIUserSubscriptionDataCreateAPIUserSubscriptionDataДа

Отговор

Връща: CreateSubscriptionAPIResponse

Пример

createSubscription Пример
Copy Copy
1
2auto tenantId = U("my-tenant-123");
3CreateAPIUserSubscriptionData subscriptionData;
4subscriptionData.email = U("user@example.com");
5subscriptionData.planId = U("premium-plan");
6subscriptionData.couponCode = boost::optional<utility::string_t>(U("WELCOME10"));
7api->createSubscription(tenantId, subscriptionData)
8 .then([](pplx::task<std::shared_ptr<CreateSubscriptionAPIResponse>> task) {
9 try {
10 auto response = task.get();
11 } catch (const std::exception&) {
12 }
13 });
14

Изтрий абонамент Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа
userIdstringНе

Отговор

Връща: DeleteSubscriptionAPIResponse

Пример

deleteSubscription Пример
Copy Copy
1
2api->deleteSubscription(utility::string_t(U("my-tenant-123")), utility::string_t(U("sub-456")), boost::optional<utility::string_t>(utility::string_t(U("user@example.com"))))
3 .then([](std::shared_ptr<DeleteSubscriptionAPIResponse> resp){
4 if (resp) {
5 }
6 });
7

Вземи абонаменти Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
userIdstringНе

Отговор

Връща: GetSubscriptionsAPIResponse

Пример

Пример за getSubscriptions
Copy Copy
1
2auto tenant = utility::conversions::to_string_t("my-tenant-123");
3boost::optional<utility::string_t> user = utility::conversions::to_string_t("user@example.com");
4
5api->getSubscriptions(tenant, user).then(
6 [](pplx::task<std::shared_ptr<GetSubscriptionsAPIResponse>> t) {
7 try {
8 auto response = t.get();
9 // process response
10 } catch (const std::exception& e) {
11 // handle error
12 }
13 }
14);
15

Обнови абонамент Internal Link

Параметри

ИмеТипИзисква сеОписание
tenantIdstringYes
idstringYes
updateAPIUserSubscriptionDataUpdateAPIUserSubscriptionDataYes
userIdstringNo

Отговор

Returns: UpdateSubscriptionAPIResponse

Пример

Пример за updateSubscription
Copy Copy
1
2UpdateAPIUserSubscriptionData subscriptionData;
3subscriptionData.plan = utility::conversions::to_string_t("premium");
4subscriptionData.active = true;
5
6api->updateSubscription(
7 utility::conversions::to_string_t("my-tenant-123"),
8 utility::conversions::to_string_t("sub-987654"),
9 subscriptionData,
10 boost::optional<utility::string_t>(utility::conversions::to_string_t("admin-user-456"))
11).then([](std::shared_ptr<UpdateSubscriptionAPIResponse> response){
12 bool ok = response && response->isSuccess;
13 (void)ok;
14});
15

Вземи дневна употреба на наемател Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetTenantDailyUsagesOptions&Да

Отговор

Връща: GetTenantDailyUsagesResponse

Пример

Пример за getTenantDailyUsages
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3GetTenantDailyUsagesOptions opts;
4opts.startDate = boost::optional<utility::datetime>(utility::datetime::from_string(U("2023-01-01T00:00:00Z")));
5opts.endDate = boost::optional<utility::datetime>(utility::datetime::from_string(U("2023-01-31T23:59:59Z")));
6api->getTenantDailyUsages(tenantId, opts).then([](std::shared_ptr<GetTenantDailyUsagesResponse> resp){
7 auto result = std::make_shared<GetTenantDailyUsagesResponse>(*resp);
8}).wait();
9

Създай пакет за наемател Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
createTenantPackageBodyCreateTenantPackageBodyДа

Отговор

Връща: CreateTenantPackageResponse

Пример

Пример за createTenantPackage
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3CreateTenantPackageBody body;
4body.name = utility::conversions::to_string_t("Pro Plan");
5body.maxUsers = 100;
6body.expiryDate = boost::optional<utility::datetime>(utility::datetime::utc_now() + std::chrono::hours(24 * 30));
7body.notes = boost::none;
8api->createTenantPackage(tenantId, body).then([](pplx::task<std::shared_ptr<CreateTenantPackageResponse>> t){
9 try{
10 auto resp = t.get();
11 }catch(const std::exception&){
12 }
13});
14

Изтрий пакет за наемател Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа

Отговор

Връща: APIEmptyResponse

Пример

Пример за deleteTenantPackage
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto packageId = utility::conversions::to_string_t("pkg-456");
4boost::optional<utility::string_t> optTenant = tenantId;
5boost::optional<utility::string_t> optPackage = packageId;
6api->deleteTenantPackage(optTenant.value(), optPackage.value())
7 .then([](std::shared_ptr<APIEmptyResponse>){ })
8 .then([](pplx::task<void> t){ try{ t.get(); }catch(const std::exception&){ } });
9

Вземи пакет за наемател Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа

Отговор

Връща: GetTenantPackageResponse

Пример

getTenantPackage Пример
Copy Copy
1
2auto tenantId = U("my-tenant-123");
3auto packageId = U("pkg-456");
4api->getTenantPackage(tenantId, packageId).then([](pplx::task<std::shared_ptr<GetTenantPackageResponse>> task){
5 try{
6 auto resp = task.get();
7 auto result = std::make_shared<GetTenantPackageResponse>(*resp);
8 }catch(...){}
9});
10

Вземи пакети за наемател Internal Link

Параметри

NameTypeRequiredDescription
tenantIdstringYes
skipdoubleNo

Отговор

Връща: GetTenantPackagesResponse

Пример

Пример getTenantPackages
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3boost::optional<double> skip = 20.0;
4api->getTenantPackages(tenantId, skip)
5 .then([](std::shared_ptr<GetTenantPackagesResponse> resp) {
6 (void)resp;
7 });
8

Замени пакет за наемател Internal Link

Параметри

NameTypeRequiredDescription
tenantIdstringYes
idstringYes
replaceTenantPackageBodyReplaceTenantPackageBodyYes

Отговор

Връща: APIEmptyResponse

Пример

replaceTenantPackage Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto pkgId = utility::conversions::to_string_t("pkg-456");
4ReplaceTenantPackageBody body;
5body.planId = utility::conversions::to_string_t("enterprise");
6body.notes = boost::optional<utility::string_t>(utility::conversions::to_string_t("Upgrade request"));
7api->replaceTenantPackage(tenantId, pkgId, body)
8 .then([](std::shared_ptr<APIEmptyResponse>) { })
9 .then([](pplx::task<void> t) {
10 try { t.get(); } catch (const std::exception&) { }
11 });
12

Обнови пакет за наемател Internal Link

Parameters

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes
updateTenantPackageBodyUpdateTenantPackageBodyYes

Response

Връща: APIEmptyResponse

Example

updateTenantPackage Пример
Copy Copy
1
2auto body = std::make_shared<UpdateTenantPackageBody>();
3body->packageId = utility::conversions::to_string_t("premium-plan");
4body->expirationDate = utility::conversions::to_string_t("2025-12-31");
5body->notes = boost::optional<utility::string_t>(utility::conversions::to_string_t("Upgraded package"));
6
7api->updateTenantPackage(utility::conversions::to_string_t("my-tenant-123"),
8 utility::conversions::to_string_t("pkg-456"),
9 body)
10 .then([](pplx::task<std::shared_ptr<APIEmptyResponse>> task) {
11 try {
12 auto response = task.get();
13 // обработка при успех
14 } catch (const std::exception& ex) {
15 // обработка при грешка
16 }
17 });
18

Създай потребител на наемателя Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
createTenantUserBodyCreateTenantUserBodyДа

Отговор

Връща: CreateTenantUserResponse

Пример

createTenantUser Пример
Copy Copy
1
2auto body = CreateTenantUserBody{};
3body.email = utility::conversions::to_string_t("newuser@example.com");
4body.firstName = utility::conversions::to_string_t("Alice");
5body.lastName = utility::conversions::to_string_t("Smith");
6body.role = boost::optional<utility::string_t>(utility::conversions::to_string_t("moderator"));
7
8api->createTenantUser(utility::conversions::to_string_t("my-tenant-123"), body)
9 .then([](pplx::task<std::shared_ptr<CreateTenantUserResponse>> task) {
10 try {
11 auto response = task.get();
12 } catch (const std::exception&) {
13 }
14 });
15

Изтрий потребител на наемателя Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа
optionsconst DeleteTenantUserOptions&Да

Отговор

Връща: APIEmptyResponse

Пример

deleteTenantUser Пример
Copy Copy
1
2DeleteTenantUserOptions options;
3options.reason = boost::optional<utility::string_t>(U("User requested deletion"));
4
5api->deleteTenantUser(U("my-tenant-123"), U("user@example.com"), options)
6 .then([](std::shared_ptr<APIEmptyResponse> resp){
7 (void)resp;
8 });
9

Вземи потребител на наемателя Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа

Отговор

Връща: GetTenantUserResponse

Пример

Пример за getTenantUser
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto userId = utility::conversions::to_string_t("user@example.com");
4api->getTenantUser(tenantId, userId)
5 .then([](pplx::task<std::shared_ptr<GetTenantUserResponse>> task) {
6 try {
7 auto response = task.get();
8 // Използвайте отговора по желание
9 } catch (const std::exception&) {
10 // Обработка на грешки
11 }
12 });
13

Вземи потребители на наемателя Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
skipdoubleНе

Отговор

Връща: GetTenantUsersResponse

Пример

Пример за getTenantUsers
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3boost::optional<double> skip = 10;
4
5api->getTenantUsers(tenantId, skip).then([](pplx::task<std::shared_ptr<GetTenantUsersResponse>> t){
6 try {
7 auto resp = t.get();
8 } catch (const std::exception&) {
9 }
10});
11

Замени потребител на наемателя Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes
replaceTenantUserBodyReplaceTenantUserBodyYes
updateCommentsstringNo

Отговор

Връща: APIEmptyResponse

Пример

replaceTenantUser Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3auto userId = utility::string_t(U("john.doe@example.com"));
4ReplaceTenantUserBody replaceBody;
5replaceBody.email = utility::string_t(U("john.doe@example.com"));
6replaceBody.role = utility::string_t(U("admin"));
7boost::optional<utility::string_t> updateComments = utility::string_t(U("Promoted to admin"));
8api->replaceTenantUser(tenantId, userId, replaceBody, updateComments)
9 .then([](std::shared_ptr<APIEmptyResponse> resp){ });
10

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes
redirectURLstringNo

Отговор

Връща: APIEmptyResponse

Пример

sendLoginLink Пример
Copy Copy
1
2api->sendLoginLink(
3 U("my-tenant-123"),
4 U("user@example.com"),
5 boost::make_optional(U("https://myapp.com/auth/callback"))
6).then([](std::shared_ptr<APIEmptyResponse> resp) {
7});
8

Обнови потребител на наемателя Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа
updateTenantUserBodyUpdateTenantUserBodyДа
updateCommentsstringНе

Отговор

Връща: APIEmptyResponse

Пример

Пример за updateTenantUser
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t userId = U("user-456");
4UpdateTenantUserBody body;
5body.email = U("john.doe@example.com");
6body.role = U("admin");
7boost::optional<utility::string_t> updateComments = U("Promoted to admin");
8
9api->updateTenantUser(tenantId, userId, body, updateComments)
10 .then([](std::shared_ptr<APIEmptyResponse>){ });
11

Създай наемател Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
createTenantBodyCreateTenantBodyДа

Отговор

Връща: CreateTenantResponse

Пример

createTenant Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3CreateTenantBody body;
4body.setName(utility::conversions::to_string_t("Acme Corp"));
5body.setAdminEmail(utility::conversions::to_string_t("admin@acme.com"));
6body.setPlan(utility::conversions::to_string_t("enterprise"));
7body.setDescription(boost::optional<utility::string_t>(utility::conversions::to_string_t("Primary tenant for Acme")));
8
9api->createTenant(tenantId, body).then([](pplx::task<std::shared_ptr<CreateTenantResponse>> t){
10 auto resp = t.get();
11});
12

Изтрий наемател Internal Link


Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа
surestringНе

Отговор

Връща: APIEmptyResponse

Пример

Пример за deleteTenant
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto userId = utility::conversions::to_string_t("user@example.com");
4boost::optional<utility::string_t> sure = utility::conversions::to_string_t("true");
5api->deleteTenant(tenantId, userId, sure)
6 .then([](pplx::task<std::shared_ptr<APIEmptyResponse>> t){
7 try{
8 auto resp = t.get();
9 auto result = std::make_shared<APIEmptyResponse>(*resp);
10 }catch(const std::exception&){})
11

Вземи наемател Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа

Отговор

Връща: GetTenantResponse

Пример

Пример за getTenant
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto id = utility::conversions::to_string_t("tenant-admin-456");
4boost::optional<utility::string_t> includeDetails = utility::conversions::to_string_t("full");
5api->getTenant(tenantId, id)
6 .then([](std::shared_ptr<GetTenantResponse> resp) {
7 if (resp) {
8 std::wcout << resp->toString() << std::endl;
9 }
10 });
11

Вземи наематели Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetTenantsOptions&Да

Отговор

Връща: GetTenantsResponse

Пример

Пример getTenants
Copy Copy
1
2GetTenantsOptions options;
3options.includeDeleted = boost::make_optional(false);
4options.searchTerm = boost::make_optional(utility::string_t(U("enterprise")));
5
6api->getTenants(utility::string_t(U("my-tenant-123")), options)
7 .then([](std::shared_ptr<GetTenantsResponse> response) {
8 })
9 .then([](pplx::task<void> t){ try{ t.get(); }catch(...){} });
10

Обнови наемател Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
idstringYes
updateTenantBodyUpdateTenantBodyYes

Отговор

Връща: APIEmptyResponse

Пример

updateTenant Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3auto recordId = utility::string_t(U("tenant-456"));
4UpdateTenantBody body;
5body.name = boost::optional<utility::string_t>(U("Acme Corp"));
6body.contactEmail = boost::optional<utility::string_t>(U("admin@acme.com"));
7api->updateTenant(tenantId, recordId, body).then([](std::shared_ptr<APIEmptyResponse> resp) {
8 auto log = std::make_shared<utility::string_t>(U("Tenant update succeeded"));
9 (void)resp;
10 (void)log;
11});
12

Промени състоянието на билет Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
userIdstringYes
idstringYes
changeTicketStateBodyChangeTicketStateBodyYes

Отговор

Връща: ChangeTicketStateResponse

Пример

changeTicketState Пример
Copy Copy
1
2auto body = std::make_shared<ChangeTicketStateBody>();
3body->state = U("closed");
4body->comment = boost::optional<utility::string_t>(U("Ticket resolved"));
5api->changeTicketState(U("my-tenant-123"), U("user@example.com"), U("ticket-456"), *body)
6 .then([](std::shared_ptr<ChangeTicketStateResponse>) {});
7

Създай билет Internal Link

Parameters

NameTypeRequiredDescription
tenantIdstringYes
userIdstringYes
createTicketBodyCreateTicketBodyYes

Response

Връща: CreateTicketResponse

Example

Пример за createTicket
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto userId = utility::conversions::to_string_t("john.doe@example.com");
4CreateTicketBody ticketBody;
5ticketBody.setSubject(utility::conversions::to_string_t("Login Issue"));
6ticketBody.setDescription(utility::conversions::to_string_t("Cannot log in after password reset."));
7boost::optional<int> priority = 2;
8ticketBody.setPriority(priority);
9api->createTicket(tenantId, userId, ticketBody).then([](pplx::task<std::shared_ptr<CreateTicketResponse>> task){
10 try{
11 auto response = task.get();
12 // Използвайте отговора според нужда
13 }catch(const std::exception&){
14 // Обработете грешката
15 }
16});
17

Вземи билет Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа
userIdstringНе

Отговор

Връща: GetTicketResponse

Пример

Пример getTicket
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t ticketId = U("ticket-789");
4boost::optional<utility::string_t> userId = U("alice@example.com");
5api->getTicket(tenantId, ticketId, userId).then([](pplx::task<std::shared_ptr<GetTicketResponse>> task){
6 try{
7 auto resp = task.get();
8 }catch(const std::exception&){
9 }
10});
11

Вземи билети Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
optionsconst GetTicketsOptions&Yes

Отговор

Returns: GetTicketsResponse

Пример

Пример за getTickets
Copy Copy
1
2auto options = GetTicketsOptions{};
3options.page = boost::optional<int>(1);
4options.status = boost::optional<utility::string_t>(U("open"));
5api->getTickets(U("my-tenant-123"), options).then([](pplx::task<std::shared_ptr<GetTicketsResponse>> task) {
6 try {
7 auto response = task.get();
8 auto responseCopy = std::make_shared<GetTicketsResponse>(*response);
9 } catch (const std::exception&) {
10 }
11});
12

Вземи преводи Internal Link

Параметри

ИмеТипЗадължителноОписание
r_namespacestringДа
componentstringДа
optionsconst GetTranslationsOptions&Да

Отговор

Връща: GetTranslationsResponse

Пример

Пример за getTranslations
Copy Copy
1
2utility::string_t ns = U("my-tenant-123");
3utility::string_t comp = U("comments");
4auto optsPtr = std::make_shared<GetTranslationsOptions>();
5optsPtr->language = boost::make_optional(U("en"));
6optsPtr->fallback = boost::none;
7api->getTranslations(ns, comp, *optsPtr)
8 .then([](pplx::task<std::shared_ptr<GetTranslationsResponse>> t) {
9 try {
10 auto resp = t.get();
11 } catch (const std::exception& e) {
12 }
13 });
14

Качи изображение Internal Link

Upload and resize an image

Качване и преоразмеряване на изображение

Parameters

Параметри

NameTypeRequiredDescription
tenantIdstringYes
fileHttpContentYes
optionsconst UploadImageOptions&Yes
ИмеТипЗадължителноОписание
tenantIdstringДа
fileHttpContentДа
optionsconst UploadImageOptions&Да

Response

Отговор

Returns: UploadImageResponse Връща: UploadImageResponse

Example

Пример

Пример за uploadImage
Copy Copy
1
2auto fileStream = concurrency::streams::fstream::open_istream(U("avatar.png"), std::ios::in).get();
3HttpContent file(fileStream, U("image/png"));
4UploadImageOptions options;
5options.description = boost::optional<utility::string_t>(U("Profile picture"));
6options.width = boost::optional<int>(256);
7options.height = boost::optional<int>(256);
8api->uploadImage(U("my-tenant-123"), file, options).then([](pplx::task<std::shared_ptr<UploadImageResponse>> t){
9 auto resp = t.get();
10});
11

Вземи напредъка на значка за потребител по ID Internal Link


Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа

Отговор

Връща: APIGetUserBadgeProgressResponse

Пример

Пример за getUserBadgeProgressById
Copy Copy
1
2auto tenantId = U("my-tenant-123");
3auto userId = U("user-456");
4api->getUserBadgeProgressById(tenantId, userId)
5 .then([=](pplx::task<std::shared_ptr<APIGetUserBadgeProgressResponse>> t){
6 try{
7 auto resp = t.get();
8 boost::optional<std::shared_ptr<APIGetUserBadgeProgressResponse>> optResp = resp;
9 if(optResp){}
10 }catch(const std::exception&){}
11 });
12

Вземи напредъка на значка за потребител по потребителско ID Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
userIdstringYes

Отговор

Връща: APIGetUserBadgeProgressResponse

Пример

Пример за getUserBadgeProgressByUserId
Copy Copy
1
2boost::optional<std::shared_ptr<APIGetUserBadgeProgressResponse>> responseOpt;
3api->getUserBadgeProgressByUserId(
4 utility::conversions::to_string_t("my-tenant-123"),
5 utility::conversions::to_string_t("user@example.com"))
6 .then([&responseOpt](pplx::task<std::shared_ptr<APIGetUserBadgeProgressResponse>> t) {
7 try {
8 responseOpt = t.get();
9 } catch (...) {
10 responseOpt = boost::none;
11 }
12 });
13

Вземи списък с напредъка на значки на потребител Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetUserBadgeProgressListOptions&Да

Отговор

Връща: APIGetUserBadgeProgressListResponse

Пример

Пример за getUserBadgeProgressList
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3GetUserBadgeProgressListOptions options;
4options.userId = U("user@example.com");
5options.page = boost::optional<int>(1);
6options.pageSize = boost::optional<int>(20);
7api->getUserBadgeProgressList(tenantId, options)
8 .then([](std::shared_ptr<APIGetUserBadgeProgressListResponse> resp) {
9 if (!resp) return;
10 for (const auto& badge : resp->badges) {
11 // обработи значка
12 }
13 });
14

Създай значка за потребител Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
createUserBadgeParamsCreateUserBadgeParamsДа

Отговор

Връща: APICreateUserBadgeResponse

Пример

createUserBadge Пример
Copy Copy
1
2auto tenantId = U("my-tenant-123");
3CreateUserBadgeParams badgeParams;
4badgeParams.userEmail = U("user@example.com");
5badgeParams.badgeCode = U("gold");
6badgeParams.expirationDate = boost::optional<utility::datetime>(utility::datetime::utc_now() + utility::datetime::from_seconds(2592000));
7api->createUserBadge(tenantId, badgeParams).then([](std::shared_ptr<APICreateUserBadgeResponse> resp){
8 if (resp && resp->success) {
9 auto result = std::make_shared<APICreateUserBadgeResponse>(*resp);
10 }
11});
12

Изтрий значка за потребител Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа

Отговор

Връща: APIEmptySuccessResponse

Пример

Пример за deleteUserBadge
Copy Copy
1
2auto tenantId = boost::optional<utility::string_t>(U("my-tenant-123"));
3auto badgeId = utility::string_t(U("badge-789"));
4api->deleteUserBadge(tenantId.value(), badgeId)
5 .then([](std::shared_ptr<APIEmptySuccessResponse> resp){
6 auto copy = std::make_shared<APIEmptySuccessResponse>(*resp);
7 })
8 .then([](pplx::task<void> t){
9 try{ t.get(); } catch(const std::exception&){ }
10 });
11

Вземи значка за потребител Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа

Отговор

Връща: APIGetUserBadgeResponse

Пример

getUserBadge Пример
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t userId = U("user-456");
4api->getUserBadge(tenantId, userId).then([](pplx::task<std::shared_ptr<APIGetUserBadgeResponse>> t){
5 try{
6 auto resp = t.get();
7 boost::optional<std::string> badgeUrl = resp->badge_url ? boost::optional<std::string>(*resp->badge_url) : boost::none;
8 }catch(const std::exception&){
9 }
10});
11

Вземи значки за потребител Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetUserBadgesOptions&Да

Отговор

Връща: APIGetUserBadgesResponse

Пример

Пример за getUserBadges
Copy Copy
1
2GetUserBadgesOptions opts;
3opts.userId = boost::make_optional(U("user@example.com"));
4opts.includeExpired = boost::make_optional(false);
5
6api->getUserBadges(U("my-tenant-123"), opts)
7 .then([](pplx::task<std::shared_ptr<APIGetUserBadgesResponse>> t) {
8 try {
9 auto response = t.get();
10 } catch (const std::exception&) {
11 }
12 });
13

Обнови значка за потребител Internal Link

Параметри

ИмеТипЗадължителенОписание
tenantIdstringДа
idstringДа
updateUserBadgeParamsUpdateUserBadgeParamsДа

Отговор

Връща: APIEmptySuccessResponse

Пример

Пример за updateUserBadge
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto userId = utility::conversions::to_string_t("user@example.com");
4UpdateUserBadgeParams params;
5params.badgeId = utility::conversions::to_string_t("vip-badge");
6params.expiration = boost::optional<utility::datetime>(utility::datetime::from_string(U("2024-12-31T23:59:59Z")));
7api->updateUserBadge(tenantId, userId, params)
8 .then([](std::shared_ptr<APIEmptySuccessResponse> resp){
9 std::cout << "Badge updated successfully\n";
10 })
11 .catch([](std::exception const& e){
12 std::cerr << "Error updating badge: " << e.what() << "\n";
13 });
14

Вземи брой потребителски известия Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
ssostringНе

Отговор

Връща: GetUserNotificationCountResponse

Пример

Пример за getUserNotificationCount
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3boost::optional<utility::string_t> sso = utility::conversions::to_string_t("user@example.com");
4api->getUserNotificationCount(tenantId, sso).then([](pplx::task<std::shared_ptr<GetUserNotificationCountResponse>> t){
5 try{
6 auto resp = t.get();
7 // използвайте resp според нуждите
8 }catch(const std::exception&){
9 // обработете грешката
10 }
11});
12

Вземи потребителски известия Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst GetUserNotificationsOptions&Да

Отговор

Връща: GetMyNotificationsResponse

Пример

getUserNotifications Пример
Copy Copy
1
2utility::string_t tenantId = utility::string_t("my-tenant-123");
3GetUserNotificationsOptions options;
4options.limit = boost::optional<int>(20);
5options.unreadOnly = boost::optional<bool>(true);
6api->getUserNotifications(tenantId, options)
7 .then([](pplx::task<std::shared_ptr<GetMyNotificationsResponse>> task){
8 auto resp = task.get();
9 auto notifications = std::make_shared<GetMyNotificationsResponse>(*resp);
10 });
11

Нулирай брой потребителски известия Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
ssostringNo

Отговор

Връща: ResetUserNotificationsResponse

Пример

Пример за resetUserNotificationCount
Copy Copy
1
2auto resetTask = api->resetUserNotificationCount(
3 U("my-tenant-123"),
4 boost::optional<utility::string_t>(U("user@example.com"))
5).then([](std::shared_ptr<ResetUserNotificationsResponse> resp){
6});
7

Нулирай потребителски известия Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
optionsconst ResetUserNotificationsOptions&Да

Отговор

Връща: ResetUserNotificationsResponse

Пример

resetUserNotifications Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3ResetUserNotificationsOptions options;
4options.email = boost::optional<utility::string_t>(U("user@example.com"));
5api->resetUserNotifications(tenantId, options)
6 .then([](std::shared_ptr<ResetUserNotificationsResponse> resp) {
7 // Обработете отговора
8 });
9

Обнови статус на абонамент за известия за коментари на потребителя Internal Link

Enable or disable notifications for a specific comment.

Parameters

ИмеТипЗадължителноОписание
tenantIdstringYes
notificationIdstringYes
optedInOrOutstringYes
commentIdstringYes
ssostringNo

Response

Връща: UpdateUserNotificationCommentSubscriptionStatusResponse

Example

Пример за updateUserNotificationCommentSubscriptionStatus
Copy Copy
1
2auto updateTask = api->updateUserNotificationCommentSubscriptionStatus(
3 utility::conversions::to_string_t("my-tenant-123"),
4 utility::conversions::to_string_t("notif-456"),
5 utility::conversions::to_string_t("optedIn"),
6 utility::conversions::to_string_t("comment-789"),
7 boost::optional<utility::string_t>(utility::conversions::to_string_t("sso-token-abc"))
8).then([](std::shared_ptr<UpdateUserNotificationCommentSubscriptionStatusResponse> resp){
9 (void)resp;
10});
11

Обнови статус на абонамент за известия за страници на потребителя 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

ИмеТипЗадължителноОписание
tenantIdstringYes
urlIdstringYes
urlstringYes
pageTitlestringYes
subscribedOrUnsubscribedstringYes
ssostringNo

Отговор

Връща: UpdateUserNotificationPageSubscriptionStatusResponse

Пример

Пример за updateUserNotificationPageSubscriptionStatus
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t urlId = U("page-456");
4utility::string_t url = U("https://example.com/articles/awesome-article");
5utility::string_t pageTitle = U("Awesome Article");
6utility::string_t subscription = U("subscribed");
7boost::optional<utility::string_t> sso = boost::make_optional<utility::string_t>(U("sso-token-789"));
8
9api->updateUserNotificationPageSubscriptionStatus(tenantId, urlId, url, pageTitle, subscription, sso)
10 .then([](std::shared_ptr<UpdateUserNotificationPageSubscriptionStatusResponse> resp) {
11 // обработете resp, ако е необходимо
12 });
13

Обнови статус на потребителски известия Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
notificationIdstringДа
newStatusstringДа
ssostringНе

Отговор

Връща: UpdateUserNotificationStatusResponse

Пример

updateUserNotificationStatus Пример
Copy Copy
1
2api->updateUserNotificationStatus(
3 U("my-tenant-123"),
4 U("notif-456"),
5 U("read"),
6 boost::optional<utility::string_t>(U("sso-token-abc"))
7).then([](std::shared_ptr<UpdateUserNotificationStatusResponse> resp) {
8}).wait();
9

Вземи статуси на присъствие на потребителя Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
urlIdWSstringДа
userIdsstringДа

Отговор

Връща: GetUserPresenceStatusesResponse

Пример

Пример за getUserPresenceStatuses
Copy Copy
1
2auto tenantId = U("my-tenant-123");
3auto urlIdWS = U("article-789");
4auto userIds = U("alice@example.com,bob@example.com");
5boost::optional<utility::string_t> optionalFilter = boost::none;
6api->getUserPresenceStatuses(tenantId, urlIdWS, userIds)
7 .then([](pplx::task<std::shared_ptr<GetUserPresenceStatusesResponse>> t){
8 try{
9 auto response = t.get();
10 }catch(...){
11 }
12 });
13

Търси потребители Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringYes
urlIdstringYes
optionsconst SearchUsersOptions&Yes

Отговор

Връща: SearchUsersResult

Пример

searchUsers Пример
Copy Copy
1
2utility::string_t tenantId = U("my-tenant-123");
3utility::string_t urlId = U("article-456");
4SearchUsersOptions options;
5options.query = U("john.doe@example.com");
6options.page = boost::optional<int>(1);
7options.pageSize = boost::optional<int>(20);
8api->searchUsers(tenantId, urlId, options).then([](pplx::task<std::shared_ptr<SearchUsersResult>> task){
9 try{
10 auto result = task.get();
11 }catch(const std::exception&){}
12});
13

Вземи потребител Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа

Отговор

Връща: GetUserResponse

Пример

getUser Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto userId = utility::conversions::to_string_t("user-789");
4boost::optional<utility::string_t> optTag = boost::none;
5
6api->getUser(tenantId, userId)
7 .then([=](pplx::task<std::shared_ptr<GetUserResponse>> task) {
8 try {
9 auto response = task.get();
10 if (!response) {
11 response = std::make_shared<GetUserResponse>();
12 }
13 // обработете отговора според нуждите
14 } catch (const std::exception&) {
15 // обработете грешката
16 }
17 });
18

Създай глас Internal Link


Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
commentIdstringДа
directionstringДа
optionsconst CreateVoteOptions&Да

Отговор

Връща: VoteResponse

Пример

createVote Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto commentId = utility::conversions::to_string_t("cmt-456");
4auto direction = utility::conversions::to_string_t("up");
5auto optionsPtr = std::make_shared<CreateVoteOptions>();
6optionsPtr->userId = utility::conversions::to_string_t("user-789");
7optionsPtr->ipAddress = boost::optional<utility::string_t>(utility::conversions::to_string_t("192.168.1.100"));
8api->createVote(tenantId, commentId, direction, *optionsPtr)
9 .then([](std::shared_ptr<VoteResponse> resp){});
10

Изтрий глас Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
idstringДа
editKeystringНе

Отговор

Връща: VoteDeleteResponse

Пример

deleteVote Пример
Copy Copy
1
2auto tenantId = utility::conversions::to_string_t("my-tenant-123");
3auto voteId = utility::conversions::to_string_t("vote-9876");
4boost::optional<utility::string_t> editKey = utility::conversions::to_string_t("edit-abc123");
5
6api->deleteVote(tenantId, voteId, editKey).then([](pplx::task<std::shared_ptr<VoteDeleteResponse>> task) {
7 try {
8 auto response = task.get();
9 // Обработете отговора по необходимост
10 } catch (const std::exception&) {
11 // Обработете грешката
12 }
13});
14

Вземи гласове Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
urlIdstringДа

Отговор

Връща: GetVotesResponse

Пример

getVotes Пример
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3auto urlId = utility::string_t(U("article-456"));
4boost::optional<utility::string_t> extraHeader = boost::none;
5
6api->getVotes(tenantId, urlId).then([=](pplx::task<std::shared_ptr<GetVotesResponse>> task) {
7 try {
8 auto original = task.get();
9 auto response = std::make_shared<GetVotesResponse>(*original);
10 } catch (...) {
11 // обработка на грешки
12 }
13});
14

Вземи гласове за потребител Internal Link

Параметри

ИмеТипЗадължителноОписание
tenantIdstringДа
urlIdstringДа
optionsconst GetVotesForUserOptions&Да

Отговор

Връща: GetVotesForUserResponse

Пример

Пример getVotesForUser
Copy Copy
1
2auto tenantId = utility::string_t(U("my-tenant-123"));
3auto urlId = utility::string_t(U("post-456"));
4GetVotesForUserOptions options;
5options.page = boost::optional<int>(2);
6options.pageSize = boost::optional<int>(50);
7api->getVotesForUser(tenantId, urlId, options).then([](std::shared_ptr<GetVotesForUserResponse> response) {
8 if (response) {
9 // обработи отговора, напр., обхождай гласовете
10 }
11});
12

Нуждаете ли се от помощ?

Ако срещнете проблеми или имате въпроси относно C++ SDK, моля:

Принос

Приноси са добре дошли! Моля, посетете репозитория в GitHub за указания относно приносянето.