GetCustomerFilesRequestBuilder
extends RequestBuilder
in package
Request builder for GET /customer/files endpoint operations.
This builder constructs HTTP requests to retrieve information about uploaded customer files. Files can be queried by file ID to get details about a specific file, or by customer ID to retrieve all files associated with a customer.
The builder follows the builder pattern, allowing method chaining to configure request parameters before execution.
Example usage:
$builder = new GetCustomerFilesRequestBuilder($httpClient, $serviceAddress, $jwt);
$response = $builder->forQueryParameters(['file_id' => $fileId])->execute();
Tags
Table of Contents
Constants
- HEADERS = ["X-Client-Name" => "stellar_php_sdk", "X-Client-Version" => \Soneso\StellarSDK\StellarSDK::VERSION_NR]
Properties
- $httpClient : Client
- $queryParameters : array<string|int, mixed>
- $segments : array<string|int, mixed>
Methods
- __construct() : mixed
- Constructor for building GET /customer/files requests.
- buildUrl() : string
- Builds the complete URL for the request.
- cursor() : RequestBuilder
- Sets <code>cursor</code> parameter on the request.
- execute() : GetCustomerFilesResponse
- Builds and executes the request.
- executeRequest() : Response
- Executes an HTTP request to Horizon and returns a parsed response object
- forQueryParameters() : GetCustomerFilesRequestBuilder
- Sets the query parameters for the request.
- getAndStream() : void
- Streams Server-Sent Events from Horizon to a callback function
- limit() : RequestBuilder
- Sets <code>limit</code> parameter on the request.
- order() : RequestBuilder
- Sets <code>order</code> parameter on the request.
- request() : GetCustomerFilesResponse
- Executes the HTTP request to the specified URL.
- setSegments() : RequestBuilder
- Sets the URL path segments for this request
Constants
HEADERS
public
mixed
HEADERS
= ["X-Client-Name" => "stellar_php_sdk", "X-Client-Version" => \Soneso\StellarSDK\StellarSDK::VERSION_NR]
Properties
$httpClient
protected
Client
$httpClient
$queryParameters
protected
array<string|int, mixed>
$queryParameters
$segments
protected
array<string|int, mixed>
$segments
Methods
__construct()
Constructor for building GET /customer/files requests.
public
__construct(Client $httpClient, string $serviceAddress, string $jwtToken) : mixed
Parameters
- $httpClient : Client
-
The HTTP client to use for sending requests
- $serviceAddress : string
-
The base URL of the SEP-12 KYC service endpoint
- $jwtToken : string
-
JWT token for authentication obtained via SEP-10
buildUrl()
Builds the complete URL for the request.
public
buildUrl() : string
Return values
string —The fully constructed URL with query parameters
cursor()
Sets <code>cursor</code> parameter on the request.
public
cursor(string $cursor) : RequestBuilder
A cursor is a value that points to a specific location in a collection of resources. The cursor attribute itself is an opaque value meaning that users should not try to parse it.
Parameters
- $cursor : string
Tags
Return values
RequestBuilderexecute()
Builds and executes the request.
public
execute() : GetCustomerFilesResponse
Tags
Return values
GetCustomerFilesResponse —The parsed response containing file information
executeRequest()
Executes an HTTP request to Horizon and returns a parsed response object
public
executeRequest(string $url, string $requestType[, string|null $requestMethod = "GET" ]) : Response
This method sends the HTTP request to the Horizon server, handles errors, and parses the JSON response into the appropriate response type.
Parameters
- $url : string
-
The complete request URL to fetch
- $requestType : string
-
The expected response type for parsing
- $requestMethod : string|null = "GET"
-
The HTTP method to use (default: "GET")
Tags
Return values
Response —The parsed response object of the specified type
forQueryParameters()
Sets the query parameters for the request.
public
forQueryParameters(array<string, string> $queryParameters) : GetCustomerFilesRequestBuilder
Supported parameters: file_id, customer_id
Parameters
- $queryParameters : array<string, string>
-
Query parameters to include in the request
Return values
GetCustomerFilesRequestBuilder —Returns this builder for method chaining
getAndStream()
Streams Server-Sent Events from Horizon to a callback function
public
getAndStream(string $relativeUrl, callable $callback[, bool $retryOnServerException = true ]) : void
This method establishes a persistent connection to Horizon's streaming endpoints using Server-Sent Events (SSE). It processes each event and passes the parsed data to the provided callback function. The stream automatically reconnects on server exceptions if retryOnServerException is true.
Horizon streaming uses SSE to push real-time updates. The stream sends:
- "hello" message on connection
- "byebye" message on disconnection
- JSON data objects for actual events
Parameters
- $relativeUrl : string
-
The relative URL to stream from
- $callback : callable
-
Function to receive parsed event data
- $retryOnServerException : bool = true
-
If true, automatically retry on server errors (default: true)
Tags
Return values
void —This method runs indefinitely until interrupted
limit()
Sets <code>limit</code> parameter on the request.
public
limit(int $number) : RequestBuilder
It defines maximum number of records to return. For range and default values check documentation of the endpoint requested.
Parameters
- $number : int
-
Maximum number of records to return
Return values
RequestBuilderorder()
Sets <code>order</code> parameter on the request.
public
order([string $direction = "asc" ]) : RequestBuilder
Parameters
- $direction : string = "asc"
-
"asc" or "desc"
Return values
RequestBuilderrequest()
Executes the HTTP request to the specified URL.
public
request(string $url) : GetCustomerFilesResponse
Parameters
- $url : string
-
The fully constructed URL to send the request to
Tags
Return values
GetCustomerFilesResponse —The parsed response containing file information
setSegments()
Sets the URL path segments for this request
protected
setSegments(string ...$segments) : RequestBuilder
This method constructs the URL path by combining multiple segments. Can only be called once per request builder instance.
Parameters
- $segments : string
-
Variable number of URL path segments
Tags
Return values
RequestBuilder —This instance for method chaining