Table of Contents

Class SegmentsClient

Namespace
Auth0.ManagementApi.Experimentation
Assembly
Auth0.ManagementApi.dll
public class SegmentsClient : ISegmentsClient
Inheritance
SegmentsClient
Implements
Inherited Members
Extension Methods

Methods

CreateAsync(CreateSegmentRequestContent, RequestOptions?, CancellationToken)

Create a new segment with rule-based membership criteria for use in experiments.

public WithRawResponseTask<CreateSegmentResponseContent> CreateAsync(CreateSegmentRequestContent request, RequestOptions? options = null, CancellationToken cancellationToken = default)

Parameters

request CreateSegmentRequestContent
options RequestOptions
cancellationToken CancellationToken

Returns

WithRawResponseTask<CreateSegmentResponseContent>

Examples

await client.Experimentation.Segments.CreateAsync(
    new CreateSegmentRequestContent
    {
        Name = "name",
        Rules = new List<SegmentRule>() { new SegmentRule() },
    }
);

DeleteAsync(string, RequestOptions?, CancellationToken)

Delete a segment by ID. Idempotent: returns 204 even if segment does not exist.

public WithRawResponseTask DeleteAsync(string id, RequestOptions? options = null, CancellationToken cancellationToken = default)

Parameters

id string
options RequestOptions
cancellationToken CancellationToken

Returns

WithRawResponseTask

Examples

await client.Experimentation.Segments.DeleteAsync("id");

GetAsync(string, RequestOptions?, CancellationToken)

Retrieve a single segment by its ID.

public WithRawResponseTask<GetSegmentResponseContent> GetAsync(string id, RequestOptions? options = null, CancellationToken cancellationToken = default)

Parameters

id string
options RequestOptions
cancellationToken CancellationToken

Returns

WithRawResponseTask<GetSegmentResponseContent>

Examples

await client.Experimentation.Segments.GetAsync("id");

ListAsync(ListSegmentsRequestParameters, RequestOptions?, CancellationToken)

Retrieve a paginated list of segments for the tenant.

public Task<Pager<Segment>> ListAsync(ListSegmentsRequestParameters request, RequestOptions? options = null, CancellationToken cancellationToken = default)

Parameters

request ListSegmentsRequestParameters
options RequestOptions
cancellationToken CancellationToken

Returns

Task<Pager<Segment>>

Examples

await client.Experimentation.Segments.ListAsync(
    new ListSegmentsRequestParameters
    {
        From = "from",
        Take = 1,
        Type = SegmentTypeFilterEnum.Auth0,
    }
);

UpdateAsync(string, UpdateSegmentRequestContent, RequestOptions?, CancellationToken)

Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array.

public WithRawResponseTask<UpdateSegmentResponseContent> UpdateAsync(string id, UpdateSegmentRequestContent request, RequestOptions? options = null, CancellationToken cancellationToken = default)

Parameters

id string
request UpdateSegmentRequestContent
options RequestOptions
cancellationToken CancellationToken

Returns

WithRawResponseTask<UpdateSegmentResponseContent>

Examples

await client.Experimentation.Segments.UpdateAsync("id", new UpdateSegmentRequestContent());