http library
HTTP client utilities for the Calljmp SDK.
This module provides a flexible HTTP client with middleware support, automatic authentication handling, and service error processing.
Features
- Middleware-based request/response processing
- Automatic access token management
- Platform context injection
- Service error handling
- Multipart form data support
Example
final response = await request('https://api.calljmp.com/users')
.params({'limit': 10})
.get()
.json();
Classes
- ByteStream
- A stream of chunks of bytes representing a single piece of data.
- FormData
- Container for multipart form data.
- HttpClient
- HTTP client with middleware support for the Calljmp SDK.
- HttpRequest
- Builder class for constructing and executing HTTP requests.
- HttpResult
- Result wrapper for HTTP requests with response processing capabilities.
- MediaType
- A class representing an HTTP media type, as used in Accept and Content-Type headers.
- MultipartFile
-
A file to be uploaded as part of a
MultipartRequest.
Functions
-
access(
) → HttpMiddleware - Middleware that handles access token authentication.
-
context(
Config config) → HttpMiddleware - Middleware that adds platform context and API tokens to requests.
-
request(
String url) → HttpRequest - Creates an HttpRequest for the specified URL string.
Typedefs
-
HttpMiddleware
= Future<
StreamedResponse> Function(BaseRequest request, Future<StreamedResponse> next(BaseRequest)) - Function signature for HTTP middleware.