Skip to content

@ecp.eth/sdk


@ecp.eth/sdk / indexer / FetchCommentsOptions

Type Alias: FetchCommentsOptions

type FetchCommentsOptions = {
  apiUrl?: string;
  app?: Hex;
  author?: Hex;
  chainId: number | number[];
  channelId?: bigint;
  commentType?: number;
  cursor?: Hex;
  excludeByModerationLabels?: IndexerAPIModerationClassificationLabelSchemaType[];
  isDeleted?: boolean;
  limit?: number;
  mode?: IndexerAPICommentListModeSchemaType;
  moderationScore?: number;
  moderationStatus?:   | IndexerAPICommentModerationStatusSchemaType
     | IndexerAPICommentModerationStatusSchemaType[];
  retries?: number;
  signal?: AbortSignal;
  sort?: IndexerAPISortSchemaType;
  targetUri?: string;
  viewer?: Hex;
};

Defined in: packages/sdk/src/indexer/api.ts:180

The options for fetchComments()

Properties

apiUrl?

optional apiUrl: string;

Defined in: packages/sdk/src/indexer/api.ts:202

URL on which /api/comments endpoint will be called

Default

"https://api.ethcomments.xyz"

app?

optional app: Hex;

Defined in: packages/sdk/src/indexer/api.ts:206

Filter comments sent using this app signer key.


author?

optional author: Hex;

Defined in: packages/sdk/src/indexer/api.ts:188

Filter comments by author


chainId

chainId: number | number[];

Defined in: packages/sdk/src/indexer/api.ts:192

Filter comments by chain ID(s)


channelId?

optional channelId: bigint;

Defined in: packages/sdk/src/indexer/api.ts:210

Filter comments by channel ID


commentType?

optional commentType: number;

Defined in: packages/sdk/src/indexer/api.ts:214

Filter comments by comment type


cursor?

optional cursor: Hex;

Defined in: packages/sdk/src/indexer/api.ts:240

The cursor to fetch comments from


excludeByModerationLabels?

optional excludeByModerationLabels: IndexerAPIModerationClassificationLabelSchemaType[];

Defined in: packages/sdk/src/indexer/api.ts:270

Filter comments by moderation labels.

Only comments with moderation labels not included in the provided array are returned. This can be used to bypass premoderation, make sure to pass all moderation statuses to moderationStatus parameter if the premoderation is enabled.


isDeleted?

optional isDeleted: boolean;

Defined in: packages/sdk/src/indexer/api.ts:219

Whether to return only deleted comments or only undeleted comments. If omitted it will return both deleted and undeleted comments.


limit?

optional limit: number;

Defined in: packages/sdk/src/indexer/api.ts:276

The number of comments to fetch

Default

50

mode?

optional mode: IndexerAPICommentListModeSchemaType;

Defined in: packages/sdk/src/indexer/api.ts:254

The mode to fetch replies, by default it returns only the first level of replies.

  • "flat" mode returns all replies (no matter the nesting level) sorted by timestamp in descending order.
  • "nested" mode returns only the first level of replies sorted by timestamp in descending order.

Default

"nested"

moderationScore?

optional moderationScore: number;

Defined in: packages/sdk/src/indexer/api.ts:262

Filter comments by moderation score.

Only comments with moderation score lower or equal to the provided value are returned. This can be used to bypass premoderation, make sure to pass all moderation statuses to moderationStatus parameter if the premoderation is enabled.


moderationStatus?

optional moderationStatus: 
  | IndexerAPICommentModerationStatusSchemaType
  | IndexerAPICommentModerationStatusSchemaType[];

Defined in: packages/sdk/src/indexer/api.ts:228

Filter comments by moderation status.

By default API returns only approved comments if moderation is enabled for all comments except when the viewer is provided, for viewer it returns all comments regardless of status.

If moderation is disabled, this parameter is ignored.


retries?

optional retries: number;

Defined in: packages/sdk/src/indexer/api.ts:236

Number of times to retry the signing operation in case of failure.

Default

3

signal?

optional signal: AbortSignal;

Defined in: packages/sdk/src/indexer/api.ts:277


sort?

optional sort: IndexerAPISortSchemaType;

Defined in: packages/sdk/src/indexer/api.ts:246

The sort order, either asc or desc

Default

"desc"

targetUri?

optional targetUri: string;

Defined in: packages/sdk/src/indexer/api.ts:184

The target URI to fetch comments for


viewer?

optional viewer: Hex;

Defined in: packages/sdk/src/indexer/api.ts:196

The viewer's address. This is useful when the content moderation is enabled on the indexer.