Table of Contents

Class FluxerBaseApiClient

Namespace
Fluxer.Net.Rest
Assembly
Fluxer.Net.dll
public class FluxerBaseApiClient
Inheritance
object
FluxerBaseApiClient
Derived

Properties

HttpClient

The HTTP client used to make requests. Can be shared or injected for connection pooling.

public HttpClient HttpClient { get; }

Property Value

HttpClient

Limits

API limits for message length, attachment count and premium limits.

public ApiLimits Limits { get; }

Property Value

ApiLimits

RateLimitManager

Manages client-side rate limiting using sliding window algorithm. Prevents exceeding Fluxer API rate limits by automatically waiting when necessary.

public RateLimitManager RateLimitManager { get; }

Property Value

RateLimitManager

Methods

SendRequestAsync<TResponse>(HttpMethod, string, bool, bool)

Makes an HTTP request with no request body but expects a response body.

public Task<TResponse> SendRequestAsync<TResponse>(HttpMethod method, string route, bool throwOnNonSuccess = false, bool authorize = true)

Parameters

method HttpMethod

The HTTP method (typically GET).

route string

The API route (e.g., "/users/@me").

throwOnNonSuccess bool

Whether to throw an exception on non-2xx status codes.

authorize bool

Whether to include the Authorization header.

Returns

Task<TResponse>

The deserialized response object.

Type Parameters

TResponse

The type to deserialize the response into.

Exceptions

FluxerApiException

Thrown when throwOnNonSuccess is true and the API returns a non-success status code.

SendRequestAsync<TSend>(HttpMethod, string, TSend, bool, bool)

Makes an HTTP request with a request body but no response body (returns status code only).

public Task<HttpStatusCode> SendRequestAsync<TSend>(HttpMethod method, string route, TSend data, bool throwOnNonSuccess = false, bool authorize = true)

Parameters

method HttpMethod

The HTTP method (POST, PATCH, DELETE, etc.).

route string

The API route (e.g., "/channels/123/typing").

data TSend

The request body data to serialize and send.

throwOnNonSuccess bool

Whether to throw an exception on non-2xx status codes.

authorize bool

Whether to include the Authorization header.

Returns

Task<HttpStatusCode>

The HTTP status code of the response.

Type Parameters

TSend

The type of the request body.

Exceptions

FluxerApiException

Thrown when throwOnNonSuccess is true and the API returns a non-success status code.

SendRequestAsync<TResponse, TSend>(HttpMethod, string, TSend, bool, bool, ICollection<KeyValuePair<string, (HttpContent content, string? filename)>>?)

Makes an HTTP request with both request and response bodies.

public Task<TResponse> SendRequestAsync<TResponse, TSend>(HttpMethod method, string route, TSend data, bool throwOnNonSuccess = false, bool authorize = true, ICollection<KeyValuePair<string, (HttpContent content, string? filename)>>? otherFormData = null)

Parameters

method HttpMethod

The HTTP method (GET, POST, PATCH, etc.).

route string

The API route (e.g., "/channels/123/messages").

data TSend

The request body data to serialize and send.

throwOnNonSuccess bool

Whether to throw an exception on non-2xx status codes.

authorize bool

Whether to include the Authorization header.

otherFormData ICollection<KeyValuePair<string, (HttpContent content, string filename)>>

Returns

Task<TResponse>

The deserialized response object.

Type Parameters

TResponse

The type to deserialize the response into.

TSend

The type of the request body.

Exceptions

FluxerApiException

Thrown when throwOnNonSuccess is true and the API returns a non-success status code.

SendRequestQueryParamsAsync<TResponse>(HttpMethod, RestClientQueryParams, string, bool, bool)

Makes an HTTP request with no request body but expects a response body.

public Task<TResponse> SendRequestQueryParamsAsync<TResponse>(HttpMethod method, RestClientQueryParams queryParams, string route, bool throwOnNonSuccess = false, bool authorize = true)

Parameters

method HttpMethod

The HTTP method (typically GET).

queryParams RestClientQueryParams

The HTTP method query params like limit, after, etc.

route string

The API route (e.g., "/users/@me").

throwOnNonSuccess bool

Whether to throw an exception on non-2xx status codes.

authorize bool

Whether to include the Authorization header.

Returns

Task<TResponse>

The deserialized response object.

Type Parameters

TResponse

The type to deserialize the response into.

Exceptions

FluxerApiException

Thrown when throwOnNonSuccess is true and the API returns a non-success status code.

SendRequestRawAsync(HttpMethod, string, bool, bool)

Makes an HTTP request with no request or response body (returns status code only).

public Task<HttpStatusCode> SendRequestRawAsync(HttpMethod method, string route, bool throwOnNonSuccess = false, bool authorize = true)

Parameters

method HttpMethod

The HTTP method (DELETE, POST, etc.).

route string

The API route (e.g., "/channels/123").

throwOnNonSuccess bool

Whether to throw an exception on non-2xx status codes.

authorize bool

Whether to include the Authorization header.

Returns

Task<HttpStatusCode>

The HTTP status code of the response.

Exceptions

FluxerApiException

Thrown when throwOnNonSuccess is true and the API returns a non-success status code.