Class TagBuilder
- Namespace
- CivitaiSharp.Core.Request
- Assembly
- CivitaiSharp.Core.dll
Immutable, thread-safe request builder for tags. Use the fluent methods to compose filters, then call ExecuteAsync(int?, string?, CancellationToken) to execute the request. Each fluent method returns a new builder instance, allowing safe reuse and caching of base configurations.
public sealed record TagBuilder : RequestBuilder<TagBuilder, Tag>, IEquatable<RequestBuilder<TagBuilder, Tag>>, IEquatable<TagBuilder>
- Inheritance
-
TagBuilder
- Implements
- Inherited Members
Fields
MaximumResultsPerPage
The maximum allowed value for the resultsLimit parameter in ExecuteAsync (200).
public const int MaximumResultsPerPage = 200
Field Value
MinimumResultsPerPage
The minimum allowed value for the resultsLimit parameter in ExecuteAsync (1).
public const int MinimumResultsPerPage = 1
Field Value
Properties
DefaultResultsLimit
Gets the default results limit when none is specified for this endpoint.
protected override int DefaultResultsLimit { get; }
Property Value
Remarks
The tags endpoint returns 20 results by default.
Endpoint
Gets the API endpoint path segment for this resource type (e.g., "models", "images").
protected override string Endpoint { get; }
Property Value
MaxResultsLimit
Gets the maximum allowed value for results limit for this endpoint.
protected override int MaxResultsLimit { get; }
Property Value
Remarks
The tags endpoint has a maximum limit of 200.
MinResultsLimit
Gets the minimum allowed value for results limit for this endpoint.
protected override int MinResultsLimit { get; }
Property Value
Remarks
The tags endpoint requires a minimum limit of 1. Omit the limit to return all results (up to 200 per page).
Methods
WhereName(string)
Filter tags by name (partial match via search query parameter).
public TagBuilder WhereName(string name)
Parameters
namestringThe tag name to search for.
Returns
- TagBuilder
A new builder instance with the filter applied.
Exceptions
- ArgumentException
Thrown if name is null or whitespace.
With(ImmutableDictionary<string, object?>, string?, int?)
Creates a new builder instance with the specified state changes. Derived classes must implement this to return the correct derived type.
protected override TagBuilder With(ImmutableDictionary<string, object?> filters, string? sort, int? resultsLimit)
Parameters
filtersImmutableDictionary<string, object>The new filters dictionary with typed values.
sortstringThe new sort value.
resultsLimitint?The new results limit.
Returns
- TagBuilder
A new builder instance with the updated state.
WithPageIndex(int)
Set the page index for page-based pagination.
public TagBuilder WithPageIndex(int pageIndex)
Parameters
pageIndexintThe 1-based page index. Must be at least 1.
Returns
- TagBuilder
A new builder instance with the page index applied.
Exceptions
- ArgumentOutOfRangeException
Thrown if pageIndex is less than 1.