FastComments.com

FastComments JavaScript/TypeScript SDK


Il s'agit du SDK officiel JavaScript/TypeScript pour FastComments.

SDK officiel JavaScript/TypeScript pour l'API FastComments

Dépôt

Voir sur GitHub


Installation Internal Link

npm install fastcomments-sdk

Documentation de l'API Internal Link


Référence complète de l'API: docs/api/README.md

Compatibilité navigateur vs serveur Internal Link


Ce SDK utilise des points d'entrée doubles pour garantir une compatibilité optimale et éviter les erreurs d'exécution :

  • fastcomments-sdk/browser - Version sécurisée pour les navigateurs avec fetch natif
  • fastcomments-sdk/server - Version complète pour Node.js avec prise en charge du SSO
  • fastcomments-sdk (par défaut) - Contient uniquement des types, sûr à importer n'importe où

API publiques vs sécurisées Internal Link

Le SDK fournit trois classes d'API principales :

  • DefaultApi - Points de terminaison sécurisés qui nécessitent votre clé API pour l'authentification. Utilisez-les pour les opérations côté serveur.
  • PublicApi - Points de terminaison publics accessibles sans clé API. Ils peuvent être appelés directement depuis des navigateurs, appareils mobiles, etc.
  • HiddenApi - Points de terminaison internes/admin pour des cas d'utilisation avancés.

Exemple : Utilisation de l'API publique (adaptée au navigateur)

import { PublicApi } from 'fastcomments-sdk/browser';

const publicApi = new PublicApi();

// Récupérer les commentaires d'une page (pas de clé API requise)
const response = await publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id'
});

Exemple : Utilisation de l'API par défaut (côté serveur uniquement)

import { DefaultApi, Configuration } from 'fastcomments-sdk/server';

const config = new Configuration({
  apiKey: 'your-api-key' // À garder secret !
});
const defaultApi = new DefaultApi(config);

// Récupérer les commentaires avec un accès administrateur complet
const response = await defaultApi.getComments({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id'
});

Intégration SSO (Authentification unique) Internal Link

FastComments prend en charge le SSO pour s'intégrer à votre système d'authentification utilisateur existant. La fonctionnalité SSO n'est disponible que dans l'export côté serveur car elle nécessite les fonctionnalités crypto de Node.js.

SSO simple (côté serveur uniquement)

Le SSO simple doit être généré côté serveur et envoyé au client :

// Code côté serveur (Node.js/backend)
import { FastCommentsSSO, PublicApi } from 'fastcomments-sdk/server';

// Créez un SSO simple en utilisant l'assistant intégré  
const userData = {
  username: 'john_doe',
  email: 'john@example.com',
  displayName: 'John Doe',
  avatar: 'https://example.com/avatar.jpg'
};

const sso = FastCommentsSSO.createSimple(userData, {
  loginURL: '/login',
  logoutURL: '/logout'
});

const ssoToken = sso.createToken();

// Envoyez ssoToken à votre code côté client
// Le code côté client peut ensuite utiliser ce jeton avec le SDK pour navigateur

SSO sécurisé (côté serveur, recommandé)

Le SSO sécurisé doit être implémenté côté serveur et offre une meilleure sécurité :

// Code côté serveur (Node.js/backend)
import { FastCommentsSSO, PublicApi } from 'fastcomments-sdk/server';

// Créez un SSO sécurisé en utilisant l'assistant intégré
const userData = {
  id: 'user-123',
  email: 'john@example.com',
  username: 'john_doe',
  displayName: 'John Doe',
  avatar: 'https://example.com/avatar.jpg',
  isAdmin: false,
  isModerator: false
};

const sso = FastCommentsSSO.createSecure('your-api-key', userData, {
  loginURL: '/login',
  logoutURL: '/logout'
});

const ssoConfig = sso.prepareToSend();

// À utiliser avec les appels API côté serveur
const publicApi = new PublicApi();
const response = await publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id',
  sso: JSON.stringify(ssoConfig)
});

// Ou envoyez ssoConfig au client pour une utilisation dans le navigateur

Utiliser le SSO depuis le navigateur (avec un jeton généré par le serveur)

// Code côté client (navigateur)
import { PublicApi } from 'fastcomments-sdk/browser';

// Récupérez le jeton SSO depuis votre endpoint serveur
const ssoToken = await fetch('/api/sso-token').then(r => r.json());

const publicApi = new PublicApi();
const response = await publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id',
  sso: ssoToken // Utilisez le jeton SSO généré par le serveur
});

SSO avec création de commentaire

// Côté serveur : créer le SSO et le commentaire
import { FastCommentsSSO, PublicApi } from 'fastcomments-sdk/server';

const sso = FastCommentsSSO.createSecure('your-api-key', userData);
const ssoConfig = sso.prepareToSend();

const response = await publicApi.createCommentPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id',
  broadcastId: 'unique-broadcast-id',
  commentData: {
    comment: 'This is my comment',
    date: Date.now(),
    commenterName: 'John Doe',
    url: 'https://example.com/page',
    urlId: 'page-url-id'
  },
  sso: JSON.stringify(ssoConfig)
});

Cas d'utilisation courants Internal Link

Récupérer les commentaires d'une page

const comments = await sdk.publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'article-123'
});

Créer un commentaire

const newComment = await sdk.publicApi.createCommentPublic({
  createCommentParams: {
    tenantId: 'your-tenant-id',
    urlId: 'article-123',
    comment: 'Great article!',
    commenterName: 'John Doe',
    commenterEmail: 'john@example.com'
  }
});

Voter sur un commentaire

const voteResponse = await sdk.publicApi.voteComment({
  voteBodyParams: {
    commentId: 'comment-id',
    direction: 1 // 1 pour un vote positif, -1 pour un vote négatif
  }
});

Gestion des utilisateurs (Nécessite une clé API)

// Rechercher des utilisateurs (nécessite DefaultApi)
const users = await sdk.defaultApi.searchUsers({
  tenantId: 'your-tenant-id',
  urlId: 'page-id',
  usernameStartsWith: 'john'
});

Événements en direct (Mises à jour en temps réel) Internal Link

Abonnez-vous aux événements en direct pour recevoir des mises à jour en temps réel concernant les commentaires, les votes et autres activités.

Événements au niveau de la page

Écoutez les événements en direct sur une page spécifique (commentaires, votes, etc.) :

import { subscribeToChanges, LiveEvent, LiveEventType } from 'fastcomments-sdk/browser';

const config = {
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id',
};

// Subscribe to live events for a page
const subscription = subscribeToChanges(
  config,
  'your-tenant-id', // tenantIdWS
  'page-url-id',    // urlIdWS  
  'user-session-id', // userIdWS (get this from getComments response)
  (event: LiveEvent) => {
    console.log('Live event received:', event);

    switch (event.type) {
      case LiveEventType.new_comment:
        console.log('New comment:', event.comment);
        // Mettez à jour votre interface avec le nouveau commentaire
        break;
      case LiveEventType.new_vote:
        console.log('New vote:', event.vote);
        // Mettez à jour les compteurs de votes dans votre interface
        break;
      case LiveEventType.updated_comment:
        console.log('Comment updated:', event.comment);
        break;
      default:
        console.log('Other event type:', event.type);
    }

    return true; // Retournez true si l'événement a été traité
  },
  (isConnected: boolean) => {
    console.log('Connection status:', isConnected ? 'Connected' : 'Disconnected');
  }
);

// Close the subscription when done
subscription.close();

S'abonner aux événements utilisateur

Écoutez les événements spécifiques à un utilisateur (notifications, mentions, etc.) :

import { subscribeToUserFeed, LiveEvent, LiveEventType } from 'fastcomments-sdk/browser';

const userConfig = {
  userIdWS: 'user-session-id', // Get this from getComments response
};

// Subscribe to user's personal feed
const userSubscription = subscribeToUserFeed(
  userConfig,
  (event: LiveEvent) => {
    console.log('User event received:', event);

    switch (event.type) {
      case LiveEventType.notification:
        console.log('New notification:', event.notification);
        // Affichez la notification dans votre interface
        break;
      case LiveEventType.notification_update:
        console.log('Notification updated:', event.notification);
        break;
      default:
        console.log('Other user event:', event.type);
    }

    return true;
  },
  (isConnected: boolean) => {
    console.log('User feed connection:', isConnected ? 'Connected' : 'Disconnected');
  }
);

// Close when done
userSubscription.close();

