Skip to main content

Class: SanctionManager

Manages sanctions for a project.

Constructors

new SanctionManager()

new SanctionManager(ctx, projectId): SanctionManager

Internal

Parameters

ParameterType
ctxClientContext
projectIdstring

Returns

SanctionManager

Defined in

4Players/cortex-typescript-sdk/src/resources/sanctions.ts:31

Methods

create()

create(body): Promise<Sanction>

Create a new sanction

Parameters

ParameterTypeDescription
bodyobjectSanction creation payload
body.endAt?stringDescription When the sanction ends (null = permanent) Example 2024-01-15T11:00:00Z
body.externalUserId?stringDescription External user ID from ODIN (for cross-session sanctions) Example user_abc123
body.metadata?Record<string, never>Description Additional metadata (evidence, AI confidence, etc.) Example { * "confidence": 0.95, * "triggeredBy": "profanity_filter" * }
body.participantId?stringDescription Participant ID to sanction (for session-scoped sanctions) Example 550e8400-e29b-41d4-a716-446655440000
body.reason?stringDescription Reason for the sanction Example Repeated use of profanity detected by automated filter
body.scope?Record<string, never>Description Scope configuration for channel-specific sanctions Example { * "channels": [ * "team", * "proximity" * ] * }
body.sessionId?stringDescription Session ID (for session-scoped sanctions) Example 550e8400-e29b-41d4-a716-446655440001
body.startAt?stringDescription When the sanction starts (defaults to now) Example 2024-01-15T10:00:00Z
body.type| "warn" | "mute" | "listen_only" | "text_only" | "rate_limit" | "shadow_mute" | "temp_ban" | "perm_ban" | "ranked_restriction" | "queue_delay" | "party_restriction" | "human_review"Description Type of sanction to apply Example mute @enum {string}

Returns

Promise<Sanction>

Live Sanction object

Defined in

4Players/cortex-typescript-sdk/src/resources/sanctions.ts:55


get()

get(sanctionId): Promise<Sanction>

Get a sanction by ID

Parameters

ParameterTypeDescription
sanctionIdstringSanction ID

Returns

Promise<Sanction>

Live Sanction object

Defined in

4Players/cortex-typescript-sdk/src/resources/sanctions.ts:69


getActive()

getActive(externalUserId, query?): Promise<object[]>

Get active sanctions for a user

Parameters

ParameterTypeDescription
externalUserIdstringExternal user ID from ODIN
query?objectOptional filter by sanction type
query.type?| "warn" | "mute" | "listen_only" | "text_only" | "rate_limit" | "shadow_mute" | "temp_ban" | "perm_ban" | "ranked_restriction" | "queue_delay" | "party_restriction" | "human_review"Description Filter by specific sanction type

Returns

Promise<object[]>

Array of active sanctions

Defined in

4Players/cortex-typescript-sdk/src/resources/sanctions.ts:112


getByParticipant()

getByParticipant(participantId): Promise<object[]>

Get all sanctions for a participant

Parameters

ParameterTypeDescription
participantIdstringParticipant ID

Returns

Promise<object[]>

Array of sanctions

Defined in

4Players/cortex-typescript-sdk/src/resources/sanctions.ts:97


getByUser()

getByUser(externalUserId): Promise<object[]>

Get all sanctions for a user by external user ID

Parameters

ParameterTypeDescription
externalUserIdstringExternal user ID from ODIN

Returns

Promise<object[]>

Array of sanctions

Defined in

4Players/cortex-typescript-sdk/src/resources/sanctions.ts:83


list()

list(query?): Promise<object>

List sanctions for this project

Parameters

ParameterTypeDescription
query?objectOptional filters (type, activeOnly, limit, offset)
query.activeOnly?booleanDescription Only return active sanctions
query.limit?numberDescription Pagination limit
query.offset?numberDescription Pagination offset
query.type?| "warn" | "mute" | "listen_only" | "text_only" | "rate_limit" | "shadow_mute" | "temp_ban" | "perm_ban" | "ranked_restriction" | "queue_delay" | "party_restriction" | "human_review"Description Filter by sanction type

Returns

Promise<object>

Sanctions list with total count

NameTypeDescriptionDefined in
sanctionsobject[]Description List of sanctions4Players/cortex-typescript-sdk/src/types.ts:4246
totalnumberDescription Total count (for pagination)4Players/cortex-typescript-sdk/src/types.ts:4248

Defined in

4Players/cortex-typescript-sdk/src/resources/sanctions.ts:41


watch()

watch()

watch(): CollectionSubscription<object>

Live-subscribe to sanctions. With no argument, watches the whole collection; with a sanction ID, watches that single sanction. A revoked sanction stays in the collection with an updated status (it is not removed).

Returns

CollectionSubscription<object>

A CollectionSubscription (no id) or DocumentSubscription (with id)

