YfyRequestBuilder
class YfyRequestBuilder
Class YfyRequestBuilder
Properties
protected string | $method | ||
protected string | $endpoint | ||
protected array | $headers | ||
protected array | $basicAuth | ||
protected array | $pathParams | ||
protected array | $queryParams | ||
protected array | $formParams | ||
protected array | $json | ||
protected array | $files | ||
protected int | $connectTimeout | ||
protected int | $timeout | ||
protected bool | $stream | ||
protected YfyContext | $yfyContext |
Methods
$this
withMethod(string $method)
设置请求方法
$this
withEndpoint(string $endpoint)
设置请求路径模板
$this
withHeaders(array $headers)
设置请求header数组
$this
addHeader(string $key, string $value)
增加一个header
$this
withBasicAuth(string $username, string $password)
设置basic auth参数
$this
withPathParams(array $pathParams)
设置路径参数
$this
addPathParam(string $param)
增加一个路径参数
$this
withQueryParams(array $queryParams)
设置query参数数组
$this
addQueryParam(string $key, string $value)
增加一个query参数
$this
withFormParams(array $formParams)
设置表单参数
$this
addFormParam(string $key, string $value)
增加一个表单参数
$this
withJson(array $json)
设置json参数
$this
withFiles(array $files)
设置通过multipart方式上传的文件
$this
withConnectTimeout(int $connectTimeout)
设置连接超时时间
$this
withTimeout(int $timeout)
设置请求超时时间
$this
returnStream(bool $stream)
设置是否以流形式返回
$this
build()
构造request
static YfyRequestBuilder
factory()
创建一个工厂实例
Details
at line 75
__construct(YfyContext $yfyContext = null)
YfyRequestBuilder constructor.
at line 87
$this
withMethod(string $method)
设置请求方法
at line 98
$this
withEndpoint(string $endpoint)
设置请求路径模板
at line 109
$this
withHeaders(array $headers)
设置请求header数组
at line 121
$this
addHeader(string $key, string $value)
增加一个header
at line 133
$this
withBasicAuth(string $username, string $password)
设置basic auth参数
at line 144
$this
withPathParams(array $pathParams)
设置路径参数
at line 155
$this
addPathParam(string $param)
增加一个路径参数
at line 166
$this
withQueryParams(array $queryParams)
设置query参数数组
at line 178
$this
addQueryParam(string $key, string $value)
增加一个query参数
at line 189
$this
withFormParams(array $formParams)
设置表单参数
at line 201
$this
addFormParam(string $key, string $value)
增加一个表单参数
at line 212
$this
withJson(array $json)
设置json参数
at line 223
$this
withFiles(array $files)
设置通过multipart方式上传的文件
at line 234
$this
addFile(YfyFile $yfyFile)
增加一个通过multipart方式上传的文件
at line 245
$this
withConnectTimeout(int $connectTimeout)
设置连接超时时间
at line 256
$this
withTimeout(int $timeout)
设置请求超时时间
at line 267
$this
returnStream(bool $stream)
设置是否以流形式返回
at line 279
$this
withYfyContext(YfyContext $yfyContext)
设置请求上下文
at line 312
YfyRequest
build()
构造request
at line 339
static YfyRequestBuilder
factory()
创建一个工厂实例