Obtenir userIdWS

Le paramètre userIdWS est requis pour les événements en direct et peut être obtenu à partir des réponses de l'API :

const response = await sdk.publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-id'
});

// Extract userIdWS from the response
const userIdWS = response.data?.userSessionInfo?.userIdWS;

if (userIdWS) {
  // Now you can subscribe to live events
  const subscription = subscribeToChanges(config, tenantIdWS, urlIdWS, userIdWS, handleEvent);
}

Identifiants de diffusion Internal Link


Vous verrez qu'il faut transmettre un broadcastId dans certains appels d'API. Quand vous recevez des événements, vous récupérerez cet ID, ce qui vous permet d'ignorer l'événement si vous comptez appliquer les changements de manière optimiste côté client (ce que vous voudrez probablement faire car cela offre la meilleure expérience). Passez un UUID ici. L'ID doit être suffisamment unique pour ne pas apparaître deux fois durant une session de navigateur.

import { v4 as uuidv4 } from 'uuid';

const response = await sdk.publicApi.createCommentPublic({
  createCommentParams: {
    tenantId: 'your-tenant-id',
    urlId: 'page-id',
    comment: 'My comment',
    broadcastId: uuidv4() // ID unique pour cette opération
  }
});

Gestion des erreurs Internal Link

try {
  const comments = await sdk.publicApi.getCommentsPublic({
    tenantId: 'your-tenant-id',
    urlId: 'page-id'
  });
} catch (error) {
  if (error.response?.status === 404) {
    console.log('Page not found');
  } else {
    console.error('API Error:', error.message);
  }
}

aggregate Internal Link

Agrège les documents en les regroupant (si groupBy est fourni) et en appliquant plusieurs opérations. Différentes opérations (p. ex. sum, countDistinct, avg, etc.) sont prises en charge.

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
aggregationRequest AggregationRequest Oui
parentTenantId string Non
includeStats boolean Non

Réponse

Renvoie : AggregationResponse


getAuditLogs Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
limit number Non
skip number Non
order SORTDIR Non
after number Non
before number Non

Réponse

Renvoie : GetAuditLogs200Response


blockFromCommentPublic Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
commentId string Oui
publicBlockFromCommentParams PublicBlockFromCommentParams Oui
sso string Non

Réponse

Renvoie: BlockFromCommentPublic200Response

unBlockCommentPublic Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
commentId string Oui
publicBlockFromCommentParams PublicBlockFromCommentParams Oui
sso string Non

Réponse

Renvoie: UnBlockCommentPublic200Response


checkedCommentsForBlocked Internal Link

Paramètres

Name Type Required Description
tenantId string Oui
commentIds string Oui
sso string Non

Réponse

Renvoie : CheckedCommentsForBlocked200Response


blockUserFromComment Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui
blockFromCommentParams BlockFromCommentParams Oui
userId string Non
anonUserId string Non

Réponse

Renvoie: BlockFromCommentPublic200Response


createCommentPublic Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
urlId string Oui
broadcastId string Oui
commentData CommentData Oui
sessionId string Non
sso string Non

Réponse

Renvoie : CreateCommentPublic200Response


deleteComment Internal Link


Paramètres

Nom Type Requis Description
tenantId string Oui
id string Oui
contextUserId string Non
isLive boolean Non

Réponse

Retourne: DeleteComment200Response


deleteCommentPublic Internal Link


Paramètres

Nom Type Obligatoire Description
tenantId string Oui
commentId string Oui
broadcastId string Oui
editKey string Non
sso string Non

Réponse

Renvoie : DeleteCommentPublic200Response


deleteCommentVote Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
commentId string Oui
voteId string Oui
urlId string Oui
broadcastId string Oui
editKey string Non
sso string Non

Réponse

Renvoie : DeleteCommentVote200Response


flagComment Internal Link


Paramètres

Nom Type Requis Description
tenantId string Oui
id string Oui
userId string Non
anonUserId string Non

Réponse

Renvoie : FlagComment200Response


getComment Internal Link


Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui

Réponse

Renvoie : GetComment200Response


getComments Internal Link

Paramètres

Name Type Requis Description
tenantId string Oui
page number Non
limit number Non
skip number Non
asTree boolean Non
skipChildren number Non
limitChildren number Non
maxTreeDepth number Non
urlId string Non
userId string Non
anonUserId string Non
contextUserId string Non
hashTag string Non
parentId string Non
direction SortDirections Non

Réponse

Retourne: GetComments200Response


getCommentsPublic Internal Link

req tenantId urlId

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
urlId string Oui
page number Non
direction SortDirections Non
sso string Non
skip number Non
skipChildren number Non
limit number Non
limitChildren number Non
countChildren boolean Non
fetchPageForCommentId string Non
includeConfig boolean Non
countAll boolean Non
includei10n boolean Non
locale string Non
modules string Non
isCrawler boolean Non
includeNotificationCount boolean Non
asTree boolean Non
maxTreeDepth number Non
useFullTranslationIds boolean Non
parentId string Non
searchText string Non
hashTags Array Non
userId string Non
customConfigStr string Non
afterCommentId string Non
beforeCommentId string Non

Réponse

Renvoie : GetCommentsPublic200Response

getCommentText Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
commentId string Oui
editKey string Non
sso string Non

Réponse

Renvoie : GetCommentText200Response


getCommentVoteUserNames Internal Link


Parameters

Nom Type Requis Description
tenantId string Oui
commentId string Oui
dir number Oui
sso string Non

Réponse

Renvoie: GetCommentVoteUserNames200Response


lockComment Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
commentId string Oui
broadcastId string Oui
sso string Non

Réponse

Renvoie: LockComment200Response


pinComment Internal Link


Paramètres

Nom Type Requis Description
tenantId string Oui
commentId string Oui
broadcastId string Oui
sso string Non

Réponse

Renvoie : PinComment200Response


saveComment Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
createCommentParams CreateCommentParams Oui
isLive boolean Non
doSpamCheck boolean Non
sendEmails boolean Non
populateNotifications boolean Non

Réponse

Renvoie : SaveComment200Response


saveCommentsBulk Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
createCommentParams Array Oui
isLive boolean Non
doSpamCheck boolean Non
sendEmails boolean Non
populateNotifications boolean Non

Réponse

Renvoie: Array<SaveComment200Response


setCommentText Internal Link


Paramètres

Nom Type Obligatoire Description
tenantId string Oui
commentId string Oui
broadcastId string Oui
commentTextUpdateRequest CommentTextUpdateRequest Oui
editKey string Non
sso string Non

Réponse

Renvoie : SetCommentText200Response


unBlockUserFromComment Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
id string Oui
unBlockFromCommentParams UnBlockFromCommentParams Oui
userId string Non
anonUserId string Non

Réponse

Renvoie: UnBlockCommentPublic200Response


unFlagComment Internal Link


Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui
userId string Non
anonUserId string Non

Réponse

Renvoie: FlagComment200Response


unLockComment Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
commentId string Oui
broadcastId string Oui
sso string Non

Réponse

Retourne: LockComment200Response


unPinComment Internal Link

Paramètres

Name Type Required Description
tenantId string Oui
commentId string Oui
broadcastId string Oui
sso string Non

Réponse

Renvoie: PinComment200Response


updateComment Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui
body PickAPICommentUpdatableCommentFields Oui
contextUserId string Non
doSpamCheck boolean Non
isLive boolean Non

Réponse

Renvoie: FlagCommentPublic200Response


voteComment Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
commentId string Oui
urlId string Oui
broadcastId string Oui
voteBodyParams VoteBodyParams Oui
sessionId string Non
sso string Non

Réponse

Renvoie: VoteComment200Response


addDomainConfig Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
addDomainConfigParams AddDomainConfigParams Oui

Réponse

Renvoie: AddDomainConfig200Response


deleteDomainConfig Internal Link


Paramètres

Nom Type Obligatoire Description
tenantId string Oui
domain string Oui

Réponse

Retourne: DeleteDomainConfig200Response


getDomainConfig Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
domain string Oui

Réponse

Renvoie: GetDomainConfig200Response


getDomainConfigs Internal Link


Paramètres

Nom Type Requis Description
tenantId string Oui

Réponse

Renvoie : GetDomainConfigs200Response


patchDomainConfig Internal Link


Paramètres

Nom Type Obligatoire Description
tenantId string Oui
domainToUpdate string Oui
patchDomainConfigParams PatchDomainConfigParams Oui

Réponse

