Class FluxerBaseApiClient
public class FluxerBaseApiClient
- Inheritance
-
objectFluxerBaseApiClient
- Derived
Properties
HttpClient
The HTTP client used to make requests. Can be shared or injected for connection pooling.
public HttpClient HttpClient { get; }
Property Value
Limits
API limits for message length, attachment count and premium limits.
public ApiLimits Limits { get; }
Property Value
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
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
methodHttpMethodThe HTTP method (typically GET).
routestringThe API route (e.g., "/users/@me").
throwOnNonSuccessboolWhether to throw an exception on non-2xx status codes.
authorizeboolWhether to include the Authorization header.
Returns
- Task<TResponse>
The deserialized response object.
Type Parameters
TResponseThe type to deserialize the response into.
Exceptions
- FluxerApiException
Thrown when
throwOnNonSuccessis 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
methodHttpMethodThe HTTP method (POST, PATCH, DELETE, etc.).
routestringThe API route (e.g., "/channels/123/typing").
dataTSendThe request body data to serialize and send.
throwOnNonSuccessboolWhether to throw an exception on non-2xx status codes.
authorizeboolWhether to include the Authorization header.
Returns
- Task<HttpStatusCode>
The HTTP status code of the response.
Type Parameters
TSendThe type of the request body.
Exceptions
- FluxerApiException
Thrown when
throwOnNonSuccessis 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
methodHttpMethodThe HTTP method (GET, POST, PATCH, etc.).
routestringThe API route (e.g., "/channels/123/messages").
dataTSendThe request body data to serialize and send.
throwOnNonSuccessboolWhether to throw an exception on non-2xx status codes.
authorizeboolWhether to include the Authorization header.
otherFormDataICollection<KeyValuePair<string, (HttpContent content, string filename)>>
Returns
- Task<TResponse>
The deserialized response object.
Type Parameters
TResponseThe type to deserialize the response into.
TSendThe type of the request body.
Exceptions
- FluxerApiException
Thrown when
throwOnNonSuccessis 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
methodHttpMethodThe HTTP method (typically GET).
queryParamsRestClientQueryParamsThe HTTP method query params like limit, after, etc.
routestringThe API route (e.g., "/users/@me").
throwOnNonSuccessboolWhether to throw an exception on non-2xx status codes.
authorizeboolWhether to include the Authorization header.
Returns
- Task<TResponse>
The deserialized response object.
Type Parameters
TResponseThe type to deserialize the response into.
Exceptions
- FluxerApiException
Thrown when
throwOnNonSuccessis 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
methodHttpMethodThe HTTP method (DELETE, POST, etc.).
routestringThe API route (e.g., "/channels/123").
throwOnNonSuccessboolWhether to throw an exception on non-2xx status codes.
authorizeboolWhether to include the Authorization header.
Returns
- Task<HttpStatusCode>
The HTTP status code of the response.
Exceptions
- FluxerApiException
Thrown when
throwOnNonSuccessis true and the API returns a non-success status code.