DiscordPHP-Http Documentation

EndpointTrait

Table of Contents

Methods

__toString()  : string
Converts the endpoint to a string.
addQuery()  : void
Adds a key-value query pair to the endpoint.
bind()  : Endpoint
Creates an endpoint class and binds arguments to the newly created instance.
bindArgs()  : this
Binds a list of arguments to the endpoint.
bindAssoc()  : this
Binds an associative array to the endpoint.
toAbsoluteEndpoint()  : string
Converts the endpoint into the absolute endpoint with placeholders replaced.
isMajorParameter()  : bool
Checks if a parameter is a major parameter.

Methods

__toString()

Converts the endpoint to a string.

public __toString() : string

Alias of ->toAbsoluteEndpoint();.

Return values
string

addQuery()

Adds a key-value query pair to the endpoint.

public addQuery(string $key, string|bool $value) : void
Parameters
$key : string
$value : string|bool

bind()

Creates an endpoint class and binds arguments to the newly created instance.

public static bind(string $endpoint, array<string|int, string> ...$args) : Endpoint
Parameters
$endpoint : string
$args : array<string|int, string>
Return values
Endpoint

bindArgs()

Binds a list of arguments to the endpoint.

public bindArgs(array<string|int, string> ...$args) : this
Parameters
$args : array<string|int, string>
Return values
this

bindAssoc()

Binds an associative array to the endpoint.

public bindAssoc(array<string|int, string> $args) : this
Parameters
$args : array<string|int, string>
Return values
this

toAbsoluteEndpoint()

Converts the endpoint into the absolute endpoint with placeholders replaced.

public toAbsoluteEndpoint([bool $onlyMajorParameters = false ]) : string

Passing a true boolean in will only replace the major parameters. Used for rate limit buckets.

Parameters
$onlyMajorParameters : bool = false
Return values
string

isMajorParameter()

Checks if a parameter is a major parameter.

private static isMajorParameter(string $param) : bool
Parameters
$param : string
Return values
bool
On this page

Search results