Retourne : GetDomainConfig200Response


putDomainConfig Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
domainToUpdate string Oui
updateDomainConfigParams UpdateDomainConfigParams Oui

Réponse

Renvoie: GetDomainConfig200Response

createEmailTemplate Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
createEmailTemplateBody CreateEmailTemplateBody Oui

Réponse

Renvoie : CreateEmailTemplate200Response

Exemple

Exemple de createEmailTemplate
Copy Copy
1
2const tenantId: string = "tenant_7a9f2b3d";
3
4const createEmailTemplateBody: CreateEmailTemplateBody = {
5 name: "Comment Notification",
6 subject: "New comment on your article: ",
7 htmlBody: "<p> left a comment:</p><blockquote></blockquote>",
8 enabled: true,
9 defaultLocale: "en-US",
10 metadata: { createdBy: "admin@example.com", purpose: "notify_comment" } // données supplémentaires optionnelles
11};
12
13const result: CreateEmailTemplate200Response = await createEmailTemplate(tenantId, createEmailTemplateBody);
14

deleteEmailTemplate Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui

Réponse

Renvoie: FlagCommentPublic200Response

Exemple

Exemple de deleteEmailTemplate
Copy Copy
1
2const tenantId: string = "tenant_4b2f6a-4b2f6a2d";
3const templateId: string = "email_template_9f8b7c3e";
4const result: FlagCommentPublic200Response = await deleteEmailTemplate(tenantId, templateId);
5const status: APIStatus | undefined = result?.status
6

deleteEmailTemplateRenderError Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
id string Oui
errorId string Oui

Réponse

Renvoie : FlagCommentPublic200Response

Exemple

Exemple de deleteEmailTemplateRenderError
Copy Copy
1
2const tenantId: string = "tenant_8f3b2a9c";
3const id: string = "template_4a1c9f7e";
4const errorId: string = "err_20260112_abc123";
5const result: FlagCommentPublic200Response = await deleteEmailTemplateRenderError(tenantId, id, errorId);
6

getEmailTemplate Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui

Réponse

Renvoie: GetEmailTemplate200Response

Exemple

Exemple de getEmailTemplate
Copy Copy
1
2(async () => {
3 const tenantId: string = 'acme-enterprises-123';
4 const id: string = 'welcome-email-template-v2';
5 const locale: string | undefined = 'en-US'; // exemple de paramètre optionnel
6 const template: GetEmailTemplate200Response = await getEmailTemplate(tenantId, id);
7 console.log(template, locale);
8})();
9

getEmailTemplateDefinitions Internal Link


Paramètres

Name Type Requis Description
tenantId string Yes

Réponse

Renvoie : GetEmailTemplateDefinitions200Response

Exemple

Exemple de getEmailTemplateDefinitions
Copy Copy
1
2const tenantId: string = 'acme-enterprises-78f2';
3const emailTemplates: GetEmailTemplateDefinitions200Response = await getEmailTemplateDefinitions(tenantId);
4

getEmailTemplateRenderErrors Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui
skip number Non

Réponse

Renvoie : GetEmailTemplateRenderErrors200Response

Exemple

Exemple de getEmailTemplateRenderErrors
Copy Copy
1
2const tenantId: string = "tenant_7b3f2a9c";
3const id: string = "tmpl_4f1b2c9e";
4const skip: number = 25;
5const result: GetEmailTemplateRenderErrors200Response = await getEmailTemplateRenderErrors(tenantId, id, skip);
6

getEmailTemplates Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
skip number Non

Response

Retourne : GetEmailTemplates200Response

Exemple

Exemple de getEmailTemplates
Copy Copy
1
2const tenantId: string = 'tenant_8f4d2b7c';
3const responseWithoutSkip: GetEmailTemplates200Response = await getEmailTemplates(tenantId);
4const skip: number = 20;
5const responseWithSkip: GetEmailTemplates200Response = await getEmailTemplates(tenantId, skip);
6

renderEmailTemplate Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
renderEmailTemplateBody RenderEmailTemplateBody Oui
locale string Non

Réponse

Renvoie : RenderEmailTemplate200Response

Exemple

Exemple de renderEmailTemplate
Copy Copy
1
2const tenantId: string = 'acme-corp-7f3';
3const renderEmailTemplateBody: RenderEmailTemplateBody = {
4 templateId: 'new-comment-notification',
5 recipientEmail: 'jane.doe@acme.com',
6 variables: {
7 commenterName: 'Samir Patel',
8 commentText: 'I found this article really helpful — thanks for sharing!',
9 threadUrl: 'https://acme.com/blog/123#comments'
10 },
11 includeUnsubscribeLink: true
12};
13const locale: string = 'en-US';
14const response: RenderEmailTemplate200Response = await renderEmailTemplate(tenantId, renderEmailTemplateBody, locale);
15

updateEmailTemplate Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
id string Oui
updateEmailTemplateBody UpdateEmailTemplateBody Oui

Réponse

Renvoie: FlagCommentPublic200Response

Exemple

Exemple de updateEmailTemplate
Copy Copy
1
2const tenantId: string = 'acme-corp-tenant-01';
3const id: string = 'email_tpl_42b7a9';
4const updateEmailTemplateBody: UpdateEmailTemplateBody = {
5 name: 'Comment Flag Notification',
6 subject: 'A comment was flagged on acme.com',
7 html: '<p>A comment by was flagged. Review at </p>',
8 replyTo: 'noreply@acme.com', // champ optionnel démontré
9 enabled: true,
10 customConfig: { priority: 'high' } // paramètres personnalisés optionnels
11};
12const response: FlagCommentPublic200Response = await updateEmailTemplate(tenantId, id, updateEmailTemplateBody);
13

getEventLog Internal Link

req tenantId urlId userIdWS

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
urlId string Oui
userIdWS string Oui
startTime number Oui
endTime number Oui

Réponse

Retourne : GetEventLog200Response

getGlobalEventLog Internal Link


req tenantId urlId userIdWS

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
urlId string Oui
userIdWS string Oui
startTime number Oui
endTime number Oui

Réponse

Retourne : GetEventLog200Response


createFeedPost Internal Link


Paramètres

Nom Type Requis Description
tenantId string Oui
createFeedPostParams CreateFeedPostParams Oui
broadcastId string Non
isLive boolean Non
doSpamCheck boolean Non
skipDupCheck boolean Non

Réponse

Renvoie : CreateFeedPost200Response


createFeedPostPublic Internal Link


Paramètres

Nom Type Obligatoire Description
tenantId string Oui
createFeedPostParams CreateFeedPostParams Oui
broadcastId string Non
sso string Non

Réponse

Renvoie: CreateFeedPostPublic200Response


deleteFeedPostPublic Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
postId string Oui
broadcastId string Non
sso string Non

Réponse

Renvoie : DeleteFeedPostPublic200Response

getFeedPosts Internal Link

req tenantId afterId

Paramètres

Name Type Required Description
tenantId string Oui
afterId string Non
limit number Non
tags Array Non

Réponse

Renvoie : GetFeedPosts200Response

getFeedPostsPublic Internal Link

req tenantId afterId

Paramètres

Nom Type Requis Description
tenantId string Oui
afterId string Non
limit number Non
tags Array Non
sso string Non
isCrawler boolean Non
includeUserInfo boolean Non

Réponse

Renvoie : GetFeedPostsPublic200Response

getFeedPostsStats Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
postIds Array Oui
sso string Non

Response

Retourne: GetFeedPostsStats200Response


getUserReactsPublic Internal Link


Paramètres

Nom Type Obligatoire Description
tenantId string Oui
postIds Array Non
sso string Non

Réponse

Retourne: GetUserReactsPublic200Response


reactFeedPostPublic Internal Link


Paramètres

Nom Type Requis Description
tenantId string Oui
postId string Oui
reactBodyParams ReactBodyParams Oui
isUndo boolean Non
broadcastId string Non
sso string Non

Réponse

Renvoie : ReactFeedPostPublic200Response


updateFeedPost Internal Link


Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui
feedPost FeedPost Oui

Réponse

Retourne : FlagCommentPublic200Response


updateFeedPostPublic Internal Link


Paramètres

Nom Type Requis Description
tenantId string Oui
postId string Oui
updateFeedPostParams UpdateFeedPostParams Oui
broadcastId string Non
sso string Non

Réponse

Renvoie: CreateFeedPostPublic200Response


flagCommentPublic Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
commentId string Oui
isFlagged boolean Oui
sso string Non