NameTypeDescriptionDefined in
createdAtstringFormat: date-time Description Creation timestamp4Players/cortex-typescript-sdk/src/types.ts:3485
createdByUserId?stringDescription User who created the sanction4Players/cortex-typescript-sdk/src/types.ts:3480
endAt?stringFormat: date-time Description When sanction expires (null = permanent)4Players/cortex-typescript-sdk/src/types.ts:3478
externalUserId?stringDescription External user ID4Players/cortex-typescript-sdk/src/types.ts:3455
idstringDescription Sanction ID4Players/cortex-typescript-sdk/src/types.ts:3449
isActivebooleanDescription Whether the sanction is currently active4Players/cortex-typescript-sdk/src/types.ts:3499
metadata?Record<string, never>Description Additional metadata4Players/cortex-typescript-sdk/src/types.ts:3468
participant?objectDescription Participant information (if available)4Players/cortex-typescript-sdk/src/types.ts:3503
participant.displayNamestringDescription Display name of the participant4Players/cortex-typescript-sdk/src/types.ts:3436
participant.externalUserIdstringDescription External user ID from ODIN4Players/cortex-typescript-sdk/src/types.ts:3438
participant.idstringDescription Participant ID4Players/cortex-typescript-sdk/src/types.ts:3432
participant.joinedAt?stringFormat: date-time Description When the participant first joined the project4Players/cortex-typescript-sdk/src/types.ts:3445
participant.projectIdstringDescription ODIN project ID this participant belongs to4Players/cortex-typescript-sdk/src/types.ts:3434
participant.userData?Record<string, never>Description User data from ODIN (parsed JSON)4Players/cortex-typescript-sdk/src/types.ts:3440
participantId?stringDescription Participant ID (if session-scoped)4Players/cortex-typescript-sdk/src/types.ts:3453
reason?stringDescription Reason for sanction4Players/cortex-typescript-sdk/src/types.ts:3466
revokedAt?stringFormat: date-time Description When sanction was revoked4Players/cortex-typescript-sdk/src/types.ts:3495
revokedByUserId?stringDescription User who revoked the sanction4Players/cortex-typescript-sdk/src/types.ts:3497
scope?Record<string, never>Description Scope configuration4Players/cortex-typescript-sdk/src/types.ts:3464
sessionId?stringDescription Session ID (if session-scoped)4Players/cortex-typescript-sdk/src/types.ts:3457
startAtstringFormat: date-time Description When sanction becomes active4Players/cortex-typescript-sdk/src/types.ts:3473
statusstringDescription Status: active, expired, or revoked4Players/cortex-typescript-sdk/src/types.ts:3501
tenantIdstringDescription Tenant ID4Players/cortex-typescript-sdk/src/types.ts:3451
type| "warn" | "mute" | "listen_only" | "text_only" | "rate_limit" | "shadow_mute" | "temp_ban" | "perm_ban" | "ranked_restriction" | "queue_delay" | "party_restriction" | "human_review"Description Type of sanction4Players/cortex-typescript-sdk/src/types.ts:3462
updatedAtstringFormat: date-time Description Last update timestamp4Players/cortex-typescript-sdk/src/types.ts:3490
Defined in

4Players/cortex-typescript-sdk/src/resources/sanctions.ts:127

watch(sanctionId)

watch(sanctionId): DocumentSubscription<object>
Parameters
ParameterType
sanctionIdstring
Returns

DocumentSubscription<object>

NameTypeDescriptionDefined in
createdAtstringFormat: date-time Description Creation timestamp4Players/cortex-typescript-sdk/src/types.ts:3485
createdByUserId?stringDescription User who created the sanction4Players/cortex-typescript-sdk/src/types.ts:3480
endAt?stringFormat: date-time Description When sanction expires (null = permanent)4Players/cortex-typescript-sdk/src/types.ts:3478
externalUserId?stringDescription External user ID4Players/cortex-typescript-sdk/src/types.ts:3455
idstringDescription Sanction ID4Players/cortex-typescript-sdk/src/types.ts:3449
isActivebooleanDescription Whether the sanction is currently active4Players/cortex-typescript-sdk/src/types.ts:3499
metadata?Record<string, never>Description Additional metadata4Players/cortex-typescript-sdk/src/types.ts:3468
participant?objectDescription Participant information (if available)4Players/cortex-typescript-sdk/src/types.ts:3503
participant.displayNamestringDescription Display name of the participant4Players/cortex-typescript-sdk/src/types.ts:3436
participant.externalUserIdstringDescription External user ID from ODIN4Players/cortex-typescript-sdk/src/types.ts:3438
participant.idstringDescription Participant ID4Players/cortex-typescript-sdk/src/types.ts:3432
participant.joinedAt?stringFormat: date-time Description When the participant first joined the project4Players/cortex-typescript-sdk/src/types.ts:3445
participant.projectIdstringDescription ODIN project ID this participant belongs to4Players/cortex-typescript-sdk/src/types.ts:3434
participant.userData?Record<string, never>Description User data from ODIN (parsed JSON)4Players/cortex-typescript-sdk/src/types.ts:3440
participantId?stringDescription Participant ID (if session-scoped)4Players/cortex-typescript-sdk/src/types.ts:3453
reason?stringDescription Reason for sanction4Players/cortex-typescript-sdk/src/types.ts:3466
revokedAt?stringFormat: date-time Description When sanction was revoked4Players/cortex-typescript-sdk/src/types.ts:3495
revokedByUserId?stringDescription User who revoked the sanction4Players/cortex-typescript-sdk/src/types.ts:3497
scope?Record<string, never>Description Scope configuration4Players/cortex-typescript-sdk/src/types.ts:3464
sessionId?stringDescription Session ID (if session-scoped)4Players/cortex-typescript-sdk/src/types.ts:3457
startAtstringFormat: date-time Description When sanction becomes active4Players/cortex-typescript-sdk/src/types.ts:3473
statusstringDescription Status: active, expired, or revoked4Players/cortex-typescript-sdk/src/types.ts:3501
tenantIdstringDescription Tenant ID4Players/cortex-typescript-sdk/src/types.ts:3451
type| "warn" | "mute" | "listen_only" | "text_only" | "rate_limit" | "shadow_mute" | "temp_ban" | "perm_ban" | "ranked_restriction" | "queue_delay" | "party_restriction" | "human_review"Description Type of sanction4Players/cortex-typescript-sdk/src/types.ts:3462
updatedAtstringFormat: date-time Description Last update timestamp4Players/cortex-typescript-sdk/src/types.ts:3490
Defined in

4Players/cortex-typescript-sdk/src/resources/sanctions.ts:128