assignToSegment()
Assigns a target entity id to a segment.
Usage
The following example shows a basic usage of the backend client from @wacht/nextjs/server.
import { wachtClient } from '@wacht/nextjs/server';export async function assignToSegment(segmentId: string, entityId: string) { const client = await wachtClient(); return client.segments.assignToSegment(segmentId, entityId);}Signature
function assignToSegment( segmentId: string, entityId: string,): Promise<Record<string, unknown>>Parameters
›segmentId: string;
segmentId: string;Segment id.
›entityId: string;
entityId: string;Entity id to assign.
Return value
›result?: Record<string, unknown> | undefined;
result?: Record<string, unknown> | undefined;Operation result payload.
Behavior
- Creates an association between the target entity and segment.
- Call this after validating both ids exist in your application context.