Réponse

Retourne : FlagCommentPublic200Response

addHashTag Internal Link

Paramètres

Name Type Required Description
tenantId string Non
createHashTagBody CreateHashTagBody Non

Réponse

Renvoie : AddHashTag200Response

Exemple

Exemple addHashTag
Copy Copy
1
2const tenantId: string = 'tenant_7b2f6c2b';
3const createBody: CreateHashTagBody = {
4 tag: 'feature-request',
5 label: 'Feature Request',
6 description: 'Requests for new functionality in the web client',
7 isActive: true,
8 visibility: 'public',
9 allowedDomains: ['example.com', 'internal.example.com']
10};
11const result: AddHashTag200Response = await addHashTag(tenantId, createBody);
12const resultWithoutTenant: AddHashTag200Response = await addHashTag(undefined, {
13 tag: 'bug',
14 label: 'Bug',
15 description: 'Use for reproducible bugs reported by users',
16 isActive: true,
17 visibility: 'public'
18});
19

addHashTagsBulk Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Non
bulkCreateHashTagsBody BulkCreateHashTagsBody Non

Réponse

Renvoie: AddHashTagsBulk200Response

Exemple

Exemple de addHashTagsBulk
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_3f2b9a';
4 const bulkCreateHashTagsBody: BulkCreateHashTagsBody = {
5 tags: [
6 { name: 'performance', description: 'Comments about site performance', visibleToModeratorsOnly: false },
7 { name: 'feature-request', description: 'Requests for new features', visibleToModeratorsOnly: true }
8 ]
9 };
10 const result: AddHashTagsBulk200Response = await addHashTagsBulk(tenantId, bulkCreateHashTagsBody);
11 const resultWithNoTenant: AddHashTagsBulk200Response = await addHashTagsBulk(undefined, bulkCreateHashTagsBody);
12 console.log(result, resultWithNoTenant);
13})();
14

deleteHashTag Internal Link

Paramètres

Name Type Required Description
tag string Oui
tenantId string Non
deleteHashTagRequest DeleteHashTagRequest Non

Réponse

Retourne: FlagCommentPublic200Response

Exemple

Exemple de deleteHashTag
Copy Copy
1
2const tag: string = 'breaking-news';
3const tenantId: string = 'tenant_42';
4const deleteReq: DeleteHashTagRequest = { removedBy: 'moderator_jane', reason: 'off-topic for this community', deleteAssociatedComments: true } as DeleteHashTagRequest;
5const result: FlagCommentPublic200Response = await deleteHashTag(tag, tenantId, deleteReq);
6

getHashTags Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
page number Non

Réponse

Renvoie : GetHashTags200Response

Exemple

Exemple de getHashTags
Copy Copy
1
2(async () => {
3 const tenantId: string = "acme-corp-7a9f";
4 const tagsPage1: GetHashTags200Response = await getHashTags(tenantId);
5 const tagsPage2: GetHashTags200Response = await getHashTags(tenantId, 2);
6 console.log(tagsPage1, tagsPage2);
7})();
8

patchHashTag Internal Link

Paramètres

Nom Type Obligatoire Description
tag string Oui
tenantId string Non
updateHashTagBody UpdateHashTagBody Non

Réponse

Renvoie : PatchHashTag200Response

Exemple

Exemple de patchHashTag
Copy Copy
1
2const tag: string = 'release-2026';
3const tenantId: string = 'tenant_42';
4const updateHashTagBody: UpdateHashTagBody = {
5 displayName: 'Release 2026',
6 description: 'Discussions and notes for the 2026 product release',
7 isActive: true
8};
9const result: PatchHashTag200Response = await patchHashTag(tag, tenantId, updateHashTagBody);
10

createModerator Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
createModeratorBody CreateModeratorBody Oui

Réponse

Retourne : CreateModerator200Response

Exemple

Exemple de createModerator
Copy Copy
1
2const tenantId: string = "tenant_prod_us-east_01";
3const createModeratorBody: CreateModeratorBody = {
4 email: "maria.lopez+mod@fastcompany.com",
5 username: "mlopez_mod",
6 displayName: "Maria Lopez",
7 roles: ["content_moderator"],
8 notifyOnReports: true,
9 metadata: { region: "us-east", team: "community" }
10};
11const result: CreateModerator200Response = await createModerator(tenantId, createModeratorBody);
12

deleteModerator Internal Link


Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui
sendEmail string Non

Réponse

Renvoie : FlagCommentPublic200Response

Exemple

Exemple de deleteModerator
Copy Copy
1
2const tenantId: string = 'acme-tenant-987';
3const moderatorId: string = 'mod-78b2c9a4-3f1e-4d6a';
4const sendEmail: string = 'true';
5const result: FlagCommentPublic200Response = await deleteModerator(tenantId, moderatorId, sendEmail);
6

getModerator Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui

Réponse

Renvoie : GetModerator200Response

Exemple

Exemple de getModerator
Copy Copy
1
2const tenantId: string = "tenant_eu_4f8d2b9e";
3const maybeModeratorId: string | undefined = "mod_91c3b7a2"; // source optionnelle (peut être undefined)
4const moderator: GetModerator200Response = await getModerator(tenantId, maybeModeratorId!);
5

getModerators Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
skip number Non

Réponse

Renvoie : GetModerators200Response

Exemple

Exemple de getModerators
Copy Copy
1
2const tenantId: string = "tenant_corp_7f9b2a";
3const moderatorsPage1: GetModerators200Response = await getModerators(tenantId);
4const skip: number = 50;
5const moderatorsPage2: GetModerators200Response = await getModerators(tenantId, skip);
6

sendInvite Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui
fromName string Oui

Réponse

Renvoie : FlagCommentPublic200Response

Exemple

Exemple de sendInvite
Copy Copy
1
2const tenantId: string = 'acme-tenant-004';
3const id: string = 'comment_9b7f3a2c';
4const fromName: string = 'María Hernández';
5const response: FlagCommentPublic200Response = await sendInvite(tenantId, id, fromName);
6

updateModerator Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui
updateModeratorBody UpdateModeratorBody Oui

Réponse

Renvoie : FlagCommentPublic200Response

Exemple

Exemple updateModerator
Copy Copy
1
2const tenantId: string = '4f8a9c2e-3b6d-4d9e-8c2f-1a2b3c4d5e6f';
3const id: string = 'mod_92a7c4';
4const updateModeratorBodyMinimal: UpdateModeratorBody = { displayName: 'Sophia Patel' };
5const updateModeratorBodyWithOptional: UpdateModeratorBody = {
6 displayName: 'Sophia Patel',
7 email: 'sophia.patel@newsroom.example',
8 permissions: ['remove_comments', 'ban_user'],
9 notifyOnFlag: true // paramètre optionnel démontré
10};
11const result: FlagCommentPublic200Response = await updateModerator(tenantId, id, updateModeratorBodyWithOptional);
12

deleteNotificationCount Internal Link

Paramètres

Name Type Required Description
tenantId string Oui
id string Oui

Réponse

Renvoie : FlagCommentPublic200Response

Exemple

Exemple de deleteNotificationCount
Copy Copy
1
2const tenantId: string = 'tenant_7f3a1b2c4d9e';
3const notificationId: string = 'notif_8c9d0a1b2f3e4b7';
4const result: FlagCommentPublic200Response = await deleteNotificationCount(tenantId, notificationId);
5

getCachedNotificationCount Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui

Réponse

Renvoie: GetCachedNotificationCount200Response

Exemple

Exemple pour getCachedNotificationCount
Copy Copy
1
2const tenantId: string = 'acme-tenant-01';
3const baseNotificationId: string = 'notif-000123';
4const idSuffix: string | undefined = undefined; // optional parameter example
5const notificationId: string = idSuffix ? `${baseNotificationId}-${idSuffix}` : baseNotificationId;
6const result: GetCachedNotificationCount200Response = await getCachedNotificationCount(tenantId, notificationId);
7console.log(result);
8

getNotificationCount Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
userId string Non
urlId string Non
fromCommentId string Non
viewed boolean Non
type string Non

Réponse

Renvoie : GetNotificationCount200Response

Exemple

Exemple getNotificationCount
Copy Copy
1
2const tenantId: string = 'tenant_8a9b7c';
3const userId: string = 'user_42b3c';
4const urlId: string = 'https://blog.example.com/posts/introducing-new-editor';
5const fromCommentId: string | undefined = undefined;
6const viewed: boolean = false;
7const type: string = 'mention';
8const result: GetNotificationCount200Response = await getNotificationCount(tenantId, userId, urlId, fromCommentId, viewed, type);
9

