HttpClient
in package
Table of Contents
Constants
- HOST = 'https://uploadthing.com'
- UT_VERSION = "6.1.0"
Properties
Methods
- __construct() : mixed
- generateUrl() : string
- The function generates a URL by concatenating the host and the given path.
- request() : mixed
- The function "request" sends an HTTP request using the specified method, path, and options.
Constants
HOST
public
mixed
HOST
= 'https://uploadthing.com'
UT_VERSION
public
mixed
UT_VERSION
= "6.1.0"
Properties
$client
public
Client
$client
$headers
public
array<string|int, mixed>
$headers
Methods
__construct()
public
__construct(string $apiKey) : mixed
Parameters
- $apiKey : string
generateUrl()
The function generates a URL by concatenating the host and the given path.
public
static generateUrl(string $path) : string
Parameters
- $path : string
-
A string that represents the path or endpoint of a URL. It is used to construct a complete URL by appending it to the host.
Return values
string —the concatenation of the static variable $host
and the parameter $path
.
request()
The function "request" sends an HTTP request using the specified method, path, and options.
public
request(string $method, string $path[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $method : string
-
The method parameter is a string that represents the HTTP method to be used for the request. This can be "GET", "POST", "PUT", "PATCH", "DELETE", etc.
- $path : string
-
The "path" parameter is a string that represents the URL path or endpoint that you want to make a request to. It typically includes the domain name and any additional path segments that are required to access the desired resource. For example, if you want to make a request to the "/users" endpoint
- $options : array<string|int, mixed> = []
-
The
options
parameter is an array that can contain additional options for the request. These options can include things like query parameters, request body, authentication credentials, and more. By passing this array as an argument to therequest
method, you can customize the behavior of the request.