|
|
@@ -0,0 +1,4067 @@
|
|
|
+<?php
|
|
|
+/**
|
|
|
+ * GroupsApi
|
|
|
+ * PHP version 8.1
|
|
|
+ *
|
|
|
+ * @category Class
|
|
|
+ * @package WikipaliApi
|
|
|
+ * @author OpenAPI Generator team
|
|
|
+ * @link https://openapi-generator.tech
|
|
|
+ */
|
|
|
+
|
|
|
+/**
|
|
|
+ * MINT API
|
|
|
+ *
|
|
|
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院) 由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
|
|
|
+ *
|
|
|
+ * The version of the OpenAPI document: 1.0.0
|
|
|
+ * Generated by: https://openapi-generator.tech
|
|
|
+ * Generator version: 7.25.0
|
|
|
+ */
|
|
|
+
|
|
|
+/**
|
|
|
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
|
+ * https://openapi-generator.tech
|
|
|
+ * Do not edit the class manually.
|
|
|
+ */
|
|
|
+
|
|
|
+namespace WikipaliApi\Api;
|
|
|
+
|
|
|
+use GuzzleHttp\Client;
|
|
|
+use GuzzleHttp\ClientInterface;
|
|
|
+use GuzzleHttp\Exception\ConnectException;
|
|
|
+use GuzzleHttp\Exception\RequestException;
|
|
|
+use GuzzleHttp\Psr7\MultipartStream;
|
|
|
+use GuzzleHttp\Psr7\Request;
|
|
|
+use GuzzleHttp\RequestOptions;
|
|
|
+use Psr\Http\Message\RequestInterface;
|
|
|
+use Psr\Http\Message\ResponseInterface;
|
|
|
+use WikipaliApi\ApiException;
|
|
|
+use WikipaliApi\Configuration;
|
|
|
+use WikipaliApi\FormDataProcessor;
|
|
|
+use WikipaliApi\HeaderSelector;
|
|
|
+use WikipaliApi\ObjectSerializer;
|
|
|
+
|
|
|
+/**
|
|
|
+ * GroupsApi Class Doc Comment
|
|
|
+ *
|
|
|
+ * @category Class
|
|
|
+ * @package WikipaliApi
|
|
|
+ * @author OpenAPI Generator team
|
|
|
+ * @link https://openapi-generator.tech
|
|
|
+ */
|
|
|
+class GroupsApi
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * @var ClientInterface
|
|
|
+ */
|
|
|
+ protected $client;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @var Configuration
|
|
|
+ */
|
|
|
+ protected $config;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @var HeaderSelector
|
|
|
+ */
|
|
|
+ protected $headerSelector;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @var int Host index
|
|
|
+ */
|
|
|
+ protected $hostIndex;
|
|
|
+
|
|
|
+ /** @var string[] $contentTypes **/
|
|
|
+ public const contentTypes = [
|
|
|
+ 'deleteApiV3GroupsGroup' => [
|
|
|
+ 'application/json',
|
|
|
+ ],
|
|
|
+ 'deleteApiV3GroupsGroupMembersMember' => [
|
|
|
+ 'application/json',
|
|
|
+ ],
|
|
|
+ 'deleteApiV3GroupsGroupSharesShare' => [
|
|
|
+ 'application/json',
|
|
|
+ ],
|
|
|
+ 'getApiV3Groups' => [
|
|
|
+ 'application/json',
|
|
|
+ ],
|
|
|
+ 'getApiV3GroupsGroup' => [
|
|
|
+ 'application/json',
|
|
|
+ ],
|
|
|
+ 'getApiV3GroupsGroupMembers' => [
|
|
|
+ 'application/json',
|
|
|
+ ],
|
|
|
+ 'getApiV3GroupsGroupShares' => [
|
|
|
+ 'application/json',
|
|
|
+ ],
|
|
|
+ 'getApiV3MeGroups' => [
|
|
|
+ 'application/json',
|
|
|
+ ],
|
|
|
+ 'patchApiV3GroupsGroup' => [
|
|
|
+ 'application/json',
|
|
|
+ ],
|
|
|
+ 'patchApiV3GroupsGroupMembersMember' => [
|
|
|
+ 'application/json',
|
|
|
+ ],
|
|
|
+ 'postApiV3Groups' => [
|
|
|
+ 'application/json',
|
|
|
+ ],
|
|
|
+ 'postApiV3GroupsGroupMembers' => [
|
|
|
+ 'application/json',
|
|
|
+ ],
|
|
|
+ ];
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param ClientInterface $client
|
|
|
+ * @param Configuration $config
|
|
|
+ * @param HeaderSelector $selector
|
|
|
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
|
|
|
+ */
|
|
|
+ public function __construct(
|
|
|
+ ?ClientInterface $client = null,
|
|
|
+ ?Configuration $config = null,
|
|
|
+ ?HeaderSelector $selector = null,
|
|
|
+ int $hostIndex = 0
|
|
|
+ ) {
|
|
|
+ $this->client = $client ?: new Client();
|
|
|
+ $this->config = $config ?: Configuration::getDefaultConfiguration();
|
|
|
+ $this->headerSelector = $selector ?: new HeaderSelector();
|
|
|
+ $this->hostIndex = $hostIndex;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set the host index
|
|
|
+ *
|
|
|
+ * @param int $hostIndex Host index (required)
|
|
|
+ */
|
|
|
+ public function setHostIndex($hostIndex): void
|
|
|
+ {
|
|
|
+ $this->hostIndex = $hostIndex;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get the host index
|
|
|
+ *
|
|
|
+ * @return int Host index
|
|
|
+ */
|
|
|
+ public function getHostIndex()
|
|
|
+ {
|
|
|
+ return $this->hostIndex;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @return Configuration
|
|
|
+ */
|
|
|
+ public function getConfig()
|
|
|
+ {
|
|
|
+ return $this->config;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation deleteApiV3GroupsGroup
|
|
|
+ *
|
|
|
+ * 删团队
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroup'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function deleteApiV3GroupsGroup($group, string $contentType = self::contentTypes['deleteApiV3GroupsGroup'][0])
|
|
|
+ {
|
|
|
+ $this->deleteApiV3GroupsGroupWithHttpInfo($group, $contentType);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation deleteApiV3GroupsGroupWithHttpInfo
|
|
|
+ *
|
|
|
+ * 删团队
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroup'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
|
|
|
+ */
|
|
|
+ public function deleteApiV3GroupsGroupWithHttpInfo($group, string $contentType = self::contentTypes['deleteApiV3GroupsGroup'][0])
|
|
|
+ {
|
|
|
+ $request = $this->deleteApiV3GroupsGroupRequest($group, $contentType);
|
|
|
+
|
|
|
+ try {
|
|
|
+ $options = $this->createHttpClientOption();
|
|
|
+ try {
|
|
|
+ $response = $this->client->send($request, $options);
|
|
|
+ } catch (RequestException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
|
|
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
|
|
|
+ );
|
|
|
+ } catch (ConnectException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ null,
|
|
|
+ null
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+
|
|
|
+
|
|
|
+ return [null, $statusCode, $response->getHeaders()];
|
|
|
+ } catch (ApiException $e) {
|
|
|
+ switch ($e->getCode()) {
|
|
|
+ case 401:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 403:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 409:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 422:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation deleteApiV3GroupsGroupAsync
|
|
|
+ *
|
|
|
+ * 删团队
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroup'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function deleteApiV3GroupsGroupAsync($group, string $contentType = self::contentTypes['deleteApiV3GroupsGroup'][0])
|
|
|
+ {
|
|
|
+ return $this->deleteApiV3GroupsGroupAsyncWithHttpInfo($group, $contentType)
|
|
|
+ ->then(
|
|
|
+ function ($response) {
|
|
|
+ return $response[0];
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation deleteApiV3GroupsGroupAsyncWithHttpInfo
|
|
|
+ *
|
|
|
+ * 删团队
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroup'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function deleteApiV3GroupsGroupAsyncWithHttpInfo($group, string $contentType = self::contentTypes['deleteApiV3GroupsGroup'][0])
|
|
|
+ {
|
|
|
+ $returnType = '';
|
|
|
+ $request = $this->deleteApiV3GroupsGroupRequest($group, $contentType);
|
|
|
+
|
|
|
+ return $this->client
|
|
|
+ ->sendAsync($request, $this->createHttpClientOption())
|
|
|
+ ->then(
|
|
|
+ function ($response) use ($returnType) {
|
|
|
+ return [null, $response->getStatusCode(), $response->getHeaders()];
|
|
|
+ },
|
|
|
+ function ($exception) {
|
|
|
+ $response = $exception->getResponse();
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ $exception->getRequest()->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create request for operation 'deleteApiV3GroupsGroup'
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroup'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Psr7\Request
|
|
|
+ */
|
|
|
+ public function deleteApiV3GroupsGroupRequest($group, string $contentType = self::contentTypes['deleteApiV3GroupsGroup'][0])
|
|
|
+ {
|
|
|
+
|
|
|
+ // verify the required parameter 'group' is set
|
|
|
+ if ($group === null || (is_array($group) && count($group) === 0)) {
|
|
|
+ throw new \InvalidArgumentException(
|
|
|
+ 'Missing the required parameter $group when calling deleteApiV3GroupsGroup'
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $resourcePath = '/v3/groups/{group}';
|
|
|
+ $formParams = [];
|
|
|
+ $queryParams = [];
|
|
|
+ $headerParams = [];
|
|
|
+ $httpBody = '';
|
|
|
+ $multipart = false;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // path params
|
|
|
+ if ($group !== null) {
|
|
|
+ $resourcePath = str_replace(
|
|
|
+ '{group}',
|
|
|
+ ObjectSerializer::toPathValue($group),
|
|
|
+ $resourcePath
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $headers = $this->headerSelector->selectHeaders(
|
|
|
+ ['application/problem+json', ],
|
|
|
+ $contentType,
|
|
|
+ $multipart
|
|
|
+ );
|
|
|
+
|
|
|
+ // for model (json/xml)
|
|
|
+ if (count($formParams) > 0) {
|
|
|
+ if ($multipart) {
|
|
|
+ $multipartContents = [];
|
|
|
+ foreach ($formParams as $formParamName => $formParamValue) {
|
|
|
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
|
|
|
+ foreach ($formParamValueItems as $formParamValueItem) {
|
|
|
+ $multipartContents[] = [
|
|
|
+ 'name' => $formParamName,
|
|
|
+ 'contents' => $formParamValueItem
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = new MultipartStream($multipartContents);
|
|
|
+
|
|
|
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
|
|
+ # if Content-Type contains "application/json", json_encode the form parameters
|
|
|
+ try {
|
|
|
+ $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
|
|
|
+ } catch (\JsonException $e) {
|
|
|
+ throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = ObjectSerializer::buildQuery($formParams);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // this endpoint requires Bearer authentication (access token)
|
|
|
+ if (!empty($this->config->getAccessToken())) {
|
|
|
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
|
|
|
+ }
|
|
|
+
|
|
|
+ $defaultHeaders = [];
|
|
|
+ if ($this->config->getUserAgent()) {
|
|
|
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
|
|
+ }
|
|
|
+
|
|
|
+ $headers = array_merge(
|
|
|
+ $defaultHeaders,
|
|
|
+ $headerParams,
|
|
|
+ $headers
|
|
|
+ );
|
|
|
+
|
|
|
+ $operationHost = $this->config->getHost();
|
|
|
+ $query = ObjectSerializer::buildQuery($queryParams);
|
|
|
+ return new Request(
|
|
|
+ 'DELETE',
|
|
|
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
|
|
|
+ $headers,
|
|
|
+ $httpBody
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation deleteApiV3GroupsGroupMembersMember
|
|
|
+ *
|
|
|
+ * 移除成员 / 退出团队
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $member 成员记录 id (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupMembersMember'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function deleteApiV3GroupsGroupMembersMember($group, $member, string $contentType = self::contentTypes['deleteApiV3GroupsGroupMembersMember'][0])
|
|
|
+ {
|
|
|
+ $this->deleteApiV3GroupsGroupMembersMemberWithHttpInfo($group, $member, $contentType);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation deleteApiV3GroupsGroupMembersMemberWithHttpInfo
|
|
|
+ *
|
|
|
+ * 移除成员 / 退出团队
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $member 成员记录 id (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupMembersMember'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
|
|
|
+ */
|
|
|
+ public function deleteApiV3GroupsGroupMembersMemberWithHttpInfo($group, $member, string $contentType = self::contentTypes['deleteApiV3GroupsGroupMembersMember'][0])
|
|
|
+ {
|
|
|
+ $request = $this->deleteApiV3GroupsGroupMembersMemberRequest($group, $member, $contentType);
|
|
|
+
|
|
|
+ try {
|
|
|
+ $options = $this->createHttpClientOption();
|
|
|
+ try {
|
|
|
+ $response = $this->client->send($request, $options);
|
|
|
+ } catch (RequestException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
|
|
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
|
|
|
+ );
|
|
|
+ } catch (ConnectException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ null,
|
|
|
+ null
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+
|
|
|
+
|
|
|
+ return [null, $statusCode, $response->getHeaders()];
|
|
|
+ } catch (ApiException $e) {
|
|
|
+ switch ($e->getCode()) {
|
|
|
+ case 401:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 403:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 422:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation deleteApiV3GroupsGroupMembersMemberAsync
|
|
|
+ *
|
|
|
+ * 移除成员 / 退出团队
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $member 成员记录 id (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupMembersMember'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function deleteApiV3GroupsGroupMembersMemberAsync($group, $member, string $contentType = self::contentTypes['deleteApiV3GroupsGroupMembersMember'][0])
|
|
|
+ {
|
|
|
+ return $this->deleteApiV3GroupsGroupMembersMemberAsyncWithHttpInfo($group, $member, $contentType)
|
|
|
+ ->then(
|
|
|
+ function ($response) {
|
|
|
+ return $response[0];
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation deleteApiV3GroupsGroupMembersMemberAsyncWithHttpInfo
|
|
|
+ *
|
|
|
+ * 移除成员 / 退出团队
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $member 成员记录 id (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupMembersMember'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function deleteApiV3GroupsGroupMembersMemberAsyncWithHttpInfo($group, $member, string $contentType = self::contentTypes['deleteApiV3GroupsGroupMembersMember'][0])
|
|
|
+ {
|
|
|
+ $returnType = '';
|
|
|
+ $request = $this->deleteApiV3GroupsGroupMembersMemberRequest($group, $member, $contentType);
|
|
|
+
|
|
|
+ return $this->client
|
|
|
+ ->sendAsync($request, $this->createHttpClientOption())
|
|
|
+ ->then(
|
|
|
+ function ($response) use ($returnType) {
|
|
|
+ return [null, $response->getStatusCode(), $response->getHeaders()];
|
|
|
+ },
|
|
|
+ function ($exception) {
|
|
|
+ $response = $exception->getResponse();
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ $exception->getRequest()->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create request for operation 'deleteApiV3GroupsGroupMembersMember'
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $member 成员记录 id (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupMembersMember'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Psr7\Request
|
|
|
+ */
|
|
|
+ public function deleteApiV3GroupsGroupMembersMemberRequest($group, $member, string $contentType = self::contentTypes['deleteApiV3GroupsGroupMembersMember'][0])
|
|
|
+ {
|
|
|
+
|
|
|
+ // verify the required parameter 'group' is set
|
|
|
+ if ($group === null || (is_array($group) && count($group) === 0)) {
|
|
|
+ throw new \InvalidArgumentException(
|
|
|
+ 'Missing the required parameter $group when calling deleteApiV3GroupsGroupMembersMember'
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // verify the required parameter 'member' is set
|
|
|
+ if ($member === null || (is_array($member) && count($member) === 0)) {
|
|
|
+ throw new \InvalidArgumentException(
|
|
|
+ 'Missing the required parameter $member when calling deleteApiV3GroupsGroupMembersMember'
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $resourcePath = '/v3/groups/{group}/members/{member}';
|
|
|
+ $formParams = [];
|
|
|
+ $queryParams = [];
|
|
|
+ $headerParams = [];
|
|
|
+ $httpBody = '';
|
|
|
+ $multipart = false;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // path params
|
|
|
+ if ($group !== null) {
|
|
|
+ $resourcePath = str_replace(
|
|
|
+ '{group}',
|
|
|
+ ObjectSerializer::toPathValue($group),
|
|
|
+ $resourcePath
|
|
|
+ );
|
|
|
+ }
|
|
|
+ // path params
|
|
|
+ if ($member !== null) {
|
|
|
+ $resourcePath = str_replace(
|
|
|
+ '{member}',
|
|
|
+ ObjectSerializer::toPathValue($member),
|
|
|
+ $resourcePath
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $headers = $this->headerSelector->selectHeaders(
|
|
|
+ ['application/problem+json', ],
|
|
|
+ $contentType,
|
|
|
+ $multipart
|
|
|
+ );
|
|
|
+
|
|
|
+ // for model (json/xml)
|
|
|
+ if (count($formParams) > 0) {
|
|
|
+ if ($multipart) {
|
|
|
+ $multipartContents = [];
|
|
|
+ foreach ($formParams as $formParamName => $formParamValue) {
|
|
|
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
|
|
|
+ foreach ($formParamValueItems as $formParamValueItem) {
|
|
|
+ $multipartContents[] = [
|
|
|
+ 'name' => $formParamName,
|
|
|
+ 'contents' => $formParamValueItem
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = new MultipartStream($multipartContents);
|
|
|
+
|
|
|
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
|
|
+ # if Content-Type contains "application/json", json_encode the form parameters
|
|
|
+ try {
|
|
|
+ $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
|
|
|
+ } catch (\JsonException $e) {
|
|
|
+ throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = ObjectSerializer::buildQuery($formParams);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // this endpoint requires Bearer authentication (access token)
|
|
|
+ if (!empty($this->config->getAccessToken())) {
|
|
|
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
|
|
|
+ }
|
|
|
+
|
|
|
+ $defaultHeaders = [];
|
|
|
+ if ($this->config->getUserAgent()) {
|
|
|
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
|
|
+ }
|
|
|
+
|
|
|
+ $headers = array_merge(
|
|
|
+ $defaultHeaders,
|
|
|
+ $headerParams,
|
|
|
+ $headers
|
|
|
+ );
|
|
|
+
|
|
|
+ $operationHost = $this->config->getHost();
|
|
|
+ $query = ObjectSerializer::buildQuery($queryParams);
|
|
|
+ return new Request(
|
|
|
+ 'DELETE',
|
|
|
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
|
|
|
+ $headers,
|
|
|
+ $httpBody
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation deleteApiV3GroupsGroupSharesShare
|
|
|
+ *
|
|
|
+ * 把资源移出团队
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $share 共享记录 id (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupSharesShare'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function deleteApiV3GroupsGroupSharesShare($group, $share, string $contentType = self::contentTypes['deleteApiV3GroupsGroupSharesShare'][0])
|
|
|
+ {
|
|
|
+ $this->deleteApiV3GroupsGroupSharesShareWithHttpInfo($group, $share, $contentType);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation deleteApiV3GroupsGroupSharesShareWithHttpInfo
|
|
|
+ *
|
|
|
+ * 把资源移出团队
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $share 共享记录 id (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupSharesShare'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
|
|
|
+ */
|
|
|
+ public function deleteApiV3GroupsGroupSharesShareWithHttpInfo($group, $share, string $contentType = self::contentTypes['deleteApiV3GroupsGroupSharesShare'][0])
|
|
|
+ {
|
|
|
+ $request = $this->deleteApiV3GroupsGroupSharesShareRequest($group, $share, $contentType);
|
|
|
+
|
|
|
+ try {
|
|
|
+ $options = $this->createHttpClientOption();
|
|
|
+ try {
|
|
|
+ $response = $this->client->send($request, $options);
|
|
|
+ } catch (RequestException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
|
|
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
|
|
|
+ );
|
|
|
+ } catch (ConnectException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ null,
|
|
|
+ null
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+
|
|
|
+
|
|
|
+ return [null, $statusCode, $response->getHeaders()];
|
|
|
+ } catch (ApiException $e) {
|
|
|
+ switch ($e->getCode()) {
|
|
|
+ case 401:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 403:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 422:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation deleteApiV3GroupsGroupSharesShareAsync
|
|
|
+ *
|
|
|
+ * 把资源移出团队
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $share 共享记录 id (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupSharesShare'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function deleteApiV3GroupsGroupSharesShareAsync($group, $share, string $contentType = self::contentTypes['deleteApiV3GroupsGroupSharesShare'][0])
|
|
|
+ {
|
|
|
+ return $this->deleteApiV3GroupsGroupSharesShareAsyncWithHttpInfo($group, $share, $contentType)
|
|
|
+ ->then(
|
|
|
+ function ($response) {
|
|
|
+ return $response[0];
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation deleteApiV3GroupsGroupSharesShareAsyncWithHttpInfo
|
|
|
+ *
|
|
|
+ * 把资源移出团队
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $share 共享记录 id (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupSharesShare'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function deleteApiV3GroupsGroupSharesShareAsyncWithHttpInfo($group, $share, string $contentType = self::contentTypes['deleteApiV3GroupsGroupSharesShare'][0])
|
|
|
+ {
|
|
|
+ $returnType = '';
|
|
|
+ $request = $this->deleteApiV3GroupsGroupSharesShareRequest($group, $share, $contentType);
|
|
|
+
|
|
|
+ return $this->client
|
|
|
+ ->sendAsync($request, $this->createHttpClientOption())
|
|
|
+ ->then(
|
|
|
+ function ($response) use ($returnType) {
|
|
|
+ return [null, $response->getStatusCode(), $response->getHeaders()];
|
|
|
+ },
|
|
|
+ function ($exception) {
|
|
|
+ $response = $exception->getResponse();
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ $exception->getRequest()->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create request for operation 'deleteApiV3GroupsGroupSharesShare'
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $share 共享记录 id (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupSharesShare'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Psr7\Request
|
|
|
+ */
|
|
|
+ public function deleteApiV3GroupsGroupSharesShareRequest($group, $share, string $contentType = self::contentTypes['deleteApiV3GroupsGroupSharesShare'][0])
|
|
|
+ {
|
|
|
+
|
|
|
+ // verify the required parameter 'group' is set
|
|
|
+ if ($group === null || (is_array($group) && count($group) === 0)) {
|
|
|
+ throw new \InvalidArgumentException(
|
|
|
+ 'Missing the required parameter $group when calling deleteApiV3GroupsGroupSharesShare'
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // verify the required parameter 'share' is set
|
|
|
+ if ($share === null || (is_array($share) && count($share) === 0)) {
|
|
|
+ throw new \InvalidArgumentException(
|
|
|
+ 'Missing the required parameter $share when calling deleteApiV3GroupsGroupSharesShare'
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $resourcePath = '/v3/groups/{group}/shares/{share}';
|
|
|
+ $formParams = [];
|
|
|
+ $queryParams = [];
|
|
|
+ $headerParams = [];
|
|
|
+ $httpBody = '';
|
|
|
+ $multipart = false;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // path params
|
|
|
+ if ($group !== null) {
|
|
|
+ $resourcePath = str_replace(
|
|
|
+ '{group}',
|
|
|
+ ObjectSerializer::toPathValue($group),
|
|
|
+ $resourcePath
|
|
|
+ );
|
|
|
+ }
|
|
|
+ // path params
|
|
|
+ if ($share !== null) {
|
|
|
+ $resourcePath = str_replace(
|
|
|
+ '{share}',
|
|
|
+ ObjectSerializer::toPathValue($share),
|
|
|
+ $resourcePath
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $headers = $this->headerSelector->selectHeaders(
|
|
|
+ ['application/problem+json', ],
|
|
|
+ $contentType,
|
|
|
+ $multipart
|
|
|
+ );
|
|
|
+
|
|
|
+ // for model (json/xml)
|
|
|
+ if (count($formParams) > 0) {
|
|
|
+ if ($multipart) {
|
|
|
+ $multipartContents = [];
|
|
|
+ foreach ($formParams as $formParamName => $formParamValue) {
|
|
|
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
|
|
|
+ foreach ($formParamValueItems as $formParamValueItem) {
|
|
|
+ $multipartContents[] = [
|
|
|
+ 'name' => $formParamName,
|
|
|
+ 'contents' => $formParamValueItem
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = new MultipartStream($multipartContents);
|
|
|
+
|
|
|
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
|
|
+ # if Content-Type contains "application/json", json_encode the form parameters
|
|
|
+ try {
|
|
|
+ $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
|
|
|
+ } catch (\JsonException $e) {
|
|
|
+ throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = ObjectSerializer::buildQuery($formParams);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // this endpoint requires Bearer authentication (access token)
|
|
|
+ if (!empty($this->config->getAccessToken())) {
|
|
|
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
|
|
|
+ }
|
|
|
+
|
|
|
+ $defaultHeaders = [];
|
|
|
+ if ($this->config->getUserAgent()) {
|
|
|
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
|
|
+ }
|
|
|
+
|
|
|
+ $headers = array_merge(
|
|
|
+ $defaultHeaders,
|
|
|
+ $headerParams,
|
|
|
+ $headers
|
|
|
+ );
|
|
|
+
|
|
|
+ $operationHost = $this->config->getHost();
|
|
|
+ $query = ObjectSerializer::buildQuery($queryParams);
|
|
|
+ return new Request(
|
|
|
+ 'DELETE',
|
|
|
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
|
|
|
+ $headers,
|
|
|
+ $httpBody
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3Groups
|
|
|
+ *
|
|
|
+ * 搜公开团队
|
|
|
+ *
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
|
|
|
+ * @param string|null $search 按团队名模糊匹配 (optional)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Groups'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \WikipaliApi\Model\GetApiV3Groups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
|
|
|
+ */
|
|
|
+ public function getApiV3Groups($per_page = 20, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3Groups'][0])
|
|
|
+ {
|
|
|
+ list($response) = $this->getApiV3GroupsWithHttpInfo($per_page, $search, $page, $contentType);
|
|
|
+ return $response;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3GroupsWithHttpInfo
|
|
|
+ *
|
|
|
+ * 搜公开团队
|
|
|
+ *
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
|
|
|
+ * @param string|null $search 按团队名模糊匹配 (optional)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Groups'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return array of \WikipaliApi\Model\GetApiV3Groups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsWithHttpInfo($per_page = 20, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3Groups'][0])
|
|
|
+ {
|
|
|
+ $request = $this->getApiV3GroupsRequest($per_page, $search, $page, $contentType);
|
|
|
+
|
|
|
+ try {
|
|
|
+ $options = $this->createHttpClientOption();
|
|
|
+ try {
|
|
|
+ $response = $this->client->send($request, $options);
|
|
|
+ } catch (RequestException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
|
|
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
|
|
|
+ );
|
|
|
+ } catch (ConnectException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ null,
|
|
|
+ null
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+
|
|
|
+
|
|
|
+ switch($statusCode) {
|
|
|
+ case 200:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\GetApiV3Groups200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 401:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 422:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ($statusCode < 200 || $statusCode > 299) {
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ (string) $request->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\GetApiV3Groups200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ } catch (ApiException $e) {
|
|
|
+ switch ($e->getCode()) {
|
|
|
+ case 200:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\GetApiV3Groups200Response',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 401:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 422:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3GroupsAsync
|
|
|
+ *
|
|
|
+ * 搜公开团队
|
|
|
+ *
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
|
|
|
+ * @param string|null $search 按团队名模糊匹配 (optional)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Groups'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsAsync($per_page = 20, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3Groups'][0])
|
|
|
+ {
|
|
|
+ return $this->getApiV3GroupsAsyncWithHttpInfo($per_page, $search, $page, $contentType)
|
|
|
+ ->then(
|
|
|
+ function ($response) {
|
|
|
+ return $response[0];
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3GroupsAsyncWithHttpInfo
|
|
|
+ *
|
|
|
+ * 搜公开团队
|
|
|
+ *
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
|
|
|
+ * @param string|null $search 按团队名模糊匹配 (optional)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Groups'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsAsyncWithHttpInfo($per_page = 20, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3Groups'][0])
|
|
|
+ {
|
|
|
+ $returnType = '\WikipaliApi\Model\GetApiV3Groups200Response';
|
|
|
+ $request = $this->getApiV3GroupsRequest($per_page, $search, $page, $contentType);
|
|
|
+
|
|
|
+ return $this->client
|
|
|
+ ->sendAsync($request, $this->createHttpClientOption())
|
|
|
+ ->then(
|
|
|
+ function ($response) use ($returnType) {
|
|
|
+ if ($returnType === '\SplFileObject') {
|
|
|
+ $content = $response->getBody(); //stream goes to serializer
|
|
|
+ } else {
|
|
|
+ $content = (string) $response->getBody();
|
|
|
+ if ($returnType !== 'string') {
|
|
|
+ $content = json_decode($content);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return [
|
|
|
+ ObjectSerializer::deserialize($content, $returnType, []),
|
|
|
+ $response->getStatusCode(),
|
|
|
+ $response->getHeaders()
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ function ($exception) {
|
|
|
+ $response = $exception->getResponse();
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ $exception->getRequest()->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create request for operation 'getApiV3Groups'
|
|
|
+ *
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
|
|
|
+ * @param string|null $search 按团队名模糊匹配 (optional)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Groups'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Psr7\Request
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsRequest($per_page = 20, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3Groups'][0])
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $resourcePath = '/v3/groups';
|
|
|
+ $formParams = [];
|
|
|
+ $queryParams = [];
|
|
|
+ $headerParams = [];
|
|
|
+ $httpBody = '';
|
|
|
+ $multipart = false;
|
|
|
+
|
|
|
+ // query params
|
|
|
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
|
|
|
+ $per_page,
|
|
|
+ 'per_page', // param base name
|
|
|
+ 'integer', // openApiType
|
|
|
+ 'form', // style
|
|
|
+ true, // explode
|
|
|
+ false // required
|
|
|
+ ) ?? []);
|
|
|
+ // query params
|
|
|
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
|
|
|
+ $search,
|
|
|
+ 'search', // param base name
|
|
|
+ 'string', // openApiType
|
|
|
+ 'form', // style
|
|
|
+ true, // explode
|
|
|
+ false // required
|
|
|
+ ) ?? []);
|
|
|
+ // query params
|
|
|
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
|
|
|
+ $page,
|
|
|
+ 'page', // param base name
|
|
|
+ 'integer', // openApiType
|
|
|
+ 'form', // style
|
|
|
+ true, // explode
|
|
|
+ false // required
|
|
|
+ ) ?? []);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $headers = $this->headerSelector->selectHeaders(
|
|
|
+ ['application/json', 'application/problem+json', ],
|
|
|
+ $contentType,
|
|
|
+ $multipart
|
|
|
+ );
|
|
|
+
|
|
|
+ // for model (json/xml)
|
|
|
+ if (count($formParams) > 0) {
|
|
|
+ if ($multipart) {
|
|
|
+ $multipartContents = [];
|
|
|
+ foreach ($formParams as $formParamName => $formParamValue) {
|
|
|
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
|
|
|
+ foreach ($formParamValueItems as $formParamValueItem) {
|
|
|
+ $multipartContents[] = [
|
|
|
+ 'name' => $formParamName,
|
|
|
+ 'contents' => $formParamValueItem
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = new MultipartStream($multipartContents);
|
|
|
+
|
|
|
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
|
|
+ # if Content-Type contains "application/json", json_encode the form parameters
|
|
|
+ try {
|
|
|
+ $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
|
|
|
+ } catch (\JsonException $e) {
|
|
|
+ throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = ObjectSerializer::buildQuery($formParams);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // this endpoint requires Bearer authentication (access token)
|
|
|
+ if (!empty($this->config->getAccessToken())) {
|
|
|
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
|
|
|
+ }
|
|
|
+
|
|
|
+ $defaultHeaders = [];
|
|
|
+ if ($this->config->getUserAgent()) {
|
|
|
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
|
|
+ }
|
|
|
+
|
|
|
+ $headers = array_merge(
|
|
|
+ $defaultHeaders,
|
|
|
+ $headerParams,
|
|
|
+ $headers
|
|
|
+ );
|
|
|
+
|
|
|
+ $operationHost = $this->config->getHost();
|
|
|
+ $query = ObjectSerializer::buildQuery($queryParams);
|
|
|
+ return new Request(
|
|
|
+ 'GET',
|
|
|
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
|
|
|
+ $headers,
|
|
|
+ $httpBody
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3GroupsGroup
|
|
|
+ *
|
|
|
+ * 团队详情
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroup'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \WikipaliApi\Model\PostApiV3Groups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsGroup($group, string $contentType = self::contentTypes['getApiV3GroupsGroup'][0])
|
|
|
+ {
|
|
|
+ list($response) = $this->getApiV3GroupsGroupWithHttpInfo($group, $contentType);
|
|
|
+ return $response;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3GroupsGroupWithHttpInfo
|
|
|
+ *
|
|
|
+ * 团队详情
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroup'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return array of \WikipaliApi\Model\PostApiV3Groups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsGroupWithHttpInfo($group, string $contentType = self::contentTypes['getApiV3GroupsGroup'][0])
|
|
|
+ {
|
|
|
+ $request = $this->getApiV3GroupsGroupRequest($group, $contentType);
|
|
|
+
|
|
|
+ try {
|
|
|
+ $options = $this->createHttpClientOption();
|
|
|
+ try {
|
|
|
+ $response = $this->client->send($request, $options);
|
|
|
+ } catch (RequestException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
|
|
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
|
|
|
+ );
|
|
|
+ } catch (ConnectException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ null,
|
|
|
+ null
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+
|
|
|
+
|
|
|
+ switch($statusCode) {
|
|
|
+ case 200:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\PostApiV3Groups200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 403:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 422:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ($statusCode < 200 || $statusCode > 299) {
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ (string) $request->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\PostApiV3Groups200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ } catch (ApiException $e) {
|
|
|
+ switch ($e->getCode()) {
|
|
|
+ case 200:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\PostApiV3Groups200Response',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 403:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 422:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3GroupsGroupAsync
|
|
|
+ *
|
|
|
+ * 团队详情
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroup'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsGroupAsync($group, string $contentType = self::contentTypes['getApiV3GroupsGroup'][0])
|
|
|
+ {
|
|
|
+ return $this->getApiV3GroupsGroupAsyncWithHttpInfo($group, $contentType)
|
|
|
+ ->then(
|
|
|
+ function ($response) {
|
|
|
+ return $response[0];
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3GroupsGroupAsyncWithHttpInfo
|
|
|
+ *
|
|
|
+ * 团队详情
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroup'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsGroupAsyncWithHttpInfo($group, string $contentType = self::contentTypes['getApiV3GroupsGroup'][0])
|
|
|
+ {
|
|
|
+ $returnType = '\WikipaliApi\Model\PostApiV3Groups200Response';
|
|
|
+ $request = $this->getApiV3GroupsGroupRequest($group, $contentType);
|
|
|
+
|
|
|
+ return $this->client
|
|
|
+ ->sendAsync($request, $this->createHttpClientOption())
|
|
|
+ ->then(
|
|
|
+ function ($response) use ($returnType) {
|
|
|
+ if ($returnType === '\SplFileObject') {
|
|
|
+ $content = $response->getBody(); //stream goes to serializer
|
|
|
+ } else {
|
|
|
+ $content = (string) $response->getBody();
|
|
|
+ if ($returnType !== 'string') {
|
|
|
+ $content = json_decode($content);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return [
|
|
|
+ ObjectSerializer::deserialize($content, $returnType, []),
|
|
|
+ $response->getStatusCode(),
|
|
|
+ $response->getHeaders()
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ function ($exception) {
|
|
|
+ $response = $exception->getResponse();
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ $exception->getRequest()->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create request for operation 'getApiV3GroupsGroup'
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroup'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Psr7\Request
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsGroupRequest($group, string $contentType = self::contentTypes['getApiV3GroupsGroup'][0])
|
|
|
+ {
|
|
|
+
|
|
|
+ // verify the required parameter 'group' is set
|
|
|
+ if ($group === null || (is_array($group) && count($group) === 0)) {
|
|
|
+ throw new \InvalidArgumentException(
|
|
|
+ 'Missing the required parameter $group when calling getApiV3GroupsGroup'
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $resourcePath = '/v3/groups/{group}';
|
|
|
+ $formParams = [];
|
|
|
+ $queryParams = [];
|
|
|
+ $headerParams = [];
|
|
|
+ $httpBody = '';
|
|
|
+ $multipart = false;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // path params
|
|
|
+ if ($group !== null) {
|
|
|
+ $resourcePath = str_replace(
|
|
|
+ '{group}',
|
|
|
+ ObjectSerializer::toPathValue($group),
|
|
|
+ $resourcePath
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $headers = $this->headerSelector->selectHeaders(
|
|
|
+ ['application/json', 'application/problem+json', ],
|
|
|
+ $contentType,
|
|
|
+ $multipart
|
|
|
+ );
|
|
|
+
|
|
|
+ // for model (json/xml)
|
|
|
+ if (count($formParams) > 0) {
|
|
|
+ if ($multipart) {
|
|
|
+ $multipartContents = [];
|
|
|
+ foreach ($formParams as $formParamName => $formParamValue) {
|
|
|
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
|
|
|
+ foreach ($formParamValueItems as $formParamValueItem) {
|
|
|
+ $multipartContents[] = [
|
|
|
+ 'name' => $formParamName,
|
|
|
+ 'contents' => $formParamValueItem
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = new MultipartStream($multipartContents);
|
|
|
+
|
|
|
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
|
|
+ # if Content-Type contains "application/json", json_encode the form parameters
|
|
|
+ try {
|
|
|
+ $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
|
|
|
+ } catch (\JsonException $e) {
|
|
|
+ throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = ObjectSerializer::buildQuery($formParams);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // this endpoint requires Bearer authentication (access token)
|
|
|
+ if (!empty($this->config->getAccessToken())) {
|
|
|
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
|
|
|
+ }
|
|
|
+
|
|
|
+ $defaultHeaders = [];
|
|
|
+ if ($this->config->getUserAgent()) {
|
|
|
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
|
|
+ }
|
|
|
+
|
|
|
+ $headers = array_merge(
|
|
|
+ $defaultHeaders,
|
|
|
+ $headerParams,
|
|
|
+ $headers
|
|
|
+ );
|
|
|
+
|
|
|
+ $operationHost = $this->config->getHost();
|
|
|
+ $query = ObjectSerializer::buildQuery($queryParams);
|
|
|
+ return new Request(
|
|
|
+ 'GET',
|
|
|
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
|
|
|
+ $headers,
|
|
|
+ $httpBody
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3GroupsGroupMembers
|
|
|
+ *
|
|
|
+ * 列出团队成员
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupMembers'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \WikipaliApi\Model\GetApiV3GroupsGroupMembers200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsGroupMembers($group, $per_page = 100, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupMembers'][0])
|
|
|
+ {
|
|
|
+ list($response) = $this->getApiV3GroupsGroupMembersWithHttpInfo($group, $per_page, $page, $contentType);
|
|
|
+ return $response;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3GroupsGroupMembersWithHttpInfo
|
|
|
+ *
|
|
|
+ * 列出团队成员
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupMembers'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return array of \WikipaliApi\Model\GetApiV3GroupsGroupMembers200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsGroupMembersWithHttpInfo($group, $per_page = 100, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupMembers'][0])
|
|
|
+ {
|
|
|
+ $request = $this->getApiV3GroupsGroupMembersRequest($group, $per_page, $page, $contentType);
|
|
|
+
|
|
|
+ try {
|
|
|
+ $options = $this->createHttpClientOption();
|
|
|
+ try {
|
|
|
+ $response = $this->client->send($request, $options);
|
|
|
+ } catch (RequestException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
|
|
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
|
|
|
+ );
|
|
|
+ } catch (ConnectException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ null,
|
|
|
+ null
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+
|
|
|
+
|
|
|
+ switch($statusCode) {
|
|
|
+ case 200:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\GetApiV3GroupsGroupMembers200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 401:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 403:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 422:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ($statusCode < 200 || $statusCode > 299) {
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ (string) $request->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\GetApiV3GroupsGroupMembers200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ } catch (ApiException $e) {
|
|
|
+ switch ($e->getCode()) {
|
|
|
+ case 200:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\GetApiV3GroupsGroupMembers200Response',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 401:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 403:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 422:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3GroupsGroupMembersAsync
|
|
|
+ *
|
|
|
+ * 列出团队成员
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupMembers'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsGroupMembersAsync($group, $per_page = 100, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupMembers'][0])
|
|
|
+ {
|
|
|
+ return $this->getApiV3GroupsGroupMembersAsyncWithHttpInfo($group, $per_page, $page, $contentType)
|
|
|
+ ->then(
|
|
|
+ function ($response) {
|
|
|
+ return $response[0];
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3GroupsGroupMembersAsyncWithHttpInfo
|
|
|
+ *
|
|
|
+ * 列出团队成员
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupMembers'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsGroupMembersAsyncWithHttpInfo($group, $per_page = 100, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupMembers'][0])
|
|
|
+ {
|
|
|
+ $returnType = '\WikipaliApi\Model\GetApiV3GroupsGroupMembers200Response';
|
|
|
+ $request = $this->getApiV3GroupsGroupMembersRequest($group, $per_page, $page, $contentType);
|
|
|
+
|
|
|
+ return $this->client
|
|
|
+ ->sendAsync($request, $this->createHttpClientOption())
|
|
|
+ ->then(
|
|
|
+ function ($response) use ($returnType) {
|
|
|
+ if ($returnType === '\SplFileObject') {
|
|
|
+ $content = $response->getBody(); //stream goes to serializer
|
|
|
+ } else {
|
|
|
+ $content = (string) $response->getBody();
|
|
|
+ if ($returnType !== 'string') {
|
|
|
+ $content = json_decode($content);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return [
|
|
|
+ ObjectSerializer::deserialize($content, $returnType, []),
|
|
|
+ $response->getStatusCode(),
|
|
|
+ $response->getHeaders()
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ function ($exception) {
|
|
|
+ $response = $exception->getResponse();
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ $exception->getRequest()->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create request for operation 'getApiV3GroupsGroupMembers'
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupMembers'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Psr7\Request
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsGroupMembersRequest($group, $per_page = 100, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupMembers'][0])
|
|
|
+ {
|
|
|
+
|
|
|
+ // verify the required parameter 'group' is set
|
|
|
+ if ($group === null || (is_array($group) && count($group) === 0)) {
|
|
|
+ throw new \InvalidArgumentException(
|
|
|
+ 'Missing the required parameter $group when calling getApiV3GroupsGroupMembers'
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $resourcePath = '/v3/groups/{group}/members';
|
|
|
+ $formParams = [];
|
|
|
+ $queryParams = [];
|
|
|
+ $headerParams = [];
|
|
|
+ $httpBody = '';
|
|
|
+ $multipart = false;
|
|
|
+
|
|
|
+ // query params
|
|
|
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
|
|
|
+ $per_page,
|
|
|
+ 'per_page', // param base name
|
|
|
+ 'integer', // openApiType
|
|
|
+ 'form', // style
|
|
|
+ true, // explode
|
|
|
+ false // required
|
|
|
+ ) ?? []);
|
|
|
+ // query params
|
|
|
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
|
|
|
+ $page,
|
|
|
+ 'page', // param base name
|
|
|
+ 'integer', // openApiType
|
|
|
+ 'form', // style
|
|
|
+ true, // explode
|
|
|
+ false // required
|
|
|
+ ) ?? []);
|
|
|
+
|
|
|
+
|
|
|
+ // path params
|
|
|
+ if ($group !== null) {
|
|
|
+ $resourcePath = str_replace(
|
|
|
+ '{group}',
|
|
|
+ ObjectSerializer::toPathValue($group),
|
|
|
+ $resourcePath
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $headers = $this->headerSelector->selectHeaders(
|
|
|
+ ['application/json', 'application/problem+json', ],
|
|
|
+ $contentType,
|
|
|
+ $multipart
|
|
|
+ );
|
|
|
+
|
|
|
+ // for model (json/xml)
|
|
|
+ if (count($formParams) > 0) {
|
|
|
+ if ($multipart) {
|
|
|
+ $multipartContents = [];
|
|
|
+ foreach ($formParams as $formParamName => $formParamValue) {
|
|
|
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
|
|
|
+ foreach ($formParamValueItems as $formParamValueItem) {
|
|
|
+ $multipartContents[] = [
|
|
|
+ 'name' => $formParamName,
|
|
|
+ 'contents' => $formParamValueItem
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = new MultipartStream($multipartContents);
|
|
|
+
|
|
|
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
|
|
+ # if Content-Type contains "application/json", json_encode the form parameters
|
|
|
+ try {
|
|
|
+ $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
|
|
|
+ } catch (\JsonException $e) {
|
|
|
+ throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = ObjectSerializer::buildQuery($formParams);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // this endpoint requires Bearer authentication (access token)
|
|
|
+ if (!empty($this->config->getAccessToken())) {
|
|
|
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
|
|
|
+ }
|
|
|
+
|
|
|
+ $defaultHeaders = [];
|
|
|
+ if ($this->config->getUserAgent()) {
|
|
|
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
|
|
+ }
|
|
|
+
|
|
|
+ $headers = array_merge(
|
|
|
+ $defaultHeaders,
|
|
|
+ $headerParams,
|
|
|
+ $headers
|
|
|
+ );
|
|
|
+
|
|
|
+ $operationHost = $this->config->getHost();
|
|
|
+ $query = ObjectSerializer::buildQuery($queryParams);
|
|
|
+ return new Request(
|
|
|
+ 'GET',
|
|
|
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
|
|
|
+ $headers,
|
|
|
+ $httpBody
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3GroupsGroupShares
|
|
|
+ *
|
|
|
+ * 列出团队文档
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupShares'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \WikipaliApi\Model\GetApiV3GroupsGroupShares200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsGroupShares($group, $per_page = 20, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupShares'][0])
|
|
|
+ {
|
|
|
+ list($response) = $this->getApiV3GroupsGroupSharesWithHttpInfo($group, $per_page, $page, $contentType);
|
|
|
+ return $response;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3GroupsGroupSharesWithHttpInfo
|
|
|
+ *
|
|
|
+ * 列出团队文档
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupShares'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return array of \WikipaliApi\Model\GetApiV3GroupsGroupShares200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsGroupSharesWithHttpInfo($group, $per_page = 20, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupShares'][0])
|
|
|
+ {
|
|
|
+ $request = $this->getApiV3GroupsGroupSharesRequest($group, $per_page, $page, $contentType);
|
|
|
+
|
|
|
+ try {
|
|
|
+ $options = $this->createHttpClientOption();
|
|
|
+ try {
|
|
|
+ $response = $this->client->send($request, $options);
|
|
|
+ } catch (RequestException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
|
|
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
|
|
|
+ );
|
|
|
+ } catch (ConnectException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ null,
|
|
|
+ null
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+
|
|
|
+
|
|
|
+ switch($statusCode) {
|
|
|
+ case 200:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\GetApiV3GroupsGroupShares200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 401:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 403:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 422:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ($statusCode < 200 || $statusCode > 299) {
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ (string) $request->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\GetApiV3GroupsGroupShares200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ } catch (ApiException $e) {
|
|
|
+ switch ($e->getCode()) {
|
|
|
+ case 200:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\GetApiV3GroupsGroupShares200Response',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 401:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 403:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 422:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3GroupsGroupSharesAsync
|
|
|
+ *
|
|
|
+ * 列出团队文档
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupShares'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsGroupSharesAsync($group, $per_page = 20, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupShares'][0])
|
|
|
+ {
|
|
|
+ return $this->getApiV3GroupsGroupSharesAsyncWithHttpInfo($group, $per_page, $page, $contentType)
|
|
|
+ ->then(
|
|
|
+ function ($response) {
|
|
|
+ return $response[0];
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3GroupsGroupSharesAsyncWithHttpInfo
|
|
|
+ *
|
|
|
+ * 列出团队文档
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupShares'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsGroupSharesAsyncWithHttpInfo($group, $per_page = 20, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupShares'][0])
|
|
|
+ {
|
|
|
+ $returnType = '\WikipaliApi\Model\GetApiV3GroupsGroupShares200Response';
|
|
|
+ $request = $this->getApiV3GroupsGroupSharesRequest($group, $per_page, $page, $contentType);
|
|
|
+
|
|
|
+ return $this->client
|
|
|
+ ->sendAsync($request, $this->createHttpClientOption())
|
|
|
+ ->then(
|
|
|
+ function ($response) use ($returnType) {
|
|
|
+ if ($returnType === '\SplFileObject') {
|
|
|
+ $content = $response->getBody(); //stream goes to serializer
|
|
|
+ } else {
|
|
|
+ $content = (string) $response->getBody();
|
|
|
+ if ($returnType !== 'string') {
|
|
|
+ $content = json_decode($content);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return [
|
|
|
+ ObjectSerializer::deserialize($content, $returnType, []),
|
|
|
+ $response->getStatusCode(),
|
|
|
+ $response->getHeaders()
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ function ($exception) {
|
|
|
+ $response = $exception->getResponse();
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ $exception->getRequest()->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create request for operation 'getApiV3GroupsGroupShares'
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupShares'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Psr7\Request
|
|
|
+ */
|
|
|
+ public function getApiV3GroupsGroupSharesRequest($group, $per_page = 20, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupShares'][0])
|
|
|
+ {
|
|
|
+
|
|
|
+ // verify the required parameter 'group' is set
|
|
|
+ if ($group === null || (is_array($group) && count($group) === 0)) {
|
|
|
+ throw new \InvalidArgumentException(
|
|
|
+ 'Missing the required parameter $group when calling getApiV3GroupsGroupShares'
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $resourcePath = '/v3/groups/{group}/shares';
|
|
|
+ $formParams = [];
|
|
|
+ $queryParams = [];
|
|
|
+ $headerParams = [];
|
|
|
+ $httpBody = '';
|
|
|
+ $multipart = false;
|
|
|
+
|
|
|
+ // query params
|
|
|
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
|
|
|
+ $per_page,
|
|
|
+ 'per_page', // param base name
|
|
|
+ 'integer', // openApiType
|
|
|
+ 'form', // style
|
|
|
+ true, // explode
|
|
|
+ false // required
|
|
|
+ ) ?? []);
|
|
|
+ // query params
|
|
|
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
|
|
|
+ $page,
|
|
|
+ 'page', // param base name
|
|
|
+ 'integer', // openApiType
|
|
|
+ 'form', // style
|
|
|
+ true, // explode
|
|
|
+ false // required
|
|
|
+ ) ?? []);
|
|
|
+
|
|
|
+
|
|
|
+ // path params
|
|
|
+ if ($group !== null) {
|
|
|
+ $resourcePath = str_replace(
|
|
|
+ '{group}',
|
|
|
+ ObjectSerializer::toPathValue($group),
|
|
|
+ $resourcePath
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $headers = $this->headerSelector->selectHeaders(
|
|
|
+ ['application/json', 'application/problem+json', ],
|
|
|
+ $contentType,
|
|
|
+ $multipart
|
|
|
+ );
|
|
|
+
|
|
|
+ // for model (json/xml)
|
|
|
+ if (count($formParams) > 0) {
|
|
|
+ if ($multipart) {
|
|
|
+ $multipartContents = [];
|
|
|
+ foreach ($formParams as $formParamName => $formParamValue) {
|
|
|
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
|
|
|
+ foreach ($formParamValueItems as $formParamValueItem) {
|
|
|
+ $multipartContents[] = [
|
|
|
+ 'name' => $formParamName,
|
|
|
+ 'contents' => $formParamValueItem
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = new MultipartStream($multipartContents);
|
|
|
+
|
|
|
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
|
|
+ # if Content-Type contains "application/json", json_encode the form parameters
|
|
|
+ try {
|
|
|
+ $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
|
|
|
+ } catch (\JsonException $e) {
|
|
|
+ throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = ObjectSerializer::buildQuery($formParams);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // this endpoint requires Bearer authentication (access token)
|
|
|
+ if (!empty($this->config->getAccessToken())) {
|
|
|
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
|
|
|
+ }
|
|
|
+
|
|
|
+ $defaultHeaders = [];
|
|
|
+ if ($this->config->getUserAgent()) {
|
|
|
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
|
|
+ }
|
|
|
+
|
|
|
+ $headers = array_merge(
|
|
|
+ $defaultHeaders,
|
|
|
+ $headerParams,
|
|
|
+ $headers
|
|
|
+ );
|
|
|
+
|
|
|
+ $operationHost = $this->config->getHost();
|
|
|
+ $query = ObjectSerializer::buildQuery($queryParams);
|
|
|
+ return new Request(
|
|
|
+ 'GET',
|
|
|
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
|
|
|
+ $headers,
|
|
|
+ $httpBody
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3MeGroups
|
|
|
+ *
|
|
|
+ * 列出我加入的团队
|
|
|
+ *
|
|
|
+ * @param bool|null $owned true 只列我创建的,false 只列我参加的别人的团队;不传列全部 (optional)
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
|
|
|
+ * @param string|null $search 按团队名模糊匹配 (optional)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3MeGroups'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \WikipaliApi\Model\GetApiV3MeGroups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
|
|
|
+ */
|
|
|
+ public function getApiV3MeGroups($owned = null, $per_page = 100, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3MeGroups'][0])
|
|
|
+ {
|
|
|
+ list($response) = $this->getApiV3MeGroupsWithHttpInfo($owned, $per_page, $search, $page, $contentType);
|
|
|
+ return $response;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3MeGroupsWithHttpInfo
|
|
|
+ *
|
|
|
+ * 列出我加入的团队
|
|
|
+ *
|
|
|
+ * @param bool|null $owned true 只列我创建的,false 只列我参加的别人的团队;不传列全部 (optional)
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
|
|
|
+ * @param string|null $search 按团队名模糊匹配 (optional)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3MeGroups'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return array of \WikipaliApi\Model\GetApiV3MeGroups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
|
|
|
+ */
|
|
|
+ public function getApiV3MeGroupsWithHttpInfo($owned = null, $per_page = 100, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3MeGroups'][0])
|
|
|
+ {
|
|
|
+ $request = $this->getApiV3MeGroupsRequest($owned, $per_page, $search, $page, $contentType);
|
|
|
+
|
|
|
+ try {
|
|
|
+ $options = $this->createHttpClientOption();
|
|
|
+ try {
|
|
|
+ $response = $this->client->send($request, $options);
|
|
|
+ } catch (RequestException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
|
|
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
|
|
|
+ );
|
|
|
+ } catch (ConnectException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ null,
|
|
|
+ null
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+
|
|
|
+
|
|
|
+ switch($statusCode) {
|
|
|
+ case 200:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\GetApiV3MeGroups200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 401:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 422:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ($statusCode < 200 || $statusCode > 299) {
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ (string) $request->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\GetApiV3MeGroups200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ } catch (ApiException $e) {
|
|
|
+ switch ($e->getCode()) {
|
|
|
+ case 200:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\GetApiV3MeGroups200Response',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 401:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 422:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3MeGroupsAsync
|
|
|
+ *
|
|
|
+ * 列出我加入的团队
|
|
|
+ *
|
|
|
+ * @param bool|null $owned true 只列我创建的,false 只列我参加的别人的团队;不传列全部 (optional)
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
|
|
|
+ * @param string|null $search 按团队名模糊匹配 (optional)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3MeGroups'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function getApiV3MeGroupsAsync($owned = null, $per_page = 100, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3MeGroups'][0])
|
|
|
+ {
|
|
|
+ return $this->getApiV3MeGroupsAsyncWithHttpInfo($owned, $per_page, $search, $page, $contentType)
|
|
|
+ ->then(
|
|
|
+ function ($response) {
|
|
|
+ return $response[0];
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation getApiV3MeGroupsAsyncWithHttpInfo
|
|
|
+ *
|
|
|
+ * 列出我加入的团队
|
|
|
+ *
|
|
|
+ * @param bool|null $owned true 只列我创建的,false 只列我参加的别人的团队;不传列全部 (optional)
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
|
|
|
+ * @param string|null $search 按团队名模糊匹配 (optional)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3MeGroups'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function getApiV3MeGroupsAsyncWithHttpInfo($owned = null, $per_page = 100, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3MeGroups'][0])
|
|
|
+ {
|
|
|
+ $returnType = '\WikipaliApi\Model\GetApiV3MeGroups200Response';
|
|
|
+ $request = $this->getApiV3MeGroupsRequest($owned, $per_page, $search, $page, $contentType);
|
|
|
+
|
|
|
+ return $this->client
|
|
|
+ ->sendAsync($request, $this->createHttpClientOption())
|
|
|
+ ->then(
|
|
|
+ function ($response) use ($returnType) {
|
|
|
+ if ($returnType === '\SplFileObject') {
|
|
|
+ $content = $response->getBody(); //stream goes to serializer
|
|
|
+ } else {
|
|
|
+ $content = (string) $response->getBody();
|
|
|
+ if ($returnType !== 'string') {
|
|
|
+ $content = json_decode($content);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return [
|
|
|
+ ObjectSerializer::deserialize($content, $returnType, []),
|
|
|
+ $response->getStatusCode(),
|
|
|
+ $response->getHeaders()
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ function ($exception) {
|
|
|
+ $response = $exception->getResponse();
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ $exception->getRequest()->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create request for operation 'getApiV3MeGroups'
|
|
|
+ *
|
|
|
+ * @param bool|null $owned true 只列我创建的,false 只列我参加的别人的团队;不传列全部 (optional)
|
|
|
+ * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
|
|
|
+ * @param string|null $search 按团队名模糊匹配 (optional)
|
|
|
+ * @param int|null $page 页码 (optional, default to 1)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3MeGroups'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Psr7\Request
|
|
|
+ */
|
|
|
+ public function getApiV3MeGroupsRequest($owned = null, $per_page = 100, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3MeGroups'][0])
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $resourcePath = '/v3/me/groups';
|
|
|
+ $formParams = [];
|
|
|
+ $queryParams = [];
|
|
|
+ $headerParams = [];
|
|
|
+ $httpBody = '';
|
|
|
+ $multipart = false;
|
|
|
+
|
|
|
+ // query params
|
|
|
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
|
|
|
+ $owned,
|
|
|
+ 'owned', // param base name
|
|
|
+ 'boolean', // openApiType
|
|
|
+ 'form', // style
|
|
|
+ true, // explode
|
|
|
+ false // required
|
|
|
+ ) ?? []);
|
|
|
+ // query params
|
|
|
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
|
|
|
+ $per_page,
|
|
|
+ 'per_page', // param base name
|
|
|
+ 'integer', // openApiType
|
|
|
+ 'form', // style
|
|
|
+ true, // explode
|
|
|
+ false // required
|
|
|
+ ) ?? []);
|
|
|
+ // query params
|
|
|
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
|
|
|
+ $search,
|
|
|
+ 'search', // param base name
|
|
|
+ 'string', // openApiType
|
|
|
+ 'form', // style
|
|
|
+ true, // explode
|
|
|
+ false // required
|
|
|
+ ) ?? []);
|
|
|
+ // query params
|
|
|
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
|
|
|
+ $page,
|
|
|
+ 'page', // param base name
|
|
|
+ 'integer', // openApiType
|
|
|
+ 'form', // style
|
|
|
+ true, // explode
|
|
|
+ false // required
|
|
|
+ ) ?? []);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $headers = $this->headerSelector->selectHeaders(
|
|
|
+ ['application/json', 'application/problem+json', ],
|
|
|
+ $contentType,
|
|
|
+ $multipart
|
|
|
+ );
|
|
|
+
|
|
|
+ // for model (json/xml)
|
|
|
+ if (count($formParams) > 0) {
|
|
|
+ if ($multipart) {
|
|
|
+ $multipartContents = [];
|
|
|
+ foreach ($formParams as $formParamName => $formParamValue) {
|
|
|
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
|
|
|
+ foreach ($formParamValueItems as $formParamValueItem) {
|
|
|
+ $multipartContents[] = [
|
|
|
+ 'name' => $formParamName,
|
|
|
+ 'contents' => $formParamValueItem
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = new MultipartStream($multipartContents);
|
|
|
+
|
|
|
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
|
|
+ # if Content-Type contains "application/json", json_encode the form parameters
|
|
|
+ try {
|
|
|
+ $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
|
|
|
+ } catch (\JsonException $e) {
|
|
|
+ throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = ObjectSerializer::buildQuery($formParams);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // this endpoint requires Bearer authentication (access token)
|
|
|
+ if (!empty($this->config->getAccessToken())) {
|
|
|
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
|
|
|
+ }
|
|
|
+
|
|
|
+ $defaultHeaders = [];
|
|
|
+ if ($this->config->getUserAgent()) {
|
|
|
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
|
|
+ }
|
|
|
+
|
|
|
+ $headers = array_merge(
|
|
|
+ $defaultHeaders,
|
|
|
+ $headerParams,
|
|
|
+ $headers
|
|
|
+ );
|
|
|
+
|
|
|
+ $operationHost = $this->config->getHost();
|
|
|
+ $query = ObjectSerializer::buildQuery($queryParams);
|
|
|
+ return new Request(
|
|
|
+ 'GET',
|
|
|
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
|
|
|
+ $headers,
|
|
|
+ $httpBody
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation patchApiV3GroupsGroup
|
|
|
+ *
|
|
|
+ * 改团队信息
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param \WikipaliApi\Model\PatchApiV3GroupsGroupRequest|null $patch_api_v3_groups_group_request patch_api_v3_groups_group_request (optional)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroup'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \WikipaliApi\Model\PostApiV3Groups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
|
|
|
+ */
|
|
|
+ public function patchApiV3GroupsGroup($group, $patch_api_v3_groups_group_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroup'][0])
|
|
|
+ {
|
|
|
+ list($response) = $this->patchApiV3GroupsGroupWithHttpInfo($group, $patch_api_v3_groups_group_request, $contentType);
|
|
|
+ return $response;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation patchApiV3GroupsGroupWithHttpInfo
|
|
|
+ *
|
|
|
+ * 改团队信息
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param \WikipaliApi\Model\PatchApiV3GroupsGroupRequest|null $patch_api_v3_groups_group_request (optional)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroup'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return array of \WikipaliApi\Model\PostApiV3Groups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
|
|
|
+ */
|
|
|
+ public function patchApiV3GroupsGroupWithHttpInfo($group, $patch_api_v3_groups_group_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroup'][0])
|
|
|
+ {
|
|
|
+ $request = $this->patchApiV3GroupsGroupRequest($group, $patch_api_v3_groups_group_request, $contentType);
|
|
|
+
|
|
|
+ try {
|
|
|
+ $options = $this->createHttpClientOption();
|
|
|
+ try {
|
|
|
+ $response = $this->client->send($request, $options);
|
|
|
+ } catch (RequestException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
|
|
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
|
|
|
+ );
|
|
|
+ } catch (ConnectException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ null,
|
|
|
+ null
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+
|
|
|
+
|
|
|
+ switch($statusCode) {
|
|
|
+ case 200:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\PostApiV3Groups200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 401:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 403:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 422:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ($statusCode < 200 || $statusCode > 299) {
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ (string) $request->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\PostApiV3Groups200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ } catch (ApiException $e) {
|
|
|
+ switch ($e->getCode()) {
|
|
|
+ case 200:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\PostApiV3Groups200Response',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 401:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 403:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 422:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation patchApiV3GroupsGroupAsync
|
|
|
+ *
|
|
|
+ * 改团队信息
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param \WikipaliApi\Model\PatchApiV3GroupsGroupRequest|null $patch_api_v3_groups_group_request (optional)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroup'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function patchApiV3GroupsGroupAsync($group, $patch_api_v3_groups_group_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroup'][0])
|
|
|
+ {
|
|
|
+ return $this->patchApiV3GroupsGroupAsyncWithHttpInfo($group, $patch_api_v3_groups_group_request, $contentType)
|
|
|
+ ->then(
|
|
|
+ function ($response) {
|
|
|
+ return $response[0];
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation patchApiV3GroupsGroupAsyncWithHttpInfo
|
|
|
+ *
|
|
|
+ * 改团队信息
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param \WikipaliApi\Model\PatchApiV3GroupsGroupRequest|null $patch_api_v3_groups_group_request (optional)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroup'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function patchApiV3GroupsGroupAsyncWithHttpInfo($group, $patch_api_v3_groups_group_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroup'][0])
|
|
|
+ {
|
|
|
+ $returnType = '\WikipaliApi\Model\PostApiV3Groups200Response';
|
|
|
+ $request = $this->patchApiV3GroupsGroupRequest($group, $patch_api_v3_groups_group_request, $contentType);
|
|
|
+
|
|
|
+ return $this->client
|
|
|
+ ->sendAsync($request, $this->createHttpClientOption())
|
|
|
+ ->then(
|
|
|
+ function ($response) use ($returnType) {
|
|
|
+ if ($returnType === '\SplFileObject') {
|
|
|
+ $content = $response->getBody(); //stream goes to serializer
|
|
|
+ } else {
|
|
|
+ $content = (string) $response->getBody();
|
|
|
+ if ($returnType !== 'string') {
|
|
|
+ $content = json_decode($content);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return [
|
|
|
+ ObjectSerializer::deserialize($content, $returnType, []),
|
|
|
+ $response->getStatusCode(),
|
|
|
+ $response->getHeaders()
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ function ($exception) {
|
|
|
+ $response = $exception->getResponse();
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ $exception->getRequest()->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create request for operation 'patchApiV3GroupsGroup'
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param \WikipaliApi\Model\PatchApiV3GroupsGroupRequest|null $patch_api_v3_groups_group_request (optional)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroup'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Psr7\Request
|
|
|
+ */
|
|
|
+ public function patchApiV3GroupsGroupRequest($group, $patch_api_v3_groups_group_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroup'][0])
|
|
|
+ {
|
|
|
+
|
|
|
+ // verify the required parameter 'group' is set
|
|
|
+ if ($group === null || (is_array($group) && count($group) === 0)) {
|
|
|
+ throw new \InvalidArgumentException(
|
|
|
+ 'Missing the required parameter $group when calling patchApiV3GroupsGroup'
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $resourcePath = '/v3/groups/{group}';
|
|
|
+ $formParams = [];
|
|
|
+ $queryParams = [];
|
|
|
+ $headerParams = [];
|
|
|
+ $httpBody = '';
|
|
|
+ $multipart = false;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // path params
|
|
|
+ if ($group !== null) {
|
|
|
+ $resourcePath = str_replace(
|
|
|
+ '{group}',
|
|
|
+ ObjectSerializer::toPathValue($group),
|
|
|
+ $resourcePath
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $headers = $this->headerSelector->selectHeaders(
|
|
|
+ ['application/json', 'application/problem+json', ],
|
|
|
+ $contentType,
|
|
|
+ $multipart
|
|
|
+ );
|
|
|
+
|
|
|
+ // for model (json/xml)
|
|
|
+ if (isset($patch_api_v3_groups_group_request)) {
|
|
|
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
|
|
|
+ # if Content-Type contains "application/json", json_encode the body
|
|
|
+ try {
|
|
|
+ $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($patch_api_v3_groups_group_request), JSON_THROW_ON_ERROR);
|
|
|
+ } catch (\JsonException $e) {
|
|
|
+ throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $httpBody = $patch_api_v3_groups_group_request;
|
|
|
+ }
|
|
|
+ } elseif (count($formParams) > 0) {
|
|
|
+ if ($multipart) {
|
|
|
+ $multipartContents = [];
|
|
|
+ foreach ($formParams as $formParamName => $formParamValue) {
|
|
|
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
|
|
|
+ foreach ($formParamValueItems as $formParamValueItem) {
|
|
|
+ $multipartContents[] = [
|
|
|
+ 'name' => $formParamName,
|
|
|
+ 'contents' => $formParamValueItem
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = new MultipartStream($multipartContents);
|
|
|
+
|
|
|
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
|
|
+ # if Content-Type contains "application/json", json_encode the form parameters
|
|
|
+ try {
|
|
|
+ $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
|
|
|
+ } catch (\JsonException $e) {
|
|
|
+ throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = ObjectSerializer::buildQuery($formParams);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // this endpoint requires Bearer authentication (access token)
|
|
|
+ if (!empty($this->config->getAccessToken())) {
|
|
|
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
|
|
|
+ }
|
|
|
+
|
|
|
+ $defaultHeaders = [];
|
|
|
+ if ($this->config->getUserAgent()) {
|
|
|
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
|
|
+ }
|
|
|
+
|
|
|
+ $headers = array_merge(
|
|
|
+ $defaultHeaders,
|
|
|
+ $headerParams,
|
|
|
+ $headers
|
|
|
+ );
|
|
|
+
|
|
|
+ $operationHost = $this->config->getHost();
|
|
|
+ $query = ObjectSerializer::buildQuery($queryParams);
|
|
|
+ return new Request(
|
|
|
+ 'PATCH',
|
|
|
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
|
|
|
+ $headers,
|
|
|
+ $httpBody
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation patchApiV3GroupsGroupMembersMember
|
|
|
+ *
|
|
|
+ * 改成员角色
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $member 成员记录 id (required)
|
|
|
+ * @param \WikipaliApi\Model\PatchApiV3GroupsGroupMembersMemberRequest|null $patch_api_v3_groups_group_members_member_request patch_api_v3_groups_group_members_member_request (optional)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroupMembersMember'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
|
|
|
+ */
|
|
|
+ public function patchApiV3GroupsGroupMembersMember($group, $member, $patch_api_v3_groups_group_members_member_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroupMembersMember'][0])
|
|
|
+ {
|
|
|
+ list($response) = $this->patchApiV3GroupsGroupMembersMemberWithHttpInfo($group, $member, $patch_api_v3_groups_group_members_member_request, $contentType);
|
|
|
+ return $response;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation patchApiV3GroupsGroupMembersMemberWithHttpInfo
|
|
|
+ *
|
|
|
+ * 改成员角色
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $member 成员记录 id (required)
|
|
|
+ * @param \WikipaliApi\Model\PatchApiV3GroupsGroupMembersMemberRequest|null $patch_api_v3_groups_group_members_member_request (optional)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroupMembersMember'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return array of \WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
|
|
|
+ */
|
|
|
+ public function patchApiV3GroupsGroupMembersMemberWithHttpInfo($group, $member, $patch_api_v3_groups_group_members_member_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroupMembersMember'][0])
|
|
|
+ {
|
|
|
+ $request = $this->patchApiV3GroupsGroupMembersMemberRequest($group, $member, $patch_api_v3_groups_group_members_member_request, $contentType);
|
|
|
+
|
|
|
+ try {
|
|
|
+ $options = $this->createHttpClientOption();
|
|
|
+ try {
|
|
|
+ $response = $this->client->send($request, $options);
|
|
|
+ } catch (RequestException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
|
|
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
|
|
|
+ );
|
|
|
+ } catch (ConnectException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ null,
|
|
|
+ null
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+
|
|
|
+
|
|
|
+ switch($statusCode) {
|
|
|
+ case 200:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 401:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 403:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 422:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ($statusCode < 200 || $statusCode > 299) {
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ (string) $request->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ } catch (ApiException $e) {
|
|
|
+ switch ($e->getCode()) {
|
|
|
+ case 200:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 401:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 403:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 422:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation patchApiV3GroupsGroupMembersMemberAsync
|
|
|
+ *
|
|
|
+ * 改成员角色
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $member 成员记录 id (required)
|
|
|
+ * @param \WikipaliApi\Model\PatchApiV3GroupsGroupMembersMemberRequest|null $patch_api_v3_groups_group_members_member_request (optional)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroupMembersMember'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function patchApiV3GroupsGroupMembersMemberAsync($group, $member, $patch_api_v3_groups_group_members_member_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroupMembersMember'][0])
|
|
|
+ {
|
|
|
+ return $this->patchApiV3GroupsGroupMembersMemberAsyncWithHttpInfo($group, $member, $patch_api_v3_groups_group_members_member_request, $contentType)
|
|
|
+ ->then(
|
|
|
+ function ($response) {
|
|
|
+ return $response[0];
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation patchApiV3GroupsGroupMembersMemberAsyncWithHttpInfo
|
|
|
+ *
|
|
|
+ * 改成员角色
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $member 成员记录 id (required)
|
|
|
+ * @param \WikipaliApi\Model\PatchApiV3GroupsGroupMembersMemberRequest|null $patch_api_v3_groups_group_members_member_request (optional)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroupMembersMember'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function patchApiV3GroupsGroupMembersMemberAsyncWithHttpInfo($group, $member, $patch_api_v3_groups_group_members_member_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroupMembersMember'][0])
|
|
|
+ {
|
|
|
+ $returnType = '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response';
|
|
|
+ $request = $this->patchApiV3GroupsGroupMembersMemberRequest($group, $member, $patch_api_v3_groups_group_members_member_request, $contentType);
|
|
|
+
|
|
|
+ return $this->client
|
|
|
+ ->sendAsync($request, $this->createHttpClientOption())
|
|
|
+ ->then(
|
|
|
+ function ($response) use ($returnType) {
|
|
|
+ if ($returnType === '\SplFileObject') {
|
|
|
+ $content = $response->getBody(); //stream goes to serializer
|
|
|
+ } else {
|
|
|
+ $content = (string) $response->getBody();
|
|
|
+ if ($returnType !== 'string') {
|
|
|
+ $content = json_decode($content);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return [
|
|
|
+ ObjectSerializer::deserialize($content, $returnType, []),
|
|
|
+ $response->getStatusCode(),
|
|
|
+ $response->getHeaders()
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ function ($exception) {
|
|
|
+ $response = $exception->getResponse();
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ $exception->getRequest()->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create request for operation 'patchApiV3GroupsGroupMembersMember'
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param string $member 成员记录 id (required)
|
|
|
+ * @param \WikipaliApi\Model\PatchApiV3GroupsGroupMembersMemberRequest|null $patch_api_v3_groups_group_members_member_request (optional)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroupMembersMember'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Psr7\Request
|
|
|
+ */
|
|
|
+ public function patchApiV3GroupsGroupMembersMemberRequest($group, $member, $patch_api_v3_groups_group_members_member_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroupMembersMember'][0])
|
|
|
+ {
|
|
|
+
|
|
|
+ // verify the required parameter 'group' is set
|
|
|
+ if ($group === null || (is_array($group) && count($group) === 0)) {
|
|
|
+ throw new \InvalidArgumentException(
|
|
|
+ 'Missing the required parameter $group when calling patchApiV3GroupsGroupMembersMember'
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // verify the required parameter 'member' is set
|
|
|
+ if ($member === null || (is_array($member) && count($member) === 0)) {
|
|
|
+ throw new \InvalidArgumentException(
|
|
|
+ 'Missing the required parameter $member when calling patchApiV3GroupsGroupMembersMember'
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $resourcePath = '/v3/groups/{group}/members/{member}';
|
|
|
+ $formParams = [];
|
|
|
+ $queryParams = [];
|
|
|
+ $headerParams = [];
|
|
|
+ $httpBody = '';
|
|
|
+ $multipart = false;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // path params
|
|
|
+ if ($group !== null) {
|
|
|
+ $resourcePath = str_replace(
|
|
|
+ '{group}',
|
|
|
+ ObjectSerializer::toPathValue($group),
|
|
|
+ $resourcePath
|
|
|
+ );
|
|
|
+ }
|
|
|
+ // path params
|
|
|
+ if ($member !== null) {
|
|
|
+ $resourcePath = str_replace(
|
|
|
+ '{member}',
|
|
|
+ ObjectSerializer::toPathValue($member),
|
|
|
+ $resourcePath
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $headers = $this->headerSelector->selectHeaders(
|
|
|
+ ['application/json', 'application/problem+json', ],
|
|
|
+ $contentType,
|
|
|
+ $multipart
|
|
|
+ );
|
|
|
+
|
|
|
+ // for model (json/xml)
|
|
|
+ if (isset($patch_api_v3_groups_group_members_member_request)) {
|
|
|
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
|
|
|
+ # if Content-Type contains "application/json", json_encode the body
|
|
|
+ try {
|
|
|
+ $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($patch_api_v3_groups_group_members_member_request), JSON_THROW_ON_ERROR);
|
|
|
+ } catch (\JsonException $e) {
|
|
|
+ throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $httpBody = $patch_api_v3_groups_group_members_member_request;
|
|
|
+ }
|
|
|
+ } elseif (count($formParams) > 0) {
|
|
|
+ if ($multipart) {
|
|
|
+ $multipartContents = [];
|
|
|
+ foreach ($formParams as $formParamName => $formParamValue) {
|
|
|
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
|
|
|
+ foreach ($formParamValueItems as $formParamValueItem) {
|
|
|
+ $multipartContents[] = [
|
|
|
+ 'name' => $formParamName,
|
|
|
+ 'contents' => $formParamValueItem
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = new MultipartStream($multipartContents);
|
|
|
+
|
|
|
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
|
|
+ # if Content-Type contains "application/json", json_encode the form parameters
|
|
|
+ try {
|
|
|
+ $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
|
|
|
+ } catch (\JsonException $e) {
|
|
|
+ throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = ObjectSerializer::buildQuery($formParams);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // this endpoint requires Bearer authentication (access token)
|
|
|
+ if (!empty($this->config->getAccessToken())) {
|
|
|
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
|
|
|
+ }
|
|
|
+
|
|
|
+ $defaultHeaders = [];
|
|
|
+ if ($this->config->getUserAgent()) {
|
|
|
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
|
|
+ }
|
|
|
+
|
|
|
+ $headers = array_merge(
|
|
|
+ $defaultHeaders,
|
|
|
+ $headerParams,
|
|
|
+ $headers
|
|
|
+ );
|
|
|
+
|
|
|
+ $operationHost = $this->config->getHost();
|
|
|
+ $query = ObjectSerializer::buildQuery($queryParams);
|
|
|
+ return new Request(
|
|
|
+ 'PATCH',
|
|
|
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
|
|
|
+ $headers,
|
|
|
+ $httpBody
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation postApiV3Groups
|
|
|
+ *
|
|
|
+ * 建团队
|
|
|
+ *
|
|
|
+ * @param \WikipaliApi\Model\PostApiV3GroupsRequest $post_api_v3_groups_request post_api_v3_groups_request (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3Groups'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \WikipaliApi\Model\PostApiV3Groups200Response|\WikipaliApi\Model\PostApiV3Groups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
|
|
|
+ */
|
|
|
+ public function postApiV3Groups($post_api_v3_groups_request, string $contentType = self::contentTypes['postApiV3Groups'][0])
|
|
|
+ {
|
|
|
+ list($response) = $this->postApiV3GroupsWithHttpInfo($post_api_v3_groups_request, $contentType);
|
|
|
+ return $response;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation postApiV3GroupsWithHttpInfo
|
|
|
+ *
|
|
|
+ * 建团队
|
|
|
+ *
|
|
|
+ * @param \WikipaliApi\Model\PostApiV3GroupsRequest $post_api_v3_groups_request (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3Groups'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return array of \WikipaliApi\Model\PostApiV3Groups200Response|\WikipaliApi\Model\PostApiV3Groups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
|
|
|
+ */
|
|
|
+ public function postApiV3GroupsWithHttpInfo($post_api_v3_groups_request, string $contentType = self::contentTypes['postApiV3Groups'][0])
|
|
|
+ {
|
|
|
+ $request = $this->postApiV3GroupsRequest($post_api_v3_groups_request, $contentType);
|
|
|
+
|
|
|
+ try {
|
|
|
+ $options = $this->createHttpClientOption();
|
|
|
+ try {
|
|
|
+ $response = $this->client->send($request, $options);
|
|
|
+ } catch (RequestException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
|
|
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
|
|
|
+ );
|
|
|
+ } catch (ConnectException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ null,
|
|
|
+ null
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+
|
|
|
+
|
|
|
+ switch($statusCode) {
|
|
|
+ case 200:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\PostApiV3Groups200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 201:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\PostApiV3Groups200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 401:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 422:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ($statusCode < 200 || $statusCode > 299) {
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ (string) $request->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\PostApiV3Groups200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ } catch (ApiException $e) {
|
|
|
+ switch ($e->getCode()) {
|
|
|
+ case 200:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\PostApiV3Groups200Response',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 201:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\PostApiV3Groups200Response',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 401:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 422:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation postApiV3GroupsAsync
|
|
|
+ *
|
|
|
+ * 建团队
|
|
|
+ *
|
|
|
+ * @param \WikipaliApi\Model\PostApiV3GroupsRequest $post_api_v3_groups_request (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3Groups'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function postApiV3GroupsAsync($post_api_v3_groups_request, string $contentType = self::contentTypes['postApiV3Groups'][0])
|
|
|
+ {
|
|
|
+ return $this->postApiV3GroupsAsyncWithHttpInfo($post_api_v3_groups_request, $contentType)
|
|
|
+ ->then(
|
|
|
+ function ($response) {
|
|
|
+ return $response[0];
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation postApiV3GroupsAsyncWithHttpInfo
|
|
|
+ *
|
|
|
+ * 建团队
|
|
|
+ *
|
|
|
+ * @param \WikipaliApi\Model\PostApiV3GroupsRequest $post_api_v3_groups_request (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3Groups'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function postApiV3GroupsAsyncWithHttpInfo($post_api_v3_groups_request, string $contentType = self::contentTypes['postApiV3Groups'][0])
|
|
|
+ {
|
|
|
+ $returnType = '\WikipaliApi\Model\PostApiV3Groups200Response';
|
|
|
+ $request = $this->postApiV3GroupsRequest($post_api_v3_groups_request, $contentType);
|
|
|
+
|
|
|
+ return $this->client
|
|
|
+ ->sendAsync($request, $this->createHttpClientOption())
|
|
|
+ ->then(
|
|
|
+ function ($response) use ($returnType) {
|
|
|
+ if ($returnType === '\SplFileObject') {
|
|
|
+ $content = $response->getBody(); //stream goes to serializer
|
|
|
+ } else {
|
|
|
+ $content = (string) $response->getBody();
|
|
|
+ if ($returnType !== 'string') {
|
|
|
+ $content = json_decode($content);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return [
|
|
|
+ ObjectSerializer::deserialize($content, $returnType, []),
|
|
|
+ $response->getStatusCode(),
|
|
|
+ $response->getHeaders()
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ function ($exception) {
|
|
|
+ $response = $exception->getResponse();
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ $exception->getRequest()->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create request for operation 'postApiV3Groups'
|
|
|
+ *
|
|
|
+ * @param \WikipaliApi\Model\PostApiV3GroupsRequest $post_api_v3_groups_request (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3Groups'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Psr7\Request
|
|
|
+ */
|
|
|
+ public function postApiV3GroupsRequest($post_api_v3_groups_request, string $contentType = self::contentTypes['postApiV3Groups'][0])
|
|
|
+ {
|
|
|
+
|
|
|
+ // verify the required parameter 'post_api_v3_groups_request' is set
|
|
|
+ if ($post_api_v3_groups_request === null || (is_array($post_api_v3_groups_request) && count($post_api_v3_groups_request) === 0)) {
|
|
|
+ throw new \InvalidArgumentException(
|
|
|
+ 'Missing the required parameter $post_api_v3_groups_request when calling postApiV3Groups'
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $resourcePath = '/v3/groups';
|
|
|
+ $formParams = [];
|
|
|
+ $queryParams = [];
|
|
|
+ $headerParams = [];
|
|
|
+ $httpBody = '';
|
|
|
+ $multipart = false;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $headers = $this->headerSelector->selectHeaders(
|
|
|
+ ['application/json', 'application/problem+json', ],
|
|
|
+ $contentType,
|
|
|
+ $multipart
|
|
|
+ );
|
|
|
+
|
|
|
+ // for model (json/xml)
|
|
|
+ if (isset($post_api_v3_groups_request)) {
|
|
|
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
|
|
|
+ # if Content-Type contains "application/json", json_encode the body
|
|
|
+ try {
|
|
|
+ $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($post_api_v3_groups_request), JSON_THROW_ON_ERROR);
|
|
|
+ } catch (\JsonException $e) {
|
|
|
+ throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $httpBody = $post_api_v3_groups_request;
|
|
|
+ }
|
|
|
+ } elseif (count($formParams) > 0) {
|
|
|
+ if ($multipart) {
|
|
|
+ $multipartContents = [];
|
|
|
+ foreach ($formParams as $formParamName => $formParamValue) {
|
|
|
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
|
|
|
+ foreach ($formParamValueItems as $formParamValueItem) {
|
|
|
+ $multipartContents[] = [
|
|
|
+ 'name' => $formParamName,
|
|
|
+ 'contents' => $formParamValueItem
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = new MultipartStream($multipartContents);
|
|
|
+
|
|
|
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
|
|
+ # if Content-Type contains "application/json", json_encode the form parameters
|
|
|
+ try {
|
|
|
+ $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
|
|
|
+ } catch (\JsonException $e) {
|
|
|
+ throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = ObjectSerializer::buildQuery($formParams);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // this endpoint requires Bearer authentication (access token)
|
|
|
+ if (!empty($this->config->getAccessToken())) {
|
|
|
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
|
|
|
+ }
|
|
|
+
|
|
|
+ $defaultHeaders = [];
|
|
|
+ if ($this->config->getUserAgent()) {
|
|
|
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
|
|
+ }
|
|
|
+
|
|
|
+ $headers = array_merge(
|
|
|
+ $defaultHeaders,
|
|
|
+ $headerParams,
|
|
|
+ $headers
|
|
|
+ );
|
|
|
+
|
|
|
+ $operationHost = $this->config->getHost();
|
|
|
+ $query = ObjectSerializer::buildQuery($queryParams);
|
|
|
+ return new Request(
|
|
|
+ 'POST',
|
|
|
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
|
|
|
+ $headers,
|
|
|
+ $httpBody
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation postApiV3GroupsGroupMembers
|
|
|
+ *
|
|
|
+ * 加一名成员
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param \WikipaliApi\Model\PostApiV3GroupsGroupMembersRequest $post_api_v3_groups_group_members_request post_api_v3_groups_group_members_request (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3GroupsGroupMembers'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response|\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
|
|
|
+ */
|
|
|
+ public function postApiV3GroupsGroupMembers($group, $post_api_v3_groups_group_members_request, string $contentType = self::contentTypes['postApiV3GroupsGroupMembers'][0])
|
|
|
+ {
|
|
|
+ list($response) = $this->postApiV3GroupsGroupMembersWithHttpInfo($group, $post_api_v3_groups_group_members_request, $contentType);
|
|
|
+ return $response;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation postApiV3GroupsGroupMembersWithHttpInfo
|
|
|
+ *
|
|
|
+ * 加一名成员
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param \WikipaliApi\Model\PostApiV3GroupsGroupMembersRequest $post_api_v3_groups_group_members_request (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3GroupsGroupMembers'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return array of \WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response|\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
|
|
|
+ */
|
|
|
+ public function postApiV3GroupsGroupMembersWithHttpInfo($group, $post_api_v3_groups_group_members_request, string $contentType = self::contentTypes['postApiV3GroupsGroupMembers'][0])
|
|
|
+ {
|
|
|
+ $request = $this->postApiV3GroupsGroupMembersRequest($group, $post_api_v3_groups_group_members_request, $contentType);
|
|
|
+
|
|
|
+ try {
|
|
|
+ $options = $this->createHttpClientOption();
|
|
|
+ try {
|
|
|
+ $response = $this->client->send($request, $options);
|
|
|
+ } catch (RequestException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
|
|
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
|
|
|
+ );
|
|
|
+ } catch (ConnectException $e) {
|
|
|
+ throw new ApiException(
|
|
|
+ "[{$e->getCode()}] {$e->getMessage()}",
|
|
|
+ (int) $e->getCode(),
|
|
|
+ null,
|
|
|
+ null
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+
|
|
|
+
|
|
|
+ switch($statusCode) {
|
|
|
+ case 200:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 201:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 401:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 403:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ case 422:
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ($statusCode < 200 || $statusCode > 299) {
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ (string) $request->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this->handleResponseWithDataType(
|
|
|
+ '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response',
|
|
|
+ $request,
|
|
|
+ $response,
|
|
|
+ );
|
|
|
+ } catch (ApiException $e) {
|
|
|
+ switch ($e->getCode()) {
|
|
|
+ case 200:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 201:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 401:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 403:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ case 422:
|
|
|
+ $data = ObjectSerializer::deserialize(
|
|
|
+ $e->getResponseBody(),
|
|
|
+ '\WikipaliApi\Model\ProblemDetails',
|
|
|
+ $e->getResponseHeaders()
|
|
|
+ );
|
|
|
+ $e->setResponseObject($data);
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ throw $e;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation postApiV3GroupsGroupMembersAsync
|
|
|
+ *
|
|
|
+ * 加一名成员
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param \WikipaliApi\Model\PostApiV3GroupsGroupMembersRequest $post_api_v3_groups_group_members_request (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3GroupsGroupMembers'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function postApiV3GroupsGroupMembersAsync($group, $post_api_v3_groups_group_members_request, string $contentType = self::contentTypes['postApiV3GroupsGroupMembers'][0])
|
|
|
+ {
|
|
|
+ return $this->postApiV3GroupsGroupMembersAsyncWithHttpInfo($group, $post_api_v3_groups_group_members_request, $contentType)
|
|
|
+ ->then(
|
|
|
+ function ($response) {
|
|
|
+ return $response[0];
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Operation postApiV3GroupsGroupMembersAsyncWithHttpInfo
|
|
|
+ *
|
|
|
+ * 加一名成员
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param \WikipaliApi\Model\PostApiV3GroupsGroupMembersRequest $post_api_v3_groups_group_members_request (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3GroupsGroupMembers'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Promise\PromiseInterface
|
|
|
+ */
|
|
|
+ public function postApiV3GroupsGroupMembersAsyncWithHttpInfo($group, $post_api_v3_groups_group_members_request, string $contentType = self::contentTypes['postApiV3GroupsGroupMembers'][0])
|
|
|
+ {
|
|
|
+ $returnType = '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response';
|
|
|
+ $request = $this->postApiV3GroupsGroupMembersRequest($group, $post_api_v3_groups_group_members_request, $contentType);
|
|
|
+
|
|
|
+ return $this->client
|
|
|
+ ->sendAsync($request, $this->createHttpClientOption())
|
|
|
+ ->then(
|
|
|
+ function ($response) use ($returnType) {
|
|
|
+ if ($returnType === '\SplFileObject') {
|
|
|
+ $content = $response->getBody(); //stream goes to serializer
|
|
|
+ } else {
|
|
|
+ $content = (string) $response->getBody();
|
|
|
+ if ($returnType !== 'string') {
|
|
|
+ $content = json_decode($content);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return [
|
|
|
+ ObjectSerializer::deserialize($content, $returnType, []),
|
|
|
+ $response->getStatusCode(),
|
|
|
+ $response->getHeaders()
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ function ($exception) {
|
|
|
+ $response = $exception->getResponse();
|
|
|
+ $statusCode = $response->getStatusCode();
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ '[%d] Error connecting to the API (%s)',
|
|
|
+ $statusCode,
|
|
|
+ $exception->getRequest()->getUri()
|
|
|
+ ),
|
|
|
+ $statusCode,
|
|
|
+ $response->getHeaders(),
|
|
|
+ (string) $response->getBody()
|
|
|
+ );
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create request for operation 'postApiV3GroupsGroupMembers'
|
|
|
+ *
|
|
|
+ * @param string $group 团队 uid (required)
|
|
|
+ * @param \WikipaliApi\Model\PostApiV3GroupsGroupMembersRequest $post_api_v3_groups_group_members_request (required)
|
|
|
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3GroupsGroupMembers'] to see the possible values for this operation
|
|
|
+ *
|
|
|
+ * @throws \InvalidArgumentException
|
|
|
+ * @return \GuzzleHttp\Psr7\Request
|
|
|
+ */
|
|
|
+ public function postApiV3GroupsGroupMembersRequest($group, $post_api_v3_groups_group_members_request, string $contentType = self::contentTypes['postApiV3GroupsGroupMembers'][0])
|
|
|
+ {
|
|
|
+
|
|
|
+ // verify the required parameter 'group' is set
|
|
|
+ if ($group === null || (is_array($group) && count($group) === 0)) {
|
|
|
+ throw new \InvalidArgumentException(
|
|
|
+ 'Missing the required parameter $group when calling postApiV3GroupsGroupMembers'
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // verify the required parameter 'post_api_v3_groups_group_members_request' is set
|
|
|
+ if ($post_api_v3_groups_group_members_request === null || (is_array($post_api_v3_groups_group_members_request) && count($post_api_v3_groups_group_members_request) === 0)) {
|
|
|
+ throw new \InvalidArgumentException(
|
|
|
+ 'Missing the required parameter $post_api_v3_groups_group_members_request when calling postApiV3GroupsGroupMembers'
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $resourcePath = '/v3/groups/{group}/members';
|
|
|
+ $formParams = [];
|
|
|
+ $queryParams = [];
|
|
|
+ $headerParams = [];
|
|
|
+ $httpBody = '';
|
|
|
+ $multipart = false;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // path params
|
|
|
+ if ($group !== null) {
|
|
|
+ $resourcePath = str_replace(
|
|
|
+ '{group}',
|
|
|
+ ObjectSerializer::toPathValue($group),
|
|
|
+ $resourcePath
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $headers = $this->headerSelector->selectHeaders(
|
|
|
+ ['application/json', 'application/problem+json', ],
|
|
|
+ $contentType,
|
|
|
+ $multipart
|
|
|
+ );
|
|
|
+
|
|
|
+ // for model (json/xml)
|
|
|
+ if (isset($post_api_v3_groups_group_members_request)) {
|
|
|
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
|
|
|
+ # if Content-Type contains "application/json", json_encode the body
|
|
|
+ try {
|
|
|
+ $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($post_api_v3_groups_group_members_request), JSON_THROW_ON_ERROR);
|
|
|
+ } catch (\JsonException $e) {
|
|
|
+ throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $httpBody = $post_api_v3_groups_group_members_request;
|
|
|
+ }
|
|
|
+ } elseif (count($formParams) > 0) {
|
|
|
+ if ($multipart) {
|
|
|
+ $multipartContents = [];
|
|
|
+ foreach ($formParams as $formParamName => $formParamValue) {
|
|
|
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
|
|
|
+ foreach ($formParamValueItems as $formParamValueItem) {
|
|
|
+ $multipartContents[] = [
|
|
|
+ 'name' => $formParamName,
|
|
|
+ 'contents' => $formParamValueItem
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = new MultipartStream($multipartContents);
|
|
|
+
|
|
|
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
|
|
+ # if Content-Type contains "application/json", json_encode the form parameters
|
|
|
+ try {
|
|
|
+ $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
|
|
|
+ } catch (\JsonException $e) {
|
|
|
+ throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // for HTTP post (form)
|
|
|
+ $httpBody = ObjectSerializer::buildQuery($formParams);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // this endpoint requires Bearer authentication (access token)
|
|
|
+ if (!empty($this->config->getAccessToken())) {
|
|
|
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
|
|
|
+ }
|
|
|
+
|
|
|
+ $defaultHeaders = [];
|
|
|
+ if ($this->config->getUserAgent()) {
|
|
|
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
|
|
+ }
|
|
|
+
|
|
|
+ $headers = array_merge(
|
|
|
+ $defaultHeaders,
|
|
|
+ $headerParams,
|
|
|
+ $headers
|
|
|
+ );
|
|
|
+
|
|
|
+ $operationHost = $this->config->getHost();
|
|
|
+ $query = ObjectSerializer::buildQuery($queryParams);
|
|
|
+ return new Request(
|
|
|
+ 'POST',
|
|
|
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
|
|
|
+ $headers,
|
|
|
+ $httpBody
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create http client option
|
|
|
+ *
|
|
|
+ * @throws \RuntimeException on file opening failure
|
|
|
+ * @return array of http client options
|
|
|
+ */
|
|
|
+ protected function createHttpClientOption()
|
|
|
+ {
|
|
|
+ $options = [];
|
|
|
+ if ($this->config->getDebug()) {
|
|
|
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
|
|
|
+ if (!$options[RequestOptions::DEBUG]) {
|
|
|
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($this->config->getCertFile()) {
|
|
|
+ $options[RequestOptions::CERT] = $this->config->getCertFile();
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($this->config->getKeyFile()) {
|
|
|
+ $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
|
|
|
+ }
|
|
|
+
|
|
|
+ return $options;
|
|
|
+ }
|
|
|
+
|
|
|
+ private function handleResponseWithDataType(
|
|
|
+ string $dataType,
|
|
|
+ RequestInterface $request,
|
|
|
+ ResponseInterface $response
|
|
|
+ ): array {
|
|
|
+ if ($dataType === '\SplFileObject') {
|
|
|
+ $content = $response->getBody(); //stream goes to serializer
|
|
|
+ } else {
|
|
|
+ $content = (string) $response->getBody();
|
|
|
+ if ($dataType !== 'string') {
|
|
|
+ try {
|
|
|
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
|
|
|
+ } catch (\JsonException $exception) {
|
|
|
+ throw new ApiException(
|
|
|
+ sprintf(
|
|
|
+ 'Error JSON decoding server response (%s)',
|
|
|
+ $request->getUri()
|
|
|
+ ),
|
|
|
+ $response->getStatusCode(),
|
|
|
+ $response->getHeaders(),
|
|
|
+ $content
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return [
|
|
|
+ ObjectSerializer::deserialize($content, $dataType, []),
|
|
|
+ $response->getStatusCode(),
|
|
|
+ $response->getHeaders()
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ private function responseWithinRangeCode(
|
|
|
+ string $rangeCode,
|
|
|
+ int $statusCode
|
|
|
+ ): bool {
|
|
|
+ $left = (int) ($rangeCode[0].'00');
|
|
|
+ $right = (int) ($rangeCode[0].'99');
|
|
|
+
|
|
|
+ return $statusCode >= $left && $statusCode <= $right;
|
|
|
+ }
|
|
|
+}
|