getNotifications Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
userId string Non
urlId string Non
fromCommentId string Non
viewed boolean Non
type string Non
skip number Non

Réponse

Renvoie: GetNotifications200Response

Exemple

Exemple getNotifications
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_8f3b1a2c';
4 const userId: string = 'user_42';
5 const urlId: string = 'https://news.example.com/articles/2026/01/11/comment-thread';
6 const fromCommentId: string = 'cmt_9a7b';
7 const viewed: boolean = false;
8 const type: string = 'mention';
9 const skip: number = 0;
10 const response: GetNotifications200Response = await getNotifications(tenantId, userId, urlId, fromCommentId, viewed, type, skip);
11 console.log(response);
12})();
13

updateNotification Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui
updateNotificationBody UpdateNotificationBody Oui
userId string Non

Réponse

Renvoie: FlagCommentPublic200Response

Exemple

Exemple de updateNotification
Copy Copy
1
2const tenantId: string = "tenant_86a7b3";
3const id: string = "notif_20260112_01";
4const userId: string = "moderator_42";
5const updateNotificationBody: UpdateNotificationBody = {
6 name: "Flagged comment alert",
7 enabled: true,
8 channels: ["email"],
9 recipients: ["mod-team@news-site.com"],
10 threshold: 1
11};
12
13(async () => {
14 const result: FlagCommentPublic200Response = await updateNotification(tenantId, id, updateNotificationBody, userId);
15 console.log(result);
16})();
17

addPage Internal Link


Paramètres

Nom Type Requis Description
tenantId string Oui
createAPIPageData CreateAPIPageData Oui

Réponse

Retourne: AddPageAPIResponse


deletePage Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui

Réponse

Renvoie : DeletePageAPIResponse


getPageByURLId Internal Link


Paramètres

Nom Type Requis Description
tenantId string Oui
urlId string Oui

Réponse

Renvoie : GetPageByURLIdAPIResponse


getPages Internal Link


Paramètres

Nom Type Obligatoire Description
tenantId string Oui

Réponse

Renvoie : GetPagesAPIResponse


patchPage Internal Link


Paramètres

Nom Type Requis Description
tenantId string Oui
id string Oui
updateAPIPageData UpdateAPIPageData Oui

Réponse

Renvoie: PatchPageAPIResponse


deletePendingWebhookEvent Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui

Réponse

Retourne : FlagCommentPublic200Response

Exemple

Exemple de deletePendingWebhookEvent
Copy Copy
1
2const tenantId: string = 'tenant_7f4e2b';
3const pendingEventId: string = '9f7b6a8c-3b2a-4c0d-a8e5-1234567890ab';
4const result: FlagCommentPublic200Response = await deletePendingWebhookEvent(tenantId, pendingEventId);
5console.log(result);
6

getPendingWebhookEventCount Internal Link

Paramètres

Name Type Required Description
tenantId string Oui
commentId string Non
externalId string Non
eventType string Non
type string Non
domain string Non
attemptCountGT number Non

Réponse

Renvoie: GetPendingWebhookEventCount200Response

Exemple

Exemple de getPendingWebhookEventCount
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_9c3b2b';
4 const commentId: string = 'cmt_f4a1b2';
5 const externalId: string = 'ext-789';
6 const eventType: string = 'comment.created';
7 const type: string = 'delivery';
8 const domain: string = 'app.example.com';
9 const attemptCountGT: number = 2;
10
11 const result: GetPendingWebhookEventCount200Response = await getPendingWebhookEventCount(
12 tenantId,
13 commentId,
14 externalId,
15 eventType,
16 type,
17 domain,
18 attemptCountGT
19 );
20
21 console.log(result);
22})();
23

getPendingWebhookEvents Internal Link

Paramètres

Name Type Required Description
tenantId string Oui
commentId string Non
externalId string Non
eventType string Non
type string Non
domain string Non
attemptCountGT number Non
skip number Non

Réponse

Renvoie : GetPendingWebhookEvents200Response

Exemple

Exemple de getPendingWebhookEvents
Copy Copy
1
2const tenantId: string = "tenant_78b2f1";
3const commentId: string = "cmt_0042";
4const eventType: string = "comment.created";
5const domain: string = "blog.example.com";
6const attemptCountGT: number = 1;
7const skip: number = 0;
8
9const pending: GetPendingWebhookEvents200Response = await getPendingWebhookEvents(
10 tenantId,
11 commentId,
12 undefined, // externalId
13 eventType,
14 undefined, // type
15 domain,
16 attemptCountGT,
17 skip
18);
19

createQuestionConfig Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
createQuestionConfigBody CreateQuestionConfigBody Oui

Réponse

Renvoie : CreateQuestionConfig200Response

Exemple

Exemple de createQuestionConfig
Copy Copy
1
2const tenantId: string = "tenant_live_7f8b3c2a";
3const customOptions: QuestionConfigCustomOptionsInner[] = [
4 { value: "under18", label: "Under 18" },
5 { value: "18-24", label: "18-24" },
6 { value: "25-34", label: "25-34", defaultSelected: true }
7];
8const createQuestionConfigBody: CreateQuestionConfigBody = {
9 key: "age_range",
10 label: "What is your age range?",
11 required: false, // facultatif : démontrer les champs optionnels omis et inclus
12 renderingType: QuestionRenderingType.Dropdown,
13 options: customOptions,
14 whenSave: QuestionWhenSave.Always
15};
16const result: CreateQuestionConfig200Response = await createQuestionConfig(tenantId, createQuestionConfigBody);
17

deleteQuestionConfig Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui

Réponse

Retourne : FlagCommentPublic200Response

Exemple

Exemple de deleteQuestionConfig
Copy Copy
1
2async function deleteIfPresent(tenantId: string, id?: string): Promise<FlagCommentPublic200Response | null> {
3 if (!id) return null;
4 const result: FlagCommentPublic200Response = await deleteQuestionConfig(tenantId, id);
5 return result;
6}
7const tenantId: string = 'tenant_acme_001';
8const optionalConfigId: string | undefined = 'qcfg_20260112_01';
9(async (): Promise<void> => {
10 const deleted: FlagCommentPublic200Response | null = await deleteIfPresent(tenantId, optionalConfigId);
11 void deleted;
12})();
13

getQuestionConfig Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
id string Oui

Réponse

Renvoie : GetQuestionConfig200Response

Exemple

Exemple de getQuestionConfig
Copy Copy
1
2const tenantId: string = 'acme-corp-47';
3const questionId: string = 'q-2026-01-12-01';
4const result: GetQuestionConfig200Response = await getQuestionConfig(tenantId, questionId);
5function summarizeConfig(cfg: GetQuestionConfig200Response, includeMetadata?: boolean): QuestionConfig | undefined {
6 // includeMetadata est optionnel ; implémentation omise par souci de concision
7 return undefined;
8}
9const summarizedWithMeta: QuestionConfig | undefined = summarizeConfig(result, true);
10const summarizedDefault: QuestionConfig | undefined = summarizeConfig(result);
11

getQuestionConfigs Internal Link

Paramètres

Name Type Requis Description
tenantId string Oui
skip number Non

Réponse

Retourne: GetQuestionConfigs200Response

Exemple

Exemple de getQuestionConfigs
Copy Copy
1
2const tenantId: string = 'tenant-42a7b9';
3const firstPage: GetQuestionConfigs200Response = await getQuestionConfigs(tenantId);
4const secondPage: GetQuestionConfigs200Response = await getQuestionConfigs(tenantId, 50);
5

updateQuestionConfig Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui
updateQuestionConfigBody UpdateQuestionConfigBody Oui

Réponse

Renvoie : FlagCommentPublic200Response

Exemple

Exemple de updateQuestionConfig
Copy Copy
1
2const tenantId: string = 'tenant-82b3a';
3const id: string = 'qst-20260112';
4const updateQuestionConfigBody: UpdateQuestionConfigBody = { label: 'Age verification', required: true, renderingType: 'singleChoice', customOptions: [{ value: '18-24', label: '18–24' }] } as UpdateQuestionConfigBody;
5const result: FlagCommentPublic200Response = await updateQuestionConfig(tenantId, id, updateQuestionConfigBody);
6

createQuestionResult Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
createQuestionResultBody CreateQuestionResultBody Oui

Réponse

Renvoie : CreateQuestionResult200Response

Exemple

Exemple de createQuestionResult
Copy Copy
1
2const tenantId: string = "fc_tenant_7a3c_us-east-1";
3const metaItem: MetaItem = { key: "referrer", value: "/blog/how-to-comment" };
4const createQuestionResultBody: CreateQuestionResultBody = {
5 questionId: "q_42",
6 commenterId: "user_1984",
7 answer: "yes",
8 score: 4,
9 meta: [metaItem] // métadonnées optionnelles (exemple)
10} as CreateQuestionResultBody;
11const result: CreateQuestionResult200Response = await createQuestionResult(tenantId, createQuestionResultBody);
12

deleteQuestionResult Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
id string Oui

Réponse

Renvoie : FlagCommentPublic200Response

Exemple

Exemple de deleteQuestionResult
Copy Copy
1
2const tenantId: string = 'acme-tenant-01';
3const questionResultId: string = '6f1a2b3c-4d5e-6789-abcd-ef0123456789';
4const deletedResult: FlagCommentPublic200Response = await deleteQuestionResult(tenantId, questionResultId);
5console.log(deletedResult);
6

getQuestionResult Internal Link

Paramètres

Name Type Requis Description
tenantId string Oui
id string Oui

Réponse

Renvoie: GetQuestionResult200Response

Exemple

Exemple de getQuestionResult
Copy Copy
1
2const tenantId: string = "3fa85f64-5717-4562-b3fc-2c963f66afa6";
3const questionId: string = "question_72f1b9c3a4";
4const result: GetQuestionResult200Response = await getQuestionResult(tenantId, questionId);
5console.log(result);
6

getQuestionResults Internal Link


Paramètres

Name Type Requis Description
tenantId string Oui
urlId string Non
userId string Non
startDate string Non
questionId string Non
questionIds string Non
skip number Non

Réponse

Renvoie: GetQuestionResults200Response

Exemple

Exemple de getQuestionResults
Copy Copy
1
2const tenantId: string = 'tenant_42';
3const urlId: string = 'news/2025/fastcomments-release';
4const userId: string = 'user_8b7f3c';
5const startDate: string = '2025-01-01T00:00:00Z';
6const questionIds: string = 'q123,q124';
7const skip: number = 20;
8const result: GetQuestionResults200Response = await getQuestionResults(tenantId, urlId, userId, startDate, undefined, questionIds, skip);
9

updateQuestionResult Internal Link

Paramètres

Name Type Required Description
tenantId string Oui
id string Oui
updateQuestionResultBody UpdateQuestionResultBody Oui

Réponse

Renvoie : FlagCommentPublic200Response

Exemple

Exemple de updateQuestionResult
Copy Copy
1
2const tenantId: string = 'tenant_84f2b9';
3const id: string = 'question_3a7c1d';
4const updateQuestionResultBody: UpdateQuestionResultBody = {
5 result: { verdict: 'helpful', confidence: 0.92 },
6 reviewer: { id: 'mod_102', name: 'Aisha Rahman' },
7 notifyUser: true // paramètre optionnel inclus
8};
9const response: FlagCommentPublic200Response = await updateQuestionResult(tenantId, id, updateQuestionResultBody);
10

aggregateQuestionResults Internal Link

Paramètres

Nom Type Requis Description
tenantId string Yes
questionId string No
questionIds Array No
urlId string No
timeBucket AggregateTimeBucket No
startDate Date No
forceRecalculate boolean No

Réponse

Retourne: AggregateQuestionResults200Response


bulkAggregateQuestionResults Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
bulkAggregateQuestionResultsRequest BulkAggregateQuestionResultsRequest Oui
forceRecalculate boolean Non

Réponse

Renvoie : BulkAggregateQuestionResults200Response


combineCommentsWithQuestionResults Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
questionId string Non
questionIds Array Non
urlId string Non
startDate Date Non
forceRecalculate boolean Non
minValue number Non
maxValue number Non
limit number Non

Réponse

Renvoie : CombineCommentsWithQuestionResults200Response


addSSOUser Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
createAPISSOUserData CreateAPISSOUserData Oui

Réponse

Renvoie : AddSSOUserAPIResponse


deleteSSOUser Internal Link


Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui
deleteComments boolean Non
commentDeleteMode string Non

Réponse

Renvoie: DeleteSSOUserAPIResponse


getSSOUserByEmail Internal Link


Paramètres

Nom Type Requis Description
tenantId string Oui
email string Oui

Réponse

Renvoie : GetSSOUserByEmailAPIResponse


getSSOUserById Internal Link


Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui

Réponse

Renvoie: GetSSOUserByIdAPIResponse


getSSOUsers Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
skip number Non

Réponse

Retourne: GetSSOUsers200Response


patchSSOUser Internal Link


Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui
updateAPISSOUserData UpdateAPISSOUserData Oui
updateComments boolean Non

Réponse

Renvoie: PatchSSOUserAPIResponse


putSSOUser Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
id string Oui
updateAPISSOUserData UpdateAPISSOUserData Oui
updateComments boolean Non

Réponse

Renvoie: PutSSOUserAPIResponse


createSubscription Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
createAPIUserSubscriptionData CreateAPIUserSubscriptionData Oui

Réponse

Retourne: CreateSubscriptionAPIResponse


deleteSubscription Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui
userId string Non

Réponse

Retourne: DeleteSubscriptionAPIResponse


getSubscriptions Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
userId string Non

Réponse

Renvoie : GetSubscriptionsAPIResponse


getTenantDailyUsages Internal Link

Paramètres

Name Type Requis Description
tenantId string Oui
yearNumber number Non
monthNumber number Non
dayNumber number Non
skip number Non

Réponse

Renvoie: GetTenantDailyUsages200Response

Exemple

getTenantDailyUsages Exemple
Copy Copy
1
2const tenantId: string = "tenant_89f3c2-prod";
3const yearNumber: number = 2026;
4const monthNumber: number = 1;
5const skip: number = 0;
6const usages: GetTenantDailyUsages200Response = await getTenantDailyUsages(tenantId, yearNumber, monthNumber, undefined, skip);
7

createTenantPackage Internal Link


Paramètres

Nom Type Requis Description
tenantId string Oui
createTenantPackageBody CreateTenantPackageBody Oui

Réponse

Retourne: CreateTenantPackage200Response

Exemple

Exemple de createTenantPackage
Copy Copy
1
2const tenantId: string = "tenant_7f3b1a9c";
3const tenantPackage: TenantPackage = { id: "pkg_001", name: "Premium Plan", seats: 100 };
4const customConfig: CustomConfigParameters = { enableImages: true, maxImageSizeMb: 10 };
5const createTenantPackageBody: CreateTenantPackageBody = {
6 packageName: "Premium Plus",
7 tenantPackage,
8 customConfig,
9 notes: "Enable advanced moderation and image uploads" // paramètre optionnel démontré
10};
11const result: CreateTenantPackage200Response = await createTenantPackage(tenantId, createTenantPackageBody);
12

deleteTenantPackage Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui

Réponse

Renvoie: FlagCommentPublic200Response

Exemple

Exemple de deleteTenantPackage
Copy Copy
1
2const tenantId: string = 'fc-tenant-8a9c2b';
3const packageId: string = 'pkg-47f3c9';
4const result: FlagCommentPublic200Response = await deleteTenantPackage(tenantId, packageId);
5

getTenantPackage Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
id string Oui

Réponse

Retourne: GetTenantPackage200Response

Exemple

Exemple de getTenantPackage
Copy Copy
1
2const tenantId: string = 'tenant_westus_01';
3const packageId: string = 'pkg_premium_annual_2026';
4interface FetchOptions { includeArchived?: boolean }
5const options: FetchOptions = { includeArchived: false };
6const result: GetTenantPackage200Response = await getTenantPackage(tenantId, packageId);
7

getTenantPackages Internal Link

Parameters

Nom Type Requis Description
tenantId string Oui
skip number Non

Réponse

Renvoie: GetTenantPackages200Response

Exemple

Exemple getTenantPackages
Copy Copy
1
2const tenantId: string = 'tenant_4f3a9c2d';
3const skip: number = 25;
4const packagesResponse: GetTenantPackages200Response = await getTenantPackages(tenantId);
5const pagedPackagesResponse: GetTenantPackages200Response = await getTenantPackages(tenantId, skip);
6

replaceTenantPackage Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
id string Oui
replaceTenantPackageBody ReplaceTenantPackageBody Oui

Réponse

Renvoie : FlagCommentPublic200Response

Exemple

Exemple de replaceTenantPackage
Copy Copy
1
2const tenantId: string = 'tenant-9b72f2';
3const packageId: string = 'pkg-prod-v2';
4const replaceTenantPackageBody: ReplaceTenantPackageBody = {
5 name: 'Premium Moderation Bundle',
6 enabled: true,
7 maxModerators: 4,
8 // les champs optionnels comme "notes" ou "trialExpiry" sont intentionnellement omis ici
9} as ReplaceTenantPackageBody;
10const result: FlagCommentPublic200Response = await replaceTenantPackage(
11 tenantId,
12 packageId,
13 replaceTenantPackageBody
14);
15

updateTenantPackage Internal Link

Paramètres

Name Type Requis Description
tenantId string Oui
id string Oui
updateTenantPackageBody UpdateTenantPackageBody Oui

Réponse

Renvoie: FlagCommentPublic200Response

Exemple

Exemple de updateTenantPackage
Copy Copy
1
2const tenantId: string = 'tenant_8a4f1c9b';
3const packageId: string = 'pkg_premium_v2';
4const customConfig: CustomConfigParameters = { enableRichText: true, maxImagesPerComment: 5 };
5const updateTenantPackageBody: UpdateTenantPackageBody = {
6 name: 'Premium Moderation Package',
7 enabled: true,
8 description: 'Adds advanced spam rules, image moderation and priority support',
9 customConfigParameters: customConfig
10};
11const result: FlagCommentPublic200Response = await updateTenantPackage(tenantId, packageId, updateTenantPackageBody);
12

createTenantUser Internal Link

Paramètres

Name Type Required Description
tenantId string Oui
createTenantUserBody CreateTenantUserBody Oui

Réponse

Retourne: CreateTenantUser200Response

Exemple

Exemple de createTenantUser
Copy Copy
1
2const tenantId: string = "tenant_9a8c7e4b";
3const createTenantUserBody: CreateTenantUserBody = {
4 email: "julia.smith@acme-corp.com",
5 displayName: "Julia Smith",
6 role: "moderator",
7 password: "Str0ngP@ssword!23",
8 sendInviteEmail: true, // paramètre optionnel démontré
9 locale: "en-US",
10 metadata: { department: "Customer Success" }
11};
12const result: CreateTenantUser200Response = await createTenantUser(tenantId, createTenantUserBody);
13

deleteTenantUser Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui
deleteComments string Non
commentDeleteMode string Non

Réponse

Renvoie : FlagCommentPublic200Response

Exemple

Exemple de deleteTenantUser
Copy Copy
1
2const tenantId: string = 'tenant_8f3b2a9c';
3const id: string = 'user_4e5f6a7b';
4const deleteComments: string = 'true';
5const commentDeleteMode: string = 'hard';
6
7const result: FlagCommentPublic200Response = await deleteTenantUser(tenantId, id, deleteComments, commentDeleteMode);
8

getTenantUser Internal Link

Paramètres

Name Type Requis Description
tenantId string Oui
id string Oui

Réponse

Retourne: GetTenantUser200Response

Exemple

Exemple getTenantUser
Copy Copy
1
2const tenantId: string = "tenant_9f7d4b2a-1c3e";
3const id: string = "user_6a12b3c4d5";
4const includeProfile: boolean | undefined = true; // exemple de paramètre optionnel
5const response: GetTenantUser200Response = await getTenantUser(tenantId, id);
6console.log("Tenant user fetched", response);
7

getTenantUsers Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
skip number Non

Réponse

Renvoie: GetTenantUsers200Response

Exemple

Exemple de getTenantUsers
Copy Copy
1
2const tenantId: string = 'tenant_8f3b2c1a';
3const skip: number = 50;
4const firstPage: GetTenantUsers200Response = await getTenantUsers(tenantId);
5const nextPage: GetTenantUsers200Response = await getTenantUsers(tenantId, skip);
6

replaceTenantUser Internal Link

Paramètres

Name Type Required Description
tenantId string Oui
id string Oui
replaceTenantUserBody ReplaceTenantUserBody Oui
updateComments string Non

Réponse

Retourne : FlagCommentPublic200Response

Exemple

Exemple replaceTenantUser
Copy Copy
1
2const tenantId: string = "tenant_5f8b9a";
3const id: string = "user_92bf21";
4const replaceTenantUserBody: ReplaceTenantUserBody = {
5 email: "jane.doe@acme-corp.com",
6 displayName: "Jane Doe",
7 externalId: "acme|12345",
8 roles: ["commenter", "moderator"],
9 isActive: true,
10 metadata: { team: "product", location: "NYC" }
11};
12const updateComments: string = "Update historical comments to reflect new display name";
13const result: FlagCommentPublic200Response = await replaceTenantUser(tenantId, id, replaceTenantUserBody, updateComments);
14

Paramètres

Nom Type Requis Description
tenantId string Oui
id string Oui
redirectURL string Non

Réponse

Renvoie : FlagCommentPublic200Response

Exemple

Exemple de sendLoginLink
Copy Copy
1
2const tenantId: string = 'tenant_acme_01';
3const id: string = 'user_9f3b2a';
4const redirectURL: string = 'https://app.example.com/onboard?source=login-email';
5const result: FlagCommentPublic200Response = await sendLoginLink(tenantId, id, redirectURL);
6

updateTenantUser Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui
updateTenantUserBody UpdateTenantUserBody Oui
updateComments string Non

Réponse

Renvoie : FlagCommentPublic200Response

Exemple

Exemple pour updateTenantUser
Copy Copy
1
2const tenantId: string = 'tenant_84f3b2';
3const id: string = 'user_7a9d1c';
4const updateComments: string = 'Promoted to moderator and updated contact email';
5const updateTenantUserBody: UpdateTenantUserBody = {
6 email: 'jane.doe+mod@example.com',
7 displayName: 'Jane D.',
8 roles: ['moderator'],
9 isBanned: false,
10 metadata: { department: 'community' }
11};
12const result: FlagCommentPublic200Response = await updateTenantUser(tenantId, id, updateTenantUserBody, updateComments);
13

createTenant Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Yes
createTenantBody CreateTenantBody Yes

Réponse

Renvoie : CreateTenant200Response

Exemple

Exemple de createTenant
Copy Copy
1
2const tenantId: string = "acme-corporation";
3const billing: BillingInfo = { planId: "pro", billingContactEmail: "finance@acme-corp.com", currency: "USD" };
4const domainConfig: APIDomainConfiguration = { primaryDomain: "comments.acme-corp.com", allowedDomains: ["acme-corp.com", "www.acme-corp.com"], enforceHttps: true };
5const importedSites: ImportedSiteType[] = [{ siteId: "site-001", url: "https://blog.acme-corp.com", name: "Acme Blog" }]; // optionnel
6const createBody: CreateTenantBody = { tenantName: "Acme Corporation", adminEmail: "admin@acme-corp.com", billingInfo: billing, domainConfiguration: domainConfig, importedSites, enableModeration: true };
7const response: CreateTenant200Response = await createTenant(tenantId, createBody);
8

deleteTenant Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
id string Oui
sure string Non

Réponse

Renvoie: FlagCommentPublic200Response

Exemple

Exemple de deleteTenant
Copy Copy
1
2const tenantId: string = "tenant_7b3f1a9e";
3const id: string = "flag_9c4d2b1a";
4const sure: string = "yes_confirm_delete";
5
6const result: FlagCommentPublic200Response = await deleteTenant(tenantId, id, sure);
7console.log(result);
8

getTenant Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
id string Oui

Réponse

Renvoie : GetTenant200Response

Exemple

Exemple de getTenant
Copy Copy
1
2const tenantId: string = "tenant_acme_corp";
3const id: string = "f47ac10b-58cc-4372-a567-0e02b2c3d479";
4interface GetOptions { includeDeleted?: boolean; locale?: string; }
5const options: GetOptions = { locale: "en-US" };
6const result: GetTenant200Response = await getTenant(tenantId, id);
7

getTenants Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
meta string Non
skip number Non

Réponse

Renvoie: GetTenants200Response

Exemple

Exemple getTenants
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_9f2d1b7c';
4 const meta: string = 'include=domains,billing,customConfig';
5 const skip: number = 20;
6 const response: GetTenants200Response = await getTenants(tenantId, meta, skip);
7 console.log(response);
8})();
9

updateTenant Internal Link

Paramètres

Name Type Requis Description
tenantId string Oui
id string Oui
updateTenantBody UpdateTenantBody Oui

Réponse

Renvoie : FlagCommentPublic200Response

Exemple

Exemple updateTenant
Copy Copy
1
2const tenantId: string = "tenant_01H4ZQ7KABCD";
3const id: string = "site_9f8e7d6c";
4const apiDomainConfiguration: APIDomainConfiguration = {
5 primaryDomain: "comments.acme.com",
6 allowSubdomains: true
7};
8const billingInfo: BillingInfo = {
9 planName: "Business",
10 billingContactEmail: "billing@acme.com",
11 seats: 25
12};
13const updateTenantBody: UpdateTenantBody = {
14 displayName: "Acme Corporation Comments",
15 apiDomainConfiguration,
16 billingInfo, // paramètre optionnel illustré
17 enableModeration: true
18};
19const result: FlagCommentPublic200Response = await updateTenant(tenantId, id, updateTenantBody);
20

uploadImage Internal Link


Téléverser et redimensionner une image

Paramètres

Nom Type Requis Description
tenantId string Oui
file Blob Oui
sizePreset SizePreset Non
urlId string Non

Réponse

Renvoie: UploadImageResponse


getUserBadgeProgressById Internal Link


Paramètres

Name Type Obligatoire Description
tenantId string Oui
id string Oui

Réponse

Renvoie: GetUserBadgeProgressById200Response


getUserBadgeProgressByUserId Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
userId string Oui

Réponse

Retourne : GetUserBadgeProgressById200Response


getUserBadgeProgressList Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
userId string Non
limit number Non
skip number Non

Réponse

Renvoie: GetUserBadgeProgressList200Response


createUserBadge Internal Link


Paramètres

Nom Type Obligatoire Description
tenantId string Oui
createUserBadgeParams CreateUserBadgeParams Oui

Réponse

Renvoie : CreateUserBadge200Response


deleteUserBadge Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
id string Oui

Réponse

Renvoie : UpdateUserBadge200Response


getUserBadge Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
id string Oui

Réponse

Renvoie : GetUserBadge200Response


getUserBadges Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
userId string Non
badgeId string Non
type number Non
displayedOnComments boolean Non
limit number Non
skip number Non

Réponse

Renvoie : GetUserBadges200Response


updateUserBadge Internal Link


Paramètres

Nom Type Requis Description
tenantId string Oui
id string Oui
updateUserBadgeParams UpdateUserBadgeParams Oui

Réponse

Retourne: UpdateUserBadge200Response


getUserNotificationCount Internal Link


Paramètres

Nom Type Obligatoire Description
tenantId string Oui
sso string Non

Réponse

Renvoie: GetUserNotificationCount200Response


getUserNotifications Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
pageSize number Non
afterId string Non
includeContext boolean Non
afterCreatedAt number Non
unreadOnly boolean Non
dmOnly boolean Non
noDm boolean Non
includeTranslations boolean Non
sso string Non

Réponse

Renvoie : GetUserNotifications200Response


resetUserNotificationCount Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
sso string Non

Réponse

Renvoie : ResetUserNotifications200Response


resetUserNotifications Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
afterId string Non
afterCreatedAt number Non
unreadOnly boolean Non
dmOnly boolean Non
noDm boolean Non
sso string Non

Réponse

Retourne: ResetUserNotifications200Response


updateUserNotificationCommentSubscriptionStatus Internal Link

Activer ou désactiver les notifications pour un commentaire spécifique.

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
notificationId string Oui
optedInOrOut UpdateUserNotificationCommentSubscriptionStatusOptedInOrOutEnum Oui
commentId string Oui
sso string Non

Réponse

Renvoie: UpdateUserNotificationStatus200Response

updateUserNotificationPageSubscriptionStatus Internal Link

Activer ou désactiver les notifications pour une page. Lorsque les utilisateurs sont abonnés à une page, des notifications sont créées pour les nouveaux commentaires racines, et aussi

Paramètres

Nom Type Requis Description
tenantId string Oui
urlId string Oui
url string Oui
pageTitle string Oui
subscribedOrUnsubscribed UpdateUserNotificationPageSubscriptionStatusSubscribedOrUnsubscribedEnum Oui
sso string Non

Réponse

Renvoie : UpdateUserNotificationStatus200Response

updateUserNotificationStatus Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
notificationId string Oui
newStatus UpdateUserNotificationStatusNewStatusEnum Oui
sso string Non

Réponse

Renvoie: UpdateUserNotificationStatus200Response


getUserPresenceStatuses Internal Link


Paramètres

Nom Type Obligatoire Description
tenantId string Oui
urlIdWS string Oui
userIds string Oui

Réponse

Renvoie: GetUserPresenceStatuses200Response


searchUsers Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
urlId string Oui
usernameStartsWith string Oui
mentionGroupIds Array Non
sso string Non

Réponse

Renvoie : SearchUsers200Response


getUser Internal Link

Paramètres

Name Type Requis Description
tenantId string Oui
id string Oui

Réponse

Renvoie: GetUser200Response

Exemple

Exemple de getUser
Copy Copy
1
2const tenantId: string = "acme-publishing-42";
3const userIdOptional: string | undefined = "user_9d7b4c"; // peut être indéfini dans certains flux (optionnel)
4const id: string = userIdOptional ?? "user_default_0001";
5const result: GetUser200Response = await getUser(tenantId, id);
6console.log(result);
7

createVote Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
commentId string Oui
direction CreateVoteDirectionEnum Oui
userId string Non
anonUserId string Non

Réponse

Renvoie : VoteComment200Response

Exemple

Exemple de createVote
Copy Copy
1
2(async () => {
3 const tenantId: string = 'acme-tenant-812';
4 const commentId: string = '5e8f8b7a-3d4b-4f1b-9a2e-1c9f2d6a7b8c';
5 const direction: CreateVoteDirectionEnum = CreateVoteDirectionEnum.UP;
6 const anonUserId: string = 'anon-84b9c2d';
7 const voteResult: VoteComment200Response = await createVote(tenantId, commentId, direction, undefined, anonUserId);
8 console.log(voteResult);
9})();
10

deleteVote Internal Link

Paramètres

Nom Type Requis Description
tenantId string Oui
id string Oui
editKey string Non

Réponse

Renvoie : DeleteCommentVote200Response

Exemple

Exemple deleteVote
Copy Copy
1
2const tenantId: string = 'tenant_7f3b21c9';
3const id: string = 'vote_4a2d9f1b';
4const editKey: string = 'edit_92b7c6a1';
5
6const resultWithoutEditKey: DeleteCommentVote200Response = await deleteVote(tenantId, id);
7const resultWithEditKey: DeleteCommentVote200Response = await deleteVote(tenantId, id, editKey);
8

getVotes Internal Link

Paramètres

Name Type Required Description
tenantId string Oui
urlId string Oui

Réponse

Renvoie: GetVotes200Response

Exemple

Exemple de getVotes
Copy Copy
1
2const tenantId: string = 'tenant_9f8b3c_prod';
3const urlId: string = '/news/2026/typescript-ecosystem-update';
4const votes: GetVotes200Response = await getVotes(tenantId, urlId);
5// Si un paramètre optionnel existait, par exemple includeHidden, il pourrait être utilisé ainsi :
6// const votesWithHidden: GetVotes200Response = await getVotes(tenantId, urlId, { includeHidden: true });
7

getVotesForUser Internal Link

Paramètres

Nom Type Obligatoire Description
tenantId string Oui
urlId string Oui
userId string Non
anonUserId string Non

Réponse

Renvoie : GetVotesForUser200Response

Exemple

Exemple de getVotesForUser
Copy Copy
1
2const tenantId: string = 'tenant_acme_01';
3const urlId: string = 'news/2026/01/12/product-launch';
4const userId: string = 'user_9c3f2b';
5const anonUserId: string = 'anon_d4e7a1';
6
7const votesForUser: GetVotesForUser200Response = await getVotesForUser(tenantId, urlId, userId);
8const votesForAnon: GetVotesForUser200Response = await getVotesForUser(tenantId, urlId, undefined, anonUserId);
9

Besoin d'aide ?

Si vous rencontrez des problèmes ou avez des questions concernant le SDK JavaScript/TypeScript, veuillez :

Contribuer

Les contributions sont les bienvenues ! Veuillez consulter le dépôt GitHub pour les consignes de contribution.