diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..208c930 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: Tests + +on: + push: + branches: + - main + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 + + - name: Setup PHP + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2 + with: + php-version: "8.3" + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run tests + run: composer test diff --git a/.github/workflows/sdk_generation.yaml b/.github/workflows/sdk_generation.yaml new file mode 100644 index 0000000..9a9c314 --- /dev/null +++ b/.github/workflows/sdk_generation.yaml @@ -0,0 +1,130 @@ +name: SDK Generation + +# Generator: OpenAPI Generator (php) via scripts/generate.sh. +# +# Keeps the same workflow filename and dispatch inputs as the other SDK repos +# (convoy.js, convoy-python, convoy-java, convoy-go, convoy.rb) so the +# frain-dev/convoy dispatcher (speakeasy-sdk.yml) works unchanged. + +on: + workflow_dispatch: + inputs: + force: + # Accepted for dispatcher compatibility. Generation is deterministic + # from the spec, so there is nothing to force: no diff means no PR. + description: Accepted for compatibility; regeneration is always run + required: false + default: "false" + type: string + feature_branch: + description: Branch for SDK changes + required: false + type: string + schedule: + - cron: "0 6 * * 1" + +# Serialize generations: overlapping cron/dispatch runs race on the same +# branch/PR. Queue instead of cancel so a triggered regen is never dropped. +concurrency: + group: sdk-generation + cancel-in-progress: false + +permissions: + contents: write + pull-requests: write + +jobs: + generate: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 + with: + # Regen branches are always derived from main: the spec is pulled + # from convoy main, so a dispatch from another ref must not silently + # commit generated output onto that ref's base. + ref: main + # Prefer a PAT: PRs opened with GITHUB_TOKEN do not trigger + # pull_request workflows, so verify CI would never run on them. + token: ${{ secrets.SDK_BOT_PAT || secrets.GITHUB_TOKEN }} + + - name: Setup Java + uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0 + with: + distribution: temurin + java-version: "17" + + - name: Setup PHP + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2 + with: + php-version: "8.3" + + - name: Regenerate client + run: ./scripts/generate.sh + + - name: Test regenerated client + # Never open a PR for a client that breaks the tests (verify + + # contract). PR CI (ci.yml) re-proves this on the PR itself. + run: | + composer install --prefer-dist --no-progress + composer test + + - name: Detect changes + id: diff + run: | + if git diff --quiet && [ -z "$(git status --porcelain)" ]; then + echo "changed=false" >> "$GITHUB_OUTPUT" + echo "No client changes; skipping PR." >> "$GITHUB_STEP_SUMMARY" + else + echo "changed=true" >> "$GITHUB_OUTPUT" + fi + + - name: Prepare feature branch + if: steps.diff.outputs.changed == 'true' + id: branch + env: + # Never interpolate free-form dispatch inputs into run: directly. + FEATURE_BRANCH_INPUT: ${{ inputs.feature_branch }} + run: | + if [ -n "$FEATURE_BRANCH_INPUT" ]; then + # SDK PRs must come from a reviewable feature branch, never a + # protected ref or an option-looking / metacharacter name. + # refs/* is blocked too: "refs/heads/main" would bypass the + # literal main check and force-push the default branch. + case "$FEATURE_BRANCH_INPUT" in + main|master|release/*|refs/*|-*|*[!a-zA-Z0-9._/-]*) + echo "::error::Invalid feature_branch '$FEATURE_BRANCH_INPUT'" + exit 1 + ;; + esac + echo "name=$FEATURE_BRANCH_INPUT" >> "$GITHUB_OUTPUT" + else + echo "name=sdk-regen-$(date -u +%Y%m%d)" >> "$GITHUB_OUTPUT" + fi + + - name: Push branch and open PR + if: steps.diff.outputs.changed == 'true' + env: + GH_TOKEN: ${{ secrets.SDK_BOT_PAT || secrets.GITHUB_TOKEN }} + BRANCH: ${{ steps.branch.outputs.name }} + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + git checkout -B "$BRANCH" + git add -A + git commit -m "feat: regenerate API client from OpenAPI spec" + # Force push is safe: the regen branch is fully derived from main + # plus this deterministic generation; any previous content is stale. + git push --force origin "$BRANCH" + + existing=$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number // empty') + if [ -z "$existing" ]; then + gh pr create \ + --head "$BRANCH" \ + --title "feat: regenerate API client from OpenAPI spec" \ + --body "Automated regeneration via OpenAPI Generator (php) from \`docs/v3/openapi3.yaml\` on frain-dev/convoy main. Hand-written SDK code (\`src/\` outside \`src/Client/\`, incl. webhook verify) is untouched by the sync script." + echo "Opened PR for $BRANCH" >> "$GITHUB_STEP_SUMMARY" + else + echo "Updated existing PR #$existing" >> "$GITHUB_STEP_SUMMARY" + fi diff --git a/.gitignore b/.gitignore index 841e6e5..56ab52f 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,6 @@ psalm.xml vendor .php-cs-fixer.cache + +# OpenAPI Generator cache (scripts/generate.sh) +.cache/ diff --git a/.openapi-generator-config.yaml b/.openapi-generator-config.yaml new file mode 100644 index 0000000..226133a --- /dev/null +++ b/.openapi-generator-config.yaml @@ -0,0 +1,6 @@ +# OpenAPI Generator (php) config for the generated API client. +# The generated code lives under src/Client/ (namespace Convoy\Client, mapped +# by the existing PSR-4 rule "Convoy\" => src); the hand-written SDK code in +# the rest of src/ is not generated and never touched by scripts/generate.sh. +invokerPackage: "Convoy\\Client" +hideGenerationTimestamp: true diff --git a/README.md b/README.md index 7e171c1..94c0899 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,38 @@ To get started quickly, composer require frain/convoy symfony/http-client nyholm/psr7 ``` +## Generated API client (`Convoy\Client`) + +The `Convoy\Client` namespace (`src/Client/`) is generated from Convoy's +OpenAPI spec via [OpenAPI Generator](https://openapi-generator.tech/) and +covers the full `/api/v1` surface with typed models (Guzzle-based): + +```php +use Convoy\Client\Api\EventsApi; +use Convoy\Client\Configuration; +use Convoy\Client\Model\ModelsCreateEvent; + +$config = (new Configuration()) + ->setHost('https://us.getconvoy.cloud/api') + ->setApiKeyPrefix('Authorization', 'Bearer') + ->setApiKey('Authorization', $apiKey); + +// Pin the API version this client was generated from. +$http = new \GuzzleHttp\Client([ + 'headers' => ['X-Convoy-Version' => '2025-11-24'], +]); + +$events = new EventsApi($http, $config); +$events->createEndpointEvent($projectId, (new ModelsCreateEvent()) + ->setEndpointId('endpoint-id') + ->setEventType('invoice.paid') + ->setData(['amount' => 100, 'currency' => 'USD'])); +``` + +Do not edit `src/Client/` by hand; regenerate with `./scripts/generate.sh` +(CI on `frain-dev/convoy` dispatches this when the spec changes). The +hand-written SDK below (incl. webhook verify) is never touched by generation. + ### Setup Client Set up the client with your instance URL, API key, and project ID. Both the API key and project ID are available from your **Project Settings** page. diff --git a/composer.json b/composer.json index 440b62f..a9f1bb4 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,9 @@ } ], "require": { - "php": "^7.3 || ^8.0", + "php": "^8.1", + "guzzlehttp/guzzle": "^7.3", + "guzzlehttp/psr7": "^1.7 || ^2.0", "php-http/client-common": "^2.5", "php-http/discovery": "^1.14", "psr/http-client": "^1.0", diff --git a/scripts/generate.sh b/scripts/generate.sh new file mode 100755 index 0000000..a471e1e --- /dev/null +++ b/scripts/generate.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Regenerate the API client from Convoy's OpenAPI spec with OpenAPI Generator +# (php), then sync it into src/Client/ without touching the hand-written SDK +# code (the rest of src/, incl. webhook verify). +# +# Requires: java 17+, rsync, curl. Run from the repo root. + +SPEC_URL="${SPEC_URL:-https://raw.githubusercontent.com/frain-dev/convoy/main/docs/v3/openapi3.yaml}" +# Pin so regeneration output is reproducible; bump deliberately. +GENERATOR_VERSION="7.23.0" +GENERATOR_JAR="${GENERATOR_JAR:-.cache/openapi-generator-cli-${GENERATOR_VERSION}.jar}" +# Official artifact checksum; the download is verified before execution so a +# compromised mirror/CDN cannot run arbitrary code in CI. Update alongside +# GENERATOR_VERSION (sha256 of the Maven Central JAR). +GENERATOR_SHA256="cb087e40001e31eb08ef6140dd5de10938dbeb89016a1fe0481eaa25cd569026" + +tmp="$(mktemp -d)" +trap 'rm -rf "$tmp"' EXIT + +if [ ! -f "$GENERATOR_JAR" ]; then + mkdir -p "$(dirname "$GENERATOR_JAR")" + curl -fsSL -o "$GENERATOR_JAR" \ + "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/${GENERATOR_VERSION}/openapi-generator-cli-${GENERATOR_VERSION}.jar" +fi + +# Fail closed on checksum mismatch (covers cached files too). +echo "${GENERATOR_SHA256} ${GENERATOR_JAR}" | shasum -a 256 -c - >/dev/null || { + echo "ERROR: ${GENERATOR_JAR} failed sha256 verification" >&2 + exit 1 +} + +curl -fsSL "$SPEC_URL" -o "$tmp/openapi3.yaml" + +java -jar "$GENERATOR_JAR" generate \ + -i "$tmp/openapi3.yaml" \ + -g php \ + -c .openapi-generator-config.yaml \ + -o "$tmp/gen" + +# Mirror only the generated namespace. --delete keeps src/Client an exact +# mirror of generator output; the hand-written src/ code is never touched. +rsync -a --delete "$tmp/gen/lib/" src/Client/ + +echo "Generated client synced into src/Client/" diff --git a/src/Client/Api/DeliveryAttemptsApi.php b/src/Client/Api/DeliveryAttemptsApi.php new file mode 100644 index 0000000..b4d749a --- /dev/null +++ b/src/Client/Api/DeliveryAttemptsApi.php @@ -0,0 +1,891 @@ + [ + 'application/json', + ], + 'getDeliveryAttempts' => [ + '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 getDeliveryAttempt + * + * Retrieve a delivery attempt + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $delivery_attempt_id delivery attempt id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryAttempt'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetDeliveryAttempt200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getDeliveryAttempt($project_id, $event_delivery_id, $delivery_attempt_id, string $contentType = self::contentTypes['getDeliveryAttempt'][0]) + { + list($response) = $this->getDeliveryAttemptWithHttpInfo($project_id, $event_delivery_id, $delivery_attempt_id, $contentType); + return $response; + } + + /** + * Operation getDeliveryAttemptWithHttpInfo + * + * Retrieve a delivery attempt + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $delivery_attempt_id delivery attempt id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryAttempt'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetDeliveryAttempt200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getDeliveryAttemptWithHttpInfo($project_id, $event_delivery_id, $delivery_attempt_id, string $contentType = self::contentTypes['getDeliveryAttempt'][0]) + { + $request = $this->getDeliveryAttemptRequest($project_id, $event_delivery_id, $delivery_attempt_id, $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( + '\Convoy\Client\Model\GetDeliveryAttempt200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetDeliveryAttempt200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetDeliveryAttempt200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getDeliveryAttemptAsync + * + * Retrieve a delivery attempt + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $delivery_attempt_id delivery attempt id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryAttempt'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDeliveryAttemptAsync($project_id, $event_delivery_id, $delivery_attempt_id, string $contentType = self::contentTypes['getDeliveryAttempt'][0]) + { + return $this->getDeliveryAttemptAsyncWithHttpInfo($project_id, $event_delivery_id, $delivery_attempt_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getDeliveryAttemptAsyncWithHttpInfo + * + * Retrieve a delivery attempt + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $delivery_attempt_id delivery attempt id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryAttempt'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDeliveryAttemptAsyncWithHttpInfo($project_id, $event_delivery_id, $delivery_attempt_id, string $contentType = self::contentTypes['getDeliveryAttempt'][0]) + { + $returnType = '\Convoy\Client\Model\GetDeliveryAttempt200Response'; + $request = $this->getDeliveryAttemptRequest($project_id, $event_delivery_id, $delivery_attempt_id, $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 'getDeliveryAttempt' + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $delivery_attempt_id delivery attempt id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryAttempt'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getDeliveryAttemptRequest($project_id, $event_delivery_id, $delivery_attempt_id, string $contentType = self::contentTypes['getDeliveryAttempt'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getDeliveryAttempt' + ); + } + + // verify the required parameter 'event_delivery_id' is set + if ($event_delivery_id === null || (is_array($event_delivery_id) && count($event_delivery_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $event_delivery_id when calling getDeliveryAttempt' + ); + } + + // verify the required parameter 'delivery_attempt_id' is set + if ($delivery_attempt_id === null || (is_array($delivery_attempt_id) && count($delivery_attempt_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $delivery_attempt_id when calling getDeliveryAttempt' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/eventdeliveries/{eventDeliveryID}/deliveryattempts/{deliveryAttemptID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($event_delivery_id !== null) { + $resourcePath = str_replace( + '{eventDeliveryID}', + ObjectSerializer::toPathValue($event_delivery_id), + $resourcePath + ); + } + // path params + if ($delivery_attempt_id !== null) { + $resourcePath = str_replace( + '{deliveryAttemptID}', + ObjectSerializer::toPathValue($delivery_attempt_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 getDeliveryAttempts + * + * List delivery attempts + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryAttempts'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetDeliveryAttempts200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getDeliveryAttempts($project_id, $event_delivery_id, string $contentType = self::contentTypes['getDeliveryAttempts'][0]) + { + list($response) = $this->getDeliveryAttemptsWithHttpInfo($project_id, $event_delivery_id, $contentType); + return $response; + } + + /** + * Operation getDeliveryAttemptsWithHttpInfo + * + * List delivery attempts + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryAttempts'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetDeliveryAttempts200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getDeliveryAttemptsWithHttpInfo($project_id, $event_delivery_id, string $contentType = self::contentTypes['getDeliveryAttempts'][0]) + { + $request = $this->getDeliveryAttemptsRequest($project_id, $event_delivery_id, $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( + '\Convoy\Client\Model\GetDeliveryAttempts200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetDeliveryAttempts200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetDeliveryAttempts200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getDeliveryAttemptsAsync + * + * List delivery attempts + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryAttempts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDeliveryAttemptsAsync($project_id, $event_delivery_id, string $contentType = self::contentTypes['getDeliveryAttempts'][0]) + { + return $this->getDeliveryAttemptsAsyncWithHttpInfo($project_id, $event_delivery_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getDeliveryAttemptsAsyncWithHttpInfo + * + * List delivery attempts + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryAttempts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDeliveryAttemptsAsyncWithHttpInfo($project_id, $event_delivery_id, string $contentType = self::contentTypes['getDeliveryAttempts'][0]) + { + $returnType = '\Convoy\Client\Model\GetDeliveryAttempts200Response'; + $request = $this->getDeliveryAttemptsRequest($project_id, $event_delivery_id, $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 'getDeliveryAttempts' + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryAttempts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getDeliveryAttemptsRequest($project_id, $event_delivery_id, string $contentType = self::contentTypes['getDeliveryAttempts'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getDeliveryAttempts' + ); + } + + // verify the required parameter 'event_delivery_id' is set + if ($event_delivery_id === null || (is_array($event_delivery_id) && count($event_delivery_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $event_delivery_id when calling getDeliveryAttempts' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/eventdeliveries/{eventDeliveryID}/deliveryattempts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($event_delivery_id !== null) { + $resourcePath = str_replace( + '{eventDeliveryID}', + ObjectSerializer::toPathValue($event_delivery_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 + ); + } + + /** + * 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; + } +} diff --git a/src/Client/Api/EndpointsApi.php b/src/Client/Api/EndpointsApi.php new file mode 100644 index 0000000..96ccb18 --- /dev/null +++ b/src/Client/Api/EndpointsApi.php @@ -0,0 +1,3358 @@ + [ + 'application/json', + ], + 'createEndpoint' => [ + 'application/json', + ], + 'deleteEndpoint' => [ + 'application/json', + ], + 'expireSecret' => [ + 'application/json', + ], + 'getEndpoint' => [ + 'application/json', + ], + 'getEndpoints' => [ + 'application/json', + ], + 'pauseEndpoint' => [ + 'application/json', + ], + 'testOAuth2Connection' => [ + 'application/json', + ], + 'updateEndpoint' => [ + '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 activateEndpoint + * + * Activate endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['activateEndpoint'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateEndpoint201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function activateEndpoint($project_id, $endpoint_id, string $contentType = self::contentTypes['activateEndpoint'][0]) + { + list($response) = $this->activateEndpointWithHttpInfo($project_id, $endpoint_id, $contentType); + return $response; + } + + /** + * Operation activateEndpointWithHttpInfo + * + * Activate endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['activateEndpoint'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateEndpoint201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function activateEndpointWithHttpInfo($project_id, $endpoint_id, string $contentType = self::contentTypes['activateEndpoint'][0]) + { + $request = $this->activateEndpointRequest($project_id, $endpoint_id, $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 202: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\CreateEndpoint201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateEndpoint201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateEndpoint201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation activateEndpointAsync + * + * Activate endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['activateEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function activateEndpointAsync($project_id, $endpoint_id, string $contentType = self::contentTypes['activateEndpoint'][0]) + { + return $this->activateEndpointAsyncWithHttpInfo($project_id, $endpoint_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation activateEndpointAsyncWithHttpInfo + * + * Activate endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['activateEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function activateEndpointAsyncWithHttpInfo($project_id, $endpoint_id, string $contentType = self::contentTypes['activateEndpoint'][0]) + { + $returnType = '\Convoy\Client\Model\CreateEndpoint201Response'; + $request = $this->activateEndpointRequest($project_id, $endpoint_id, $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 'activateEndpoint' + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['activateEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function activateEndpointRequest($project_id, $endpoint_id, string $contentType = self::contentTypes['activateEndpoint'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling activateEndpoint' + ); + } + + // verify the required parameter 'endpoint_id' is set + if ($endpoint_id === null || (is_array($endpoint_id) && count($endpoint_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $endpoint_id when calling activateEndpoint' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/endpoints/{endpointID}/activate'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($endpoint_id !== null) { + $resourcePath = str_replace( + '{endpointID}', + ObjectSerializer::toPathValue($endpoint_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 createEndpoint + * + * Create an endpoint + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateEndpoint $models_create_endpoint Endpoint Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpoint'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateEndpoint201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function createEndpoint($project_id, $models_create_endpoint, string $contentType = self::contentTypes['createEndpoint'][0]) + { + list($response) = $this->createEndpointWithHttpInfo($project_id, $models_create_endpoint, $contentType); + return $response; + } + + /** + * Operation createEndpointWithHttpInfo + * + * Create an endpoint + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateEndpoint $models_create_endpoint Endpoint Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpoint'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateEndpoint201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function createEndpointWithHttpInfo($project_id, $models_create_endpoint, string $contentType = self::contentTypes['createEndpoint'][0]) + { + $request = $this->createEndpointRequest($project_id, $models_create_endpoint, $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 201: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\CreateEndpoint201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateEndpoint201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateEndpoint201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation createEndpointAsync + * + * Create an endpoint + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateEndpoint $models_create_endpoint Endpoint Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createEndpointAsync($project_id, $models_create_endpoint, string $contentType = self::contentTypes['createEndpoint'][0]) + { + return $this->createEndpointAsyncWithHttpInfo($project_id, $models_create_endpoint, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createEndpointAsyncWithHttpInfo + * + * Create an endpoint + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateEndpoint $models_create_endpoint Endpoint Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createEndpointAsyncWithHttpInfo($project_id, $models_create_endpoint, string $contentType = self::contentTypes['createEndpoint'][0]) + { + $returnType = '\Convoy\Client\Model\CreateEndpoint201Response'; + $request = $this->createEndpointRequest($project_id, $models_create_endpoint, $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 'createEndpoint' + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateEndpoint $models_create_endpoint Endpoint Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createEndpointRequest($project_id, $models_create_endpoint, string $contentType = self::contentTypes['createEndpoint'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling createEndpoint' + ); + } + + // verify the required parameter 'models_create_endpoint' is set + if ($models_create_endpoint === null || (is_array($models_create_endpoint) && count($models_create_endpoint) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_create_endpoint when calling createEndpoint' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/endpoints'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_create_endpoint)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_create_endpoint)); + } else { + $httpBody = $models_create_endpoint; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 deleteEndpoint + * + * Delete endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEndpoint'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function deleteEndpoint($project_id, $endpoint_id, string $contentType = self::contentTypes['deleteEndpoint'][0]) + { + list($response) = $this->deleteEndpointWithHttpInfo($project_id, $endpoint_id, $contentType); + return $response; + } + + /** + * Operation deleteEndpointWithHttpInfo + * + * Delete endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEndpoint'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteEndpointWithHttpInfo($project_id, $endpoint_id, string $contentType = self::contentTypes['deleteEndpoint'][0]) + { + $request = $this->deleteEndpointRequest($project_id, $endpoint_id, $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation deleteEndpointAsync + * + * Delete endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteEndpointAsync($project_id, $endpoint_id, string $contentType = self::contentTypes['deleteEndpoint'][0]) + { + return $this->deleteEndpointAsyncWithHttpInfo($project_id, $endpoint_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteEndpointAsyncWithHttpInfo + * + * Delete endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteEndpointAsyncWithHttpInfo($project_id, $endpoint_id, string $contentType = self::contentTypes['deleteEndpoint'][0]) + { + $returnType = '\Convoy\Client\Model\GetProjects400Response'; + $request = $this->deleteEndpointRequest($project_id, $endpoint_id, $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 'deleteEndpoint' + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteEndpointRequest($project_id, $endpoint_id, string $contentType = self::contentTypes['deleteEndpoint'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling deleteEndpoint' + ); + } + + // verify the required parameter 'endpoint_id' is set + if ($endpoint_id === null || (is_array($endpoint_id) && count($endpoint_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $endpoint_id when calling deleteEndpoint' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/endpoints/{endpointID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($endpoint_id !== null) { + $resourcePath = str_replace( + '{endpointID}', + ObjectSerializer::toPathValue($endpoint_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 expireSecret + * + * Roll endpoint secret + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param \Convoy\Client\Model\ModelsExpireSecret $models_expire_secret Expire Secret Body Parameters (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expireSecret'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateEndpoint201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function expireSecret($project_id, $endpoint_id, $models_expire_secret, string $contentType = self::contentTypes['expireSecret'][0]) + { + list($response) = $this->expireSecretWithHttpInfo($project_id, $endpoint_id, $models_expire_secret, $contentType); + return $response; + } + + /** + * Operation expireSecretWithHttpInfo + * + * Roll endpoint secret + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param \Convoy\Client\Model\ModelsExpireSecret $models_expire_secret Expire Secret Body Parameters (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expireSecret'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateEndpoint201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function expireSecretWithHttpInfo($project_id, $endpoint_id, $models_expire_secret, string $contentType = self::contentTypes['expireSecret'][0]) + { + $request = $this->expireSecretRequest($project_id, $endpoint_id, $models_expire_secret, $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( + '\Convoy\Client\Model\CreateEndpoint201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateEndpoint201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateEndpoint201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation expireSecretAsync + * + * Roll endpoint secret + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param \Convoy\Client\Model\ModelsExpireSecret $models_expire_secret Expire Secret Body Parameters (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expireSecret'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function expireSecretAsync($project_id, $endpoint_id, $models_expire_secret, string $contentType = self::contentTypes['expireSecret'][0]) + { + return $this->expireSecretAsyncWithHttpInfo($project_id, $endpoint_id, $models_expire_secret, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation expireSecretAsyncWithHttpInfo + * + * Roll endpoint secret + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param \Convoy\Client\Model\ModelsExpireSecret $models_expire_secret Expire Secret Body Parameters (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expireSecret'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function expireSecretAsyncWithHttpInfo($project_id, $endpoint_id, $models_expire_secret, string $contentType = self::contentTypes['expireSecret'][0]) + { + $returnType = '\Convoy\Client\Model\CreateEndpoint201Response'; + $request = $this->expireSecretRequest($project_id, $endpoint_id, $models_expire_secret, $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 'expireSecret' + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param \Convoy\Client\Model\ModelsExpireSecret $models_expire_secret Expire Secret Body Parameters (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expireSecret'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function expireSecretRequest($project_id, $endpoint_id, $models_expire_secret, string $contentType = self::contentTypes['expireSecret'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling expireSecret' + ); + } + + // verify the required parameter 'endpoint_id' is set + if ($endpoint_id === null || (is_array($endpoint_id) && count($endpoint_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $endpoint_id when calling expireSecret' + ); + } + + // verify the required parameter 'models_expire_secret' is set + if ($models_expire_secret === null || (is_array($models_expire_secret) && count($models_expire_secret) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_expire_secret when calling expireSecret' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/endpoints/{endpointID}/expire_secret'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($endpoint_id !== null) { + $resourcePath = str_replace( + '{endpointID}', + ObjectSerializer::toPathValue($endpoint_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_expire_secret)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_expire_secret)); + } else { + $httpBody = $models_expire_secret; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getEndpoint + * + * Retrieve endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoint'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateEndpoint201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getEndpoint($project_id, $endpoint_id, string $contentType = self::contentTypes['getEndpoint'][0]) + { + list($response) = $this->getEndpointWithHttpInfo($project_id, $endpoint_id, $contentType); + return $response; + } + + /** + * Operation getEndpointWithHttpInfo + * + * Retrieve endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoint'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateEndpoint201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getEndpointWithHttpInfo($project_id, $endpoint_id, string $contentType = self::contentTypes['getEndpoint'][0]) + { + $request = $this->getEndpointRequest($project_id, $endpoint_id, $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( + '\Convoy\Client\Model\CreateEndpoint201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateEndpoint201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateEndpoint201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getEndpointAsync + * + * Retrieve endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEndpointAsync($project_id, $endpoint_id, string $contentType = self::contentTypes['getEndpoint'][0]) + { + return $this->getEndpointAsyncWithHttpInfo($project_id, $endpoint_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEndpointAsyncWithHttpInfo + * + * Retrieve endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEndpointAsyncWithHttpInfo($project_id, $endpoint_id, string $contentType = self::contentTypes['getEndpoint'][0]) + { + $returnType = '\Convoy\Client\Model\CreateEndpoint201Response'; + $request = $this->getEndpointRequest($project_id, $endpoint_id, $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 'getEndpoint' + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEndpointRequest($project_id, $endpoint_id, string $contentType = self::contentTypes['getEndpoint'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getEndpoint' + ); + } + + // verify the required parameter 'endpoint_id' is set + if ($endpoint_id === null || (is_array($endpoint_id) && count($endpoint_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $endpoint_id when calling getEndpoint' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/endpoints/{endpointID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($endpoint_id !== null) { + $resourcePath = str_replace( + '{endpointID}', + ObjectSerializer::toPathValue($endpoint_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 getEndpoints + * + * List all endpoints + * + * @param string $project_id Project ID (required) + * @param string|null $direction direction (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param string|null $owner_id The owner ID of the endpoint (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $q The name of the endpoint (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoints'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetEndpoints200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getEndpoints($project_id, $direction = null, $next_page_cursor = null, $owner_id = null, $per_page = null, $prev_page_cursor = null, $q = null, $sort = null, string $contentType = self::contentTypes['getEndpoints'][0]) + { + list($response) = $this->getEndpointsWithHttpInfo($project_id, $direction, $next_page_cursor, $owner_id, $per_page, $prev_page_cursor, $q, $sort, $contentType); + return $response; + } + + /** + * Operation getEndpointsWithHttpInfo + * + * List all endpoints + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param string|null $owner_id The owner ID of the endpoint (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $q The name of the endpoint (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoints'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetEndpoints200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getEndpointsWithHttpInfo($project_id, $direction = null, $next_page_cursor = null, $owner_id = null, $per_page = null, $prev_page_cursor = null, $q = null, $sort = null, string $contentType = self::contentTypes['getEndpoints'][0]) + { + $request = $this->getEndpointsRequest($project_id, $direction, $next_page_cursor, $owner_id, $per_page, $prev_page_cursor, $q, $sort, $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( + '\Convoy\Client\Model\GetEndpoints200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetEndpoints200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetEndpoints200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getEndpointsAsync + * + * List all endpoints + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param string|null $owner_id The owner ID of the endpoint (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $q The name of the endpoint (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoints'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEndpointsAsync($project_id, $direction = null, $next_page_cursor = null, $owner_id = null, $per_page = null, $prev_page_cursor = null, $q = null, $sort = null, string $contentType = self::contentTypes['getEndpoints'][0]) + { + return $this->getEndpointsAsyncWithHttpInfo($project_id, $direction, $next_page_cursor, $owner_id, $per_page, $prev_page_cursor, $q, $sort, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEndpointsAsyncWithHttpInfo + * + * List all endpoints + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param string|null $owner_id The owner ID of the endpoint (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $q The name of the endpoint (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoints'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEndpointsAsyncWithHttpInfo($project_id, $direction = null, $next_page_cursor = null, $owner_id = null, $per_page = null, $prev_page_cursor = null, $q = null, $sort = null, string $contentType = self::contentTypes['getEndpoints'][0]) + { + $returnType = '\Convoy\Client\Model\GetEndpoints200Response'; + $request = $this->getEndpointsRequest($project_id, $direction, $next_page_cursor, $owner_id, $per_page, $prev_page_cursor, $q, $sort, $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 'getEndpoints' + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param string|null $owner_id The owner ID of the endpoint (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $q The name of the endpoint (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoints'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEndpointsRequest($project_id, $direction = null, $next_page_cursor = null, $owner_id = null, $per_page = null, $prev_page_cursor = null, $q = null, $sort = null, string $contentType = self::contentTypes['getEndpoints'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getEndpoints' + ); + } + + + + + + + + + + $resourcePath = '/v1/projects/{projectID}/endpoints'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $direction, + 'direction', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next_page_cursor, + 'next_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $owner_id, + 'ownerId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $per_page, + 'perPage', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $prev_page_cursor, + 'prev_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $q, + 'q', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 pauseEndpoint + * + * Pause endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['pauseEndpoint'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateEndpoint201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function pauseEndpoint($project_id, $endpoint_id, string $contentType = self::contentTypes['pauseEndpoint'][0]) + { + list($response) = $this->pauseEndpointWithHttpInfo($project_id, $endpoint_id, $contentType); + return $response; + } + + /** + * Operation pauseEndpointWithHttpInfo + * + * Pause endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['pauseEndpoint'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateEndpoint201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function pauseEndpointWithHttpInfo($project_id, $endpoint_id, string $contentType = self::contentTypes['pauseEndpoint'][0]) + { + $request = $this->pauseEndpointRequest($project_id, $endpoint_id, $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 202: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\CreateEndpoint201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateEndpoint201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateEndpoint201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation pauseEndpointAsync + * + * Pause endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['pauseEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function pauseEndpointAsync($project_id, $endpoint_id, string $contentType = self::contentTypes['pauseEndpoint'][0]) + { + return $this->pauseEndpointAsyncWithHttpInfo($project_id, $endpoint_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation pauseEndpointAsyncWithHttpInfo + * + * Pause endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['pauseEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function pauseEndpointAsyncWithHttpInfo($project_id, $endpoint_id, string $contentType = self::contentTypes['pauseEndpoint'][0]) + { + $returnType = '\Convoy\Client\Model\CreateEndpoint201Response'; + $request = $this->pauseEndpointRequest($project_id, $endpoint_id, $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 'pauseEndpoint' + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['pauseEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function pauseEndpointRequest($project_id, $endpoint_id, string $contentType = self::contentTypes['pauseEndpoint'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling pauseEndpoint' + ); + } + + // verify the required parameter 'endpoint_id' is set + if ($endpoint_id === null || (is_array($endpoint_id) && count($endpoint_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $endpoint_id when calling pauseEndpoint' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/endpoints/{endpointID}/pause'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($endpoint_id !== null) { + $resourcePath = str_replace( + '{endpointID}', + ObjectSerializer::toPathValue($endpoint_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation testOAuth2Connection + * + * Test OAuth2 connection + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsTestOAuth2Request $models_test_o_auth2_request OAuth2 Configuration (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testOAuth2Connection'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\TestOAuth2Connection200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function testOAuth2Connection($project_id, $models_test_o_auth2_request, string $contentType = self::contentTypes['testOAuth2Connection'][0]) + { + list($response) = $this->testOAuth2ConnectionWithHttpInfo($project_id, $models_test_o_auth2_request, $contentType); + return $response; + } + + /** + * Operation testOAuth2ConnectionWithHttpInfo + * + * Test OAuth2 connection + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsTestOAuth2Request $models_test_o_auth2_request OAuth2 Configuration (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testOAuth2Connection'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\TestOAuth2Connection200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function testOAuth2ConnectionWithHttpInfo($project_id, $models_test_o_auth2_request, string $contentType = self::contentTypes['testOAuth2Connection'][0]) + { + $request = $this->testOAuth2ConnectionRequest($project_id, $models_test_o_auth2_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( + '\Convoy\Client\Model\TestOAuth2Connection200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\TestOAuth2Connection200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\TestOAuth2Connection200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation testOAuth2ConnectionAsync + * + * Test OAuth2 connection + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsTestOAuth2Request $models_test_o_auth2_request OAuth2 Configuration (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testOAuth2Connection'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testOAuth2ConnectionAsync($project_id, $models_test_o_auth2_request, string $contentType = self::contentTypes['testOAuth2Connection'][0]) + { + return $this->testOAuth2ConnectionAsyncWithHttpInfo($project_id, $models_test_o_auth2_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation testOAuth2ConnectionAsyncWithHttpInfo + * + * Test OAuth2 connection + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsTestOAuth2Request $models_test_o_auth2_request OAuth2 Configuration (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testOAuth2Connection'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testOAuth2ConnectionAsyncWithHttpInfo($project_id, $models_test_o_auth2_request, string $contentType = self::contentTypes['testOAuth2Connection'][0]) + { + $returnType = '\Convoy\Client\Model\TestOAuth2Connection200Response'; + $request = $this->testOAuth2ConnectionRequest($project_id, $models_test_o_auth2_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 'testOAuth2Connection' + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsTestOAuth2Request $models_test_o_auth2_request OAuth2 Configuration (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testOAuth2Connection'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function testOAuth2ConnectionRequest($project_id, $models_test_o_auth2_request, string $contentType = self::contentTypes['testOAuth2Connection'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling testOAuth2Connection' + ); + } + + // verify the required parameter 'models_test_o_auth2_request' is set + if ($models_test_o_auth2_request === null || (is_array($models_test_o_auth2_request) && count($models_test_o_auth2_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_test_o_auth2_request when calling testOAuth2Connection' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/endpoints/oauth2/test'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_test_o_auth2_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_test_o_auth2_request)); + } else { + $httpBody = $models_test_o_auth2_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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 updateEndpoint + * + * Update an endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param \Convoy\Client\Model\ModelsUpdateEndpoint $models_update_endpoint Endpoint Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEndpoint'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateEndpoint201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function updateEndpoint($project_id, $endpoint_id, $models_update_endpoint, string $contentType = self::contentTypes['updateEndpoint'][0]) + { + list($response) = $this->updateEndpointWithHttpInfo($project_id, $endpoint_id, $models_update_endpoint, $contentType); + return $response; + } + + /** + * Operation updateEndpointWithHttpInfo + * + * Update an endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param \Convoy\Client\Model\ModelsUpdateEndpoint $models_update_endpoint Endpoint Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEndpoint'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateEndpoint201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function updateEndpointWithHttpInfo($project_id, $endpoint_id, $models_update_endpoint, string $contentType = self::contentTypes['updateEndpoint'][0]) + { + $request = $this->updateEndpointRequest($project_id, $endpoint_id, $models_update_endpoint, $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 202: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\CreateEndpoint201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateEndpoint201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateEndpoint201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation updateEndpointAsync + * + * Update an endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param \Convoy\Client\Model\ModelsUpdateEndpoint $models_update_endpoint Endpoint Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateEndpointAsync($project_id, $endpoint_id, $models_update_endpoint, string $contentType = self::contentTypes['updateEndpoint'][0]) + { + return $this->updateEndpointAsyncWithHttpInfo($project_id, $endpoint_id, $models_update_endpoint, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateEndpointAsyncWithHttpInfo + * + * Update an endpoint + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param \Convoy\Client\Model\ModelsUpdateEndpoint $models_update_endpoint Endpoint Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateEndpointAsyncWithHttpInfo($project_id, $endpoint_id, $models_update_endpoint, string $contentType = self::contentTypes['updateEndpoint'][0]) + { + $returnType = '\Convoy\Client\Model\CreateEndpoint201Response'; + $request = $this->updateEndpointRequest($project_id, $endpoint_id, $models_update_endpoint, $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 'updateEndpoint' + * + * @param string $project_id Project ID (required) + * @param string $endpoint_id Endpoint ID (required) + * @param \Convoy\Client\Model\ModelsUpdateEndpoint $models_update_endpoint Endpoint Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEndpoint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateEndpointRequest($project_id, $endpoint_id, $models_update_endpoint, string $contentType = self::contentTypes['updateEndpoint'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling updateEndpoint' + ); + } + + // verify the required parameter 'endpoint_id' is set + if ($endpoint_id === null || (is_array($endpoint_id) && count($endpoint_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $endpoint_id when calling updateEndpoint' + ); + } + + // verify the required parameter 'models_update_endpoint' is set + if ($models_update_endpoint === null || (is_array($models_update_endpoint) && count($models_update_endpoint) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_update_endpoint when calling updateEndpoint' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/endpoints/{endpointID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($endpoint_id !== null) { + $resourcePath = str_replace( + '{endpointID}', + ObjectSerializer::toPathValue($endpoint_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_update_endpoint)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_update_endpoint)); + } else { + $httpBody = $models_update_endpoint; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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( + 'PUT', + $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; + } +} diff --git a/src/Client/Api/EventDeliveriesApi.php b/src/Client/Api/EventDeliveriesApi.php new file mode 100644 index 0000000..c05398e --- /dev/null +++ b/src/Client/Api/EventDeliveriesApi.php @@ -0,0 +1,2234 @@ + [ + 'application/json', + ], + 'forceResendEventDeliveries' => [ + 'application/json', + ], + 'getEventDeliveriesPaged' => [ + 'application/json', + ], + 'getEventDelivery' => [ + 'application/json', + ], + 'resendEventDelivery' => [ + '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 batchRetryEventDelivery + * + * Batch retry event delivery + * + * @param string $project_id Project ID (required) + * @param string|null $direction direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint IDs to filter by (optional) + * @param string|null $event_id Event ID to filter by (optional) + * @param string|null $event_type EventType to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $start_date The start date (optional) + * @param string[]|null $status A list of event delivery statuses to filter by (optional) + * @param string|null $subscription_id SubscriptionID to filter by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchRetryEventDelivery'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function batchRetryEventDelivery($project_id, $direction = null, $end_date = null, $endpoint_id = null, $event_id = null, $event_type = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, $start_date = null, $status = null, $subscription_id = null, string $contentType = self::contentTypes['batchRetryEventDelivery'][0]) + { + list($response) = $this->batchRetryEventDeliveryWithHttpInfo($project_id, $direction, $end_date, $endpoint_id, $event_id, $event_type, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $sort, $start_date, $status, $subscription_id, $contentType); + return $response; + } + + /** + * Operation batchRetryEventDeliveryWithHttpInfo + * + * Batch retry event delivery + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint IDs to filter by (optional) + * @param string|null $event_id Event ID to filter by (optional) + * @param string|null $event_type EventType to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $start_date The start date (optional) + * @param string[]|null $status A list of event delivery statuses to filter by (optional) + * @param string|null $subscription_id SubscriptionID to filter by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchRetryEventDelivery'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function batchRetryEventDeliveryWithHttpInfo($project_id, $direction = null, $end_date = null, $endpoint_id = null, $event_id = null, $event_type = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, $start_date = null, $status = null, $subscription_id = null, string $contentType = self::contentTypes['batchRetryEventDelivery'][0]) + { + $request = $this->batchRetryEventDeliveryRequest($project_id, $direction, $end_date, $endpoint_id, $event_id, $event_type, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $sort, $start_date, $status, $subscription_id, $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation batchRetryEventDeliveryAsync + * + * Batch retry event delivery + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint IDs to filter by (optional) + * @param string|null $event_id Event ID to filter by (optional) + * @param string|null $event_type EventType to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $start_date The start date (optional) + * @param string[]|null $status A list of event delivery statuses to filter by (optional) + * @param string|null $subscription_id SubscriptionID to filter by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchRetryEventDelivery'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function batchRetryEventDeliveryAsync($project_id, $direction = null, $end_date = null, $endpoint_id = null, $event_id = null, $event_type = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, $start_date = null, $status = null, $subscription_id = null, string $contentType = self::contentTypes['batchRetryEventDelivery'][0]) + { + return $this->batchRetryEventDeliveryAsyncWithHttpInfo($project_id, $direction, $end_date, $endpoint_id, $event_id, $event_type, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $sort, $start_date, $status, $subscription_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation batchRetryEventDeliveryAsyncWithHttpInfo + * + * Batch retry event delivery + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint IDs to filter by (optional) + * @param string|null $event_id Event ID to filter by (optional) + * @param string|null $event_type EventType to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $start_date The start date (optional) + * @param string[]|null $status A list of event delivery statuses to filter by (optional) + * @param string|null $subscription_id SubscriptionID to filter by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchRetryEventDelivery'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function batchRetryEventDeliveryAsyncWithHttpInfo($project_id, $direction = null, $end_date = null, $endpoint_id = null, $event_id = null, $event_type = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, $start_date = null, $status = null, $subscription_id = null, string $contentType = self::contentTypes['batchRetryEventDelivery'][0]) + { + $returnType = '\Convoy\Client\Model\GetProjects400Response'; + $request = $this->batchRetryEventDeliveryRequest($project_id, $direction, $end_date, $endpoint_id, $event_id, $event_type, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $sort, $start_date, $status, $subscription_id, $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 'batchRetryEventDelivery' + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint IDs to filter by (optional) + * @param string|null $event_id Event ID to filter by (optional) + * @param string|null $event_type EventType to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $start_date The start date (optional) + * @param string[]|null $status A list of event delivery statuses to filter by (optional) + * @param string|null $subscription_id SubscriptionID to filter by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchRetryEventDelivery'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function batchRetryEventDeliveryRequest($project_id, $direction = null, $end_date = null, $endpoint_id = null, $event_id = null, $event_type = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, $start_date = null, $status = null, $subscription_id = null, string $contentType = self::contentTypes['batchRetryEventDelivery'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling batchRetryEventDelivery' + ); + } + + + + + + + + + + + + + + + + $resourcePath = '/v1/projects/{projectID}/eventdeliveries/batchretry'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $direction, + 'direction', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $end_date, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endpoint_id, + 'endpointId', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $event_id, + 'eventId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $event_type, + 'event_type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $idempotency_key, + 'idempotencyKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next_page_cursor, + 'next_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $per_page, + 'perPage', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $prev_page_cursor, + 'prev_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $start_date, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $status, + 'status', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $subscription_id, + 'subscriptionId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 forceResendEventDeliveries + * + * Force retry event delivery + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsIDs $models_ids event delivery ids (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['forceResendEventDeliveries'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function forceResendEventDeliveries($project_id, $models_ids, string $contentType = self::contentTypes['forceResendEventDeliveries'][0]) + { + list($response) = $this->forceResendEventDeliveriesWithHttpInfo($project_id, $models_ids, $contentType); + return $response; + } + + /** + * Operation forceResendEventDeliveriesWithHttpInfo + * + * Force retry event delivery + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsIDs $models_ids event delivery ids (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['forceResendEventDeliveries'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function forceResendEventDeliveriesWithHttpInfo($project_id, $models_ids, string $contentType = self::contentTypes['forceResendEventDeliveries'][0]) + { + $request = $this->forceResendEventDeliveriesRequest($project_id, $models_ids, $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation forceResendEventDeliveriesAsync + * + * Force retry event delivery + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsIDs $models_ids event delivery ids (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['forceResendEventDeliveries'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function forceResendEventDeliveriesAsync($project_id, $models_ids, string $contentType = self::contentTypes['forceResendEventDeliveries'][0]) + { + return $this->forceResendEventDeliveriesAsyncWithHttpInfo($project_id, $models_ids, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation forceResendEventDeliveriesAsyncWithHttpInfo + * + * Force retry event delivery + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsIDs $models_ids event delivery ids (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['forceResendEventDeliveries'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function forceResendEventDeliveriesAsyncWithHttpInfo($project_id, $models_ids, string $contentType = self::contentTypes['forceResendEventDeliveries'][0]) + { + $returnType = '\Convoy\Client\Model\GetProjects400Response'; + $request = $this->forceResendEventDeliveriesRequest($project_id, $models_ids, $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 'forceResendEventDeliveries' + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsIDs $models_ids event delivery ids (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['forceResendEventDeliveries'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function forceResendEventDeliveriesRequest($project_id, $models_ids, string $contentType = self::contentTypes['forceResendEventDeliveries'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling forceResendEventDeliveries' + ); + } + + // verify the required parameter 'models_ids' is set + if ($models_ids === null || (is_array($models_ids) && count($models_ids) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_ids when calling forceResendEventDeliveries' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/eventdeliveries/forceresend'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_ids)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_ids)); + } else { + $httpBody = $models_ids; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 getEventDeliveriesPaged + * + * List all event deliveries + * + * @param string $project_id Project ID (required) + * @param string|null $direction direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint IDs to filter by (optional) + * @param string|null $event_id Event ID to filter by (optional) + * @param string|null $event_type EventType to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $start_date The start date (optional) + * @param string[]|null $status A list of event delivery statuses to filter by (optional) + * @param string|null $subscription_id SubscriptionID to filter by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventDeliveriesPaged'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetEventDeliveriesPaged200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getEventDeliveriesPaged($project_id, $direction = null, $end_date = null, $endpoint_id = null, $event_id = null, $event_type = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, $start_date = null, $status = null, $subscription_id = null, string $contentType = self::contentTypes['getEventDeliveriesPaged'][0]) + { + list($response) = $this->getEventDeliveriesPagedWithHttpInfo($project_id, $direction, $end_date, $endpoint_id, $event_id, $event_type, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $sort, $start_date, $status, $subscription_id, $contentType); + return $response; + } + + /** + * Operation getEventDeliveriesPagedWithHttpInfo + * + * List all event deliveries + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint IDs to filter by (optional) + * @param string|null $event_id Event ID to filter by (optional) + * @param string|null $event_type EventType to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $start_date The start date (optional) + * @param string[]|null $status A list of event delivery statuses to filter by (optional) + * @param string|null $subscription_id SubscriptionID to filter by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventDeliveriesPaged'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetEventDeliveriesPaged200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getEventDeliveriesPagedWithHttpInfo($project_id, $direction = null, $end_date = null, $endpoint_id = null, $event_id = null, $event_type = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, $start_date = null, $status = null, $subscription_id = null, string $contentType = self::contentTypes['getEventDeliveriesPaged'][0]) + { + $request = $this->getEventDeliveriesPagedRequest($project_id, $direction, $end_date, $endpoint_id, $event_id, $event_type, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $sort, $start_date, $status, $subscription_id, $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( + '\Convoy\Client\Model\GetEventDeliveriesPaged200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetEventDeliveriesPaged200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetEventDeliveriesPaged200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getEventDeliveriesPagedAsync + * + * List all event deliveries + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint IDs to filter by (optional) + * @param string|null $event_id Event ID to filter by (optional) + * @param string|null $event_type EventType to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $start_date The start date (optional) + * @param string[]|null $status A list of event delivery statuses to filter by (optional) + * @param string|null $subscription_id SubscriptionID to filter by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventDeliveriesPaged'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEventDeliveriesPagedAsync($project_id, $direction = null, $end_date = null, $endpoint_id = null, $event_id = null, $event_type = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, $start_date = null, $status = null, $subscription_id = null, string $contentType = self::contentTypes['getEventDeliveriesPaged'][0]) + { + return $this->getEventDeliveriesPagedAsyncWithHttpInfo($project_id, $direction, $end_date, $endpoint_id, $event_id, $event_type, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $sort, $start_date, $status, $subscription_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEventDeliveriesPagedAsyncWithHttpInfo + * + * List all event deliveries + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint IDs to filter by (optional) + * @param string|null $event_id Event ID to filter by (optional) + * @param string|null $event_type EventType to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $start_date The start date (optional) + * @param string[]|null $status A list of event delivery statuses to filter by (optional) + * @param string|null $subscription_id SubscriptionID to filter by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventDeliveriesPaged'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEventDeliveriesPagedAsyncWithHttpInfo($project_id, $direction = null, $end_date = null, $endpoint_id = null, $event_id = null, $event_type = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, $start_date = null, $status = null, $subscription_id = null, string $contentType = self::contentTypes['getEventDeliveriesPaged'][0]) + { + $returnType = '\Convoy\Client\Model\GetEventDeliveriesPaged200Response'; + $request = $this->getEventDeliveriesPagedRequest($project_id, $direction, $end_date, $endpoint_id, $event_id, $event_type, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $sort, $start_date, $status, $subscription_id, $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 'getEventDeliveriesPaged' + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint IDs to filter by (optional) + * @param string|null $event_id Event ID to filter by (optional) + * @param string|null $event_type EventType to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $start_date The start date (optional) + * @param string[]|null $status A list of event delivery statuses to filter by (optional) + * @param string|null $subscription_id SubscriptionID to filter by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventDeliveriesPaged'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEventDeliveriesPagedRequest($project_id, $direction = null, $end_date = null, $endpoint_id = null, $event_id = null, $event_type = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, $start_date = null, $status = null, $subscription_id = null, string $contentType = self::contentTypes['getEventDeliveriesPaged'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getEventDeliveriesPaged' + ); + } + + + + + + + + + + + + + + + + $resourcePath = '/v1/projects/{projectID}/eventdeliveries'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $direction, + 'direction', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $end_date, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endpoint_id, + 'endpointId', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $event_id, + 'eventId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $event_type, + 'event_type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $idempotency_key, + 'idempotencyKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next_page_cursor, + 'next_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $per_page, + 'perPage', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $prev_page_cursor, + 'prev_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $start_date, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $status, + 'status', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $subscription_id, + 'subscriptionId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 getEventDelivery + * + * Retrieve an event delivery + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventDelivery'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetEventDelivery200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getEventDelivery($project_id, $event_delivery_id, string $contentType = self::contentTypes['getEventDelivery'][0]) + { + list($response) = $this->getEventDeliveryWithHttpInfo($project_id, $event_delivery_id, $contentType); + return $response; + } + + /** + * Operation getEventDeliveryWithHttpInfo + * + * Retrieve an event delivery + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventDelivery'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetEventDelivery200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getEventDeliveryWithHttpInfo($project_id, $event_delivery_id, string $contentType = self::contentTypes['getEventDelivery'][0]) + { + $request = $this->getEventDeliveryRequest($project_id, $event_delivery_id, $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( + '\Convoy\Client\Model\GetEventDelivery200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetEventDelivery200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetEventDelivery200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getEventDeliveryAsync + * + * Retrieve an event delivery + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventDelivery'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEventDeliveryAsync($project_id, $event_delivery_id, string $contentType = self::contentTypes['getEventDelivery'][0]) + { + return $this->getEventDeliveryAsyncWithHttpInfo($project_id, $event_delivery_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEventDeliveryAsyncWithHttpInfo + * + * Retrieve an event delivery + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventDelivery'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEventDeliveryAsyncWithHttpInfo($project_id, $event_delivery_id, string $contentType = self::contentTypes['getEventDelivery'][0]) + { + $returnType = '\Convoy\Client\Model\GetEventDelivery200Response'; + $request = $this->getEventDeliveryRequest($project_id, $event_delivery_id, $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 'getEventDelivery' + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventDelivery'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEventDeliveryRequest($project_id, $event_delivery_id, string $contentType = self::contentTypes['getEventDelivery'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getEventDelivery' + ); + } + + // verify the required parameter 'event_delivery_id' is set + if ($event_delivery_id === null || (is_array($event_delivery_id) && count($event_delivery_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $event_delivery_id when calling getEventDelivery' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/eventdeliveries/{eventDeliveryID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($event_delivery_id !== null) { + $resourcePath = str_replace( + '{eventDeliveryID}', + ObjectSerializer::toPathValue($event_delivery_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 resendEventDelivery + * + * Retry event delivery + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resendEventDelivery'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetEventDelivery200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function resendEventDelivery($project_id, $event_delivery_id, string $contentType = self::contentTypes['resendEventDelivery'][0]) + { + list($response) = $this->resendEventDeliveryWithHttpInfo($project_id, $event_delivery_id, $contentType); + return $response; + } + + /** + * Operation resendEventDeliveryWithHttpInfo + * + * Retry event delivery + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resendEventDelivery'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetEventDelivery200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function resendEventDeliveryWithHttpInfo($project_id, $event_delivery_id, string $contentType = self::contentTypes['resendEventDelivery'][0]) + { + $request = $this->resendEventDeliveryRequest($project_id, $event_delivery_id, $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( + '\Convoy\Client\Model\GetEventDelivery200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetEventDelivery200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetEventDelivery200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation resendEventDeliveryAsync + * + * Retry event delivery + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resendEventDelivery'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function resendEventDeliveryAsync($project_id, $event_delivery_id, string $contentType = self::contentTypes['resendEventDelivery'][0]) + { + return $this->resendEventDeliveryAsyncWithHttpInfo($project_id, $event_delivery_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation resendEventDeliveryAsyncWithHttpInfo + * + * Retry event delivery + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resendEventDelivery'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function resendEventDeliveryAsyncWithHttpInfo($project_id, $event_delivery_id, string $contentType = self::contentTypes['resendEventDelivery'][0]) + { + $returnType = '\Convoy\Client\Model\GetEventDelivery200Response'; + $request = $this->resendEventDeliveryRequest($project_id, $event_delivery_id, $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 'resendEventDelivery' + * + * @param string $project_id Project ID (required) + * @param string $event_delivery_id event delivery id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resendEventDelivery'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function resendEventDeliveryRequest($project_id, $event_delivery_id, string $contentType = self::contentTypes['resendEventDelivery'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling resendEventDelivery' + ); + } + + // verify the required parameter 'event_delivery_id' is set + if ($event_delivery_id === null || (is_array($event_delivery_id) && count($event_delivery_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $event_delivery_id when calling resendEventDelivery' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/eventdeliveries/{eventDeliveryID}/resend'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($event_delivery_id !== null) { + $resourcePath = str_replace( + '{eventDeliveryID}', + ObjectSerializer::toPathValue($event_delivery_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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( + 'PUT', + $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; + } +} diff --git a/src/Client/Api/EventTypesApi.php b/src/Client/Api/EventTypesApi.php new file mode 100644 index 0000000..2e94a5c --- /dev/null +++ b/src/Client/Api/EventTypesApi.php @@ -0,0 +1,1882 @@ + [ + 'application/json', + ], + 'deprecateEventType' => [ + 'application/json', + ], + 'getEventTypes' => [ + 'application/json', + ], + 'importOpenApiSpec' => [ + 'application/json', + ], + 'updateEventType' => [ + '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 createEventType + * + * Create an event type + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateEventType $models_create_event_type Event Type Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEventType'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateEventType201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function createEventType($project_id, $models_create_event_type, string $contentType = self::contentTypes['createEventType'][0]) + { + list($response) = $this->createEventTypeWithHttpInfo($project_id, $models_create_event_type, $contentType); + return $response; + } + + /** + * Operation createEventTypeWithHttpInfo + * + * Create an event type + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateEventType $models_create_event_type Event Type Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEventType'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateEventType201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function createEventTypeWithHttpInfo($project_id, $models_create_event_type, string $contentType = self::contentTypes['createEventType'][0]) + { + $request = $this->createEventTypeRequest($project_id, $models_create_event_type, $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 201: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\CreateEventType201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateEventType201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateEventType201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation createEventTypeAsync + * + * Create an event type + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateEventType $models_create_event_type Event Type Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEventType'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createEventTypeAsync($project_id, $models_create_event_type, string $contentType = self::contentTypes['createEventType'][0]) + { + return $this->createEventTypeAsyncWithHttpInfo($project_id, $models_create_event_type, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createEventTypeAsyncWithHttpInfo + * + * Create an event type + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateEventType $models_create_event_type Event Type Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEventType'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createEventTypeAsyncWithHttpInfo($project_id, $models_create_event_type, string $contentType = self::contentTypes['createEventType'][0]) + { + $returnType = '\Convoy\Client\Model\CreateEventType201Response'; + $request = $this->createEventTypeRequest($project_id, $models_create_event_type, $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 'createEventType' + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateEventType $models_create_event_type Event Type Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEventType'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createEventTypeRequest($project_id, $models_create_event_type, string $contentType = self::contentTypes['createEventType'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling createEventType' + ); + } + + // verify the required parameter 'models_create_event_type' is set + if ($models_create_event_type === null || (is_array($models_create_event_type) && count($models_create_event_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_create_event_type when calling createEventType' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/event-types'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_create_event_type)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_create_event_type)); + } else { + $httpBody = $models_create_event_type; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 deprecateEventType + * + * Deprecates an event type + * + * @param string $project_id Project ID (required) + * @param string $event_type_id Event Type ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deprecateEventType'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateEventType201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function deprecateEventType($project_id, $event_type_id, string $contentType = self::contentTypes['deprecateEventType'][0]) + { + list($response) = $this->deprecateEventTypeWithHttpInfo($project_id, $event_type_id, $contentType); + return $response; + } + + /** + * Operation deprecateEventTypeWithHttpInfo + * + * Deprecates an event type + * + * @param string $project_id Project ID (required) + * @param string $event_type_id Event Type ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deprecateEventType'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateEventType201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function deprecateEventTypeWithHttpInfo($project_id, $event_type_id, string $contentType = self::contentTypes['deprecateEventType'][0]) + { + $request = $this->deprecateEventTypeRequest($project_id, $event_type_id, $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 201: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\CreateEventType201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateEventType201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateEventType201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation deprecateEventTypeAsync + * + * Deprecates an event type + * + * @param string $project_id Project ID (required) + * @param string $event_type_id Event Type ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deprecateEventType'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deprecateEventTypeAsync($project_id, $event_type_id, string $contentType = self::contentTypes['deprecateEventType'][0]) + { + return $this->deprecateEventTypeAsyncWithHttpInfo($project_id, $event_type_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deprecateEventTypeAsyncWithHttpInfo + * + * Deprecates an event type + * + * @param string $project_id Project ID (required) + * @param string $event_type_id Event Type ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deprecateEventType'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deprecateEventTypeAsyncWithHttpInfo($project_id, $event_type_id, string $contentType = self::contentTypes['deprecateEventType'][0]) + { + $returnType = '\Convoy\Client\Model\CreateEventType201Response'; + $request = $this->deprecateEventTypeRequest($project_id, $event_type_id, $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 'deprecateEventType' + * + * @param string $project_id Project ID (required) + * @param string $event_type_id Event Type ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deprecateEventType'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deprecateEventTypeRequest($project_id, $event_type_id, string $contentType = self::contentTypes['deprecateEventType'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling deprecateEventType' + ); + } + + // verify the required parameter 'event_type_id' is set + if ($event_type_id === null || (is_array($event_type_id) && count($event_type_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $event_type_id when calling deprecateEventType' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/event-types/{eventTypeId}/deprecate'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($event_type_id !== null) { + $resourcePath = str_replace( + '{eventTypeId}', + ObjectSerializer::toPathValue($event_type_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 getEventTypes + * + * Retrieves a project's event types + * + * @param string $project_id Project ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventTypes'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetEventTypes200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getEventTypes($project_id, string $contentType = self::contentTypes['getEventTypes'][0]) + { + list($response) = $this->getEventTypesWithHttpInfo($project_id, $contentType); + return $response; + } + + /** + * Operation getEventTypesWithHttpInfo + * + * Retrieves a project's event types + * + * @param string $project_id Project ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventTypes'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetEventTypes200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getEventTypesWithHttpInfo($project_id, string $contentType = self::contentTypes['getEventTypes'][0]) + { + $request = $this->getEventTypesRequest($project_id, $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( + '\Convoy\Client\Model\GetEventTypes200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetEventTypes200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetEventTypes200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getEventTypesAsync + * + * Retrieves a project's event types + * + * @param string $project_id Project ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventTypes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEventTypesAsync($project_id, string $contentType = self::contentTypes['getEventTypes'][0]) + { + return $this->getEventTypesAsyncWithHttpInfo($project_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEventTypesAsyncWithHttpInfo + * + * Retrieves a project's event types + * + * @param string $project_id Project ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventTypes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEventTypesAsyncWithHttpInfo($project_id, string $contentType = self::contentTypes['getEventTypes'][0]) + { + $returnType = '\Convoy\Client\Model\GetEventTypes200Response'; + $request = $this->getEventTypesRequest($project_id, $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 'getEventTypes' + * + * @param string $project_id Project ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventTypes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEventTypesRequest($project_id, string $contentType = self::contentTypes['getEventTypes'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getEventTypes' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/event-types'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 importOpenApiSpec + * + * Import event types from OpenAPI spec + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsImportOpenAPISpec $models_import_open_api_spec OpenAPI specification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importOpenApiSpec'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetEventTypes200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function importOpenApiSpec($project_id, $models_import_open_api_spec, string $contentType = self::contentTypes['importOpenApiSpec'][0]) + { + list($response) = $this->importOpenApiSpecWithHttpInfo($project_id, $models_import_open_api_spec, $contentType); + return $response; + } + + /** + * Operation importOpenApiSpecWithHttpInfo + * + * Import event types from OpenAPI spec + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsImportOpenAPISpec $models_import_open_api_spec OpenAPI specification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importOpenApiSpec'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetEventTypes200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function importOpenApiSpecWithHttpInfo($project_id, $models_import_open_api_spec, string $contentType = self::contentTypes['importOpenApiSpec'][0]) + { + $request = $this->importOpenApiSpecRequest($project_id, $models_import_open_api_spec, $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( + '\Convoy\Client\Model\GetEventTypes200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetEventTypes200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetEventTypes200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation importOpenApiSpecAsync + * + * Import event types from OpenAPI spec + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsImportOpenAPISpec $models_import_open_api_spec OpenAPI specification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importOpenApiSpec'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importOpenApiSpecAsync($project_id, $models_import_open_api_spec, string $contentType = self::contentTypes['importOpenApiSpec'][0]) + { + return $this->importOpenApiSpecAsyncWithHttpInfo($project_id, $models_import_open_api_spec, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation importOpenApiSpecAsyncWithHttpInfo + * + * Import event types from OpenAPI spec + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsImportOpenAPISpec $models_import_open_api_spec OpenAPI specification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importOpenApiSpec'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importOpenApiSpecAsyncWithHttpInfo($project_id, $models_import_open_api_spec, string $contentType = self::contentTypes['importOpenApiSpec'][0]) + { + $returnType = '\Convoy\Client\Model\GetEventTypes200Response'; + $request = $this->importOpenApiSpecRequest($project_id, $models_import_open_api_spec, $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 'importOpenApiSpec' + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsImportOpenAPISpec $models_import_open_api_spec OpenAPI specification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importOpenApiSpec'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function importOpenApiSpecRequest($project_id, $models_import_open_api_spec, string $contentType = self::contentTypes['importOpenApiSpec'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling importOpenApiSpec' + ); + } + + // verify the required parameter 'models_import_open_api_spec' is set + if ($models_import_open_api_spec === null || (is_array($models_import_open_api_spec) && count($models_import_open_api_spec) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_import_open_api_spec when calling importOpenApiSpec' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/event-types/import'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_import_open_api_spec)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_import_open_api_spec)); + } else { + $httpBody = $models_import_open_api_spec; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 updateEventType + * + * Updates an event type + * + * @param string $project_id Project ID (required) + * @param string $event_type_id Event Type ID (required) + * @param \Convoy\Client\Model\ModelsUpdateEventType $models_update_event_type Event Type Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEventType'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateEventType201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function updateEventType($project_id, $event_type_id, $models_update_event_type, string $contentType = self::contentTypes['updateEventType'][0]) + { + list($response) = $this->updateEventTypeWithHttpInfo($project_id, $event_type_id, $models_update_event_type, $contentType); + return $response; + } + + /** + * Operation updateEventTypeWithHttpInfo + * + * Updates an event type + * + * @param string $project_id Project ID (required) + * @param string $event_type_id Event Type ID (required) + * @param \Convoy\Client\Model\ModelsUpdateEventType $models_update_event_type Event Type Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEventType'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateEventType201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function updateEventTypeWithHttpInfo($project_id, $event_type_id, $models_update_event_type, string $contentType = self::contentTypes['updateEventType'][0]) + { + $request = $this->updateEventTypeRequest($project_id, $event_type_id, $models_update_event_type, $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 201: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\CreateEventType201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateEventType201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateEventType201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation updateEventTypeAsync + * + * Updates an event type + * + * @param string $project_id Project ID (required) + * @param string $event_type_id Event Type ID (required) + * @param \Convoy\Client\Model\ModelsUpdateEventType $models_update_event_type Event Type Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEventType'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateEventTypeAsync($project_id, $event_type_id, $models_update_event_type, string $contentType = self::contentTypes['updateEventType'][0]) + { + return $this->updateEventTypeAsyncWithHttpInfo($project_id, $event_type_id, $models_update_event_type, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateEventTypeAsyncWithHttpInfo + * + * Updates an event type + * + * @param string $project_id Project ID (required) + * @param string $event_type_id Event Type ID (required) + * @param \Convoy\Client\Model\ModelsUpdateEventType $models_update_event_type Event Type Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEventType'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateEventTypeAsyncWithHttpInfo($project_id, $event_type_id, $models_update_event_type, string $contentType = self::contentTypes['updateEventType'][0]) + { + $returnType = '\Convoy\Client\Model\CreateEventType201Response'; + $request = $this->updateEventTypeRequest($project_id, $event_type_id, $models_update_event_type, $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 'updateEventType' + * + * @param string $project_id Project ID (required) + * @param string $event_type_id Event Type ID (required) + * @param \Convoy\Client\Model\ModelsUpdateEventType $models_update_event_type Event Type Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEventType'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateEventTypeRequest($project_id, $event_type_id, $models_update_event_type, string $contentType = self::contentTypes['updateEventType'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling updateEventType' + ); + } + + // verify the required parameter 'event_type_id' is set + if ($event_type_id === null || (is_array($event_type_id) && count($event_type_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $event_type_id when calling updateEventType' + ); + } + + // verify the required parameter 'models_update_event_type' is set + if ($models_update_event_type === null || (is_array($models_update_event_type) && count($models_update_event_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_update_event_type when calling updateEventType' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/event-types/{eventTypeId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($event_type_id !== null) { + $resourcePath = str_replace( + '{eventTypeId}', + ObjectSerializer::toPathValue($event_type_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_update_event_type)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_update_event_type)); + } else { + $httpBody = $models_update_event_type; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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( + 'PUT', + $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; + } +} diff --git a/src/Client/Api/EventsApi.php b/src/Client/Api/EventsApi.php new file mode 100644 index 0000000..b775d21 --- /dev/null +++ b/src/Client/Api/EventsApi.php @@ -0,0 +1,3668 @@ + [ + 'application/json', + ], + 'countAffectedEvents' => [ + 'application/json', + ], + 'createBroadcastEvent' => [ + 'application/json', + ], + 'createDynamicEvent' => [ + 'application/json', + ], + 'createEndpointEvent' => [ + 'application/json', + ], + 'createEndpointFanoutEvent' => [ + 'application/json', + ], + 'getEndpointEvent' => [ + 'application/json', + ], + 'getEventsPaged' => [ + 'application/json', + ], + 'replayEndpointEvent' => [ + '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 batchReplayEvents + * + * Batch replay events + * + * @param string $project_id Project ID (required) + * @param string|null $direction direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint ids to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $query Any arbitrary value to filter the events payload (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string[]|null $source_id A list of Source IDs to filter the events by. (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchReplayEvents'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\BatchReplayEvents200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function batchReplayEvents($project_id, $direction = null, $end_date = null, $endpoint_id = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $query = null, $sort = null, $source_id = null, $start_date = null, string $contentType = self::contentTypes['batchReplayEvents'][0]) + { + list($response) = $this->batchReplayEventsWithHttpInfo($project_id, $direction, $end_date, $endpoint_id, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $query, $sort, $source_id, $start_date, $contentType); + return $response; + } + + /** + * Operation batchReplayEventsWithHttpInfo + * + * Batch replay events + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint ids to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $query Any arbitrary value to filter the events payload (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string[]|null $source_id A list of Source IDs to filter the events by. (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchReplayEvents'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\BatchReplayEvents200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function batchReplayEventsWithHttpInfo($project_id, $direction = null, $end_date = null, $endpoint_id = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $query = null, $sort = null, $source_id = null, $start_date = null, string $contentType = self::contentTypes['batchReplayEvents'][0]) + { + $request = $this->batchReplayEventsRequest($project_id, $direction, $end_date, $endpoint_id, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $query, $sort, $source_id, $start_date, $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( + '\Convoy\Client\Model\BatchReplayEvents200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\BatchReplayEvents200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\BatchReplayEvents200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation batchReplayEventsAsync + * + * Batch replay events + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint ids to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $query Any arbitrary value to filter the events payload (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string[]|null $source_id A list of Source IDs to filter the events by. (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchReplayEvents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function batchReplayEventsAsync($project_id, $direction = null, $end_date = null, $endpoint_id = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $query = null, $sort = null, $source_id = null, $start_date = null, string $contentType = self::contentTypes['batchReplayEvents'][0]) + { + return $this->batchReplayEventsAsyncWithHttpInfo($project_id, $direction, $end_date, $endpoint_id, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $query, $sort, $source_id, $start_date, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation batchReplayEventsAsyncWithHttpInfo + * + * Batch replay events + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint ids to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $query Any arbitrary value to filter the events payload (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string[]|null $source_id A list of Source IDs to filter the events by. (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchReplayEvents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function batchReplayEventsAsyncWithHttpInfo($project_id, $direction = null, $end_date = null, $endpoint_id = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $query = null, $sort = null, $source_id = null, $start_date = null, string $contentType = self::contentTypes['batchReplayEvents'][0]) + { + $returnType = '\Convoy\Client\Model\BatchReplayEvents200Response'; + $request = $this->batchReplayEventsRequest($project_id, $direction, $end_date, $endpoint_id, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $query, $sort, $source_id, $start_date, $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 'batchReplayEvents' + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint ids to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $query Any arbitrary value to filter the events payload (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string[]|null $source_id A list of Source IDs to filter the events by. (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchReplayEvents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function batchReplayEventsRequest($project_id, $direction = null, $end_date = null, $endpoint_id = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $query = null, $sort = null, $source_id = null, $start_date = null, string $contentType = self::contentTypes['batchReplayEvents'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling batchReplayEvents' + ); + } + + + + + + + + + + + + + + $resourcePath = '/v1/projects/{projectID}/events/batchreplay'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $direction, + 'direction', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $end_date, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endpoint_id, + 'endpointId', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $idempotency_key, + 'idempotencyKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next_page_cursor, + 'next_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $per_page, + 'perPage', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $prev_page_cursor, + 'prev_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $query, + 'query', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $source_id, + 'sourceId', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $start_date, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 countAffectedEvents + * + * Count events matching batch replay filters + * + * @param string $project_id Project ID (required) + * @param string|null $direction direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint ids to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $query Any arbitrary value to filter the events payload (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string[]|null $source_id A list of Source IDs to filter the events by. (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['countAffectedEvents'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CountAffectedEvents200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function countAffectedEvents($project_id, $direction = null, $end_date = null, $endpoint_id = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $query = null, $sort = null, $source_id = null, $start_date = null, string $contentType = self::contentTypes['countAffectedEvents'][0]) + { + list($response) = $this->countAffectedEventsWithHttpInfo($project_id, $direction, $end_date, $endpoint_id, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $query, $sort, $source_id, $start_date, $contentType); + return $response; + } + + /** + * Operation countAffectedEventsWithHttpInfo + * + * Count events matching batch replay filters + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint ids to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $query Any arbitrary value to filter the events payload (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string[]|null $source_id A list of Source IDs to filter the events by. (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['countAffectedEvents'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CountAffectedEvents200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function countAffectedEventsWithHttpInfo($project_id, $direction = null, $end_date = null, $endpoint_id = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $query = null, $sort = null, $source_id = null, $start_date = null, string $contentType = self::contentTypes['countAffectedEvents'][0]) + { + $request = $this->countAffectedEventsRequest($project_id, $direction, $end_date, $endpoint_id, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $query, $sort, $source_id, $start_date, $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( + '\Convoy\Client\Model\CountAffectedEvents200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CountAffectedEvents200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CountAffectedEvents200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation countAffectedEventsAsync + * + * Count events matching batch replay filters + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint ids to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $query Any arbitrary value to filter the events payload (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string[]|null $source_id A list of Source IDs to filter the events by. (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['countAffectedEvents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function countAffectedEventsAsync($project_id, $direction = null, $end_date = null, $endpoint_id = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $query = null, $sort = null, $source_id = null, $start_date = null, string $contentType = self::contentTypes['countAffectedEvents'][0]) + { + return $this->countAffectedEventsAsyncWithHttpInfo($project_id, $direction, $end_date, $endpoint_id, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $query, $sort, $source_id, $start_date, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation countAffectedEventsAsyncWithHttpInfo + * + * Count events matching batch replay filters + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint ids to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $query Any arbitrary value to filter the events payload (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string[]|null $source_id A list of Source IDs to filter the events by. (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['countAffectedEvents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function countAffectedEventsAsyncWithHttpInfo($project_id, $direction = null, $end_date = null, $endpoint_id = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $query = null, $sort = null, $source_id = null, $start_date = null, string $contentType = self::contentTypes['countAffectedEvents'][0]) + { + $returnType = '\Convoy\Client\Model\CountAffectedEvents200Response'; + $request = $this->countAffectedEventsRequest($project_id, $direction, $end_date, $endpoint_id, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $query, $sort, $source_id, $start_date, $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 'countAffectedEvents' + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint ids to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $query Any arbitrary value to filter the events payload (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string[]|null $source_id A list of Source IDs to filter the events by. (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['countAffectedEvents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function countAffectedEventsRequest($project_id, $direction = null, $end_date = null, $endpoint_id = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $query = null, $sort = null, $source_id = null, $start_date = null, string $contentType = self::contentTypes['countAffectedEvents'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling countAffectedEvents' + ); + } + + + + + + + + + + + + + + $resourcePath = '/v1/projects/{projectID}/events/countbatchreplayevents'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $direction, + 'direction', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $end_date, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endpoint_id, + 'endpointId', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $idempotency_key, + 'idempotencyKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next_page_cursor, + 'next_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $per_page, + 'perPage', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $prev_page_cursor, + 'prev_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $query, + 'query', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $source_id, + 'sourceId', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $start_date, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 createBroadcastEvent + * + * Create a broadcast event + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsBroadcastEvent $models_broadcast_event Broadcast Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBroadcastEvent'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateBroadcastEvent201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function createBroadcastEvent($project_id, $models_broadcast_event, string $contentType = self::contentTypes['createBroadcastEvent'][0]) + { + list($response) = $this->createBroadcastEventWithHttpInfo($project_id, $models_broadcast_event, $contentType); + return $response; + } + + /** + * Operation createBroadcastEventWithHttpInfo + * + * Create a broadcast event + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsBroadcastEvent $models_broadcast_event Broadcast Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBroadcastEvent'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateBroadcastEvent201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function createBroadcastEventWithHttpInfo($project_id, $models_broadcast_event, string $contentType = self::contentTypes['createBroadcastEvent'][0]) + { + $request = $this->createBroadcastEventRequest($project_id, $models_broadcast_event, $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 201: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\CreateBroadcastEvent201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateBroadcastEvent201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateBroadcastEvent201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation createBroadcastEventAsync + * + * Create a broadcast event + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsBroadcastEvent $models_broadcast_event Broadcast Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBroadcastEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createBroadcastEventAsync($project_id, $models_broadcast_event, string $contentType = self::contentTypes['createBroadcastEvent'][0]) + { + return $this->createBroadcastEventAsyncWithHttpInfo($project_id, $models_broadcast_event, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createBroadcastEventAsyncWithHttpInfo + * + * Create a broadcast event + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsBroadcastEvent $models_broadcast_event Broadcast Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBroadcastEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createBroadcastEventAsyncWithHttpInfo($project_id, $models_broadcast_event, string $contentType = self::contentTypes['createBroadcastEvent'][0]) + { + $returnType = '\Convoy\Client\Model\CreateBroadcastEvent201Response'; + $request = $this->createBroadcastEventRequest($project_id, $models_broadcast_event, $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 'createBroadcastEvent' + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsBroadcastEvent $models_broadcast_event Broadcast Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBroadcastEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createBroadcastEventRequest($project_id, $models_broadcast_event, string $contentType = self::contentTypes['createBroadcastEvent'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling createBroadcastEvent' + ); + } + + // verify the required parameter 'models_broadcast_event' is set + if ($models_broadcast_event === null || (is_array($models_broadcast_event) && count($models_broadcast_event) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_broadcast_event when calling createBroadcastEvent' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/events/broadcast'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_broadcast_event)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_broadcast_event)); + } else { + $httpBody = $models_broadcast_event; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 createDynamicEvent + * + * Dynamic Events + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsDynamicEvent $models_dynamic_event Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDynamicEvent'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function createDynamicEvent($project_id, $models_dynamic_event, string $contentType = self::contentTypes['createDynamicEvent'][0]) + { + list($response) = $this->createDynamicEventWithHttpInfo($project_id, $models_dynamic_event, $contentType); + return $response; + } + + /** + * Operation createDynamicEventWithHttpInfo + * + * Dynamic Events + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsDynamicEvent $models_dynamic_event Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDynamicEvent'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function createDynamicEventWithHttpInfo($project_id, $models_dynamic_event, string $contentType = self::contentTypes['createDynamicEvent'][0]) + { + $request = $this->createDynamicEventRequest($project_id, $models_dynamic_event, $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 201: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation createDynamicEventAsync + * + * Dynamic Events + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsDynamicEvent $models_dynamic_event Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDynamicEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createDynamicEventAsync($project_id, $models_dynamic_event, string $contentType = self::contentTypes['createDynamicEvent'][0]) + { + return $this->createDynamicEventAsyncWithHttpInfo($project_id, $models_dynamic_event, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createDynamicEventAsyncWithHttpInfo + * + * Dynamic Events + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsDynamicEvent $models_dynamic_event Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDynamicEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createDynamicEventAsyncWithHttpInfo($project_id, $models_dynamic_event, string $contentType = self::contentTypes['createDynamicEvent'][0]) + { + $returnType = '\Convoy\Client\Model\GetProjects400Response'; + $request = $this->createDynamicEventRequest($project_id, $models_dynamic_event, $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 'createDynamicEvent' + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsDynamicEvent $models_dynamic_event Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDynamicEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createDynamicEventRequest($project_id, $models_dynamic_event, string $contentType = self::contentTypes['createDynamicEvent'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling createDynamicEvent' + ); + } + + // verify the required parameter 'models_dynamic_event' is set + if ($models_dynamic_event === null || (is_array($models_dynamic_event) && count($models_dynamic_event) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_dynamic_event when calling createDynamicEvent' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/events/dynamic'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_dynamic_event)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_dynamic_event)); + } else { + $httpBody = $models_dynamic_event; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 createEndpointEvent + * + * Create an event + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateEvent $models_create_event Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpointEvent'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function createEndpointEvent($project_id, $models_create_event, string $contentType = self::contentTypes['createEndpointEvent'][0]) + { + list($response) = $this->createEndpointEventWithHttpInfo($project_id, $models_create_event, $contentType); + return $response; + } + + /** + * Operation createEndpointEventWithHttpInfo + * + * Create an event + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateEvent $models_create_event Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpointEvent'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function createEndpointEventWithHttpInfo($project_id, $models_create_event, string $contentType = self::contentTypes['createEndpointEvent'][0]) + { + $request = $this->createEndpointEventRequest($project_id, $models_create_event, $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 201: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation createEndpointEventAsync + * + * Create an event + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateEvent $models_create_event Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpointEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createEndpointEventAsync($project_id, $models_create_event, string $contentType = self::contentTypes['createEndpointEvent'][0]) + { + return $this->createEndpointEventAsyncWithHttpInfo($project_id, $models_create_event, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createEndpointEventAsyncWithHttpInfo + * + * Create an event + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateEvent $models_create_event Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpointEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createEndpointEventAsyncWithHttpInfo($project_id, $models_create_event, string $contentType = self::contentTypes['createEndpointEvent'][0]) + { + $returnType = '\Convoy\Client\Model\GetProjects400Response'; + $request = $this->createEndpointEventRequest($project_id, $models_create_event, $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 'createEndpointEvent' + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateEvent $models_create_event Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpointEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createEndpointEventRequest($project_id, $models_create_event, string $contentType = self::contentTypes['createEndpointEvent'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling createEndpointEvent' + ); + } + + // verify the required parameter 'models_create_event' is set + if ($models_create_event === null || (is_array($models_create_event) && count($models_create_event) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_create_event when calling createEndpointEvent' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/events'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_create_event)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_create_event)); + } else { + $httpBody = $models_create_event; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 createEndpointFanoutEvent + * + * Fan out an event + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsFanoutEvent $models_fanout_event Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpointFanoutEvent'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function createEndpointFanoutEvent($project_id, $models_fanout_event, string $contentType = self::contentTypes['createEndpointFanoutEvent'][0]) + { + list($response) = $this->createEndpointFanoutEventWithHttpInfo($project_id, $models_fanout_event, $contentType); + return $response; + } + + /** + * Operation createEndpointFanoutEventWithHttpInfo + * + * Fan out an event + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsFanoutEvent $models_fanout_event Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpointFanoutEvent'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function createEndpointFanoutEventWithHttpInfo($project_id, $models_fanout_event, string $contentType = self::contentTypes['createEndpointFanoutEvent'][0]) + { + $request = $this->createEndpointFanoutEventRequest($project_id, $models_fanout_event, $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 201: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation createEndpointFanoutEventAsync + * + * Fan out an event + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsFanoutEvent $models_fanout_event Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpointFanoutEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createEndpointFanoutEventAsync($project_id, $models_fanout_event, string $contentType = self::contentTypes['createEndpointFanoutEvent'][0]) + { + return $this->createEndpointFanoutEventAsyncWithHttpInfo($project_id, $models_fanout_event, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createEndpointFanoutEventAsyncWithHttpInfo + * + * Fan out an event + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsFanoutEvent $models_fanout_event Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpointFanoutEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createEndpointFanoutEventAsyncWithHttpInfo($project_id, $models_fanout_event, string $contentType = self::contentTypes['createEndpointFanoutEvent'][0]) + { + $returnType = '\Convoy\Client\Model\GetProjects400Response'; + $request = $this->createEndpointFanoutEventRequest($project_id, $models_fanout_event, $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 'createEndpointFanoutEvent' + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsFanoutEvent $models_fanout_event Event Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpointFanoutEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createEndpointFanoutEventRequest($project_id, $models_fanout_event, string $contentType = self::contentTypes['createEndpointFanoutEvent'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling createEndpointFanoutEvent' + ); + } + + // verify the required parameter 'models_fanout_event' is set + if ($models_fanout_event === null || (is_array($models_fanout_event) && count($models_fanout_event) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_fanout_event when calling createEndpointFanoutEvent' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/events/fanout'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_fanout_event)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_fanout_event)); + } else { + $httpBody = $models_fanout_event; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 getEndpointEvent + * + * Retrieve an event + * + * @param string $project_id Project ID (required) + * @param string $event_id event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpointEvent'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateBroadcastEvent201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getEndpointEvent($project_id, $event_id, string $contentType = self::contentTypes['getEndpointEvent'][0]) + { + list($response) = $this->getEndpointEventWithHttpInfo($project_id, $event_id, $contentType); + return $response; + } + + /** + * Operation getEndpointEventWithHttpInfo + * + * Retrieve an event + * + * @param string $project_id Project ID (required) + * @param string $event_id event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpointEvent'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateBroadcastEvent201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getEndpointEventWithHttpInfo($project_id, $event_id, string $contentType = self::contentTypes['getEndpointEvent'][0]) + { + $request = $this->getEndpointEventRequest($project_id, $event_id, $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( + '\Convoy\Client\Model\CreateBroadcastEvent201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateBroadcastEvent201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateBroadcastEvent201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getEndpointEventAsync + * + * Retrieve an event + * + * @param string $project_id Project ID (required) + * @param string $event_id event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpointEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEndpointEventAsync($project_id, $event_id, string $contentType = self::contentTypes['getEndpointEvent'][0]) + { + return $this->getEndpointEventAsyncWithHttpInfo($project_id, $event_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEndpointEventAsyncWithHttpInfo + * + * Retrieve an event + * + * @param string $project_id Project ID (required) + * @param string $event_id event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpointEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEndpointEventAsyncWithHttpInfo($project_id, $event_id, string $contentType = self::contentTypes['getEndpointEvent'][0]) + { + $returnType = '\Convoy\Client\Model\CreateBroadcastEvent201Response'; + $request = $this->getEndpointEventRequest($project_id, $event_id, $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 'getEndpointEvent' + * + * @param string $project_id Project ID (required) + * @param string $event_id event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpointEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEndpointEventRequest($project_id, $event_id, string $contentType = self::contentTypes['getEndpointEvent'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getEndpointEvent' + ); + } + + // verify the required parameter 'event_id' is set + if ($event_id === null || (is_array($event_id) && count($event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $event_id when calling getEndpointEvent' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/events/{eventID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($event_id !== null) { + $resourcePath = str_replace( + '{eventID}', + ObjectSerializer::toPathValue($event_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 getEventsPaged + * + * List all events + * + * @param string $project_id Project ID (required) + * @param string|null $direction direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint ids to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $query Any arbitrary value to filter the events payload (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string[]|null $source_id A list of Source IDs to filter the events by. (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventsPaged'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetEventsPaged200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getEventsPaged($project_id, $direction = null, $end_date = null, $endpoint_id = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $query = null, $sort = null, $source_id = null, $start_date = null, string $contentType = self::contentTypes['getEventsPaged'][0]) + { + list($response) = $this->getEventsPagedWithHttpInfo($project_id, $direction, $end_date, $endpoint_id, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $query, $sort, $source_id, $start_date, $contentType); + return $response; + } + + /** + * Operation getEventsPagedWithHttpInfo + * + * List all events + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint ids to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $query Any arbitrary value to filter the events payload (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string[]|null $source_id A list of Source IDs to filter the events by. (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventsPaged'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetEventsPaged200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getEventsPagedWithHttpInfo($project_id, $direction = null, $end_date = null, $endpoint_id = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $query = null, $sort = null, $source_id = null, $start_date = null, string $contentType = self::contentTypes['getEventsPaged'][0]) + { + $request = $this->getEventsPagedRequest($project_id, $direction, $end_date, $endpoint_id, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $query, $sort, $source_id, $start_date, $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( + '\Convoy\Client\Model\GetEventsPaged200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetEventsPaged200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetEventsPaged200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getEventsPagedAsync + * + * List all events + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint ids to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $query Any arbitrary value to filter the events payload (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string[]|null $source_id A list of Source IDs to filter the events by. (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventsPaged'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEventsPagedAsync($project_id, $direction = null, $end_date = null, $endpoint_id = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $query = null, $sort = null, $source_id = null, $start_date = null, string $contentType = self::contentTypes['getEventsPaged'][0]) + { + return $this->getEventsPagedAsyncWithHttpInfo($project_id, $direction, $end_date, $endpoint_id, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $query, $sort, $source_id, $start_date, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEventsPagedAsyncWithHttpInfo + * + * List all events + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint ids to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $query Any arbitrary value to filter the events payload (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string[]|null $source_id A list of Source IDs to filter the events by. (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventsPaged'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEventsPagedAsyncWithHttpInfo($project_id, $direction = null, $end_date = null, $endpoint_id = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $query = null, $sort = null, $source_id = null, $start_date = null, string $contentType = self::contentTypes['getEventsPaged'][0]) + { + $returnType = '\Convoy\Client\Model\GetEventsPaged200Response'; + $request = $this->getEventsPagedRequest($project_id, $direction, $end_date, $endpoint_id, $idempotency_key, $next_page_cursor, $per_page, $prev_page_cursor, $query, $sort, $source_id, $start_date, $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 'getEventsPaged' + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string[]|null $endpoint_id A list of endpoint ids to filter by (optional) + * @param string|null $idempotency_key IdempotencyKey to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $query Any arbitrary value to filter the events payload (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string[]|null $source_id A list of Source IDs to filter the events by. (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEventsPaged'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEventsPagedRequest($project_id, $direction = null, $end_date = null, $endpoint_id = null, $idempotency_key = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $query = null, $sort = null, $source_id = null, $start_date = null, string $contentType = self::contentTypes['getEventsPaged'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getEventsPaged' + ); + } + + + + + + + + + + + + + + $resourcePath = '/v1/projects/{projectID}/events'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $direction, + 'direction', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $end_date, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endpoint_id, + 'endpointId', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $idempotency_key, + 'idempotencyKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next_page_cursor, + 'next_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $per_page, + 'perPage', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $prev_page_cursor, + 'prev_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $query, + 'query', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $source_id, + 'sourceId', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $start_date, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 replayEndpointEvent + * + * Replay event + * + * @param string $project_id Project ID (required) + * @param string $event_id event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replayEndpointEvent'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateBroadcastEvent201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function replayEndpointEvent($project_id, $event_id, string $contentType = self::contentTypes['replayEndpointEvent'][0]) + { + list($response) = $this->replayEndpointEventWithHttpInfo($project_id, $event_id, $contentType); + return $response; + } + + /** + * Operation replayEndpointEventWithHttpInfo + * + * Replay event + * + * @param string $project_id Project ID (required) + * @param string $event_id event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replayEndpointEvent'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateBroadcastEvent201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function replayEndpointEventWithHttpInfo($project_id, $event_id, string $contentType = self::contentTypes['replayEndpointEvent'][0]) + { + $request = $this->replayEndpointEventRequest($project_id, $event_id, $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( + '\Convoy\Client\Model\CreateBroadcastEvent201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateBroadcastEvent201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateBroadcastEvent201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation replayEndpointEventAsync + * + * Replay event + * + * @param string $project_id Project ID (required) + * @param string $event_id event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replayEndpointEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function replayEndpointEventAsync($project_id, $event_id, string $contentType = self::contentTypes['replayEndpointEvent'][0]) + { + return $this->replayEndpointEventAsyncWithHttpInfo($project_id, $event_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation replayEndpointEventAsyncWithHttpInfo + * + * Replay event + * + * @param string $project_id Project ID (required) + * @param string $event_id event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replayEndpointEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function replayEndpointEventAsyncWithHttpInfo($project_id, $event_id, string $contentType = self::contentTypes['replayEndpointEvent'][0]) + { + $returnType = '\Convoy\Client\Model\CreateBroadcastEvent201Response'; + $request = $this->replayEndpointEventRequest($project_id, $event_id, $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 'replayEndpointEvent' + * + * @param string $project_id Project ID (required) + * @param string $event_id event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replayEndpointEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function replayEndpointEventRequest($project_id, $event_id, string $contentType = self::contentTypes['replayEndpointEvent'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling replayEndpointEvent' + ); + } + + // verify the required parameter 'event_id' is set + if ($event_id === null || (is_array($event_id) && count($event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $event_id when calling replayEndpointEvent' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/events/{eventID}/replay'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($event_id !== null) { + $resourcePath = str_replace( + '{eventID}', + ObjectSerializer::toPathValue($event_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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( + 'PUT', + $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; + } +} diff --git a/src/Client/Api/FiltersApi.php b/src/Client/Api/FiltersApi.php new file mode 100644 index 0000000..4f0eedc --- /dev/null +++ b/src/Client/Api/FiltersApi.php @@ -0,0 +1,3074 @@ + [ + 'application/json', + ], + 'bulkUpdateFilters' => [ + 'application/json', + ], + 'createFilter' => [ + 'application/json', + ], + 'deleteFilter' => [ + 'application/json', + ], + 'getFilter' => [ + 'application/json', + ], + 'getFilters' => [ + 'application/json', + ], + 'testFilter' => [ + 'application/json', + ], + 'updateFilter' => [ + '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 bulkCreateFilters + * + * Create multiple subscription filters + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param \Convoy\Client\Model\ModelsCreateFilterRequest[] $models_create_filter_request Filters to create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkCreateFilters'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetFilters200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function bulkCreateFilters($project_id, $subscription_id, $models_create_filter_request, string $contentType = self::contentTypes['bulkCreateFilters'][0]) + { + list($response) = $this->bulkCreateFiltersWithHttpInfo($project_id, $subscription_id, $models_create_filter_request, $contentType); + return $response; + } + + /** + * Operation bulkCreateFiltersWithHttpInfo + * + * Create multiple subscription filters + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param \Convoy\Client\Model\ModelsCreateFilterRequest[] $models_create_filter_request Filters to create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkCreateFilters'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetFilters200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function bulkCreateFiltersWithHttpInfo($project_id, $subscription_id, $models_create_filter_request, string $contentType = self::contentTypes['bulkCreateFilters'][0]) + { + $request = $this->bulkCreateFiltersRequest($project_id, $subscription_id, $models_create_filter_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 201: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetFilters200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetFilters200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetFilters200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation bulkCreateFiltersAsync + * + * Create multiple subscription filters + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param \Convoy\Client\Model\ModelsCreateFilterRequest[] $models_create_filter_request Filters to create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkCreateFilters'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function bulkCreateFiltersAsync($project_id, $subscription_id, $models_create_filter_request, string $contentType = self::contentTypes['bulkCreateFilters'][0]) + { + return $this->bulkCreateFiltersAsyncWithHttpInfo($project_id, $subscription_id, $models_create_filter_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation bulkCreateFiltersAsyncWithHttpInfo + * + * Create multiple subscription filters + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param \Convoy\Client\Model\ModelsCreateFilterRequest[] $models_create_filter_request Filters to create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkCreateFilters'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function bulkCreateFiltersAsyncWithHttpInfo($project_id, $subscription_id, $models_create_filter_request, string $contentType = self::contentTypes['bulkCreateFilters'][0]) + { + $returnType = '\Convoy\Client\Model\GetFilters200Response'; + $request = $this->bulkCreateFiltersRequest($project_id, $subscription_id, $models_create_filter_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 'bulkCreateFilters' + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param \Convoy\Client\Model\ModelsCreateFilterRequest[] $models_create_filter_request Filters to create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkCreateFilters'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function bulkCreateFiltersRequest($project_id, $subscription_id, $models_create_filter_request, string $contentType = self::contentTypes['bulkCreateFilters'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling bulkCreateFilters' + ); + } + + // verify the required parameter 'subscription_id' is set + if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscription_id when calling bulkCreateFilters' + ); + } + + // verify the required parameter 'models_create_filter_request' is set + if ($models_create_filter_request === null || (is_array($models_create_filter_request) && count($models_create_filter_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_create_filter_request when calling bulkCreateFilters' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/subscriptions/{subscriptionID}/filters/bulk'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($subscription_id !== null) { + $resourcePath = str_replace( + '{subscriptionID}', + ObjectSerializer::toPathValue($subscription_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_create_filter_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_create_filter_request)); + } else { + $httpBody = $models_create_filter_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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 bulkUpdateFilters + * + * Update multiple subscription filters + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param \Convoy\Client\Model\ModelsBulkUpdateFilterRequest[] $models_bulk_update_filter_request Filters to update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkUpdateFilters'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetFilters200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function bulkUpdateFilters($project_id, $subscription_id, $models_bulk_update_filter_request, string $contentType = self::contentTypes['bulkUpdateFilters'][0]) + { + list($response) = $this->bulkUpdateFiltersWithHttpInfo($project_id, $subscription_id, $models_bulk_update_filter_request, $contentType); + return $response; + } + + /** + * Operation bulkUpdateFiltersWithHttpInfo + * + * Update multiple subscription filters + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param \Convoy\Client\Model\ModelsBulkUpdateFilterRequest[] $models_bulk_update_filter_request Filters to update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkUpdateFilters'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetFilters200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function bulkUpdateFiltersWithHttpInfo($project_id, $subscription_id, $models_bulk_update_filter_request, string $contentType = self::contentTypes['bulkUpdateFilters'][0]) + { + $request = $this->bulkUpdateFiltersRequest($project_id, $subscription_id, $models_bulk_update_filter_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( + '\Convoy\Client\Model\GetFilters200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetFilters200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetFilters200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation bulkUpdateFiltersAsync + * + * Update multiple subscription filters + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param \Convoy\Client\Model\ModelsBulkUpdateFilterRequest[] $models_bulk_update_filter_request Filters to update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkUpdateFilters'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function bulkUpdateFiltersAsync($project_id, $subscription_id, $models_bulk_update_filter_request, string $contentType = self::contentTypes['bulkUpdateFilters'][0]) + { + return $this->bulkUpdateFiltersAsyncWithHttpInfo($project_id, $subscription_id, $models_bulk_update_filter_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation bulkUpdateFiltersAsyncWithHttpInfo + * + * Update multiple subscription filters + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param \Convoy\Client\Model\ModelsBulkUpdateFilterRequest[] $models_bulk_update_filter_request Filters to update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkUpdateFilters'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function bulkUpdateFiltersAsyncWithHttpInfo($project_id, $subscription_id, $models_bulk_update_filter_request, string $contentType = self::contentTypes['bulkUpdateFilters'][0]) + { + $returnType = '\Convoy\Client\Model\GetFilters200Response'; + $request = $this->bulkUpdateFiltersRequest($project_id, $subscription_id, $models_bulk_update_filter_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 'bulkUpdateFilters' + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param \Convoy\Client\Model\ModelsBulkUpdateFilterRequest[] $models_bulk_update_filter_request Filters to update (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkUpdateFilters'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function bulkUpdateFiltersRequest($project_id, $subscription_id, $models_bulk_update_filter_request, string $contentType = self::contentTypes['bulkUpdateFilters'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling bulkUpdateFilters' + ); + } + + // verify the required parameter 'subscription_id' is set + if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscription_id when calling bulkUpdateFilters' + ); + } + + // verify the required parameter 'models_bulk_update_filter_request' is set + if ($models_bulk_update_filter_request === null || (is_array($models_bulk_update_filter_request) && count($models_bulk_update_filter_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_bulk_update_filter_request when calling bulkUpdateFilters' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/subscriptions/{subscriptionID}/filters/bulk_update'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($subscription_id !== null) { + $resourcePath = str_replace( + '{subscriptionID}', + ObjectSerializer::toPathValue($subscription_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_bulk_update_filter_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_bulk_update_filter_request)); + } else { + $httpBody = $models_bulk_update_filter_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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createFilter + * + * Create a new filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param \Convoy\Client\Model\ModelsCreateFilterRequest $models_create_filter_request Filter to create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFilter'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateFilter201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function createFilter($project_id, $subscription_id, $models_create_filter_request, string $contentType = self::contentTypes['createFilter'][0]) + { + list($response) = $this->createFilterWithHttpInfo($project_id, $subscription_id, $models_create_filter_request, $contentType); + return $response; + } + + /** + * Operation createFilterWithHttpInfo + * + * Create a new filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param \Convoy\Client\Model\ModelsCreateFilterRequest $models_create_filter_request Filter to create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFilter'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateFilter201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function createFilterWithHttpInfo($project_id, $subscription_id, $models_create_filter_request, string $contentType = self::contentTypes['createFilter'][0]) + { + $request = $this->createFilterRequest($project_id, $subscription_id, $models_create_filter_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 201: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\CreateFilter201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateFilter201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateFilter201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation createFilterAsync + * + * Create a new filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param \Convoy\Client\Model\ModelsCreateFilterRequest $models_create_filter_request Filter to create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createFilterAsync($project_id, $subscription_id, $models_create_filter_request, string $contentType = self::contentTypes['createFilter'][0]) + { + return $this->createFilterAsyncWithHttpInfo($project_id, $subscription_id, $models_create_filter_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createFilterAsyncWithHttpInfo + * + * Create a new filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param \Convoy\Client\Model\ModelsCreateFilterRequest $models_create_filter_request Filter to create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createFilterAsyncWithHttpInfo($project_id, $subscription_id, $models_create_filter_request, string $contentType = self::contentTypes['createFilter'][0]) + { + $returnType = '\Convoy\Client\Model\CreateFilter201Response'; + $request = $this->createFilterRequest($project_id, $subscription_id, $models_create_filter_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 'createFilter' + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param \Convoy\Client\Model\ModelsCreateFilterRequest $models_create_filter_request Filter to create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createFilterRequest($project_id, $subscription_id, $models_create_filter_request, string $contentType = self::contentTypes['createFilter'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling createFilter' + ); + } + + // verify the required parameter 'subscription_id' is set + if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscription_id when calling createFilter' + ); + } + + // verify the required parameter 'models_create_filter_request' is set + if ($models_create_filter_request === null || (is_array($models_create_filter_request) && count($models_create_filter_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_create_filter_request when calling createFilter' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/subscriptions/{subscriptionID}/filters'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($subscription_id !== null) { + $resourcePath = str_replace( + '{subscriptionID}', + ObjectSerializer::toPathValue($subscription_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_create_filter_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_create_filter_request)); + } else { + $httpBody = $models_create_filter_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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 deleteFilter + * + * Delete a filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $filter_id Filter ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFilter'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function deleteFilter($project_id, $subscription_id, $filter_id, string $contentType = self::contentTypes['deleteFilter'][0]) + { + list($response) = $this->deleteFilterWithHttpInfo($project_id, $subscription_id, $filter_id, $contentType); + return $response; + } + + /** + * Operation deleteFilterWithHttpInfo + * + * Delete a filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $filter_id Filter ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFilter'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteFilterWithHttpInfo($project_id, $subscription_id, $filter_id, string $contentType = self::contentTypes['deleteFilter'][0]) + { + $request = $this->deleteFilterRequest($project_id, $subscription_id, $filter_id, $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation deleteFilterAsync + * + * Delete a filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $filter_id Filter ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteFilterAsync($project_id, $subscription_id, $filter_id, string $contentType = self::contentTypes['deleteFilter'][0]) + { + return $this->deleteFilterAsyncWithHttpInfo($project_id, $subscription_id, $filter_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteFilterAsyncWithHttpInfo + * + * Delete a filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $filter_id Filter ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteFilterAsyncWithHttpInfo($project_id, $subscription_id, $filter_id, string $contentType = self::contentTypes['deleteFilter'][0]) + { + $returnType = '\Convoy\Client\Model\GetProjects400Response'; + $request = $this->deleteFilterRequest($project_id, $subscription_id, $filter_id, $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 'deleteFilter' + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $filter_id Filter ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteFilterRequest($project_id, $subscription_id, $filter_id, string $contentType = self::contentTypes['deleteFilter'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling deleteFilter' + ); + } + + // verify the required parameter 'subscription_id' is set + if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscription_id when calling deleteFilter' + ); + } + + // verify the required parameter 'filter_id' is set + if ($filter_id === null || (is_array($filter_id) && count($filter_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $filter_id when calling deleteFilter' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/subscriptions/{subscriptionID}/filters/{filterID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($subscription_id !== null) { + $resourcePath = str_replace( + '{subscriptionID}', + ObjectSerializer::toPathValue($subscription_id), + $resourcePath + ); + } + // path params + if ($filter_id !== null) { + $resourcePath = str_replace( + '{filterID}', + ObjectSerializer::toPathValue($filter_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 getFilter + * + * Get a filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $filter_id Filter ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFilter'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateFilter201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getFilter($project_id, $subscription_id, $filter_id, string $contentType = self::contentTypes['getFilter'][0]) + { + list($response) = $this->getFilterWithHttpInfo($project_id, $subscription_id, $filter_id, $contentType); + return $response; + } + + /** + * Operation getFilterWithHttpInfo + * + * Get a filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $filter_id Filter ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFilter'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateFilter201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getFilterWithHttpInfo($project_id, $subscription_id, $filter_id, string $contentType = self::contentTypes['getFilter'][0]) + { + $request = $this->getFilterRequest($project_id, $subscription_id, $filter_id, $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( + '\Convoy\Client\Model\CreateFilter201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateFilter201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateFilter201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getFilterAsync + * + * Get a filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $filter_id Filter ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getFilterAsync($project_id, $subscription_id, $filter_id, string $contentType = self::contentTypes['getFilter'][0]) + { + return $this->getFilterAsyncWithHttpInfo($project_id, $subscription_id, $filter_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getFilterAsyncWithHttpInfo + * + * Get a filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $filter_id Filter ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getFilterAsyncWithHttpInfo($project_id, $subscription_id, $filter_id, string $contentType = self::contentTypes['getFilter'][0]) + { + $returnType = '\Convoy\Client\Model\CreateFilter201Response'; + $request = $this->getFilterRequest($project_id, $subscription_id, $filter_id, $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 'getFilter' + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $filter_id Filter ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getFilterRequest($project_id, $subscription_id, $filter_id, string $contentType = self::contentTypes['getFilter'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getFilter' + ); + } + + // verify the required parameter 'subscription_id' is set + if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscription_id when calling getFilter' + ); + } + + // verify the required parameter 'filter_id' is set + if ($filter_id === null || (is_array($filter_id) && count($filter_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $filter_id when calling getFilter' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/subscriptions/{subscriptionID}/filters/{filterID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($subscription_id !== null) { + $resourcePath = str_replace( + '{subscriptionID}', + ObjectSerializer::toPathValue($subscription_id), + $resourcePath + ); + } + // path params + if ($filter_id !== null) { + $resourcePath = str_replace( + '{filterID}', + ObjectSerializer::toPathValue($filter_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 getFilters + * + * List all filters + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFilters'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetFilters200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getFilters($project_id, $subscription_id, string $contentType = self::contentTypes['getFilters'][0]) + { + list($response) = $this->getFiltersWithHttpInfo($project_id, $subscription_id, $contentType); + return $response; + } + + /** + * Operation getFiltersWithHttpInfo + * + * List all filters + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFilters'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetFilters200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getFiltersWithHttpInfo($project_id, $subscription_id, string $contentType = self::contentTypes['getFilters'][0]) + { + $request = $this->getFiltersRequest($project_id, $subscription_id, $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( + '\Convoy\Client\Model\GetFilters200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetFilters200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetFilters200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getFiltersAsync + * + * List all filters + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFilters'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getFiltersAsync($project_id, $subscription_id, string $contentType = self::contentTypes['getFilters'][0]) + { + return $this->getFiltersAsyncWithHttpInfo($project_id, $subscription_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getFiltersAsyncWithHttpInfo + * + * List all filters + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFilters'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getFiltersAsyncWithHttpInfo($project_id, $subscription_id, string $contentType = self::contentTypes['getFilters'][0]) + { + $returnType = '\Convoy\Client\Model\GetFilters200Response'; + $request = $this->getFiltersRequest($project_id, $subscription_id, $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 'getFilters' + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFilters'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getFiltersRequest($project_id, $subscription_id, string $contentType = self::contentTypes['getFilters'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getFilters' + ); + } + + // verify the required parameter 'subscription_id' is set + if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscription_id when calling getFilters' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/subscriptions/{subscriptionID}/filters'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($subscription_id !== null) { + $resourcePath = str_replace( + '{subscriptionID}', + ObjectSerializer::toPathValue($subscription_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 testFilter + * + * Test a filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $event_type Event Type (required) + * @param \Convoy\Client\Model\ModelsTestFilterRequest $models_test_filter_request Payload to test (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFilter'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\TestFilter200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function testFilter($project_id, $subscription_id, $event_type, $models_test_filter_request, string $contentType = self::contentTypes['testFilter'][0]) + { + list($response) = $this->testFilterWithHttpInfo($project_id, $subscription_id, $event_type, $models_test_filter_request, $contentType); + return $response; + } + + /** + * Operation testFilterWithHttpInfo + * + * Test a filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $event_type Event Type (required) + * @param \Convoy\Client\Model\ModelsTestFilterRequest $models_test_filter_request Payload to test (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFilter'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\TestFilter200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function testFilterWithHttpInfo($project_id, $subscription_id, $event_type, $models_test_filter_request, string $contentType = self::contentTypes['testFilter'][0]) + { + $request = $this->testFilterRequest($project_id, $subscription_id, $event_type, $models_test_filter_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( + '\Convoy\Client\Model\TestFilter200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\TestFilter200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\TestFilter200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation testFilterAsync + * + * Test a filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $event_type Event Type (required) + * @param \Convoy\Client\Model\ModelsTestFilterRequest $models_test_filter_request Payload to test (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testFilterAsync($project_id, $subscription_id, $event_type, $models_test_filter_request, string $contentType = self::contentTypes['testFilter'][0]) + { + return $this->testFilterAsyncWithHttpInfo($project_id, $subscription_id, $event_type, $models_test_filter_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation testFilterAsyncWithHttpInfo + * + * Test a filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $event_type Event Type (required) + * @param \Convoy\Client\Model\ModelsTestFilterRequest $models_test_filter_request Payload to test (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testFilterAsyncWithHttpInfo($project_id, $subscription_id, $event_type, $models_test_filter_request, string $contentType = self::contentTypes['testFilter'][0]) + { + $returnType = '\Convoy\Client\Model\TestFilter200Response'; + $request = $this->testFilterRequest($project_id, $subscription_id, $event_type, $models_test_filter_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 'testFilter' + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $event_type Event Type (required) + * @param \Convoy\Client\Model\ModelsTestFilterRequest $models_test_filter_request Payload to test (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function testFilterRequest($project_id, $subscription_id, $event_type, $models_test_filter_request, string $contentType = self::contentTypes['testFilter'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling testFilter' + ); + } + + // verify the required parameter 'subscription_id' is set + if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscription_id when calling testFilter' + ); + } + + // verify the required parameter 'event_type' is set + if ($event_type === null || (is_array($event_type) && count($event_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $event_type when calling testFilter' + ); + } + + // verify the required parameter 'models_test_filter_request' is set + if ($models_test_filter_request === null || (is_array($models_test_filter_request) && count($models_test_filter_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_test_filter_request when calling testFilter' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/subscriptions/{subscriptionID}/filters/test/{eventType}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($subscription_id !== null) { + $resourcePath = str_replace( + '{subscriptionID}', + ObjectSerializer::toPathValue($subscription_id), + $resourcePath + ); + } + // path params + if ($event_type !== null) { + $resourcePath = str_replace( + '{eventType}', + ObjectSerializer::toPathValue($event_type), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_test_filter_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_test_filter_request)); + } else { + $httpBody = $models_test_filter_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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 updateFilter + * + * Update a filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $filter_id Filter ID (required) + * @param \Convoy\Client\Model\ModelsUpdateFilterRequest $models_update_filter_request Updated filter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFilter'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateFilter201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function updateFilter($project_id, $subscription_id, $filter_id, $models_update_filter_request, string $contentType = self::contentTypes['updateFilter'][0]) + { + list($response) = $this->updateFilterWithHttpInfo($project_id, $subscription_id, $filter_id, $models_update_filter_request, $contentType); + return $response; + } + + /** + * Operation updateFilterWithHttpInfo + * + * Update a filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $filter_id Filter ID (required) + * @param \Convoy\Client\Model\ModelsUpdateFilterRequest $models_update_filter_request Updated filter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFilter'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateFilter201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function updateFilterWithHttpInfo($project_id, $subscription_id, $filter_id, $models_update_filter_request, string $contentType = self::contentTypes['updateFilter'][0]) + { + $request = $this->updateFilterRequest($project_id, $subscription_id, $filter_id, $models_update_filter_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( + '\Convoy\Client\Model\CreateFilter201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateFilter201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateFilter201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation updateFilterAsync + * + * Update a filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $filter_id Filter ID (required) + * @param \Convoy\Client\Model\ModelsUpdateFilterRequest $models_update_filter_request Updated filter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateFilterAsync($project_id, $subscription_id, $filter_id, $models_update_filter_request, string $contentType = self::contentTypes['updateFilter'][0]) + { + return $this->updateFilterAsyncWithHttpInfo($project_id, $subscription_id, $filter_id, $models_update_filter_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateFilterAsyncWithHttpInfo + * + * Update a filter + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $filter_id Filter ID (required) + * @param \Convoy\Client\Model\ModelsUpdateFilterRequest $models_update_filter_request Updated filter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateFilterAsyncWithHttpInfo($project_id, $subscription_id, $filter_id, $models_update_filter_request, string $contentType = self::contentTypes['updateFilter'][0]) + { + $returnType = '\Convoy\Client\Model\CreateFilter201Response'; + $request = $this->updateFilterRequest($project_id, $subscription_id, $filter_id, $models_update_filter_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 'updateFilter' + * + * @param string $project_id Project ID (required) + * @param string $subscription_id Subscription ID (required) + * @param string $filter_id Filter ID (required) + * @param \Convoy\Client\Model\ModelsUpdateFilterRequest $models_update_filter_request Updated filter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateFilterRequest($project_id, $subscription_id, $filter_id, $models_update_filter_request, string $contentType = self::contentTypes['updateFilter'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling updateFilter' + ); + } + + // verify the required parameter 'subscription_id' is set + if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscription_id when calling updateFilter' + ); + } + + // verify the required parameter 'filter_id' is set + if ($filter_id === null || (is_array($filter_id) && count($filter_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $filter_id when calling updateFilter' + ); + } + + // verify the required parameter 'models_update_filter_request' is set + if ($models_update_filter_request === null || (is_array($models_update_filter_request) && count($models_update_filter_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_update_filter_request when calling updateFilter' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/subscriptions/{subscriptionID}/filters/{filterID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($subscription_id !== null) { + $resourcePath = str_replace( + '{subscriptionID}', + ObjectSerializer::toPathValue($subscription_id), + $resourcePath + ); + } + // path params + if ($filter_id !== null) { + $resourcePath = str_replace( + '{filterID}', + ObjectSerializer::toPathValue($filter_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_update_filter_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_update_filter_request)); + } else { + $httpBody = $models_update_filter_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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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( + 'PUT', + $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; + } +} diff --git a/src/Client/Api/MetaEventsApi.php b/src/Client/Api/MetaEventsApi.php new file mode 100644 index 0000000..15442e3 --- /dev/null +++ b/src/Client/Api/MetaEventsApi.php @@ -0,0 +1,1294 @@ + [ + 'application/json', + ], + 'getMetaEventsPaged' => [ + 'application/json', + ], + 'resendMetaEvent' => [ + '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 getMetaEvent + * + * Retrieve a meta event + * + * @param string $project_id Project ID (required) + * @param string $meta_event_id meta event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetaEvent'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetMetaEvent200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getMetaEvent($project_id, $meta_event_id, string $contentType = self::contentTypes['getMetaEvent'][0]) + { + list($response) = $this->getMetaEventWithHttpInfo($project_id, $meta_event_id, $contentType); + return $response; + } + + /** + * Operation getMetaEventWithHttpInfo + * + * Retrieve a meta event + * + * @param string $project_id Project ID (required) + * @param string $meta_event_id meta event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetaEvent'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetMetaEvent200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getMetaEventWithHttpInfo($project_id, $meta_event_id, string $contentType = self::contentTypes['getMetaEvent'][0]) + { + $request = $this->getMetaEventRequest($project_id, $meta_event_id, $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( + '\Convoy\Client\Model\GetMetaEvent200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetMetaEvent200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetMetaEvent200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getMetaEventAsync + * + * Retrieve a meta event + * + * @param string $project_id Project ID (required) + * @param string $meta_event_id meta event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetaEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getMetaEventAsync($project_id, $meta_event_id, string $contentType = self::contentTypes['getMetaEvent'][0]) + { + return $this->getMetaEventAsyncWithHttpInfo($project_id, $meta_event_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getMetaEventAsyncWithHttpInfo + * + * Retrieve a meta event + * + * @param string $project_id Project ID (required) + * @param string $meta_event_id meta event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetaEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getMetaEventAsyncWithHttpInfo($project_id, $meta_event_id, string $contentType = self::contentTypes['getMetaEvent'][0]) + { + $returnType = '\Convoy\Client\Model\GetMetaEvent200Response'; + $request = $this->getMetaEventRequest($project_id, $meta_event_id, $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 'getMetaEvent' + * + * @param string $project_id Project ID (required) + * @param string $meta_event_id meta event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetaEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getMetaEventRequest($project_id, $meta_event_id, string $contentType = self::contentTypes['getMetaEvent'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getMetaEvent' + ); + } + + // verify the required parameter 'meta_event_id' is set + if ($meta_event_id === null || (is_array($meta_event_id) && count($meta_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $meta_event_id when calling getMetaEvent' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/meta-events/{metaEventID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($meta_event_id !== null) { + $resourcePath = str_replace( + '{metaEventID}', + ObjectSerializer::toPathValue($meta_event_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 getMetaEventsPaged + * + * List all meta events + * + * @param string $project_id Project ID (required) + * @param string|null $direction direction (optional) + * @param string|null $end_date The end date (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetaEventsPaged'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetMetaEventsPaged200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getMetaEventsPaged($project_id, $direction = null, $end_date = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, $start_date = null, string $contentType = self::contentTypes['getMetaEventsPaged'][0]) + { + list($response) = $this->getMetaEventsPagedWithHttpInfo($project_id, $direction, $end_date, $next_page_cursor, $per_page, $prev_page_cursor, $sort, $start_date, $contentType); + return $response; + } + + /** + * Operation getMetaEventsPagedWithHttpInfo + * + * List all meta events + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetaEventsPaged'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetMetaEventsPaged200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getMetaEventsPagedWithHttpInfo($project_id, $direction = null, $end_date = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, $start_date = null, string $contentType = self::contentTypes['getMetaEventsPaged'][0]) + { + $request = $this->getMetaEventsPagedRequest($project_id, $direction, $end_date, $next_page_cursor, $per_page, $prev_page_cursor, $sort, $start_date, $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( + '\Convoy\Client\Model\GetMetaEventsPaged200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetMetaEventsPaged200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetMetaEventsPaged200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getMetaEventsPagedAsync + * + * List all meta events + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetaEventsPaged'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getMetaEventsPagedAsync($project_id, $direction = null, $end_date = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, $start_date = null, string $contentType = self::contentTypes['getMetaEventsPaged'][0]) + { + return $this->getMetaEventsPagedAsyncWithHttpInfo($project_id, $direction, $end_date, $next_page_cursor, $per_page, $prev_page_cursor, $sort, $start_date, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getMetaEventsPagedAsyncWithHttpInfo + * + * List all meta events + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetaEventsPaged'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getMetaEventsPagedAsyncWithHttpInfo($project_id, $direction = null, $end_date = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, $start_date = null, string $contentType = self::contentTypes['getMetaEventsPaged'][0]) + { + $returnType = '\Convoy\Client\Model\GetMetaEventsPaged200Response'; + $request = $this->getMetaEventsPagedRequest($project_id, $direction, $end_date, $next_page_cursor, $per_page, $prev_page_cursor, $sort, $start_date, $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 'getMetaEventsPaged' + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $end_date The end date (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $start_date The start date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetaEventsPaged'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getMetaEventsPagedRequest($project_id, $direction = null, $end_date = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, $start_date = null, string $contentType = self::contentTypes['getMetaEventsPaged'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getMetaEventsPaged' + ); + } + + + + + + + + + + $resourcePath = '/v1/projects/{projectID}/meta-events'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $direction, + 'direction', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $end_date, + 'endDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next_page_cursor, + 'next_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $per_page, + 'perPage', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $prev_page_cursor, + 'prev_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $start_date, + 'startDate', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 resendMetaEvent + * + * Retry meta event + * + * @param string $project_id Project ID (required) + * @param string $meta_event_id meta event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resendMetaEvent'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetMetaEvent200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function resendMetaEvent($project_id, $meta_event_id, string $contentType = self::contentTypes['resendMetaEvent'][0]) + { + list($response) = $this->resendMetaEventWithHttpInfo($project_id, $meta_event_id, $contentType); + return $response; + } + + /** + * Operation resendMetaEventWithHttpInfo + * + * Retry meta event + * + * @param string $project_id Project ID (required) + * @param string $meta_event_id meta event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resendMetaEvent'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetMetaEvent200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function resendMetaEventWithHttpInfo($project_id, $meta_event_id, string $contentType = self::contentTypes['resendMetaEvent'][0]) + { + $request = $this->resendMetaEventRequest($project_id, $meta_event_id, $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( + '\Convoy\Client\Model\GetMetaEvent200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetMetaEvent200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetMetaEvent200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation resendMetaEventAsync + * + * Retry meta event + * + * @param string $project_id Project ID (required) + * @param string $meta_event_id meta event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resendMetaEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function resendMetaEventAsync($project_id, $meta_event_id, string $contentType = self::contentTypes['resendMetaEvent'][0]) + { + return $this->resendMetaEventAsyncWithHttpInfo($project_id, $meta_event_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation resendMetaEventAsyncWithHttpInfo + * + * Retry meta event + * + * @param string $project_id Project ID (required) + * @param string $meta_event_id meta event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resendMetaEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function resendMetaEventAsyncWithHttpInfo($project_id, $meta_event_id, string $contentType = self::contentTypes['resendMetaEvent'][0]) + { + $returnType = '\Convoy\Client\Model\GetMetaEvent200Response'; + $request = $this->resendMetaEventRequest($project_id, $meta_event_id, $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 'resendMetaEvent' + * + * @param string $project_id Project ID (required) + * @param string $meta_event_id meta event id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resendMetaEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function resendMetaEventRequest($project_id, $meta_event_id, string $contentType = self::contentTypes['resendMetaEvent'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling resendMetaEvent' + ); + } + + // verify the required parameter 'meta_event_id' is set + if ($meta_event_id === null || (is_array($meta_event_id) && count($meta_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $meta_event_id when calling resendMetaEvent' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/meta-events/{metaEventID}/resend'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($meta_event_id !== null) { + $resourcePath = str_replace( + '{metaEventID}', + ObjectSerializer::toPathValue($meta_event_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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( + 'PUT', + $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; + } +} diff --git a/src/Client/Api/OnboardApi.php b/src/Client/Api/OnboardApi.php new file mode 100644 index 0000000..c4dd982 --- /dev/null +++ b/src/Client/Api/OnboardApi.php @@ -0,0 +1,555 @@ + [ + 'application/octet-stream', + ], + ]; + + /** + * @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 bulkOnboard + * + * Bulk onboard endpoints with subscriptions + * + * @param string $project_id Project ID (required) + * @param bool|null $dry_run Validate without creating (optional) + * @param \SplFileObject|null $body Onboard Details (JSON) (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkOnboard'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\BulkOnboard200Response|\Convoy\Client\Model\BulkOnboard202Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function bulkOnboard($project_id, $dry_run = null, $body = null, string $contentType = self::contentTypes['bulkOnboard'][0]) + { + list($response) = $this->bulkOnboardWithHttpInfo($project_id, $dry_run, $body, $contentType); + return $response; + } + + /** + * Operation bulkOnboardWithHttpInfo + * + * Bulk onboard endpoints with subscriptions + * + * @param string $project_id Project ID (required) + * @param bool|null $dry_run Validate without creating (optional) + * @param \SplFileObject|null $body Onboard Details (JSON) (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkOnboard'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\BulkOnboard200Response|\Convoy\Client\Model\BulkOnboard202Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function bulkOnboardWithHttpInfo($project_id, $dry_run = null, $body = null, string $contentType = self::contentTypes['bulkOnboard'][0]) + { + $request = $this->bulkOnboardRequest($project_id, $dry_run, $body, $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( + '\Convoy\Client\Model\BulkOnboard200Response', + $request, + $response, + ); + case 202: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\BulkOnboard202Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\BulkOnboard200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\BulkOnboard200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\BulkOnboard202Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation bulkOnboardAsync + * + * Bulk onboard endpoints with subscriptions + * + * @param string $project_id Project ID (required) + * @param bool|null $dry_run Validate without creating (optional) + * @param \SplFileObject|null $body Onboard Details (JSON) (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkOnboard'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function bulkOnboardAsync($project_id, $dry_run = null, $body = null, string $contentType = self::contentTypes['bulkOnboard'][0]) + { + return $this->bulkOnboardAsyncWithHttpInfo($project_id, $dry_run, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation bulkOnboardAsyncWithHttpInfo + * + * Bulk onboard endpoints with subscriptions + * + * @param string $project_id Project ID (required) + * @param bool|null $dry_run Validate without creating (optional) + * @param \SplFileObject|null $body Onboard Details (JSON) (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkOnboard'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function bulkOnboardAsyncWithHttpInfo($project_id, $dry_run = null, $body = null, string $contentType = self::contentTypes['bulkOnboard'][0]) + { + $returnType = '\Convoy\Client\Model\BulkOnboard200Response'; + $request = $this->bulkOnboardRequest($project_id, $dry_run, $body, $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 'bulkOnboard' + * + * @param string $project_id Project ID (required) + * @param bool|null $dry_run Validate without creating (optional) + * @param \SplFileObject|null $body Onboard Details (JSON) (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkOnboard'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function bulkOnboardRequest($project_id, $dry_run = null, $body = null, string $contentType = self::contentTypes['bulkOnboard'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling bulkOnboard' + ); + } + + + + + $resourcePath = '/v1/projects/{projectID}/onboard'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $dry_run, + 'dry_run', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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; + } +} diff --git a/src/Client/Api/PortalLinksApi.php b/src/Client/Api/PortalLinksApi.php new file mode 100644 index 0000000..4c37d02 --- /dev/null +++ b/src/Client/Api/PortalLinksApi.php @@ -0,0 +1,2326 @@ + [ + 'application/json', + ], + 'getPortalLink' => [ + 'application/json', + ], + 'loadPortalLinksPaged' => [ + 'application/json', + ], + 'refreshPortalLinkAuthToken' => [ + 'application/json', + ], + 'revokePortalLink' => [ + 'application/json', + ], + 'updatePortalLink' => [ + '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 createPortalLink + * + * Create a portal link + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\DatastoreCreatePortalLinkRequest $datastore_create_portal_link_request Portal Link Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPortalLink'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreatePortalLink201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function createPortalLink($project_id, $datastore_create_portal_link_request, string $contentType = self::contentTypes['createPortalLink'][0]) + { + list($response) = $this->createPortalLinkWithHttpInfo($project_id, $datastore_create_portal_link_request, $contentType); + return $response; + } + + /** + * Operation createPortalLinkWithHttpInfo + * + * Create a portal link + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\DatastoreCreatePortalLinkRequest $datastore_create_portal_link_request Portal Link Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPortalLink'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreatePortalLink201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function createPortalLinkWithHttpInfo($project_id, $datastore_create_portal_link_request, string $contentType = self::contentTypes['createPortalLink'][0]) + { + $request = $this->createPortalLinkRequest($project_id, $datastore_create_portal_link_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 201: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\CreatePortalLink201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreatePortalLink201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreatePortalLink201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation createPortalLinkAsync + * + * Create a portal link + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\DatastoreCreatePortalLinkRequest $datastore_create_portal_link_request Portal Link Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPortalLink'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPortalLinkAsync($project_id, $datastore_create_portal_link_request, string $contentType = self::contentTypes['createPortalLink'][0]) + { + return $this->createPortalLinkAsyncWithHttpInfo($project_id, $datastore_create_portal_link_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createPortalLinkAsyncWithHttpInfo + * + * Create a portal link + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\DatastoreCreatePortalLinkRequest $datastore_create_portal_link_request Portal Link Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPortalLink'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPortalLinkAsyncWithHttpInfo($project_id, $datastore_create_portal_link_request, string $contentType = self::contentTypes['createPortalLink'][0]) + { + $returnType = '\Convoy\Client\Model\CreatePortalLink201Response'; + $request = $this->createPortalLinkRequest($project_id, $datastore_create_portal_link_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 'createPortalLink' + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\DatastoreCreatePortalLinkRequest $datastore_create_portal_link_request Portal Link Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPortalLink'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createPortalLinkRequest($project_id, $datastore_create_portal_link_request, string $contentType = self::contentTypes['createPortalLink'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling createPortalLink' + ); + } + + // verify the required parameter 'datastore_create_portal_link_request' is set + if ($datastore_create_portal_link_request === null || (is_array($datastore_create_portal_link_request) && count($datastore_create_portal_link_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $datastore_create_portal_link_request when calling createPortalLink' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/portal-links'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($datastore_create_portal_link_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($datastore_create_portal_link_request)); + } else { + $httpBody = $datastore_create_portal_link_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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 getPortalLink + * + * Retrieve a portal link + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPortalLink'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreatePortalLink201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getPortalLink($project_id, $portal_link_id, string $contentType = self::contentTypes['getPortalLink'][0]) + { + list($response) = $this->getPortalLinkWithHttpInfo($project_id, $portal_link_id, $contentType); + return $response; + } + + /** + * Operation getPortalLinkWithHttpInfo + * + * Retrieve a portal link + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPortalLink'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreatePortalLink201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getPortalLinkWithHttpInfo($project_id, $portal_link_id, string $contentType = self::contentTypes['getPortalLink'][0]) + { + $request = $this->getPortalLinkRequest($project_id, $portal_link_id, $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( + '\Convoy\Client\Model\CreatePortalLink201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreatePortalLink201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreatePortalLink201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getPortalLinkAsync + * + * Retrieve a portal link + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPortalLink'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPortalLinkAsync($project_id, $portal_link_id, string $contentType = self::contentTypes['getPortalLink'][0]) + { + return $this->getPortalLinkAsyncWithHttpInfo($project_id, $portal_link_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPortalLinkAsyncWithHttpInfo + * + * Retrieve a portal link + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPortalLink'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPortalLinkAsyncWithHttpInfo($project_id, $portal_link_id, string $contentType = self::contentTypes['getPortalLink'][0]) + { + $returnType = '\Convoy\Client\Model\CreatePortalLink201Response'; + $request = $this->getPortalLinkRequest($project_id, $portal_link_id, $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 'getPortalLink' + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPortalLink'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPortalLinkRequest($project_id, $portal_link_id, string $contentType = self::contentTypes['getPortalLink'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getPortalLink' + ); + } + + // verify the required parameter 'portal_link_id' is set + if ($portal_link_id === null || (is_array($portal_link_id) && count($portal_link_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $portal_link_id when calling getPortalLink' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/portal-links/{portalLinkID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($portal_link_id !== null) { + $resourcePath = str_replace( + '{portalLinkID}', + ObjectSerializer::toPathValue($portal_link_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 loadPortalLinksPaged + * + * List all portal links + * + * @param string $project_id Project ID (required) + * @param string|null $direction direction (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param string|null $owner_id The owner ID of the endpoint (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $q The name of the endpoint (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loadPortalLinksPaged'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\LoadPortalLinksPaged200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function loadPortalLinksPaged($project_id, $direction = null, $next_page_cursor = null, $owner_id = null, $per_page = null, $prev_page_cursor = null, $q = null, $sort = null, string $contentType = self::contentTypes['loadPortalLinksPaged'][0]) + { + list($response) = $this->loadPortalLinksPagedWithHttpInfo($project_id, $direction, $next_page_cursor, $owner_id, $per_page, $prev_page_cursor, $q, $sort, $contentType); + return $response; + } + + /** + * Operation loadPortalLinksPagedWithHttpInfo + * + * List all portal links + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param string|null $owner_id The owner ID of the endpoint (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $q The name of the endpoint (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loadPortalLinksPaged'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\LoadPortalLinksPaged200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function loadPortalLinksPagedWithHttpInfo($project_id, $direction = null, $next_page_cursor = null, $owner_id = null, $per_page = null, $prev_page_cursor = null, $q = null, $sort = null, string $contentType = self::contentTypes['loadPortalLinksPaged'][0]) + { + $request = $this->loadPortalLinksPagedRequest($project_id, $direction, $next_page_cursor, $owner_id, $per_page, $prev_page_cursor, $q, $sort, $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( + '\Convoy\Client\Model\LoadPortalLinksPaged200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\LoadPortalLinksPaged200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\LoadPortalLinksPaged200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation loadPortalLinksPagedAsync + * + * List all portal links + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param string|null $owner_id The owner ID of the endpoint (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $q The name of the endpoint (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loadPortalLinksPaged'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function loadPortalLinksPagedAsync($project_id, $direction = null, $next_page_cursor = null, $owner_id = null, $per_page = null, $prev_page_cursor = null, $q = null, $sort = null, string $contentType = self::contentTypes['loadPortalLinksPaged'][0]) + { + return $this->loadPortalLinksPagedAsyncWithHttpInfo($project_id, $direction, $next_page_cursor, $owner_id, $per_page, $prev_page_cursor, $q, $sort, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation loadPortalLinksPagedAsyncWithHttpInfo + * + * List all portal links + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param string|null $owner_id The owner ID of the endpoint (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $q The name of the endpoint (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loadPortalLinksPaged'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function loadPortalLinksPagedAsyncWithHttpInfo($project_id, $direction = null, $next_page_cursor = null, $owner_id = null, $per_page = null, $prev_page_cursor = null, $q = null, $sort = null, string $contentType = self::contentTypes['loadPortalLinksPaged'][0]) + { + $returnType = '\Convoy\Client\Model\LoadPortalLinksPaged200Response'; + $request = $this->loadPortalLinksPagedRequest($project_id, $direction, $next_page_cursor, $owner_id, $per_page, $prev_page_cursor, $q, $sort, $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 'loadPortalLinksPaged' + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param string|null $owner_id The owner ID of the endpoint (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $q The name of the endpoint (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loadPortalLinksPaged'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function loadPortalLinksPagedRequest($project_id, $direction = null, $next_page_cursor = null, $owner_id = null, $per_page = null, $prev_page_cursor = null, $q = null, $sort = null, string $contentType = self::contentTypes['loadPortalLinksPaged'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling loadPortalLinksPaged' + ); + } + + + + + + + + + + $resourcePath = '/v1/projects/{projectID}/portal-links'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $direction, + 'direction', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next_page_cursor, + 'next_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $owner_id, + 'ownerId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $per_page, + 'perPage', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $prev_page_cursor, + 'prev_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $q, + 'q', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 refreshPortalLinkAuthToken + * + * Get a portal link auth token + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['refreshPortalLinkAuthToken'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\BatchReplayEvents200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function refreshPortalLinkAuthToken($project_id, $portal_link_id, string $contentType = self::contentTypes['refreshPortalLinkAuthToken'][0]) + { + list($response) = $this->refreshPortalLinkAuthTokenWithHttpInfo($project_id, $portal_link_id, $contentType); + return $response; + } + + /** + * Operation refreshPortalLinkAuthTokenWithHttpInfo + * + * Get a portal link auth token + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['refreshPortalLinkAuthToken'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\BatchReplayEvents200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function refreshPortalLinkAuthTokenWithHttpInfo($project_id, $portal_link_id, string $contentType = self::contentTypes['refreshPortalLinkAuthToken'][0]) + { + $request = $this->refreshPortalLinkAuthTokenRequest($project_id, $portal_link_id, $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( + '\Convoy\Client\Model\BatchReplayEvents200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\BatchReplayEvents200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\BatchReplayEvents200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation refreshPortalLinkAuthTokenAsync + * + * Get a portal link auth token + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['refreshPortalLinkAuthToken'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function refreshPortalLinkAuthTokenAsync($project_id, $portal_link_id, string $contentType = self::contentTypes['refreshPortalLinkAuthToken'][0]) + { + return $this->refreshPortalLinkAuthTokenAsyncWithHttpInfo($project_id, $portal_link_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation refreshPortalLinkAuthTokenAsyncWithHttpInfo + * + * Get a portal link auth token + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['refreshPortalLinkAuthToken'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function refreshPortalLinkAuthTokenAsyncWithHttpInfo($project_id, $portal_link_id, string $contentType = self::contentTypes['refreshPortalLinkAuthToken'][0]) + { + $returnType = '\Convoy\Client\Model\BatchReplayEvents200Response'; + $request = $this->refreshPortalLinkAuthTokenRequest($project_id, $portal_link_id, $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 'refreshPortalLinkAuthToken' + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['refreshPortalLinkAuthToken'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function refreshPortalLinkAuthTokenRequest($project_id, $portal_link_id, string $contentType = self::contentTypes['refreshPortalLinkAuthToken'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling refreshPortalLinkAuthToken' + ); + } + + // verify the required parameter 'portal_link_id' is set + if ($portal_link_id === null || (is_array($portal_link_id) && count($portal_link_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $portal_link_id when calling refreshPortalLinkAuthToken' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/portal-links/{portalLinkID}/refresh_token'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($portal_link_id !== null) { + $resourcePath = str_replace( + '{portalLinkID}', + ObjectSerializer::toPathValue($portal_link_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 revokePortalLink + * + * Revoke a portal link + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['revokePortalLink'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function revokePortalLink($project_id, $portal_link_id, string $contentType = self::contentTypes['revokePortalLink'][0]) + { + list($response) = $this->revokePortalLinkWithHttpInfo($project_id, $portal_link_id, $contentType); + return $response; + } + + /** + * Operation revokePortalLinkWithHttpInfo + * + * Revoke a portal link + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['revokePortalLink'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function revokePortalLinkWithHttpInfo($project_id, $portal_link_id, string $contentType = self::contentTypes['revokePortalLink'][0]) + { + $request = $this->revokePortalLinkRequest($project_id, $portal_link_id, $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation revokePortalLinkAsync + * + * Revoke a portal link + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['revokePortalLink'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function revokePortalLinkAsync($project_id, $portal_link_id, string $contentType = self::contentTypes['revokePortalLink'][0]) + { + return $this->revokePortalLinkAsyncWithHttpInfo($project_id, $portal_link_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation revokePortalLinkAsyncWithHttpInfo + * + * Revoke a portal link + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['revokePortalLink'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function revokePortalLinkAsyncWithHttpInfo($project_id, $portal_link_id, string $contentType = self::contentTypes['revokePortalLink'][0]) + { + $returnType = '\Convoy\Client\Model\GetProjects400Response'; + $request = $this->revokePortalLinkRequest($project_id, $portal_link_id, $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 'revokePortalLink' + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['revokePortalLink'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function revokePortalLinkRequest($project_id, $portal_link_id, string $contentType = self::contentTypes['revokePortalLink'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling revokePortalLink' + ); + } + + // verify the required parameter 'portal_link_id' is set + if ($portal_link_id === null || (is_array($portal_link_id) && count($portal_link_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $portal_link_id when calling revokePortalLink' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/portal-links/{portalLinkID}/revoke'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($portal_link_id !== null) { + $resourcePath = str_replace( + '{portalLinkID}', + ObjectSerializer::toPathValue($portal_link_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updatePortalLink + * + * Update a portal link + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param \Convoy\Client\Model\DatastoreUpdatePortalLinkRequest $datastore_update_portal_link_request Portal Link Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePortalLink'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreatePortalLink201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function updatePortalLink($project_id, $portal_link_id, $datastore_update_portal_link_request, string $contentType = self::contentTypes['updatePortalLink'][0]) + { + list($response) = $this->updatePortalLinkWithHttpInfo($project_id, $portal_link_id, $datastore_update_portal_link_request, $contentType); + return $response; + } + + /** + * Operation updatePortalLinkWithHttpInfo + * + * Update a portal link + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param \Convoy\Client\Model\DatastoreUpdatePortalLinkRequest $datastore_update_portal_link_request Portal Link Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePortalLink'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreatePortalLink201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function updatePortalLinkWithHttpInfo($project_id, $portal_link_id, $datastore_update_portal_link_request, string $contentType = self::contentTypes['updatePortalLink'][0]) + { + $request = $this->updatePortalLinkRequest($project_id, $portal_link_id, $datastore_update_portal_link_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 202: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\CreatePortalLink201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreatePortalLink201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreatePortalLink201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation updatePortalLinkAsync + * + * Update a portal link + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param \Convoy\Client\Model\DatastoreUpdatePortalLinkRequest $datastore_update_portal_link_request Portal Link Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePortalLink'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updatePortalLinkAsync($project_id, $portal_link_id, $datastore_update_portal_link_request, string $contentType = self::contentTypes['updatePortalLink'][0]) + { + return $this->updatePortalLinkAsyncWithHttpInfo($project_id, $portal_link_id, $datastore_update_portal_link_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updatePortalLinkAsyncWithHttpInfo + * + * Update a portal link + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param \Convoy\Client\Model\DatastoreUpdatePortalLinkRequest $datastore_update_portal_link_request Portal Link Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePortalLink'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updatePortalLinkAsyncWithHttpInfo($project_id, $portal_link_id, $datastore_update_portal_link_request, string $contentType = self::contentTypes['updatePortalLink'][0]) + { + $returnType = '\Convoy\Client\Model\CreatePortalLink201Response'; + $request = $this->updatePortalLinkRequest($project_id, $portal_link_id, $datastore_update_portal_link_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 'updatePortalLink' + * + * @param string $project_id Project ID (required) + * @param string $portal_link_id portal link id (required) + * @param \Convoy\Client\Model\DatastoreUpdatePortalLinkRequest $datastore_update_portal_link_request Portal Link Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePortalLink'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updatePortalLinkRequest($project_id, $portal_link_id, $datastore_update_portal_link_request, string $contentType = self::contentTypes['updatePortalLink'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling updatePortalLink' + ); + } + + // verify the required parameter 'portal_link_id' is set + if ($portal_link_id === null || (is_array($portal_link_id) && count($portal_link_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $portal_link_id when calling updatePortalLink' + ); + } + + // verify the required parameter 'datastore_update_portal_link_request' is set + if ($datastore_update_portal_link_request === null || (is_array($datastore_update_portal_link_request) && count($datastore_update_portal_link_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $datastore_update_portal_link_request when calling updatePortalLink' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/portal-links/{portalLinkID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($portal_link_id !== null) { + $resourcePath = str_replace( + '{portalLinkID}', + ObjectSerializer::toPathValue($portal_link_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($datastore_update_portal_link_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($datastore_update_portal_link_request)); + } else { + $httpBody = $datastore_update_portal_link_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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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( + 'PUT', + $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; + } +} diff --git a/src/Client/Api/ProjectsApi.php b/src/Client/Api/ProjectsApi.php new file mode 100644 index 0000000..981525d --- /dev/null +++ b/src/Client/Api/ProjectsApi.php @@ -0,0 +1,1881 @@ + [ + 'application/json', + ], + 'deleteProject' => [ + 'application/json', + ], + 'getProject' => [ + 'application/json', + ], + 'getProjects' => [ + 'application/json', + ], + 'updateProject' => [ + '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 createProject + * + * Create a project + * + * @param string $org_id Organisation ID (required) + * @param \Convoy\Client\Model\ModelsCreateProject $models_create_project Project Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProject'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateProject201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function createProject($org_id, $models_create_project, string $contentType = self::contentTypes['createProject'][0]) + { + list($response) = $this->createProjectWithHttpInfo($org_id, $models_create_project, $contentType); + return $response; + } + + /** + * Operation createProjectWithHttpInfo + * + * Create a project + * + * @param string $org_id Organisation ID (required) + * @param \Convoy\Client\Model\ModelsCreateProject $models_create_project Project Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProject'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateProject201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function createProjectWithHttpInfo($org_id, $models_create_project, string $contentType = self::contentTypes['createProject'][0]) + { + $request = $this->createProjectRequest($org_id, $models_create_project, $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 201: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\CreateProject201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 402: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateProject201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateProject201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation createProjectAsync + * + * Create a project + * + * @param string $org_id Organisation ID (required) + * @param \Convoy\Client\Model\ModelsCreateProject $models_create_project Project Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProject'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createProjectAsync($org_id, $models_create_project, string $contentType = self::contentTypes['createProject'][0]) + { + return $this->createProjectAsyncWithHttpInfo($org_id, $models_create_project, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createProjectAsyncWithHttpInfo + * + * Create a project + * + * @param string $org_id Organisation ID (required) + * @param \Convoy\Client\Model\ModelsCreateProject $models_create_project Project Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProject'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createProjectAsyncWithHttpInfo($org_id, $models_create_project, string $contentType = self::contentTypes['createProject'][0]) + { + $returnType = '\Convoy\Client\Model\CreateProject201Response'; + $request = $this->createProjectRequest($org_id, $models_create_project, $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 'createProject' + * + * @param string $org_id Organisation ID (required) + * @param \Convoy\Client\Model\ModelsCreateProject $models_create_project Project Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProject'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createProjectRequest($org_id, $models_create_project, string $contentType = self::contentTypes['createProject'][0]) + { + + // verify the required parameter 'org_id' is set + if ($org_id === null || (is_array($org_id) && count($org_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $org_id when calling createProject' + ); + } + + // verify the required parameter 'models_create_project' is set + if ($models_create_project === null || (is_array($models_create_project) && count($models_create_project) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_create_project when calling createProject' + ); + } + + + $resourcePath = '/v1/projects'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $org_id, + 'orgID', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_create_project)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_create_project)); + } else { + $httpBody = $models_create_project; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 deleteProject + * + * Delete a project + * + * @param string $project_id Project ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProject'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function deleteProject($project_id, string $contentType = self::contentTypes['deleteProject'][0]) + { + list($response) = $this->deleteProjectWithHttpInfo($project_id, $contentType); + return $response; + } + + /** + * Operation deleteProjectWithHttpInfo + * + * Delete a project + * + * @param string $project_id Project ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProject'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteProjectWithHttpInfo($project_id, string $contentType = self::contentTypes['deleteProject'][0]) + { + $request = $this->deleteProjectRequest($project_id, $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation deleteProjectAsync + * + * Delete a project + * + * @param string $project_id Project ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProject'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteProjectAsync($project_id, string $contentType = self::contentTypes['deleteProject'][0]) + { + return $this->deleteProjectAsyncWithHttpInfo($project_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteProjectAsyncWithHttpInfo + * + * Delete a project + * + * @param string $project_id Project ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProject'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteProjectAsyncWithHttpInfo($project_id, string $contentType = self::contentTypes['deleteProject'][0]) + { + $returnType = '\Convoy\Client\Model\GetProjects400Response'; + $request = $this->deleteProjectRequest($project_id, $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 'deleteProject' + * + * @param string $project_id Project ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProject'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteProjectRequest($project_id, string $contentType = self::contentTypes['deleteProject'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling deleteProject' + ); + } + + + $resourcePath = '/v1/projects/{projectID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 getProject + * + * Retrieve a project + * + * @param string $project_id Project ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProject'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetProject200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getProject($project_id, string $contentType = self::contentTypes['getProject'][0]) + { + list($response) = $this->getProjectWithHttpInfo($project_id, $contentType); + return $response; + } + + /** + * Operation getProjectWithHttpInfo + * + * Retrieve a project + * + * @param string $project_id Project ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProject'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetProject200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectWithHttpInfo($project_id, string $contentType = self::contentTypes['getProject'][0]) + { + $request = $this->getProjectRequest($project_id, $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( + '\Convoy\Client\Model\GetProject200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetProject200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProject200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getProjectAsync + * + * Retrieve a project + * + * @param string $project_id Project ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProject'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getProjectAsync($project_id, string $contentType = self::contentTypes['getProject'][0]) + { + return $this->getProjectAsyncWithHttpInfo($project_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectAsyncWithHttpInfo + * + * Retrieve a project + * + * @param string $project_id Project ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProject'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getProjectAsyncWithHttpInfo($project_id, string $contentType = self::contentTypes['getProject'][0]) + { + $returnType = '\Convoy\Client\Model\GetProject200Response'; + $request = $this->getProjectRequest($project_id, $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 'getProject' + * + * @param string $project_id Project ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProject'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getProjectRequest($project_id, string $contentType = self::contentTypes['getProject'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getProject' + ); + } + + + $resourcePath = '/v1/projects/{projectID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 getProjects + * + * List all projects + * + * @param string $org_id Organisation ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProjects'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetProjects200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getProjects($org_id, string $contentType = self::contentTypes['getProjects'][0]) + { + list($response) = $this->getProjectsWithHttpInfo($org_id, $contentType); + return $response; + } + + /** + * Operation getProjectsWithHttpInfo + * + * List all projects + * + * @param string $org_id Organisation ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProjects'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetProjects200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectsWithHttpInfo($org_id, string $contentType = self::contentTypes['getProjects'][0]) + { + $request = $this->getProjectsRequest($org_id, $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( + '\Convoy\Client\Model\GetProjects200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetProjects200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getProjectsAsync + * + * List all projects + * + * @param string $org_id Organisation ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProjects'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getProjectsAsync($org_id, string $contentType = self::contentTypes['getProjects'][0]) + { + return $this->getProjectsAsyncWithHttpInfo($org_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectsAsyncWithHttpInfo + * + * List all projects + * + * @param string $org_id Organisation ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProjects'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getProjectsAsyncWithHttpInfo($org_id, string $contentType = self::contentTypes['getProjects'][0]) + { + $returnType = '\Convoy\Client\Model\GetProjects200Response'; + $request = $this->getProjectsRequest($org_id, $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 'getProjects' + * + * @param string $org_id Organisation ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProjects'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getProjectsRequest($org_id, string $contentType = self::contentTypes['getProjects'][0]) + { + + // verify the required parameter 'org_id' is set + if ($org_id === null || (is_array($org_id) && count($org_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $org_id when calling getProjects' + ); + } + + + $resourcePath = '/v1/projects'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $org_id, + 'orgID', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 updateProject + * + * Update a project + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsUpdateProject $models_update_project Project Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProject'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetProject200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function updateProject($project_id, $models_update_project, string $contentType = self::contentTypes['updateProject'][0]) + { + list($response) = $this->updateProjectWithHttpInfo($project_id, $models_update_project, $contentType); + return $response; + } + + /** + * Operation updateProjectWithHttpInfo + * + * Update a project + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsUpdateProject $models_update_project Project Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProject'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetProject200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function updateProjectWithHttpInfo($project_id, $models_update_project, string $contentType = self::contentTypes['updateProject'][0]) + { + $request = $this->updateProjectRequest($project_id, $models_update_project, $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 202: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProject200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetProject200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProject200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation updateProjectAsync + * + * Update a project + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsUpdateProject $models_update_project Project Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProject'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateProjectAsync($project_id, $models_update_project, string $contentType = self::contentTypes['updateProject'][0]) + { + return $this->updateProjectAsyncWithHttpInfo($project_id, $models_update_project, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateProjectAsyncWithHttpInfo + * + * Update a project + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsUpdateProject $models_update_project Project Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProject'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateProjectAsyncWithHttpInfo($project_id, $models_update_project, string $contentType = self::contentTypes['updateProject'][0]) + { + $returnType = '\Convoy\Client\Model\GetProject200Response'; + $request = $this->updateProjectRequest($project_id, $models_update_project, $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 'updateProject' + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsUpdateProject $models_update_project Project Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProject'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateProjectRequest($project_id, $models_update_project, string $contentType = self::contentTypes['updateProject'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling updateProject' + ); + } + + // verify the required parameter 'models_update_project' is set + if ($models_update_project === null || (is_array($models_update_project) && count($models_update_project) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_update_project when calling updateProject' + ); + } + + + $resourcePath = '/v1/projects/{projectID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_update_project)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_update_project)); + } else { + $httpBody = $models_update_project; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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( + 'PUT', + $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; + } +} diff --git a/src/Client/Api/SourcesApi.php b/src/Client/Api/SourcesApi.php new file mode 100644 index 0000000..c5d23d9 --- /dev/null +++ b/src/Client/Api/SourcesApi.php @@ -0,0 +1,1988 @@ + [ + 'application/json', + ], + 'deleteSource' => [ + 'application/json', + ], + 'getSource' => [ + 'application/json', + ], + 'loadSourcesPaged' => [ + 'application/json', + ], + 'updateSource' => [ + '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 createSource + * + * Create a source + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateSource $models_create_source Source Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSource'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateSource201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function createSource($project_id, $models_create_source, string $contentType = self::contentTypes['createSource'][0]) + { + list($response) = $this->createSourceWithHttpInfo($project_id, $models_create_source, $contentType); + return $response; + } + + /** + * Operation createSourceWithHttpInfo + * + * Create a source + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateSource $models_create_source Source Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSource'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateSource201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function createSourceWithHttpInfo($project_id, $models_create_source, string $contentType = self::contentTypes['createSource'][0]) + { + $request = $this->createSourceRequest($project_id, $models_create_source, $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 201: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\CreateSource201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateSource201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateSource201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation createSourceAsync + * + * Create a source + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateSource $models_create_source Source Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSource'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSourceAsync($project_id, $models_create_source, string $contentType = self::contentTypes['createSource'][0]) + { + return $this->createSourceAsyncWithHttpInfo($project_id, $models_create_source, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createSourceAsyncWithHttpInfo + * + * Create a source + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateSource $models_create_source Source Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSource'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSourceAsyncWithHttpInfo($project_id, $models_create_source, string $contentType = self::contentTypes['createSource'][0]) + { + $returnType = '\Convoy\Client\Model\CreateSource201Response'; + $request = $this->createSourceRequest($project_id, $models_create_source, $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 'createSource' + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateSource $models_create_source Source Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSource'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createSourceRequest($project_id, $models_create_source, string $contentType = self::contentTypes['createSource'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling createSource' + ); + } + + // verify the required parameter 'models_create_source' is set + if ($models_create_source === null || (is_array($models_create_source) && count($models_create_source) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_create_source when calling createSource' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/sources'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_create_source)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_create_source)); + } else { + $httpBody = $models_create_source; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 deleteSource + * + * Delete a source + * + * @param string $project_id Project ID (required) + * @param string $source_id source id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSource'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function deleteSource($project_id, $source_id, string $contentType = self::contentTypes['deleteSource'][0]) + { + list($response) = $this->deleteSourceWithHttpInfo($project_id, $source_id, $contentType); + return $response; + } + + /** + * Operation deleteSourceWithHttpInfo + * + * Delete a source + * + * @param string $project_id Project ID (required) + * @param string $source_id source id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSource'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteSourceWithHttpInfo($project_id, $source_id, string $contentType = self::contentTypes['deleteSource'][0]) + { + $request = $this->deleteSourceRequest($project_id, $source_id, $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation deleteSourceAsync + * + * Delete a source + * + * @param string $project_id Project ID (required) + * @param string $source_id source id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSource'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSourceAsync($project_id, $source_id, string $contentType = self::contentTypes['deleteSource'][0]) + { + return $this->deleteSourceAsyncWithHttpInfo($project_id, $source_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteSourceAsyncWithHttpInfo + * + * Delete a source + * + * @param string $project_id Project ID (required) + * @param string $source_id source id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSource'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSourceAsyncWithHttpInfo($project_id, $source_id, string $contentType = self::contentTypes['deleteSource'][0]) + { + $returnType = '\Convoy\Client\Model\GetProjects400Response'; + $request = $this->deleteSourceRequest($project_id, $source_id, $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 'deleteSource' + * + * @param string $project_id Project ID (required) + * @param string $source_id source id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSource'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteSourceRequest($project_id, $source_id, string $contentType = self::contentTypes['deleteSource'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling deleteSource' + ); + } + + // verify the required parameter 'source_id' is set + if ($source_id === null || (is_array($source_id) && count($source_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $source_id when calling deleteSource' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/sources/{sourceID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($source_id !== null) { + $resourcePath = str_replace( + '{sourceID}', + ObjectSerializer::toPathValue($source_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 getSource + * + * Retrieve a source + * + * @param string $project_id Project ID (required) + * @param string $source_id Source ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSource'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateSource201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getSource($project_id, $source_id, string $contentType = self::contentTypes['getSource'][0]) + { + list($response) = $this->getSourceWithHttpInfo($project_id, $source_id, $contentType); + return $response; + } + + /** + * Operation getSourceWithHttpInfo + * + * Retrieve a source + * + * @param string $project_id Project ID (required) + * @param string $source_id Source ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSource'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateSource201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getSourceWithHttpInfo($project_id, $source_id, string $contentType = self::contentTypes['getSource'][0]) + { + $request = $this->getSourceRequest($project_id, $source_id, $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( + '\Convoy\Client\Model\CreateSource201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateSource201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateSource201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getSourceAsync + * + * Retrieve a source + * + * @param string $project_id Project ID (required) + * @param string $source_id Source ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSource'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSourceAsync($project_id, $source_id, string $contentType = self::contentTypes['getSource'][0]) + { + return $this->getSourceAsyncWithHttpInfo($project_id, $source_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSourceAsyncWithHttpInfo + * + * Retrieve a source + * + * @param string $project_id Project ID (required) + * @param string $source_id Source ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSource'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSourceAsyncWithHttpInfo($project_id, $source_id, string $contentType = self::contentTypes['getSource'][0]) + { + $returnType = '\Convoy\Client\Model\CreateSource201Response'; + $request = $this->getSourceRequest($project_id, $source_id, $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 'getSource' + * + * @param string $project_id Project ID (required) + * @param string $source_id Source ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSource'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSourceRequest($project_id, $source_id, string $contentType = self::contentTypes['getSource'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getSource' + ); + } + + // verify the required parameter 'source_id' is set + if ($source_id === null || (is_array($source_id) && count($source_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $source_id when calling getSource' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/sources/{sourceID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($source_id !== null) { + $resourcePath = str_replace( + '{sourceID}', + ObjectSerializer::toPathValue($source_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 loadSourcesPaged + * + * List all sources + * + * @param string $project_id Project ID (required) + * @param string|null $direction direction (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $provider The custom source provider e.g. twitter, shopify (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $type The source type e.g. http, pub_sub (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loadSourcesPaged'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\LoadSourcesPaged200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function loadSourcesPaged($project_id, $direction = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $provider = null, $sort = null, $type = null, string $contentType = self::contentTypes['loadSourcesPaged'][0]) + { + list($response) = $this->loadSourcesPagedWithHttpInfo($project_id, $direction, $next_page_cursor, $per_page, $prev_page_cursor, $provider, $sort, $type, $contentType); + return $response; + } + + /** + * Operation loadSourcesPagedWithHttpInfo + * + * List all sources + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $provider The custom source provider e.g. twitter, shopify (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $type The source type e.g. http, pub_sub (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loadSourcesPaged'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\LoadSourcesPaged200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function loadSourcesPagedWithHttpInfo($project_id, $direction = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $provider = null, $sort = null, $type = null, string $contentType = self::contentTypes['loadSourcesPaged'][0]) + { + $request = $this->loadSourcesPagedRequest($project_id, $direction, $next_page_cursor, $per_page, $prev_page_cursor, $provider, $sort, $type, $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( + '\Convoy\Client\Model\LoadSourcesPaged200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\LoadSourcesPaged200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\LoadSourcesPaged200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation loadSourcesPagedAsync + * + * List all sources + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $provider The custom source provider e.g. twitter, shopify (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $type The source type e.g. http, pub_sub (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loadSourcesPaged'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function loadSourcesPagedAsync($project_id, $direction = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $provider = null, $sort = null, $type = null, string $contentType = self::contentTypes['loadSourcesPaged'][0]) + { + return $this->loadSourcesPagedAsyncWithHttpInfo($project_id, $direction, $next_page_cursor, $per_page, $prev_page_cursor, $provider, $sort, $type, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation loadSourcesPagedAsyncWithHttpInfo + * + * List all sources + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $provider The custom source provider e.g. twitter, shopify (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $type The source type e.g. http, pub_sub (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loadSourcesPaged'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function loadSourcesPagedAsyncWithHttpInfo($project_id, $direction = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $provider = null, $sort = null, $type = null, string $contentType = self::contentTypes['loadSourcesPaged'][0]) + { + $returnType = '\Convoy\Client\Model\LoadSourcesPaged200Response'; + $request = $this->loadSourcesPagedRequest($project_id, $direction, $next_page_cursor, $per_page, $prev_page_cursor, $provider, $sort, $type, $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 'loadSourcesPaged' + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $provider The custom source provider e.g. twitter, shopify (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string|null $type The source type e.g. http, pub_sub (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loadSourcesPaged'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function loadSourcesPagedRequest($project_id, $direction = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $provider = null, $sort = null, $type = null, string $contentType = self::contentTypes['loadSourcesPaged'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling loadSourcesPaged' + ); + } + + + + + + + + + + $resourcePath = '/v1/projects/{projectID}/sources'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $direction, + 'direction', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next_page_cursor, + 'next_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $per_page, + 'perPage', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $prev_page_cursor, + 'prev_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $provider, + 'provider', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $type, + 'type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 updateSource + * + * Update a source + * + * @param string $project_id Project ID (required) + * @param string $source_id source id (required) + * @param \Convoy\Client\Model\ModelsUpdateSource $models_update_source Source Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSource'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateSource201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function updateSource($project_id, $source_id, $models_update_source, string $contentType = self::contentTypes['updateSource'][0]) + { + list($response) = $this->updateSourceWithHttpInfo($project_id, $source_id, $models_update_source, $contentType); + return $response; + } + + /** + * Operation updateSourceWithHttpInfo + * + * Update a source + * + * @param string $project_id Project ID (required) + * @param string $source_id source id (required) + * @param \Convoy\Client\Model\ModelsUpdateSource $models_update_source Source Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSource'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateSource201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function updateSourceWithHttpInfo($project_id, $source_id, $models_update_source, string $contentType = self::contentTypes['updateSource'][0]) + { + $request = $this->updateSourceRequest($project_id, $source_id, $models_update_source, $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 202: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\CreateSource201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateSource201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateSource201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation updateSourceAsync + * + * Update a source + * + * @param string $project_id Project ID (required) + * @param string $source_id source id (required) + * @param \Convoy\Client\Model\ModelsUpdateSource $models_update_source Source Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSource'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateSourceAsync($project_id, $source_id, $models_update_source, string $contentType = self::contentTypes['updateSource'][0]) + { + return $this->updateSourceAsyncWithHttpInfo($project_id, $source_id, $models_update_source, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateSourceAsyncWithHttpInfo + * + * Update a source + * + * @param string $project_id Project ID (required) + * @param string $source_id source id (required) + * @param \Convoy\Client\Model\ModelsUpdateSource $models_update_source Source Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSource'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateSourceAsyncWithHttpInfo($project_id, $source_id, $models_update_source, string $contentType = self::contentTypes['updateSource'][0]) + { + $returnType = '\Convoy\Client\Model\CreateSource201Response'; + $request = $this->updateSourceRequest($project_id, $source_id, $models_update_source, $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 'updateSource' + * + * @param string $project_id Project ID (required) + * @param string $source_id source id (required) + * @param \Convoy\Client\Model\ModelsUpdateSource $models_update_source Source Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSource'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateSourceRequest($project_id, $source_id, $models_update_source, string $contentType = self::contentTypes['updateSource'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling updateSource' + ); + } + + // verify the required parameter 'source_id' is set + if ($source_id === null || (is_array($source_id) && count($source_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $source_id when calling updateSource' + ); + } + + // verify the required parameter 'models_update_source' is set + if ($models_update_source === null || (is_array($models_update_source) && count($models_update_source) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_update_source when calling updateSource' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/sources/{sourceID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($source_id !== null) { + $resourcePath = str_replace( + '{sourceID}', + ObjectSerializer::toPathValue($source_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_update_source)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_update_source)); + } else { + $httpBody = $models_update_source; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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( + 'PUT', + $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; + } +} diff --git a/src/Client/Api/SubscriptionsApi.php b/src/Client/Api/SubscriptionsApi.php new file mode 100644 index 0000000..81337ee --- /dev/null +++ b/src/Client/Api/SubscriptionsApi.php @@ -0,0 +1,3337 @@ + [ + 'application/json', + ], + 'deleteSubscription' => [ + 'application/json', + ], + 'getSubscription' => [ + 'application/json', + ], + 'getSubscriptions' => [ + 'application/json', + ], + 'testSubscriptionFilter' => [ + 'application/json', + ], + 'testSubscriptionFunction' => [ + 'application/json', + ], + 'toggleSubscriptionStatus' => [ + 'application/json', + ], + 'updateSubscription' => [ + 'application/json', + ], + 'v1ProjectsProjectIDSourcesTestFunctionPost' => [ + '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 createSubscription + * + * Create a subscription + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateSubscription $models_create_subscription Subscription details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSubscription'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateSubscription201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function createSubscription($project_id, $models_create_subscription, string $contentType = self::contentTypes['createSubscription'][0]) + { + list($response) = $this->createSubscriptionWithHttpInfo($project_id, $models_create_subscription, $contentType); + return $response; + } + + /** + * Operation createSubscriptionWithHttpInfo + * + * Create a subscription + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateSubscription $models_create_subscription Subscription details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSubscription'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateSubscription201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function createSubscriptionWithHttpInfo($project_id, $models_create_subscription, string $contentType = self::contentTypes['createSubscription'][0]) + { + $request = $this->createSubscriptionRequest($project_id, $models_create_subscription, $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 201: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\CreateSubscription201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateSubscription201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateSubscription201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation createSubscriptionAsync + * + * Create a subscription + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateSubscription $models_create_subscription Subscription details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSubscription'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSubscriptionAsync($project_id, $models_create_subscription, string $contentType = self::contentTypes['createSubscription'][0]) + { + return $this->createSubscriptionAsyncWithHttpInfo($project_id, $models_create_subscription, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createSubscriptionAsyncWithHttpInfo + * + * Create a subscription + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateSubscription $models_create_subscription Subscription details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSubscription'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSubscriptionAsyncWithHttpInfo($project_id, $models_create_subscription, string $contentType = self::contentTypes['createSubscription'][0]) + { + $returnType = '\Convoy\Client\Model\CreateSubscription201Response'; + $request = $this->createSubscriptionRequest($project_id, $models_create_subscription, $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 'createSubscription' + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsCreateSubscription $models_create_subscription Subscription details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSubscription'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createSubscriptionRequest($project_id, $models_create_subscription, string $contentType = self::contentTypes['createSubscription'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling createSubscription' + ); + } + + // verify the required parameter 'models_create_subscription' is set + if ($models_create_subscription === null || (is_array($models_create_subscription) && count($models_create_subscription) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_create_subscription when calling createSubscription' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/subscriptions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_create_subscription)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_create_subscription)); + } else { + $httpBody = $models_create_subscription; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 deleteSubscription + * + * Delete subscription + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubscription'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function deleteSubscription($project_id, $subscription_id, string $contentType = self::contentTypes['deleteSubscription'][0]) + { + list($response) = $this->deleteSubscriptionWithHttpInfo($project_id, $subscription_id, $contentType); + return $response; + } + + /** + * Operation deleteSubscriptionWithHttpInfo + * + * Delete subscription + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubscription'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteSubscriptionWithHttpInfo($project_id, $subscription_id, string $contentType = self::contentTypes['deleteSubscription'][0]) + { + $request = $this->deleteSubscriptionRequest($project_id, $subscription_id, $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation deleteSubscriptionAsync + * + * Delete subscription + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubscription'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSubscriptionAsync($project_id, $subscription_id, string $contentType = self::contentTypes['deleteSubscription'][0]) + { + return $this->deleteSubscriptionAsyncWithHttpInfo($project_id, $subscription_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteSubscriptionAsyncWithHttpInfo + * + * Delete subscription + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubscription'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSubscriptionAsyncWithHttpInfo($project_id, $subscription_id, string $contentType = self::contentTypes['deleteSubscription'][0]) + { + $returnType = '\Convoy\Client\Model\GetProjects400Response'; + $request = $this->deleteSubscriptionRequest($project_id, $subscription_id, $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 'deleteSubscription' + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSubscription'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteSubscriptionRequest($project_id, $subscription_id, string $contentType = self::contentTypes['deleteSubscription'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling deleteSubscription' + ); + } + + // verify the required parameter 'subscription_id' is set + if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscription_id when calling deleteSubscription' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/subscriptions/{subscriptionID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($subscription_id !== null) { + $resourcePath = str_replace( + '{subscriptionID}', + ObjectSerializer::toPathValue($subscription_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 getSubscription + * + * Retrieve a subscription + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscription'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateSubscription201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getSubscription($project_id, $subscription_id, string $contentType = self::contentTypes['getSubscription'][0]) + { + list($response) = $this->getSubscriptionWithHttpInfo($project_id, $subscription_id, $contentType); + return $response; + } + + /** + * Operation getSubscriptionWithHttpInfo + * + * Retrieve a subscription + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscription'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateSubscription201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getSubscriptionWithHttpInfo($project_id, $subscription_id, string $contentType = self::contentTypes['getSubscription'][0]) + { + $request = $this->getSubscriptionRequest($project_id, $subscription_id, $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( + '\Convoy\Client\Model\CreateSubscription201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateSubscription201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateSubscription201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getSubscriptionAsync + * + * Retrieve a subscription + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscription'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSubscriptionAsync($project_id, $subscription_id, string $contentType = self::contentTypes['getSubscription'][0]) + { + return $this->getSubscriptionAsyncWithHttpInfo($project_id, $subscription_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSubscriptionAsyncWithHttpInfo + * + * Retrieve a subscription + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscription'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSubscriptionAsyncWithHttpInfo($project_id, $subscription_id, string $contentType = self::contentTypes['getSubscription'][0]) + { + $returnType = '\Convoy\Client\Model\CreateSubscription201Response'; + $request = $this->getSubscriptionRequest($project_id, $subscription_id, $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 'getSubscription' + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscription'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSubscriptionRequest($project_id, $subscription_id, string $contentType = self::contentTypes['getSubscription'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getSubscription' + ); + } + + // verify the required parameter 'subscription_id' is set + if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscription_id when calling getSubscription' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/subscriptions/{subscriptionID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($subscription_id !== null) { + $resourcePath = str_replace( + '{subscriptionID}', + ObjectSerializer::toPathValue($subscription_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 getSubscriptions + * + * List all subscriptions + * + * @param string $project_id Project ID (required) + * @param string|null $direction direction (optional) + * @param string[]|null $endpoint_id A list of endpointIDs to filter by (optional) + * @param string|null $name Subscription name to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscriptions'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetSubscriptions200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function getSubscriptions($project_id, $direction = null, $endpoint_id = null, $name = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, string $contentType = self::contentTypes['getSubscriptions'][0]) + { + list($response) = $this->getSubscriptionsWithHttpInfo($project_id, $direction, $endpoint_id, $name, $next_page_cursor, $per_page, $prev_page_cursor, $sort, $contentType); + return $response; + } + + /** + * Operation getSubscriptionsWithHttpInfo + * + * List all subscriptions + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string[]|null $endpoint_id A list of endpointIDs to filter by (optional) + * @param string|null $name Subscription name to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscriptions'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetSubscriptions200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getSubscriptionsWithHttpInfo($project_id, $direction = null, $endpoint_id = null, $name = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, string $contentType = self::contentTypes['getSubscriptions'][0]) + { + $request = $this->getSubscriptionsRequest($project_id, $direction, $endpoint_id, $name, $next_page_cursor, $per_page, $prev_page_cursor, $sort, $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( + '\Convoy\Client\Model\GetSubscriptions200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetSubscriptions200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetSubscriptions200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getSubscriptionsAsync + * + * List all subscriptions + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string[]|null $endpoint_id A list of endpointIDs to filter by (optional) + * @param string|null $name Subscription name to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscriptions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSubscriptionsAsync($project_id, $direction = null, $endpoint_id = null, $name = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, string $contentType = self::contentTypes['getSubscriptions'][0]) + { + return $this->getSubscriptionsAsyncWithHttpInfo($project_id, $direction, $endpoint_id, $name, $next_page_cursor, $per_page, $prev_page_cursor, $sort, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSubscriptionsAsyncWithHttpInfo + * + * List all subscriptions + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string[]|null $endpoint_id A list of endpointIDs to filter by (optional) + * @param string|null $name Subscription name to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscriptions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSubscriptionsAsyncWithHttpInfo($project_id, $direction = null, $endpoint_id = null, $name = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, string $contentType = self::contentTypes['getSubscriptions'][0]) + { + $returnType = '\Convoy\Client\Model\GetSubscriptions200Response'; + $request = $this->getSubscriptionsRequest($project_id, $direction, $endpoint_id, $name, $next_page_cursor, $per_page, $prev_page_cursor, $sort, $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 'getSubscriptions' + * + * @param string $project_id Project ID (required) + * @param string|null $direction (optional) + * @param string[]|null $endpoint_id A list of endpointIDs to filter by (optional) + * @param string|null $name Subscription name to filter by (optional) + * @param string|null $next_page_cursor A pagination cursor to fetch the next page of a list (optional) + * @param int|null $per_page The number of items to return per page (optional) + * @param string|null $prev_page_cursor A pagination cursor to fetch the previous page of a list (optional) + * @param string|null $sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSubscriptions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSubscriptionsRequest($project_id, $direction = null, $endpoint_id = null, $name = null, $next_page_cursor = null, $per_page = null, $prev_page_cursor = null, $sort = null, string $contentType = self::contentTypes['getSubscriptions'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling getSubscriptions' + ); + } + + + + + + + + + + $resourcePath = '/v1/projects/{projectID}/subscriptions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $direction, + 'direction', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endpoint_id, + 'endpointId', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $name, + 'name', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $next_page_cursor, + 'next_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $per_page, + 'perPage', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $prev_page_cursor, + 'prev_page_cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 testSubscriptionFilter + * + * Validate subscription filter + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsTestFilter $models_test_filter Filter Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testSubscriptionFilter'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\TestSubscriptionFilter200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function testSubscriptionFilter($project_id, $models_test_filter, string $contentType = self::contentTypes['testSubscriptionFilter'][0]) + { + list($response) = $this->testSubscriptionFilterWithHttpInfo($project_id, $models_test_filter, $contentType); + return $response; + } + + /** + * Operation testSubscriptionFilterWithHttpInfo + * + * Validate subscription filter + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsTestFilter $models_test_filter Filter Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testSubscriptionFilter'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\TestSubscriptionFilter200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function testSubscriptionFilterWithHttpInfo($project_id, $models_test_filter, string $contentType = self::contentTypes['testSubscriptionFilter'][0]) + { + $request = $this->testSubscriptionFilterRequest($project_id, $models_test_filter, $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( + '\Convoy\Client\Model\TestSubscriptionFilter200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\TestSubscriptionFilter200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\TestSubscriptionFilter200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation testSubscriptionFilterAsync + * + * Validate subscription filter + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsTestFilter $models_test_filter Filter Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testSubscriptionFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testSubscriptionFilterAsync($project_id, $models_test_filter, string $contentType = self::contentTypes['testSubscriptionFilter'][0]) + { + return $this->testSubscriptionFilterAsyncWithHttpInfo($project_id, $models_test_filter, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation testSubscriptionFilterAsyncWithHttpInfo + * + * Validate subscription filter + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsTestFilter $models_test_filter Filter Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testSubscriptionFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testSubscriptionFilterAsyncWithHttpInfo($project_id, $models_test_filter, string $contentType = self::contentTypes['testSubscriptionFilter'][0]) + { + $returnType = '\Convoy\Client\Model\TestSubscriptionFilter200Response'; + $request = $this->testSubscriptionFilterRequest($project_id, $models_test_filter, $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 'testSubscriptionFilter' + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsTestFilter $models_test_filter Filter Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testSubscriptionFilter'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function testSubscriptionFilterRequest($project_id, $models_test_filter, string $contentType = self::contentTypes['testSubscriptionFilter'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling testSubscriptionFilter' + ); + } + + // verify the required parameter 'models_test_filter' is set + if ($models_test_filter === null || (is_array($models_test_filter) && count($models_test_filter) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_test_filter when calling testSubscriptionFilter' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/subscriptions/test_filter'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_test_filter)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_test_filter)); + } else { + $httpBody = $models_test_filter; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 testSubscriptionFunction + * + * Test a subscription function + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsFunctionRequest $models_function_request Function Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testSubscriptionFunction'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\V1ProjectsProjectIDSourcesTestFunctionPost200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function testSubscriptionFunction($project_id, $models_function_request, string $contentType = self::contentTypes['testSubscriptionFunction'][0]) + { + list($response) = $this->testSubscriptionFunctionWithHttpInfo($project_id, $models_function_request, $contentType); + return $response; + } + + /** + * Operation testSubscriptionFunctionWithHttpInfo + * + * Test a subscription function + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsFunctionRequest $models_function_request Function Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testSubscriptionFunction'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\V1ProjectsProjectIDSourcesTestFunctionPost200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function testSubscriptionFunctionWithHttpInfo($project_id, $models_function_request, string $contentType = self::contentTypes['testSubscriptionFunction'][0]) + { + $request = $this->testSubscriptionFunctionRequest($project_id, $models_function_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( + '\Convoy\Client\Model\V1ProjectsProjectIDSourcesTestFunctionPost200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\V1ProjectsProjectIDSourcesTestFunctionPost200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\V1ProjectsProjectIDSourcesTestFunctionPost200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation testSubscriptionFunctionAsync + * + * Test a subscription function + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsFunctionRequest $models_function_request Function Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testSubscriptionFunction'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testSubscriptionFunctionAsync($project_id, $models_function_request, string $contentType = self::contentTypes['testSubscriptionFunction'][0]) + { + return $this->testSubscriptionFunctionAsyncWithHttpInfo($project_id, $models_function_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation testSubscriptionFunctionAsyncWithHttpInfo + * + * Test a subscription function + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsFunctionRequest $models_function_request Function Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testSubscriptionFunction'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testSubscriptionFunctionAsyncWithHttpInfo($project_id, $models_function_request, string $contentType = self::contentTypes['testSubscriptionFunction'][0]) + { + $returnType = '\Convoy\Client\Model\V1ProjectsProjectIDSourcesTestFunctionPost200Response'; + $request = $this->testSubscriptionFunctionRequest($project_id, $models_function_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 'testSubscriptionFunction' + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsFunctionRequest $models_function_request Function Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testSubscriptionFunction'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function testSubscriptionFunctionRequest($project_id, $models_function_request, string $contentType = self::contentTypes['testSubscriptionFunction'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling testSubscriptionFunction' + ); + } + + // verify the required parameter 'models_function_request' is set + if ($models_function_request === null || (is_array($models_function_request) && count($models_function_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_function_request when calling testSubscriptionFunction' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/subscriptions/test_function'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_function_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_function_request)); + } else { + $httpBody = $models_function_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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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 toggleSubscriptionStatus + * + * Toggle subscription status + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['toggleSubscriptionStatus'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function toggleSubscriptionStatus($project_id, $subscription_id, string $contentType = self::contentTypes['toggleSubscriptionStatus'][0]) + { + list($response) = $this->toggleSubscriptionStatusWithHttpInfo($project_id, $subscription_id, $contentType); + return $response; + } + + /** + * Operation toggleSubscriptionStatusWithHttpInfo + * + * Toggle subscription status + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['toggleSubscriptionStatus'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function toggleSubscriptionStatusWithHttpInfo($project_id, $subscription_id, string $contentType = self::contentTypes['toggleSubscriptionStatus'][0]) + { + $request = $this->toggleSubscriptionStatusRequest($project_id, $subscription_id, $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 202: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation toggleSubscriptionStatusAsync + * + * Toggle subscription status + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['toggleSubscriptionStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function toggleSubscriptionStatusAsync($project_id, $subscription_id, string $contentType = self::contentTypes['toggleSubscriptionStatus'][0]) + { + return $this->toggleSubscriptionStatusAsyncWithHttpInfo($project_id, $subscription_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation toggleSubscriptionStatusAsyncWithHttpInfo + * + * Toggle subscription status + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['toggleSubscriptionStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function toggleSubscriptionStatusAsyncWithHttpInfo($project_id, $subscription_id, string $contentType = self::contentTypes['toggleSubscriptionStatus'][0]) + { + $returnType = '\Convoy\Client\Model\GetProjects400Response'; + $request = $this->toggleSubscriptionStatusRequest($project_id, $subscription_id, $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 'toggleSubscriptionStatus' + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['toggleSubscriptionStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function toggleSubscriptionStatusRequest($project_id, $subscription_id, string $contentType = self::contentTypes['toggleSubscriptionStatus'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling toggleSubscriptionStatus' + ); + } + + // verify the required parameter 'subscription_id' is set + if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscription_id when calling toggleSubscriptionStatus' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/subscriptions/{subscriptionID}/toggle_status'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($subscription_id !== null) { + $resourcePath = str_replace( + '{subscriptionID}', + ObjectSerializer::toPathValue($subscription_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateSubscription + * + * Update a subscription + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param \Convoy\Client\Model\ModelsUpdateSubscription $models_update_subscription Subscription Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSubscription'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\CreateSubscription201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function updateSubscription($project_id, $subscription_id, $models_update_subscription, string $contentType = self::contentTypes['updateSubscription'][0]) + { + list($response) = $this->updateSubscriptionWithHttpInfo($project_id, $subscription_id, $models_update_subscription, $contentType); + return $response; + } + + /** + * Operation updateSubscriptionWithHttpInfo + * + * Update a subscription + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param \Convoy\Client\Model\ModelsUpdateSubscription $models_update_subscription Subscription Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSubscription'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\CreateSubscription201Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function updateSubscriptionWithHttpInfo($project_id, $subscription_id, $models_update_subscription, string $contentType = self::contentTypes['updateSubscription'][0]) + { + $request = $this->updateSubscriptionRequest($project_id, $subscription_id, $models_update_subscription, $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 202: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\CreateSubscription201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\CreateSubscription201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\CreateSubscription201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation updateSubscriptionAsync + * + * Update a subscription + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param \Convoy\Client\Model\ModelsUpdateSubscription $models_update_subscription Subscription Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSubscription'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateSubscriptionAsync($project_id, $subscription_id, $models_update_subscription, string $contentType = self::contentTypes['updateSubscription'][0]) + { + return $this->updateSubscriptionAsyncWithHttpInfo($project_id, $subscription_id, $models_update_subscription, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateSubscriptionAsyncWithHttpInfo + * + * Update a subscription + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param \Convoy\Client\Model\ModelsUpdateSubscription $models_update_subscription Subscription Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSubscription'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateSubscriptionAsyncWithHttpInfo($project_id, $subscription_id, $models_update_subscription, string $contentType = self::contentTypes['updateSubscription'][0]) + { + $returnType = '\Convoy\Client\Model\CreateSubscription201Response'; + $request = $this->updateSubscriptionRequest($project_id, $subscription_id, $models_update_subscription, $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 'updateSubscription' + * + * @param string $project_id Project ID (required) + * @param string $subscription_id subscription id (required) + * @param \Convoy\Client\Model\ModelsUpdateSubscription $models_update_subscription Subscription Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSubscription'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateSubscriptionRequest($project_id, $subscription_id, $models_update_subscription, string $contentType = self::contentTypes['updateSubscription'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling updateSubscription' + ); + } + + // verify the required parameter 'subscription_id' is set + if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscription_id when calling updateSubscription' + ); + } + + // verify the required parameter 'models_update_subscription' is set + if ($models_update_subscription === null || (is_array($models_update_subscription) && count($models_update_subscription) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_update_subscription when calling updateSubscription' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/subscriptions/{subscriptionID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + // path params + if ($subscription_id !== null) { + $resourcePath = str_replace( + '{subscriptionID}', + ObjectSerializer::toPathValue($subscription_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_update_subscription)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_update_subscription)); + } else { + $httpBody = $models_update_subscription; + } + } 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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation v1ProjectsProjectIDSourcesTestFunctionPost + * + * Validate source function + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsFunctionRequest $models_function_request Function Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['v1ProjectsProjectIDSourcesTestFunctionPost'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Convoy\Client\Model\V1ProjectsProjectIDSourcesTestFunctionPost200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response + */ + public function v1ProjectsProjectIDSourcesTestFunctionPost($project_id, $models_function_request, string $contentType = self::contentTypes['v1ProjectsProjectIDSourcesTestFunctionPost'][0]) + { + list($response) = $this->v1ProjectsProjectIDSourcesTestFunctionPostWithHttpInfo($project_id, $models_function_request, $contentType); + return $response; + } + + /** + * Operation v1ProjectsProjectIDSourcesTestFunctionPostWithHttpInfo + * + * Validate source function + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsFunctionRequest $models_function_request Function Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['v1ProjectsProjectIDSourcesTestFunctionPost'] to see the possible values for this operation + * + * @throws \Convoy\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Convoy\Client\Model\V1ProjectsProjectIDSourcesTestFunctionPost200Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response|\Convoy\Client\Model\GetProjects400Response, HTTP status code, HTTP response headers (array of strings) + */ + public function v1ProjectsProjectIDSourcesTestFunctionPostWithHttpInfo($project_id, $models_function_request, string $contentType = self::contentTypes['v1ProjectsProjectIDSourcesTestFunctionPost'][0]) + { + $request = $this->v1ProjectsProjectIDSourcesTestFunctionPostRequest($project_id, $models_function_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( + '\Convoy\Client\Model\V1ProjectsProjectIDSourcesTestFunctionPost200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Convoy\Client\Model\GetProjects400Response', + $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( + '\Convoy\Client\Model\V1ProjectsProjectIDSourcesTestFunctionPost200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\V1ProjectsProjectIDSourcesTestFunctionPost200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Convoy\Client\Model\GetProjects400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation v1ProjectsProjectIDSourcesTestFunctionPostAsync + * + * Validate source function + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsFunctionRequest $models_function_request Function Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['v1ProjectsProjectIDSourcesTestFunctionPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function v1ProjectsProjectIDSourcesTestFunctionPostAsync($project_id, $models_function_request, string $contentType = self::contentTypes['v1ProjectsProjectIDSourcesTestFunctionPost'][0]) + { + return $this->v1ProjectsProjectIDSourcesTestFunctionPostAsyncWithHttpInfo($project_id, $models_function_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation v1ProjectsProjectIDSourcesTestFunctionPostAsyncWithHttpInfo + * + * Validate source function + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsFunctionRequest $models_function_request Function Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['v1ProjectsProjectIDSourcesTestFunctionPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function v1ProjectsProjectIDSourcesTestFunctionPostAsyncWithHttpInfo($project_id, $models_function_request, string $contentType = self::contentTypes['v1ProjectsProjectIDSourcesTestFunctionPost'][0]) + { + $returnType = '\Convoy\Client\Model\V1ProjectsProjectIDSourcesTestFunctionPost200Response'; + $request = $this->v1ProjectsProjectIDSourcesTestFunctionPostRequest($project_id, $models_function_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 'v1ProjectsProjectIDSourcesTestFunctionPost' + * + * @param string $project_id Project ID (required) + * @param \Convoy\Client\Model\ModelsFunctionRequest $models_function_request Function Details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['v1ProjectsProjectIDSourcesTestFunctionPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function v1ProjectsProjectIDSourcesTestFunctionPostRequest($project_id, $models_function_request, string $contentType = self::contentTypes['v1ProjectsProjectIDSourcesTestFunctionPost'][0]) + { + + // verify the required parameter 'project_id' is set + if ($project_id === null || (is_array($project_id) && count($project_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_id when calling v1ProjectsProjectIDSourcesTestFunctionPost' + ); + } + + // verify the required parameter 'models_function_request' is set + if ($models_function_request === null || (is_array($models_function_request) && count($models_function_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $models_function_request when calling v1ProjectsProjectIDSourcesTestFunctionPost' + ); + } + + + $resourcePath = '/v1/projects/{projectID}/sources/test_function'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($project_id !== null) { + $resourcePath = str_replace( + '{projectID}', + ObjectSerializer::toPathValue($project_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($models_function_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($models_function_request)); + } else { + $httpBody = $models_function_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 + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Authorization'); + if ($apiKey !== null) { + $headers['Authorization'] = $apiKey; + } + + $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; + } +} diff --git a/src/Client/ApiException.php b/src/Client/ApiException.php new file mode 100644 index 0000000..01ac1ce --- /dev/null +++ b/src/Client/ApiException.php @@ -0,0 +1,120 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[][]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/src/Client/Configuration.php b/src/Client/Configuration.php new file mode 100644 index 0000000..ec743b7 --- /dev/null +++ b/src/Client/Configuration.php @@ -0,0 +1,593 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix($apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets boolean format for query string. + * + * @param string $booleanFormat Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat) + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost() + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Sets the certificate file path, for mTLS + * + * @return $this + */ + public function setCertFile($certFile) + { + $this->certFile = $certFile; + return $this; + } + + /** + * Gets the certificate file path, for mTLS + * + * @return string Certificate file path + */ + public function getCertFile() + { + return $this->certFile; + } + + /** + * Sets the certificate key path, for mTLS + * + * @return $this + */ + public function setKeyFile($keyFile) + { + $this->keyFile = $keyFile; + return $this; + } + + /** + * Gets the certificate key path, for mTLS + * + * @return string Certificate key path + */ + public function getKeyFile() + { + return $this->keyFile; + } + + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration() + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config) + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = 'PHP SDK (Convoy\Client) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: 26.3.5' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return null|string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings() + { + return [ + [ + "url" => "https://us.getconvoy.cloud/api", + "description" => "US Region", + ], + [ + "url" => "https://eu.getconvoy.cloud/api", + "description" => "EU Region", + ] + ]; + } + + /** + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); + } + + $host = $hostSettings[$hostIndex]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } +} diff --git a/src/Client/FormDataProcessor.php b/src/Client/FormDataProcessor.php new file mode 100644 index 0000000..c2d41ff --- /dev/null +++ b/src/Client/FormDataProcessor.php @@ -0,0 +1,247 @@ + $values the value of the form parameter + * + * @return array [key => value] of formdata + */ + public function prepare(array $values): array + { + $this->has_file = false; + $result = []; + + foreach ($values as $k => $v) { + if ($v === null) { + continue; + } + + $result[$k] = $this->makeFormSafe($v); + } + + return $result; + } + + /** + * Flattens a multi-level array of data and generates a single-level array + * compatible with formdata - a single-level array where the keys use bracket + * notation to signify nested data. + * + * credit: https://github.com/FranBar1966/FlatPHP + */ + public static function flatten(array $source, string $start = ''): array + { + $opt = [ + 'prefix' => '[', + 'suffix' => ']', + 'suffix-end' => true, + 'prefix-list' => '[', + 'suffix-list' => ']', + 'suffix-list-end' => true, + ]; + + if ($start === '') { + $currentPrefix = ''; + $currentSuffix = ''; + $currentSuffixEnd = false; + } elseif (array_is_list($source)) { + $currentPrefix = $opt['prefix-list']; + $currentSuffix = $opt['suffix-list']; + $currentSuffixEnd = $opt['suffix-list-end']; + } else { + $currentPrefix = $opt['prefix']; + $currentSuffix = $opt['suffix']; + $currentSuffixEnd = $opt['suffix-end']; + } + + $currentName = $start; + $result = []; + + foreach ($source as $key => $val) { + $currentName .= $currentPrefix.$key; + + if (is_array($val) && !empty($val)) { + $currentName .= $currentSuffix; + $result += self::flatten($val, $currentName); + } else { + if ($currentSuffixEnd) { + $currentName .= $currentSuffix; + } + + if (is_resource($val)) { + $result[$currentName] = $val; + } else { + $result[$currentName] = ObjectSerializer::toString($val); + } + } + + $currentName = $start; + } + + return $result; + } + + /** + * formdata must be limited to scalars or arrays of scalar values, + * or a resource for a file upload. Here we iterate through all available + * data and identify how to handle each scenario + */ + protected function makeFormSafe($value) + { + if ($value instanceof SplFileObject) { + return $this->processFiles([$value])[0]; + } + + if (is_resource($value)) { + $this->has_file = true; + + return $value; + } + + if ($value instanceof ModelInterface) { + return $this->processModel($value); + } + + if (is_array($value) || (is_object($value) && !$value instanceof \DateTimeInterface)) { + $data = []; + + foreach ($value as $k => $v) { + $data[$k] = $this->makeFormSafe($v); + } + + return $data; + } + + return ObjectSerializer::toString($value); + } + + /** + * We are able to handle nested ModelInterface. We do not simply call + * json_decode(json_encode()) because any given model may have binary data + * or other data that cannot be serialized to a JSON string + */ + protected function processModel(ModelInterface $model): array + { + $result = []; + + foreach ($model::openAPITypes() as $name => $type) { + $value = $model->offsetGet($name); + + if ($value === null) { + continue; + } + + if (strpos($type, '\SplFileObject') !== false) { + $file = is_array($value) ? $value : [$value]; + $result[$name] = $this->processFiles($file); + + continue; + } + + if ($value instanceof ModelInterface) { + $result[$name] = $this->processModel($value); + + continue; + } + + if (is_array($value) || is_object($value)) { + $result[$name] = $this->makeFormSafe($value); + + continue; + } + + $result[$name] = ObjectSerializer::toString($value); + } + + return $result; + } + + /** + * Handle file data + */ + protected function processFiles(array $files): array + { + $this->has_file = true; + + $result = []; + + foreach ($files as $i => $file) { + if (is_array($file)) { + $result[$i] = $this->processFiles($file); + + continue; + } + + if ($file instanceof StreamInterface) { + $result[$i] = $file; + + continue; + } + + if ($file instanceof SplFileObject) { + $result[$i] = $this->tryFopen($file); + } + } + + return $result; + } + + private function tryFopen(SplFileObject $file) + { + return Utils::tryFopen($file->getRealPath(), 'rb'); + } +} diff --git a/src/Client/HeaderSelector.php b/src/Client/HeaderSelector.php new file mode 100644 index 0000000..c48c0ea --- /dev/null +++ b/src/Client/HeaderSelector.php @@ -0,0 +1,274 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } + + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided. + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) + */ + private function selectAcceptHeader(array $accept): ?string + { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { + return null; + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = $this->selectJsonMimeList($accept); + if (count($headersWithJson) === 0) { + return implode(',', $accept); + } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); + } + + /** + * Given an Accept header, returns an associative array splitting the header and its weight + * + * @param string $header "Accept" Header + * + * @return array with the header and its weight + */ + private function getHeaderAndWeight(string $header): array + { + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; + } else { + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); + } +} diff --git a/src/Client/Model/AuthRoleType.php b/src/Client/Model/AuthRoleType.php new file mode 100644 index 0000000..7b57e10 --- /dev/null +++ b/src/Client/Model/AuthRoleType.php @@ -0,0 +1,93 @@ + + */ +class BatchReplayEvents200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchReplayEvents_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return string|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param string|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/BulkOnboard200Response.php b/src/Client/Model/BulkOnboard200Response.php new file mode 100644 index 0000000..23fd337 --- /dev/null +++ b/src/Client/Model/BulkOnboard200Response.php @@ -0,0 +1,478 @@ + + */ +class BulkOnboard200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BulkOnboard_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsBulkOnboardDryRunResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsBulkOnboardDryRunResponse|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsBulkOnboardDryRunResponse|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/BulkOnboard202Response.php b/src/Client/Model/BulkOnboard202Response.php new file mode 100644 index 0000000..721a069 --- /dev/null +++ b/src/Client/Model/BulkOnboard202Response.php @@ -0,0 +1,478 @@ + + */ +class BulkOnboard202Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BulkOnboard_202_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsBulkOnboardAcceptedResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsBulkOnboardAcceptedResponse|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsBulkOnboardAcceptedResponse|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ConfigRequestIDHeaderProvider.php b/src/Client/Model/ConfigRequestIDHeaderProvider.php new file mode 100644 index 0000000..122b892 --- /dev/null +++ b/src/Client/Model/ConfigRequestIDHeaderProvider.php @@ -0,0 +1,60 @@ + + */ +class CountAffectedEvents200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CountAffectedEvents_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsCountResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsCountResponse|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsCountResponse|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/CreateBroadcastEvent201Response.php b/src/Client/Model/CreateBroadcastEvent201Response.php new file mode 100644 index 0000000..3f9b688 --- /dev/null +++ b/src/Client/Model/CreateBroadcastEvent201Response.php @@ -0,0 +1,478 @@ + + */ +class CreateBroadcastEvent201Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateBroadcastEvent_201_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsEventResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsEventResponse|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsEventResponse|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/CreateEndpoint201Response.php b/src/Client/Model/CreateEndpoint201Response.php new file mode 100644 index 0000000..7bbba7e --- /dev/null +++ b/src/Client/Model/CreateEndpoint201Response.php @@ -0,0 +1,478 @@ + + */ +class CreateEndpoint201Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateEndpoint_201_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsEndpointResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsEndpointResponse|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsEndpointResponse|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/CreateEventType201Response.php b/src/Client/Model/CreateEventType201Response.php new file mode 100644 index 0000000..927bee7 --- /dev/null +++ b/src/Client/Model/CreateEventType201Response.php @@ -0,0 +1,478 @@ + + */ +class CreateEventType201Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateEventType_201_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsEventTypeResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsEventTypeResponse|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsEventTypeResponse|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/CreateFilter201Response.php b/src/Client/Model/CreateFilter201Response.php new file mode 100644 index 0000000..2c31ee4 --- /dev/null +++ b/src/Client/Model/CreateFilter201Response.php @@ -0,0 +1,478 @@ + + */ +class CreateFilter201Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateFilter_201_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsFilterResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsFilterResponse|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsFilterResponse|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/CreatePortalLink201Response.php b/src/Client/Model/CreatePortalLink201Response.php new file mode 100644 index 0000000..68362b6 --- /dev/null +++ b/src/Client/Model/CreatePortalLink201Response.php @@ -0,0 +1,478 @@ + + */ +class CreatePortalLink201Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreatePortalLink_201_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\DatastorePortalLinkResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\DatastorePortalLinkResponse|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\DatastorePortalLinkResponse|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/CreateProject201Response.php b/src/Client/Model/CreateProject201Response.php new file mode 100644 index 0000000..664db53 --- /dev/null +++ b/src/Client/Model/CreateProject201Response.php @@ -0,0 +1,478 @@ + + */ +class CreateProject201Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateProject_201_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsCreateProjectResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsCreateProjectResponse|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsCreateProjectResponse|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/CreateSource201Response.php b/src/Client/Model/CreateSource201Response.php new file mode 100644 index 0000000..8514c92 --- /dev/null +++ b/src/Client/Model/CreateSource201Response.php @@ -0,0 +1,478 @@ + + */ +class CreateSource201Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateSource_201_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsSourceResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsSourceResponse|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsSourceResponse|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/CreateSubscription201Response.php b/src/Client/Model/CreateSubscription201Response.php new file mode 100644 index 0000000..d4fbbf8 --- /dev/null +++ b/src/Client/Model/CreateSubscription201Response.php @@ -0,0 +1,478 @@ + + */ +class CreateSubscription201Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateSubscription_201_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsSubscriptionResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsSubscriptionResponse|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsSubscriptionResponse|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreAPIKeyResponse.php b/src/Client/Model/DatastoreAPIKeyResponse.php new file mode 100644 index 0000000..39cc983 --- /dev/null +++ b/src/Client/Model/DatastoreAPIKeyResponse.php @@ -0,0 +1,648 @@ + + */ +class DatastoreAPIKeyResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.APIKeyResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'created_at' => 'string', + 'expires_at' => 'string', + 'key' => 'string', + 'key_type' => 'string', + 'name' => 'string', + 'role' => '\Convoy\Client\Model\DatastoreRole', + 'uid' => 'string', + 'user_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'created_at' => null, + 'expires_at' => null, + 'key' => null, + 'key_type' => null, + 'name' => null, + 'role' => null, + 'uid' => null, + 'user_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'expires_at' => false, + 'key' => false, + 'key_type' => false, + 'name' => false, + 'role' => false, + 'uid' => false, + 'user_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'created_at' => 'created_at', + 'expires_at' => 'expires_at', + 'key' => 'key', + 'key_type' => 'key_type', + 'name' => 'name', + 'role' => 'role', + 'uid' => 'uid', + 'user_id' => 'user_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'created_at' => 'setCreatedAt', + 'expires_at' => 'setExpiresAt', + 'key' => 'setKey', + 'key_type' => 'setKeyType', + 'name' => 'setName', + 'role' => 'setRole', + 'uid' => 'setUid', + 'user_id' => 'setUserId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'created_at' => 'getCreatedAt', + 'expires_at' => 'getExpiresAt', + 'key' => 'getKey', + 'key_type' => 'getKeyType', + 'name' => 'getName', + 'role' => 'getRole', + 'uid' => 'getUid', + 'user_id' => 'getUserId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + $this->setIfExists('key', $data ?? [], null); + $this->setIfExists('key_type', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('role', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets expires_at + * + * @return string|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param string|null $expires_at expires_at + * + * @return self + */ + public function setExpiresAt($expires_at) + { + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + } + $this->container['expires_at'] = $expires_at; + + return $this; + } + + /** + * Gets key + * + * @return string|null + */ + public function getKey() + { + return $this->container['key']; + } + + /** + * Sets key + * + * @param string|null $key key + * + * @return self + */ + public function setKey($key) + { + if (is_null($key)) { + throw new \InvalidArgumentException('non-nullable key cannot be null'); + } + $this->container['key'] = $key; + + return $this; + } + + /** + * Gets key_type + * + * @return string|null + */ + public function getKeyType() + { + return $this->container['key_type']; + } + + /** + * Sets key_type + * + * @param string|null $key_type key_type + * + * @return self + */ + public function setKeyType($key_type) + { + if (is_null($key_type)) { + throw new \InvalidArgumentException('non-nullable key_type cannot be null'); + } + $this->container['key_type'] = $key_type; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets role + * + * @return \Convoy\Client\Model\DatastoreRole|null + */ + public function getRole() + { + return $this->container['role']; + } + + /** + * Sets role + * + * @param \Convoy\Client\Model\DatastoreRole|null $role role + * + * @return self + */ + public function setRole($role) + { + if (is_null($role)) { + throw new \InvalidArgumentException('non-nullable role cannot be null'); + } + $this->container['role'] = $role; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets user_id + * + * @return string|null + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string|null $user_id user_id + * + * @return self + */ + public function setUserId($user_id) + { + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + $this->container['user_id'] = $user_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreAlertConfiguration.php b/src/Client/Model/DatastoreAlertConfiguration.php new file mode 100644 index 0000000..49c9e0b --- /dev/null +++ b/src/Client/Model/DatastoreAlertConfiguration.php @@ -0,0 +1,444 @@ + + */ +class DatastoreAlertConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.AlertConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'count' => 'int', + 'threshold' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'count' => null, + 'threshold' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'count' => false, + 'threshold' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'count' => 'count', + 'threshold' => 'threshold' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'count' => 'setCount', + 'threshold' => 'setThreshold' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'count' => 'getCount', + 'threshold' => 'getThreshold' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('threshold', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count count + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + throw new \InvalidArgumentException('non-nullable count cannot be null'); + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets threshold + * + * @return string|null + */ + public function getThreshold() + { + return $this->container['threshold']; + } + + /** + * Sets threshold + * + * @param string|null $threshold threshold + * + * @return self + */ + public function setThreshold($threshold) + { + if (is_null($threshold)) { + throw new \InvalidArgumentException('non-nullable threshold cannot be null'); + } + $this->container['threshold'] = $threshold; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreAmqpCredentials.php b/src/Client/Model/DatastoreAmqpCredentials.php new file mode 100644 index 0000000..a90c57f --- /dev/null +++ b/src/Client/Model/DatastoreAmqpCredentials.php @@ -0,0 +1,444 @@ + + */ +class DatastoreAmqpCredentials implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.AmqpCredentials'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'password' => 'string', + 'user' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'password' => null, + 'user' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'password' => false, + 'user' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'password' => 'password', + 'user' => 'user' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'password' => 'setPassword', + 'user' => 'setUser' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'password' => 'getPassword', + 'user' => 'getUser' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('user', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets password + * + * @return string|null + */ + public function getPassword() + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string|null $password password + * + * @return self + */ + public function setPassword($password) + { + if (is_null($password)) { + throw new \InvalidArgumentException('non-nullable password cannot be null'); + } + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets user + * + * @return string|null + */ + public function getUser() + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param string|null $user user + * + * @return self + */ + public function setUser($user) + { + if (is_null($user)) { + throw new \InvalidArgumentException('non-nullable user cannot be null'); + } + $this->container['user'] = $user; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreAmqpPubSubConfig.php b/src/Client/Model/DatastoreAmqpPubSubConfig.php new file mode 100644 index 0000000..a71d894 --- /dev/null +++ b/src/Client/Model/DatastoreAmqpPubSubConfig.php @@ -0,0 +1,682 @@ + + */ +class DatastoreAmqpPubSubConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.AmqpPubSubConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'host' => 'string', + 'auth' => '\Convoy\Client\Model\DatastoreAmqpCredentials', + 'binded_exchange' => 'string', + 'dead_letter_exchange' => 'string', + 'port' => 'string', + 'queue' => 'string', + 'routing_key' => 'string', + 'schema' => 'string', + 'vhost' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'host' => null, + 'auth' => null, + 'binded_exchange' => null, + 'dead_letter_exchange' => null, + 'port' => null, + 'queue' => null, + 'routing_key' => null, + 'schema' => null, + 'vhost' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'host' => false, + 'auth' => false, + 'binded_exchange' => false, + 'dead_letter_exchange' => false, + 'port' => false, + 'queue' => false, + 'routing_key' => false, + 'schema' => false, + 'vhost' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'host' => 'host', + 'auth' => 'auth', + 'binded_exchange' => 'bindedExchange', + 'dead_letter_exchange' => 'deadLetterExchange', + 'port' => 'port', + 'queue' => 'queue', + 'routing_key' => 'routingKey', + 'schema' => 'schema', + 'vhost' => 'vhost' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'host' => 'setHost', + 'auth' => 'setAuth', + 'binded_exchange' => 'setBindedExchange', + 'dead_letter_exchange' => 'setDeadLetterExchange', + 'port' => 'setPort', + 'queue' => 'setQueue', + 'routing_key' => 'setRoutingKey', + 'schema' => 'setSchema', + 'vhost' => 'setVhost' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'host' => 'getHost', + 'auth' => 'getAuth', + 'binded_exchange' => 'getBindedExchange', + 'dead_letter_exchange' => 'getDeadLetterExchange', + 'port' => 'getPort', + 'queue' => 'getQueue', + 'routing_key' => 'getRoutingKey', + 'schema' => 'getSchema', + 'vhost' => 'getVhost' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('host', $data ?? [], null); + $this->setIfExists('auth', $data ?? [], null); + $this->setIfExists('binded_exchange', $data ?? [], null); + $this->setIfExists('dead_letter_exchange', $data ?? [], null); + $this->setIfExists('port', $data ?? [], null); + $this->setIfExists('queue', $data ?? [], null); + $this->setIfExists('routing_key', $data ?? [], null); + $this->setIfExists('schema', $data ?? [], null); + $this->setIfExists('vhost', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets host + * + * @return string|null + */ + public function getHost() + { + return $this->container['host']; + } + + /** + * Sets host + * + * @param string|null $host host + * + * @return self + */ + public function setHost($host) + { + if (is_null($host)) { + throw new \InvalidArgumentException('non-nullable host cannot be null'); + } + $this->container['host'] = $host; + + return $this; + } + + /** + * Gets auth + * + * @return \Convoy\Client\Model\DatastoreAmqpCredentials|null + */ + public function getAuth() + { + return $this->container['auth']; + } + + /** + * Sets auth + * + * @param \Convoy\Client\Model\DatastoreAmqpCredentials|null $auth auth + * + * @return self + */ + public function setAuth($auth) + { + if (is_null($auth)) { + throw new \InvalidArgumentException('non-nullable auth cannot be null'); + } + $this->container['auth'] = $auth; + + return $this; + } + + /** + * Gets binded_exchange + * + * @return string|null + */ + public function getBindedExchange() + { + return $this->container['binded_exchange']; + } + + /** + * Sets binded_exchange + * + * @param string|null $binded_exchange binded_exchange + * + * @return self + */ + public function setBindedExchange($binded_exchange) + { + if (is_null($binded_exchange)) { + throw new \InvalidArgumentException('non-nullable binded_exchange cannot be null'); + } + $this->container['binded_exchange'] = $binded_exchange; + + return $this; + } + + /** + * Gets dead_letter_exchange + * + * @return string|null + */ + public function getDeadLetterExchange() + { + return $this->container['dead_letter_exchange']; + } + + /** + * Sets dead_letter_exchange + * + * @param string|null $dead_letter_exchange dead_letter_exchange + * + * @return self + */ + public function setDeadLetterExchange($dead_letter_exchange) + { + if (is_null($dead_letter_exchange)) { + throw new \InvalidArgumentException('non-nullable dead_letter_exchange cannot be null'); + } + $this->container['dead_letter_exchange'] = $dead_letter_exchange; + + return $this; + } + + /** + * Gets port + * + * @return string|null + */ + public function getPort() + { + return $this->container['port']; + } + + /** + * Sets port + * + * @param string|null $port port + * + * @return self + */ + public function setPort($port) + { + if (is_null($port)) { + throw new \InvalidArgumentException('non-nullable port cannot be null'); + } + $this->container['port'] = $port; + + return $this; + } + + /** + * Gets queue + * + * @return string|null + */ + public function getQueue() + { + return $this->container['queue']; + } + + /** + * Sets queue + * + * @param string|null $queue queue + * + * @return self + */ + public function setQueue($queue) + { + if (is_null($queue)) { + throw new \InvalidArgumentException('non-nullable queue cannot be null'); + } + $this->container['queue'] = $queue; + + return $this; + } + + /** + * Gets routing_key + * + * @return string|null + */ + public function getRoutingKey() + { + return $this->container['routing_key']; + } + + /** + * Sets routing_key + * + * @param string|null $routing_key routing_key + * + * @return self + */ + public function setRoutingKey($routing_key) + { + if (is_null($routing_key)) { + throw new \InvalidArgumentException('non-nullable routing_key cannot be null'); + } + $this->container['routing_key'] = $routing_key; + + return $this; + } + + /** + * Gets schema + * + * @return string|null + */ + public function getSchema() + { + return $this->container['schema']; + } + + /** + * Sets schema + * + * @param string|null $schema schema + * + * @return self + */ + public function setSchema($schema) + { + if (is_null($schema)) { + throw new \InvalidArgumentException('non-nullable schema cannot be null'); + } + $this->container['schema'] = $schema; + + return $this; + } + + /** + * Gets vhost + * + * @return string|null + */ + public function getVhost() + { + return $this->container['vhost']; + } + + /** + * Sets vhost + * + * @param string|null $vhost vhost + * + * @return self + */ + public function setVhost($vhost) + { + if (is_null($vhost)) { + throw new \InvalidArgumentException('non-nullable vhost cannot be null'); + } + $this->container['vhost'] = $vhost; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreApiKey.php b/src/Client/Model/DatastoreApiKey.php new file mode 100644 index 0000000..9a4b9a2 --- /dev/null +++ b/src/Client/Model/DatastoreApiKey.php @@ -0,0 +1,444 @@ + + */ +class DatastoreApiKey implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.ApiKey'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'header_name' => 'string', + 'header_value' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'header_name' => null, + 'header_value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'header_name' => false, + 'header_value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'header_name' => 'header_name', + 'header_value' => 'header_value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'header_name' => 'setHeaderName', + 'header_value' => 'setHeaderValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'header_name' => 'getHeaderName', + 'header_value' => 'getHeaderValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('header_name', $data ?? [], null); + $this->setIfExists('header_value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets header_name + * + * @return string|null + */ + public function getHeaderName() + { + return $this->container['header_name']; + } + + /** + * Sets header_name + * + * @param string|null $header_name header_name + * + * @return self + */ + public function setHeaderName($header_name) + { + if (is_null($header_name)) { + throw new \InvalidArgumentException('non-nullable header_name cannot be null'); + } + $this->container['header_name'] = $header_name; + + return $this; + } + + /** + * Gets header_value + * + * @return string|null + */ + public function getHeaderValue() + { + return $this->container['header_value']; + } + + /** + * Sets header_value + * + * @param string|null $header_value header_value + * + * @return self + */ + public function setHeaderValue($header_value) + { + if (is_null($header_value)) { + throw new \InvalidArgumentException('non-nullable header_value cannot be null'); + } + $this->container['header_value'] = $header_value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreBasicAuth.php b/src/Client/Model/DatastoreBasicAuth.php new file mode 100644 index 0000000..2826ef7 --- /dev/null +++ b/src/Client/Model/DatastoreBasicAuth.php @@ -0,0 +1,444 @@ + + */ +class DatastoreBasicAuth implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.BasicAuth'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'password' => 'string', + 'username' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'password' => null, + 'username' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'password' => false, + 'username' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'password' => 'password', + 'username' => 'username' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'password' => 'setPassword', + 'username' => 'setUsername' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'password' => 'getPassword', + 'username' => 'getUsername' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets password + * + * @return string|null + */ + public function getPassword() + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string|null $password password + * + * @return self + */ + public function setPassword($password) + { + if (is_null($password)) { + throw new \InvalidArgumentException('non-nullable password cannot be null'); + } + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets username + * + * @return string|null + */ + public function getUsername() + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string|null $username username + * + * @return self + */ + public function setUsername($username) + { + if (is_null($username)) { + throw new \InvalidArgumentException('non-nullable username cannot be null'); + } + $this->container['username'] = $username; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreCLIMetadata.php b/src/Client/Model/DatastoreCLIMetadata.php new file mode 100644 index 0000000..ec7334c --- /dev/null +++ b/src/Client/Model/DatastoreCLIMetadata.php @@ -0,0 +1,444 @@ + + */ +class DatastoreCLIMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.CLIMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'event_type' => 'string', + 'source_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'event_type' => null, + 'source_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'source_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'event_type' => 'event_type', + 'source_id' => 'source_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'event_type' => 'setEventType', + 'source_id' => 'setSourceId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'event_type' => 'getEventType', + 'source_id' => 'getSourceId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('source_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets source_id + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['source_id']; + } + + /** + * Sets source_id + * + * @param string|null $source_id source_id + * + * @return self + */ + public function setSourceId($source_id) + { + if (is_null($source_id)) { + throw new \InvalidArgumentException('non-nullable source_id cannot be null'); + } + $this->container['source_id'] = $source_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreCircuitBreakerConfiguration.php b/src/Client/Model/DatastoreCircuitBreakerConfiguration.php new file mode 100644 index 0000000..c6d0e7a --- /dev/null +++ b/src/Client/Model/DatastoreCircuitBreakerConfiguration.php @@ -0,0 +1,614 @@ + + */ +class DatastoreCircuitBreakerConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.CircuitBreakerConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'consecutive_failure_threshold' => 'int', + 'error_timeout' => 'int', + 'failure_threshold' => 'int', + 'minimum_request_count' => 'int', + 'observability_window' => 'int', + 'sample_rate' => 'int', + 'success_threshold' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'consecutive_failure_threshold' => null, + 'error_timeout' => null, + 'failure_threshold' => null, + 'minimum_request_count' => null, + 'observability_window' => null, + 'sample_rate' => null, + 'success_threshold' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'consecutive_failure_threshold' => false, + 'error_timeout' => false, + 'failure_threshold' => false, + 'minimum_request_count' => false, + 'observability_window' => false, + 'sample_rate' => false, + 'success_threshold' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'consecutive_failure_threshold' => 'consecutive_failure_threshold', + 'error_timeout' => 'error_timeout', + 'failure_threshold' => 'failure_threshold', + 'minimum_request_count' => 'minimum_request_count', + 'observability_window' => 'observability_window', + 'sample_rate' => 'sample_rate', + 'success_threshold' => 'success_threshold' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'consecutive_failure_threshold' => 'setConsecutiveFailureThreshold', + 'error_timeout' => 'setErrorTimeout', + 'failure_threshold' => 'setFailureThreshold', + 'minimum_request_count' => 'setMinimumRequestCount', + 'observability_window' => 'setObservabilityWindow', + 'sample_rate' => 'setSampleRate', + 'success_threshold' => 'setSuccessThreshold' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'consecutive_failure_threshold' => 'getConsecutiveFailureThreshold', + 'error_timeout' => 'getErrorTimeout', + 'failure_threshold' => 'getFailureThreshold', + 'minimum_request_count' => 'getMinimumRequestCount', + 'observability_window' => 'getObservabilityWindow', + 'sample_rate' => 'getSampleRate', + 'success_threshold' => 'getSuccessThreshold' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('consecutive_failure_threshold', $data ?? [], null); + $this->setIfExists('error_timeout', $data ?? [], null); + $this->setIfExists('failure_threshold', $data ?? [], null); + $this->setIfExists('minimum_request_count', $data ?? [], null); + $this->setIfExists('observability_window', $data ?? [], null); + $this->setIfExists('sample_rate', $data ?? [], null); + $this->setIfExists('success_threshold', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets consecutive_failure_threshold + * + * @return int|null + */ + public function getConsecutiveFailureThreshold() + { + return $this->container['consecutive_failure_threshold']; + } + + /** + * Sets consecutive_failure_threshold + * + * @param int|null $consecutive_failure_threshold consecutive_failure_threshold + * + * @return self + */ + public function setConsecutiveFailureThreshold($consecutive_failure_threshold) + { + if (is_null($consecutive_failure_threshold)) { + throw new \InvalidArgumentException('non-nullable consecutive_failure_threshold cannot be null'); + } + $this->container['consecutive_failure_threshold'] = $consecutive_failure_threshold; + + return $this; + } + + /** + * Gets error_timeout + * + * @return int|null + */ + public function getErrorTimeout() + { + return $this->container['error_timeout']; + } + + /** + * Sets error_timeout + * + * @param int|null $error_timeout error_timeout + * + * @return self + */ + public function setErrorTimeout($error_timeout) + { + if (is_null($error_timeout)) { + throw new \InvalidArgumentException('non-nullable error_timeout cannot be null'); + } + $this->container['error_timeout'] = $error_timeout; + + return $this; + } + + /** + * Gets failure_threshold + * + * @return int|null + */ + public function getFailureThreshold() + { + return $this->container['failure_threshold']; + } + + /** + * Sets failure_threshold + * + * @param int|null $failure_threshold failure_threshold + * + * @return self + */ + public function setFailureThreshold($failure_threshold) + { + if (is_null($failure_threshold)) { + throw new \InvalidArgumentException('non-nullable failure_threshold cannot be null'); + } + $this->container['failure_threshold'] = $failure_threshold; + + return $this; + } + + /** + * Gets minimum_request_count + * + * @return int|null + */ + public function getMinimumRequestCount() + { + return $this->container['minimum_request_count']; + } + + /** + * Sets minimum_request_count + * + * @param int|null $minimum_request_count minimum_request_count + * + * @return self + */ + public function setMinimumRequestCount($minimum_request_count) + { + if (is_null($minimum_request_count)) { + throw new \InvalidArgumentException('non-nullable minimum_request_count cannot be null'); + } + $this->container['minimum_request_count'] = $minimum_request_count; + + return $this; + } + + /** + * Gets observability_window + * + * @return int|null + */ + public function getObservabilityWindow() + { + return $this->container['observability_window']; + } + + /** + * Sets observability_window + * + * @param int|null $observability_window observability_window + * + * @return self + */ + public function setObservabilityWindow($observability_window) + { + if (is_null($observability_window)) { + throw new \InvalidArgumentException('non-nullable observability_window cannot be null'); + } + $this->container['observability_window'] = $observability_window; + + return $this; + } + + /** + * Gets sample_rate + * + * @return int|null + */ + public function getSampleRate() + { + return $this->container['sample_rate']; + } + + /** + * Sets sample_rate + * + * @param int|null $sample_rate sample_rate + * + * @return self + */ + public function setSampleRate($sample_rate) + { + if (is_null($sample_rate)) { + throw new \InvalidArgumentException('non-nullable sample_rate cannot be null'); + } + $this->container['sample_rate'] = $sample_rate; + + return $this; + } + + /** + * Gets success_threshold + * + * @return int|null + */ + public function getSuccessThreshold() + { + return $this->container['success_threshold']; + } + + /** + * Sets success_threshold + * + * @param int|null $success_threshold success_threshold + * + * @return self + */ + public function setSuccessThreshold($success_threshold) + { + if (is_null($success_threshold)) { + throw new \InvalidArgumentException('non-nullable success_threshold cannot be null'); + } + $this->container['success_threshold'] = $success_threshold; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreCreatePortalLinkRequest.php b/src/Client/Model/DatastoreCreatePortalLinkRequest.php new file mode 100644 index 0000000..a3cb5fd --- /dev/null +++ b/src/Client/Model/DatastoreCreatePortalLinkRequest.php @@ -0,0 +1,546 @@ + + */ +class DatastoreCreatePortalLinkRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.CreatePortalLinkRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'auth_type' => 'string', + 'can_manage_endpoint' => 'bool', + 'endpoints' => 'string[]', + 'name' => 'string', + 'owner_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'auth_type' => null, + 'can_manage_endpoint' => null, + 'endpoints' => null, + 'name' => null, + 'owner_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'auth_type' => false, + 'can_manage_endpoint' => false, + 'endpoints' => false, + 'name' => false, + 'owner_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'auth_type' => 'auth_type', + 'can_manage_endpoint' => 'can_manage_endpoint', + 'endpoints' => 'endpoints', + 'name' => 'name', + 'owner_id' => 'owner_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'auth_type' => 'setAuthType', + 'can_manage_endpoint' => 'setCanManageEndpoint', + 'endpoints' => 'setEndpoints', + 'name' => 'setName', + 'owner_id' => 'setOwnerId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'auth_type' => 'getAuthType', + 'can_manage_endpoint' => 'getCanManageEndpoint', + 'endpoints' => 'getEndpoints', + 'name' => 'getName', + 'owner_id' => 'getOwnerId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('auth_type', $data ?? [], null); + $this->setIfExists('can_manage_endpoint', $data ?? [], null); + $this->setIfExists('endpoints', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('owner_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets auth_type + * + * @return string|null + */ + public function getAuthType() + { + return $this->container['auth_type']; + } + + /** + * Sets auth_type + * + * @param string|null $auth_type auth_type + * + * @return self + */ + public function setAuthType($auth_type) + { + if (is_null($auth_type)) { + throw new \InvalidArgumentException('non-nullable auth_type cannot be null'); + } + $this->container['auth_type'] = $auth_type; + + return $this; + } + + /** + * Gets can_manage_endpoint + * + * @return bool|null + */ + public function getCanManageEndpoint() + { + return $this->container['can_manage_endpoint']; + } + + /** + * Sets can_manage_endpoint + * + * @param bool|null $can_manage_endpoint Specify whether endpoint management can be done through the Portal Link UI + * + * @return self + */ + public function setCanManageEndpoint($can_manage_endpoint) + { + if (is_null($can_manage_endpoint)) { + throw new \InvalidArgumentException('non-nullable can_manage_endpoint cannot be null'); + } + $this->container['can_manage_endpoint'] = $can_manage_endpoint; + + return $this; + } + + /** + * Gets endpoints + * + * @return string[]|null + */ + public function getEndpoints() + { + return $this->container['endpoints']; + } + + /** + * Sets endpoints + * + * @param string[]|null $endpoints Deprecated IDs of endpoints in this portal link + * + * @return self + */ + public function setEndpoints($endpoints) + { + if (is_null($endpoints)) { + throw new \InvalidArgumentException('non-nullable endpoints cannot be null'); + } + $this->container['endpoints'] = $endpoints; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Portal Link Name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets owner_id + * + * @return string|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param string|null $owner_id OwnerID, the portal link will inherit all the endpoints with this owner ID + * + * @return self + */ + public function setOwnerId($owner_id) + { + if (is_null($owner_id)) { + throw new \InvalidArgumentException('non-nullable owner_id cannot be null'); + } + $this->container['owner_id'] = $owner_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreCustomResponse.php b/src/Client/Model/DatastoreCustomResponse.php new file mode 100644 index 0000000..abdcd2f --- /dev/null +++ b/src/Client/Model/DatastoreCustomResponse.php @@ -0,0 +1,444 @@ + + */ +class DatastoreCustomResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.CustomResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'body' => 'string', + 'content_type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'body' => null, + 'content_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'body' => false, + 'content_type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'body' => 'body', + 'content_type' => 'content_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'body' => 'setBody', + 'content_type' => 'setContentType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'body' => 'getBody', + 'content_type' => 'getContentType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('content_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets body + * + * @return string|null + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param string|null $body body + * + * @return self + */ + public function setBody($body) + { + if (is_null($body)) { + throw new \InvalidArgumentException('non-nullable body cannot be null'); + } + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets content_type + * + * @return string|null + */ + public function getContentType() + { + return $this->container['content_type']; + } + + /** + * Sets content_type + * + * @param string|null $content_type content_type + * + * @return self + */ + public function setContentType($content_type) + { + if (is_null($content_type)) { + throw new \InvalidArgumentException('non-nullable content_type cannot be null'); + } + $this->container['content_type'] = $content_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreDeliveryAttempt.php b/src/Client/Model/DatastoreDeliveryAttempt.php new file mode 100644 index 0000000..1e209db --- /dev/null +++ b/src/Client/Model/DatastoreDeliveryAttempt.php @@ -0,0 +1,1022 @@ + + */ +class DatastoreDeliveryAttempt implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.DeliveryAttempt'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'api_version' => 'string', + 'created_at' => 'string', + 'deleted_at' => 'string', + 'endpoint_id' => 'string', + 'error' => 'string', + 'http_status' => 'string', + 'ip_address' => 'string', + 'method' => 'string', + 'msg_id' => 'string', + 'project_id' => 'string', + 'request_http_header' => 'array', + 'requested_at' => 'string', + 'responded_at' => 'string', + 'response_data' => 'string', + 'response_http_header' => 'array', + 'status' => 'bool', + 'uid' => 'string', + 'updated_at' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'api_version' => null, + 'created_at' => null, + 'deleted_at' => null, + 'endpoint_id' => null, + 'error' => null, + 'http_status' => null, + 'ip_address' => null, + 'method' => null, + 'msg_id' => null, + 'project_id' => null, + 'request_http_header' => null, + 'requested_at' => null, + 'responded_at' => null, + 'response_data' => null, + 'response_http_header' => null, + 'status' => null, + 'uid' => null, + 'updated_at' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'api_version' => false, + 'created_at' => false, + 'deleted_at' => false, + 'endpoint_id' => false, + 'error' => false, + 'http_status' => false, + 'ip_address' => false, + 'method' => false, + 'msg_id' => false, + 'project_id' => false, + 'request_http_header' => false, + 'requested_at' => false, + 'responded_at' => false, + 'response_data' => false, + 'response_http_header' => false, + 'status' => false, + 'uid' => false, + 'updated_at' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'api_version' => 'api_version', + 'created_at' => 'created_at', + 'deleted_at' => 'deleted_at', + 'endpoint_id' => 'endpoint_id', + 'error' => 'error', + 'http_status' => 'http_status', + 'ip_address' => 'ip_address', + 'method' => 'method', + 'msg_id' => 'msg_id', + 'project_id' => 'project_id', + 'request_http_header' => 'request_http_header', + 'requested_at' => 'requested_at', + 'responded_at' => 'responded_at', + 'response_data' => 'response_data', + 'response_http_header' => 'response_http_header', + 'status' => 'status', + 'uid' => 'uid', + 'updated_at' => 'updated_at', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'api_version' => 'setApiVersion', + 'created_at' => 'setCreatedAt', + 'deleted_at' => 'setDeletedAt', + 'endpoint_id' => 'setEndpointId', + 'error' => 'setError', + 'http_status' => 'setHttpStatus', + 'ip_address' => 'setIpAddress', + 'method' => 'setMethod', + 'msg_id' => 'setMsgId', + 'project_id' => 'setProjectId', + 'request_http_header' => 'setRequestHttpHeader', + 'requested_at' => 'setRequestedAt', + 'responded_at' => 'setRespondedAt', + 'response_data' => 'setResponseData', + 'response_http_header' => 'setResponseHttpHeader', + 'status' => 'setStatus', + 'uid' => 'setUid', + 'updated_at' => 'setUpdatedAt', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'api_version' => 'getApiVersion', + 'created_at' => 'getCreatedAt', + 'deleted_at' => 'getDeletedAt', + 'endpoint_id' => 'getEndpointId', + 'error' => 'getError', + 'http_status' => 'getHttpStatus', + 'ip_address' => 'getIpAddress', + 'method' => 'getMethod', + 'msg_id' => 'getMsgId', + 'project_id' => 'getProjectId', + 'request_http_header' => 'getRequestHttpHeader', + 'requested_at' => 'getRequestedAt', + 'responded_at' => 'getRespondedAt', + 'response_data' => 'getResponseData', + 'response_http_header' => 'getResponseHttpHeader', + 'status' => 'getStatus', + 'uid' => 'getUid', + 'updated_at' => 'getUpdatedAt', + 'url' => 'getUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('api_version', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('deleted_at', $data ?? [], null); + $this->setIfExists('endpoint_id', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('http_status', $data ?? [], null); + $this->setIfExists('ip_address', $data ?? [], null); + $this->setIfExists('method', $data ?? [], null); + $this->setIfExists('msg_id', $data ?? [], null); + $this->setIfExists('project_id', $data ?? [], null); + $this->setIfExists('request_http_header', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('responded_at', $data ?? [], null); + $this->setIfExists('response_data', $data ?? [], null); + $this->setIfExists('response_http_header', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets api_version + * + * @return string|null + */ + public function getApiVersion() + { + return $this->container['api_version']; + } + + /** + * Sets api_version + * + * @param string|null $api_version api_version + * + * @return self + */ + public function setApiVersion($api_version) + { + if (is_null($api_version)) { + throw new \InvalidArgumentException('non-nullable api_version cannot be null'); + } + $this->container['api_version'] = $api_version; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets deleted_at + * + * @return string|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param string|null $deleted_at deleted_at + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + if (is_null($deleted_at)) { + throw new \InvalidArgumentException('non-nullable deleted_at cannot be null'); + } + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets endpoint_id + * + * @return string|null + */ + public function getEndpointId() + { + return $this->container['endpoint_id']; + } + + /** + * Sets endpoint_id + * + * @param string|null $endpoint_id endpoint_id + * + * @return self + */ + public function setEndpointId($endpoint_id) + { + if (is_null($endpoint_id)) { + throw new \InvalidArgumentException('non-nullable endpoint_id cannot be null'); + } + $this->container['endpoint_id'] = $endpoint_id; + + return $this; + } + + /** + * Gets error + * + * @return string|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets http_status + * + * @return string|null + */ + public function getHttpStatus() + { + return $this->container['http_status']; + } + + /** + * Sets http_status + * + * @param string|null $http_status http_status + * + * @return self + */ + public function setHttpStatus($http_status) + { + if (is_null($http_status)) { + throw new \InvalidArgumentException('non-nullable http_status cannot be null'); + } + $this->container['http_status'] = $http_status; + + return $this; + } + + /** + * Gets ip_address + * + * @return string|null + */ + public function getIpAddress() + { + return $this->container['ip_address']; + } + + /** + * Sets ip_address + * + * @param string|null $ip_address ip_address + * + * @return self + */ + public function setIpAddress($ip_address) + { + if (is_null($ip_address)) { + throw new \InvalidArgumentException('non-nullable ip_address cannot be null'); + } + $this->container['ip_address'] = $ip_address; + + return $this; + } + + /** + * Gets method + * + * @return string|null + */ + public function getMethod() + { + return $this->container['method']; + } + + /** + * Sets method + * + * @param string|null $method method + * + * @return self + */ + public function setMethod($method) + { + if (is_null($method)) { + throw new \InvalidArgumentException('non-nullable method cannot be null'); + } + $this->container['method'] = $method; + + return $this; + } + + /** + * Gets msg_id + * + * @return string|null + */ + public function getMsgId() + { + return $this->container['msg_id']; + } + + /** + * Sets msg_id + * + * @param string|null $msg_id msg_id + * + * @return self + */ + public function setMsgId($msg_id) + { + if (is_null($msg_id)) { + throw new \InvalidArgumentException('non-nullable msg_id cannot be null'); + } + $this->container['msg_id'] = $msg_id; + + return $this; + } + + /** + * Gets project_id + * + * @return string|null + */ + public function getProjectId() + { + return $this->container['project_id']; + } + + /** + * Sets project_id + * + * @param string|null $project_id project_id + * + * @return self + */ + public function setProjectId($project_id) + { + if (is_null($project_id)) { + throw new \InvalidArgumentException('non-nullable project_id cannot be null'); + } + $this->container['project_id'] = $project_id; + + return $this; + } + + /** + * Gets request_http_header + * + * @return array|null + */ + public function getRequestHttpHeader() + { + return $this->container['request_http_header']; + } + + /** + * Sets request_http_header + * + * @param array|null $request_http_header request_http_header + * + * @return self + */ + public function setRequestHttpHeader($request_http_header) + { + if (is_null($request_http_header)) { + throw new \InvalidArgumentException('non-nullable request_http_header cannot be null'); + } + $this->container['request_http_header'] = $request_http_header; + + return $this; + } + + /** + * Gets requested_at + * + * @return string|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param string|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets responded_at + * + * @return string|null + */ + public function getRespondedAt() + { + return $this->container['responded_at']; + } + + /** + * Sets responded_at + * + * @param string|null $responded_at responded_at + * + * @return self + */ + public function setRespondedAt($responded_at) + { + if (is_null($responded_at)) { + throw new \InvalidArgumentException('non-nullable responded_at cannot be null'); + } + $this->container['responded_at'] = $responded_at; + + return $this; + } + + /** + * Gets response_data + * + * @return string|null + */ + public function getResponseData() + { + return $this->container['response_data']; + } + + /** + * Sets response_data + * + * @param string|null $response_data response_data + * + * @return self + */ + public function setResponseData($response_data) + { + if (is_null($response_data)) { + throw new \InvalidArgumentException('non-nullable response_data cannot be null'); + } + $this->container['response_data'] = $response_data; + + return $this; + } + + /** + * Gets response_http_header + * + * @return array|null + */ + public function getResponseHttpHeader() + { + return $this->container['response_http_header']; + } + + /** + * Sets response_http_header + * + * @param array|null $response_http_header response_http_header + * + * @return self + */ + public function setResponseHttpHeader($response_http_header) + { + if (is_null($response_http_header)) { + throw new \InvalidArgumentException('non-nullable response_http_header cannot be null'); + } + $this->container['response_http_header'] = $response_http_header; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url url + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreDeliveryMode.php b/src/Client/Model/DatastoreDeliveryMode.php new file mode 100644 index 0000000..9ad52b6 --- /dev/null +++ b/src/Client/Model/DatastoreDeliveryMode.php @@ -0,0 +1,63 @@ + + */ +class DatastoreDevice implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.Device'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'created_at' => 'string', + 'deleted_at' => 'string', + 'endpoint_id' => 'string', + 'host_name' => 'string', + 'last_seen_at' => 'string', + 'project_id' => 'string', + 'status' => '\Convoy\Client\Model\DatastoreDeviceStatus', + 'uid' => 'string', + 'updated_at' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'created_at' => null, + 'deleted_at' => null, + 'endpoint_id' => null, + 'host_name' => null, + 'last_seen_at' => null, + 'project_id' => null, + 'status' => null, + 'uid' => null, + 'updated_at' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'deleted_at' => false, + 'endpoint_id' => false, + 'host_name' => false, + 'last_seen_at' => false, + 'project_id' => false, + 'status' => false, + 'uid' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'created_at' => 'created_at', + 'deleted_at' => 'deleted_at', + 'endpoint_id' => 'endpoint_id', + 'host_name' => 'host_name', + 'last_seen_at' => 'last_seen_at', + 'project_id' => 'project_id', + 'status' => 'status', + 'uid' => 'uid', + 'updated_at' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'created_at' => 'setCreatedAt', + 'deleted_at' => 'setDeletedAt', + 'endpoint_id' => 'setEndpointId', + 'host_name' => 'setHostName', + 'last_seen_at' => 'setLastSeenAt', + 'project_id' => 'setProjectId', + 'status' => 'setStatus', + 'uid' => 'setUid', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'created_at' => 'getCreatedAt', + 'deleted_at' => 'getDeletedAt', + 'endpoint_id' => 'getEndpointId', + 'host_name' => 'getHostName', + 'last_seen_at' => 'getLastSeenAt', + 'project_id' => 'getProjectId', + 'status' => 'getStatus', + 'uid' => 'getUid', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('deleted_at', $data ?? [], null); + $this->setIfExists('endpoint_id', $data ?? [], null); + $this->setIfExists('host_name', $data ?? [], null); + $this->setIfExists('last_seen_at', $data ?? [], null); + $this->setIfExists('project_id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets deleted_at + * + * @return string|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param string|null $deleted_at deleted_at + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + if (is_null($deleted_at)) { + throw new \InvalidArgumentException('non-nullable deleted_at cannot be null'); + } + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets endpoint_id + * + * @return string|null + */ + public function getEndpointId() + { + return $this->container['endpoint_id']; + } + + /** + * Sets endpoint_id + * + * @param string|null $endpoint_id endpoint_id + * + * @return self + */ + public function setEndpointId($endpoint_id) + { + if (is_null($endpoint_id)) { + throw new \InvalidArgumentException('non-nullable endpoint_id cannot be null'); + } + $this->container['endpoint_id'] = $endpoint_id; + + return $this; + } + + /** + * Gets host_name + * + * @return string|null + */ + public function getHostName() + { + return $this->container['host_name']; + } + + /** + * Sets host_name + * + * @param string|null $host_name host_name + * + * @return self + */ + public function setHostName($host_name) + { + if (is_null($host_name)) { + throw new \InvalidArgumentException('non-nullable host_name cannot be null'); + } + $this->container['host_name'] = $host_name; + + return $this; + } + + /** + * Gets last_seen_at + * + * @return string|null + */ + public function getLastSeenAt() + { + return $this->container['last_seen_at']; + } + + /** + * Sets last_seen_at + * + * @param string|null $last_seen_at last_seen_at + * + * @return self + */ + public function setLastSeenAt($last_seen_at) + { + if (is_null($last_seen_at)) { + throw new \InvalidArgumentException('non-nullable last_seen_at cannot be null'); + } + $this->container['last_seen_at'] = $last_seen_at; + + return $this; + } + + /** + * Gets project_id + * + * @return string|null + */ + public function getProjectId() + { + return $this->container['project_id']; + } + + /** + * Sets project_id + * + * @param string|null $project_id project_id + * + * @return self + */ + public function setProjectId($project_id) + { + if (is_null($project_id)) { + throw new \InvalidArgumentException('non-nullable project_id cannot be null'); + } + $this->container['project_id'] = $project_id; + + return $this; + } + + /** + * Gets status + * + * @return \Convoy\Client\Model\DatastoreDeviceStatus|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Convoy\Client\Model\DatastoreDeviceStatus|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreDeviceStatus.php b/src/Client/Model/DatastoreDeviceStatus.php new file mode 100644 index 0000000..d4b8440 --- /dev/null +++ b/src/Client/Model/DatastoreDeviceStatus.php @@ -0,0 +1,66 @@ + + */ +class DatastoreEndpoint implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.Endpoint'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'advanced_signatures' => 'bool', + 'authentication' => '\Convoy\Client\Model\DatastoreEndpointAuthentication', + 'cb_state' => 'string', + 'content_type' => 'string', + 'created_at' => 'string', + 'deleted_at' => 'string', + 'description' => 'string', + 'events' => 'int', + 'failure_count' => 'int', + 'failure_rate' => 'float', + 'http_timeout' => 'int', + 'mtls_client_cert' => '\Convoy\Client\Model\DatastoreMtlsClientCert', + 'name' => 'string', + 'owner_id' => 'string', + 'period_failure_rate' => 'float', + 'project_id' => 'string', + 'rate_limit' => 'int', + 'rate_limit_duration' => 'int', + 'retry_count' => 'int', + 'secrets' => '\Convoy\Client\Model\DatastoreSecret[]', + 'slack_webhook_url' => 'string', + 'status' => '\Convoy\Client\Model\DatastoreEndpointStatus', + 'success_count' => 'int', + 'support_email' => 'string', + 'uid' => 'string', + 'updated_at' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'advanced_signatures' => null, + 'authentication' => null, + 'cb_state' => null, + 'content_type' => null, + 'created_at' => null, + 'deleted_at' => null, + 'description' => null, + 'events' => null, + 'failure_count' => null, + 'failure_rate' => null, + 'http_timeout' => null, + 'mtls_client_cert' => null, + 'name' => null, + 'owner_id' => null, + 'period_failure_rate' => null, + 'project_id' => null, + 'rate_limit' => null, + 'rate_limit_duration' => null, + 'retry_count' => null, + 'secrets' => null, + 'slack_webhook_url' => null, + 'status' => null, + 'success_count' => null, + 'support_email' => null, + 'uid' => null, + 'updated_at' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'advanced_signatures' => false, + 'authentication' => false, + 'cb_state' => false, + 'content_type' => false, + 'created_at' => false, + 'deleted_at' => false, + 'description' => false, + 'events' => false, + 'failure_count' => false, + 'failure_rate' => false, + 'http_timeout' => false, + 'mtls_client_cert' => false, + 'name' => false, + 'owner_id' => false, + 'period_failure_rate' => false, + 'project_id' => false, + 'rate_limit' => false, + 'rate_limit_duration' => false, + 'retry_count' => false, + 'secrets' => false, + 'slack_webhook_url' => false, + 'status' => false, + 'success_count' => false, + 'support_email' => false, + 'uid' => false, + 'updated_at' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'advanced_signatures' => 'advanced_signatures', + 'authentication' => 'authentication', + 'cb_state' => 'cb_state', + 'content_type' => 'content_type', + 'created_at' => 'created_at', + 'deleted_at' => 'deleted_at', + 'description' => 'description', + 'events' => 'events', + 'failure_count' => 'failure_count', + 'failure_rate' => 'failure_rate', + 'http_timeout' => 'http_timeout', + 'mtls_client_cert' => 'mtls_client_cert', + 'name' => 'name', + 'owner_id' => 'owner_id', + 'period_failure_rate' => 'period_failure_rate', + 'project_id' => 'project_id', + 'rate_limit' => 'rate_limit', + 'rate_limit_duration' => 'rate_limit_duration', + 'retry_count' => 'retry_count', + 'secrets' => 'secrets', + 'slack_webhook_url' => 'slack_webhook_url', + 'status' => 'status', + 'success_count' => 'success_count', + 'support_email' => 'support_email', + 'uid' => 'uid', + 'updated_at' => 'updated_at', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'advanced_signatures' => 'setAdvancedSignatures', + 'authentication' => 'setAuthentication', + 'cb_state' => 'setCbState', + 'content_type' => 'setContentType', + 'created_at' => 'setCreatedAt', + 'deleted_at' => 'setDeletedAt', + 'description' => 'setDescription', + 'events' => 'setEvents', + 'failure_count' => 'setFailureCount', + 'failure_rate' => 'setFailureRate', + 'http_timeout' => 'setHttpTimeout', + 'mtls_client_cert' => 'setMtlsClientCert', + 'name' => 'setName', + 'owner_id' => 'setOwnerId', + 'period_failure_rate' => 'setPeriodFailureRate', + 'project_id' => 'setProjectId', + 'rate_limit' => 'setRateLimit', + 'rate_limit_duration' => 'setRateLimitDuration', + 'retry_count' => 'setRetryCount', + 'secrets' => 'setSecrets', + 'slack_webhook_url' => 'setSlackWebhookUrl', + 'status' => 'setStatus', + 'success_count' => 'setSuccessCount', + 'support_email' => 'setSupportEmail', + 'uid' => 'setUid', + 'updated_at' => 'setUpdatedAt', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'advanced_signatures' => 'getAdvancedSignatures', + 'authentication' => 'getAuthentication', + 'cb_state' => 'getCbState', + 'content_type' => 'getContentType', + 'created_at' => 'getCreatedAt', + 'deleted_at' => 'getDeletedAt', + 'description' => 'getDescription', + 'events' => 'getEvents', + 'failure_count' => 'getFailureCount', + 'failure_rate' => 'getFailureRate', + 'http_timeout' => 'getHttpTimeout', + 'mtls_client_cert' => 'getMtlsClientCert', + 'name' => 'getName', + 'owner_id' => 'getOwnerId', + 'period_failure_rate' => 'getPeriodFailureRate', + 'project_id' => 'getProjectId', + 'rate_limit' => 'getRateLimit', + 'rate_limit_duration' => 'getRateLimitDuration', + 'retry_count' => 'getRetryCount', + 'secrets' => 'getSecrets', + 'slack_webhook_url' => 'getSlackWebhookUrl', + 'status' => 'getStatus', + 'success_count' => 'getSuccessCount', + 'support_email' => 'getSupportEmail', + 'uid' => 'getUid', + 'updated_at' => 'getUpdatedAt', + 'url' => 'getUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('advanced_signatures', $data ?? [], null); + $this->setIfExists('authentication', $data ?? [], null); + $this->setIfExists('cb_state', $data ?? [], null); + $this->setIfExists('content_type', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('deleted_at', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('events', $data ?? [], null); + $this->setIfExists('failure_count', $data ?? [], null); + $this->setIfExists('failure_rate', $data ?? [], null); + $this->setIfExists('http_timeout', $data ?? [], null); + $this->setIfExists('mtls_client_cert', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('owner_id', $data ?? [], null); + $this->setIfExists('period_failure_rate', $data ?? [], null); + $this->setIfExists('project_id', $data ?? [], null); + $this->setIfExists('rate_limit', $data ?? [], null); + $this->setIfExists('rate_limit_duration', $data ?? [], null); + $this->setIfExists('retry_count', $data ?? [], null); + $this->setIfExists('secrets', $data ?? [], null); + $this->setIfExists('slack_webhook_url', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('success_count', $data ?? [], null); + $this->setIfExists('support_email', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets advanced_signatures + * + * @return bool|null + */ + public function getAdvancedSignatures() + { + return $this->container['advanced_signatures']; + } + + /** + * Sets advanced_signatures + * + * @param bool|null $advanced_signatures advanced_signatures + * + * @return self + */ + public function setAdvancedSignatures($advanced_signatures) + { + if (is_null($advanced_signatures)) { + throw new \InvalidArgumentException('non-nullable advanced_signatures cannot be null'); + } + $this->container['advanced_signatures'] = $advanced_signatures; + + return $this; + } + + /** + * Gets authentication + * + * @return \Convoy\Client\Model\DatastoreEndpointAuthentication|null + */ + public function getAuthentication() + { + return $this->container['authentication']; + } + + /** + * Sets authentication + * + * @param \Convoy\Client\Model\DatastoreEndpointAuthentication|null $authentication authentication + * + * @return self + */ + public function setAuthentication($authentication) + { + if (is_null($authentication)) { + throw new \InvalidArgumentException('non-nullable authentication cannot be null'); + } + $this->container['authentication'] = $authentication; + + return $this; + } + + /** + * Gets cb_state + * + * @return string|null + */ + public function getCbState() + { + return $this->container['cb_state']; + } + + /** + * Sets cb_state + * + * @param string|null $cb_state CBState is the circuit breaker state (\"open\", \"half-open\", \"closed\") so the UI can reflect a tripped breaker on the endpoint status. Nil when CB is off/unlicensed or has no sample for this endpoint. + * + * @return self + */ + public function setCbState($cb_state) + { + if (is_null($cb_state)) { + throw new \InvalidArgumentException('non-nullable cb_state cannot be null'); + } + $this->container['cb_state'] = $cb_state; + + return $this; + } + + /** + * Gets content_type + * + * @return string|null + */ + public function getContentType() + { + return $this->container['content_type']; + } + + /** + * Sets content_type + * + * @param string|null $content_type content_type + * + * @return self + */ + public function setContentType($content_type) + { + if (is_null($content_type)) { + throw new \InvalidArgumentException('non-nullable content_type cannot be null'); + } + $this->container['content_type'] = $content_type; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets deleted_at + * + * @return string|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param string|null $deleted_at deleted_at + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + if (is_null($deleted_at)) { + throw new \InvalidArgumentException('non-nullable deleted_at cannot be null'); + } + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets events + * + * @return int|null + */ + public function getEvents() + { + return $this->container['events']; + } + + /** + * Sets events + * + * @param int|null $events events + * + * @return self + */ + public function setEvents($events) + { + if (is_null($events)) { + throw new \InvalidArgumentException('non-nullable events cannot be null'); + } + $this->container['events'] = $events; + + return $this; + } + + /** + * Gets failure_count + * + * @return int|null + */ + public function getFailureCount() + { + return $this->container['failure_count']; + } + + /** + * Sets failure_count + * + * @param int|null $failure_count failure_count + * + * @return self + */ + public function setFailureCount($failure_count) + { + if (is_null($failure_count)) { + throw new \InvalidArgumentException('non-nullable failure_count cannot be null'); + } + $this->container['failure_count'] = $failure_count; + + return $this; + } + + /** + * Gets failure_rate + * + * @return float|null + */ + public function getFailureRate() + { + return $this->container['failure_rate']; + } + + /** + * Sets failure_rate + * + * @param float|null $failure_rate FailureRate is the circuit breaker's rolling failure rate for this endpoint. It is a pointer so the API can return null when no rate was computed (circuit breaker feature off, or sampler not running), distinct from a genuine 0%. + * + * @return self + */ + public function setFailureRate($failure_rate) + { + if (is_null($failure_rate)) { + throw new \InvalidArgumentException('non-nullable failure_rate cannot be null'); + } + $this->container['failure_rate'] = $failure_rate; + + return $this; + } + + /** + * Gets http_timeout + * + * @return int|null + */ + public function getHttpTimeout() + { + return $this->container['http_timeout']; + } + + /** + * Sets http_timeout + * + * @param int|null $http_timeout http_timeout + * + * @return self + */ + public function setHttpTimeout($http_timeout) + { + if (is_null($http_timeout)) { + throw new \InvalidArgumentException('non-nullable http_timeout cannot be null'); + } + $this->container['http_timeout'] = $http_timeout; + + return $this; + } + + /** + * Gets mtls_client_cert + * + * @return \Convoy\Client\Model\DatastoreMtlsClientCert|null + */ + public function getMtlsClientCert() + { + return $this->container['mtls_client_cert']; + } + + /** + * Sets mtls_client_cert + * + * @param \Convoy\Client\Model\DatastoreMtlsClientCert|null $mtls_client_cert mTLS client certificate configuration + * + * @return self + */ + public function setMtlsClientCert($mtls_client_cert) + { + if (is_null($mtls_client_cert)) { + throw new \InvalidArgumentException('non-nullable mtls_client_cert cannot be null'); + } + $this->container['mtls_client_cert'] = $mtls_client_cert; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets owner_id + * + * @return string|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param string|null $owner_id owner_id + * + * @return self + */ + public function setOwnerId($owner_id) + { + if (is_null($owner_id)) { + throw new \InvalidArgumentException('non-nullable owner_id cannot be null'); + } + $this->container['owner_id'] = $owner_id; + + return $this; + } + + /** + * Gets period_failure_rate + * + * @return float|null + */ + public function getPeriodFailureRate() + { + return $this->container['period_failure_rate']; + } + + /** + * Sets period_failure_rate + * + * @param float|null $period_failure_rate PeriodFailureRate is the period failure rate from event_deliveries, (Failure+Retry)/(Success+Failure+Retry). Retry counts as failed-so-far. Nil when the range has no counted deliveries; sibling counts are transient. + * + * @return self + */ + public function setPeriodFailureRate($period_failure_rate) + { + if (is_null($period_failure_rate)) { + throw new \InvalidArgumentException('non-nullable period_failure_rate cannot be null'); + } + $this->container['period_failure_rate'] = $period_failure_rate; + + return $this; + } + + /** + * Gets project_id + * + * @return string|null + */ + public function getProjectId() + { + return $this->container['project_id']; + } + + /** + * Sets project_id + * + * @param string|null $project_id project_id + * + * @return self + */ + public function setProjectId($project_id) + { + if (is_null($project_id)) { + throw new \InvalidArgumentException('non-nullable project_id cannot be null'); + } + $this->container['project_id'] = $project_id; + + return $this; + } + + /** + * Gets rate_limit + * + * @return int|null + */ + public function getRateLimit() + { + return $this->container['rate_limit']; + } + + /** + * Sets rate_limit + * + * @param int|null $rate_limit rate_limit + * + * @return self + */ + public function setRateLimit($rate_limit) + { + if (is_null($rate_limit)) { + throw new \InvalidArgumentException('non-nullable rate_limit cannot be null'); + } + $this->container['rate_limit'] = $rate_limit; + + return $this; + } + + /** + * Gets rate_limit_duration + * + * @return int|null + */ + public function getRateLimitDuration() + { + return $this->container['rate_limit_duration']; + } + + /** + * Sets rate_limit_duration + * + * @param int|null $rate_limit_duration rate_limit_duration + * + * @return self + */ + public function setRateLimitDuration($rate_limit_duration) + { + if (is_null($rate_limit_duration)) { + throw new \InvalidArgumentException('non-nullable rate_limit_duration cannot be null'); + } + $this->container['rate_limit_duration'] = $rate_limit_duration; + + return $this; + } + + /** + * Gets retry_count + * + * @return int|null + */ + public function getRetryCount() + { + return $this->container['retry_count']; + } + + /** + * Sets retry_count + * + * @param int|null $retry_count retry_count + * + * @return self + */ + public function setRetryCount($retry_count) + { + if (is_null($retry_count)) { + throw new \InvalidArgumentException('non-nullable retry_count cannot be null'); + } + $this->container['retry_count'] = $retry_count; + + return $this; + } + + /** + * Gets secrets + * + * @return \Convoy\Client\Model\DatastoreSecret[]|null + */ + public function getSecrets() + { + return $this->container['secrets']; + } + + /** + * Sets secrets + * + * @param \Convoy\Client\Model\DatastoreSecret[]|null $secrets secrets + * + * @return self + */ + public function setSecrets($secrets) + { + if (is_null($secrets)) { + throw new \InvalidArgumentException('non-nullable secrets cannot be null'); + } + $this->container['secrets'] = $secrets; + + return $this; + } + + /** + * Gets slack_webhook_url + * + * @return string|null + */ + public function getSlackWebhookUrl() + { + return $this->container['slack_webhook_url']; + } + + /** + * Sets slack_webhook_url + * + * @param string|null $slack_webhook_url slack_webhook_url + * + * @return self + */ + public function setSlackWebhookUrl($slack_webhook_url) + { + if (is_null($slack_webhook_url)) { + throw new \InvalidArgumentException('non-nullable slack_webhook_url cannot be null'); + } + $this->container['slack_webhook_url'] = $slack_webhook_url; + + return $this; + } + + /** + * Gets status + * + * @return \Convoy\Client\Model\DatastoreEndpointStatus|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Convoy\Client\Model\DatastoreEndpointStatus|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets success_count + * + * @return int|null + */ + public function getSuccessCount() + { + return $this->container['success_count']; + } + + /** + * Sets success_count + * + * @param int|null $success_count success_count + * + * @return self + */ + public function setSuccessCount($success_count) + { + if (is_null($success_count)) { + throw new \InvalidArgumentException('non-nullable success_count cannot be null'); + } + $this->container['success_count'] = $success_count; + + return $this; + } + + /** + * Gets support_email + * + * @return string|null + */ + public function getSupportEmail() + { + return $this->container['support_email']; + } + + /** + * Sets support_email + * + * @param string|null $support_email support_email + * + * @return self + */ + public function setSupportEmail($support_email) + { + if (is_null($support_email)) { + throw new \InvalidArgumentException('non-nullable support_email cannot be null'); + } + $this->container['support_email'] = $support_email; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url url + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreEndpointAuthentication.php b/src/Client/Model/DatastoreEndpointAuthentication.php new file mode 100644 index 0000000..6ca29b3 --- /dev/null +++ b/src/Client/Model/DatastoreEndpointAuthentication.php @@ -0,0 +1,512 @@ + + */ +class DatastoreEndpointAuthentication implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.EndpointAuthentication'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'api_key' => '\Convoy\Client\Model\DatastoreApiKey', + 'basic_auth' => '\Convoy\Client\Model\DatastoreBasicAuth', + 'oauth2' => '\Convoy\Client\Model\DatastoreOAuth2', + 'type' => '\Convoy\Client\Model\DatastoreEndpointAuthenticationType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'api_key' => null, + 'basic_auth' => null, + 'oauth2' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'api_key' => false, + 'basic_auth' => false, + 'oauth2' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'api_key' => 'api_key', + 'basic_auth' => 'basic_auth', + 'oauth2' => 'oauth2', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'api_key' => 'setApiKey', + 'basic_auth' => 'setBasicAuth', + 'oauth2' => 'setOauth2', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'api_key' => 'getApiKey', + 'basic_auth' => 'getBasicAuth', + 'oauth2' => 'getOauth2', + 'type' => 'getType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('api_key', $data ?? [], null); + $this->setIfExists('basic_auth', $data ?? [], null); + $this->setIfExists('oauth2', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets api_key + * + * @return \Convoy\Client\Model\DatastoreApiKey|null + */ + public function getApiKey() + { + return $this->container['api_key']; + } + + /** + * Sets api_key + * + * @param \Convoy\Client\Model\DatastoreApiKey|null $api_key api_key + * + * @return self + */ + public function setApiKey($api_key) + { + if (is_null($api_key)) { + throw new \InvalidArgumentException('non-nullable api_key cannot be null'); + } + $this->container['api_key'] = $api_key; + + return $this; + } + + /** + * Gets basic_auth + * + * @return \Convoy\Client\Model\DatastoreBasicAuth|null + */ + public function getBasicAuth() + { + return $this->container['basic_auth']; + } + + /** + * Sets basic_auth + * + * @param \Convoy\Client\Model\DatastoreBasicAuth|null $basic_auth basic_auth + * + * @return self + */ + public function setBasicAuth($basic_auth) + { + if (is_null($basic_auth)) { + throw new \InvalidArgumentException('non-nullable basic_auth cannot be null'); + } + $this->container['basic_auth'] = $basic_auth; + + return $this; + } + + /** + * Gets oauth2 + * + * @return \Convoy\Client\Model\DatastoreOAuth2|null + */ + public function getOauth2() + { + return $this->container['oauth2']; + } + + /** + * Sets oauth2 + * + * @param \Convoy\Client\Model\DatastoreOAuth2|null $oauth2 oauth2 + * + * @return self + */ + public function setOauth2($oauth2) + { + if (is_null($oauth2)) { + throw new \InvalidArgumentException('non-nullable oauth2 cannot be null'); + } + $this->container['oauth2'] = $oauth2; + + return $this; + } + + /** + * Gets type + * + * @return \Convoy\Client\Model\DatastoreEndpointAuthenticationType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Convoy\Client\Model\DatastoreEndpointAuthenticationType|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreEndpointAuthenticationType.php b/src/Client/Model/DatastoreEndpointAuthenticationType.php new file mode 100644 index 0000000..9e3f209 --- /dev/null +++ b/src/Client/Model/DatastoreEndpointAuthenticationType.php @@ -0,0 +1,66 @@ + + */ +class DatastoreEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.Event'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'acknowledged_at' => 'string', + 'app_id' => 'string', + 'created_at' => 'string', + 'data' => 'array', + 'deleted_at' => 'string', + 'endpoint_metadata' => '\Convoy\Client\Model\DatastoreEndpoint[]', + 'endpoints' => 'string[]', + 'event_type' => 'string', + 'headers' => 'array', + 'idempotency_key' => 'string', + 'is_duplicate_event' => 'bool', + 'metadata' => 'string', + 'project_id' => 'string', + 'raw' => 'string', + 'source_id' => 'string', + 'source_metadata' => '\Convoy\Client\Model\DatastoreSource', + 'status' => '\Convoy\Client\Model\DatastoreEventStatus', + 'uid' => 'string', + 'updated_at' => 'string', + 'url_path' => 'string', + 'url_query_params' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'acknowledged_at' => null, + 'app_id' => null, + 'created_at' => null, + 'data' => null, + 'deleted_at' => null, + 'endpoint_metadata' => null, + 'endpoints' => null, + 'event_type' => null, + 'headers' => null, + 'idempotency_key' => null, + 'is_duplicate_event' => null, + 'metadata' => null, + 'project_id' => null, + 'raw' => null, + 'source_id' => null, + 'source_metadata' => null, + 'status' => null, + 'uid' => null, + 'updated_at' => null, + 'url_path' => null, + 'url_query_params' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'acknowledged_at' => false, + 'app_id' => false, + 'created_at' => false, + 'data' => false, + 'deleted_at' => false, + 'endpoint_metadata' => false, + 'endpoints' => false, + 'event_type' => false, + 'headers' => false, + 'idempotency_key' => false, + 'is_duplicate_event' => false, + 'metadata' => false, + 'project_id' => false, + 'raw' => false, + 'source_id' => false, + 'source_metadata' => false, + 'status' => false, + 'uid' => false, + 'updated_at' => false, + 'url_path' => false, + 'url_query_params' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'acknowledged_at' => 'acknowledged_at', + 'app_id' => 'app_id', + 'created_at' => 'created_at', + 'data' => 'data', + 'deleted_at' => 'deleted_at', + 'endpoint_metadata' => 'endpoint_metadata', + 'endpoints' => 'endpoints', + 'event_type' => 'event_type', + 'headers' => 'headers', + 'idempotency_key' => 'idempotency_key', + 'is_duplicate_event' => 'is_duplicate_event', + 'metadata' => 'metadata', + 'project_id' => 'project_id', + 'raw' => 'raw', + 'source_id' => 'source_id', + 'source_metadata' => 'source_metadata', + 'status' => 'status', + 'uid' => 'uid', + 'updated_at' => 'updated_at', + 'url_path' => 'url_path', + 'url_query_params' => 'url_query_params' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'acknowledged_at' => 'setAcknowledgedAt', + 'app_id' => 'setAppId', + 'created_at' => 'setCreatedAt', + 'data' => 'setData', + 'deleted_at' => 'setDeletedAt', + 'endpoint_metadata' => 'setEndpointMetadata', + 'endpoints' => 'setEndpoints', + 'event_type' => 'setEventType', + 'headers' => 'setHeaders', + 'idempotency_key' => 'setIdempotencyKey', + 'is_duplicate_event' => 'setIsDuplicateEvent', + 'metadata' => 'setMetadata', + 'project_id' => 'setProjectId', + 'raw' => 'setRaw', + 'source_id' => 'setSourceId', + 'source_metadata' => 'setSourceMetadata', + 'status' => 'setStatus', + 'uid' => 'setUid', + 'updated_at' => 'setUpdatedAt', + 'url_path' => 'setUrlPath', + 'url_query_params' => 'setUrlQueryParams' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'acknowledged_at' => 'getAcknowledgedAt', + 'app_id' => 'getAppId', + 'created_at' => 'getCreatedAt', + 'data' => 'getData', + 'deleted_at' => 'getDeletedAt', + 'endpoint_metadata' => 'getEndpointMetadata', + 'endpoints' => 'getEndpoints', + 'event_type' => 'getEventType', + 'headers' => 'getHeaders', + 'idempotency_key' => 'getIdempotencyKey', + 'is_duplicate_event' => 'getIsDuplicateEvent', + 'metadata' => 'getMetadata', + 'project_id' => 'getProjectId', + 'raw' => 'getRaw', + 'source_id' => 'getSourceId', + 'source_metadata' => 'getSourceMetadata', + 'status' => 'getStatus', + 'uid' => 'getUid', + 'updated_at' => 'getUpdatedAt', + 'url_path' => 'getUrlPath', + 'url_query_params' => 'getUrlQueryParams' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('acknowledged_at', $data ?? [], null); + $this->setIfExists('app_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('deleted_at', $data ?? [], null); + $this->setIfExists('endpoint_metadata', $data ?? [], null); + $this->setIfExists('endpoints', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('idempotency_key', $data ?? [], null); + $this->setIfExists('is_duplicate_event', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('project_id', $data ?? [], null); + $this->setIfExists('raw', $data ?? [], null); + $this->setIfExists('source_id', $data ?? [], null); + $this->setIfExists('source_metadata', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('url_path', $data ?? [], null); + $this->setIfExists('url_query_params', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets acknowledged_at + * + * @return string|null + */ + public function getAcknowledgedAt() + { + return $this->container['acknowledged_at']; + } + + /** + * Sets acknowledged_at + * + * @param string|null $acknowledged_at acknowledged_at + * + * @return self + */ + public function setAcknowledgedAt($acknowledged_at) + { + if (is_null($acknowledged_at)) { + throw new \InvalidArgumentException('non-nullable acknowledged_at cannot be null'); + } + $this->container['acknowledged_at'] = $acknowledged_at; + + return $this; + } + + /** + * Gets app_id + * + * @return string|null + */ + public function getAppId() + { + return $this->container['app_id']; + } + + /** + * Sets app_id + * + * @param string|null $app_id Deprecated + * + * @return self + */ + public function setAppId($app_id) + { + if (is_null($app_id)) { + throw new \InvalidArgumentException('non-nullable app_id cannot be null'); + } + $this->container['app_id'] = $app_id; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets data + * + * @return array|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param array|null $data Data is an arbitrary JSON value that gets sent as the body of the webhook to the endpoints + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets deleted_at + * + * @return string|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param string|null $deleted_at deleted_at + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + if (is_null($deleted_at)) { + throw new \InvalidArgumentException('non-nullable deleted_at cannot be null'); + } + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets endpoint_metadata + * + * @return \Convoy\Client\Model\DatastoreEndpoint[]|null + */ + public function getEndpointMetadata() + { + return $this->container['endpoint_metadata']; + } + + /** + * Sets endpoint_metadata + * + * @param \Convoy\Client\Model\DatastoreEndpoint[]|null $endpoint_metadata endpoint_metadata + * + * @return self + */ + public function setEndpointMetadata($endpoint_metadata) + { + if (is_null($endpoint_metadata)) { + throw new \InvalidArgumentException('non-nullable endpoint_metadata cannot be null'); + } + $this->container['endpoint_metadata'] = $endpoint_metadata; + + return $this; + } + + /** + * Gets endpoints + * + * @return string[]|null + */ + public function getEndpoints() + { + return $this->container['endpoints']; + } + + /** + * Sets endpoints + * + * @param string[]|null $endpoints endpoints + * + * @return self + */ + public function setEndpoints($endpoints) + { + if (is_null($endpoints)) { + throw new \InvalidArgumentException('non-nullable endpoints cannot be null'); + } + $this->container['endpoints'] = $endpoints; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets headers + * + * @return array|null + */ + public function getHeaders() + { + return $this->container['headers']; + } + + /** + * Sets headers + * + * @param array|null $headers headers + * + * @return self + */ + public function setHeaders($headers) + { + if (is_null($headers)) { + throw new \InvalidArgumentException('non-nullable headers cannot be null'); + } + $this->container['headers'] = $headers; + + return $this; + } + + /** + * Gets idempotency_key + * + * @return string|null + */ + public function getIdempotencyKey() + { + return $this->container['idempotency_key']; + } + + /** + * Sets idempotency_key + * + * @param string|null $idempotency_key idempotency_key + * + * @return self + */ + public function setIdempotencyKey($idempotency_key) + { + if (is_null($idempotency_key)) { + throw new \InvalidArgumentException('non-nullable idempotency_key cannot be null'); + } + $this->container['idempotency_key'] = $idempotency_key; + + return $this; + } + + /** + * Gets is_duplicate_event + * + * @return bool|null + */ + public function getIsDuplicateEvent() + { + return $this->container['is_duplicate_event']; + } + + /** + * Sets is_duplicate_event + * + * @param bool|null $is_duplicate_event is_duplicate_event + * + * @return self + */ + public function setIsDuplicateEvent($is_duplicate_event) + { + if (is_null($is_duplicate_event)) { + throw new \InvalidArgumentException('non-nullable is_duplicate_event cannot be null'); + } + $this->container['is_duplicate_event'] = $is_duplicate_event; + + return $this; + } + + /** + * Gets metadata + * + * @return string|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param string|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets project_id + * + * @return string|null + */ + public function getProjectId() + { + return $this->container['project_id']; + } + + /** + * Sets project_id + * + * @param string|null $project_id project_id + * + * @return self + */ + public function setProjectId($project_id) + { + if (is_null($project_id)) { + throw new \InvalidArgumentException('non-nullable project_id cannot be null'); + } + $this->container['project_id'] = $project_id; + + return $this; + } + + /** + * Gets raw + * + * @return string|null + */ + public function getRaw() + { + return $this->container['raw']; + } + + /** + * Sets raw + * + * @param string|null $raw raw + * + * @return self + */ + public function setRaw($raw) + { + if (is_null($raw)) { + throw new \InvalidArgumentException('non-nullable raw cannot be null'); + } + $this->container['raw'] = $raw; + + return $this; + } + + /** + * Gets source_id + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['source_id']; + } + + /** + * Sets source_id + * + * @param string|null $source_id source_id + * + * @return self + */ + public function setSourceId($source_id) + { + if (is_null($source_id)) { + throw new \InvalidArgumentException('non-nullable source_id cannot be null'); + } + $this->container['source_id'] = $source_id; + + return $this; + } + + /** + * Gets source_metadata + * + * @return \Convoy\Client\Model\DatastoreSource|null + */ + public function getSourceMetadata() + { + return $this->container['source_metadata']; + } + + /** + * Sets source_metadata + * + * @param \Convoy\Client\Model\DatastoreSource|null $source_metadata source_metadata + * + * @return self + */ + public function setSourceMetadata($source_metadata) + { + if (is_null($source_metadata)) { + throw new \InvalidArgumentException('non-nullable source_metadata cannot be null'); + } + $this->container['source_metadata'] = $source_metadata; + + return $this; + } + + /** + * Gets status + * + * @return \Convoy\Client\Model\DatastoreEventStatus|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Convoy\Client\Model\DatastoreEventStatus|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets url_path + * + * @return string|null + */ + public function getUrlPath() + { + return $this->container['url_path']; + } + + /** + * Sets url_path + * + * @param string|null $url_path url_path + * + * @return self + */ + public function setUrlPath($url_path) + { + if (is_null($url_path)) { + throw new \InvalidArgumentException('non-nullable url_path cannot be null'); + } + $this->container['url_path'] = $url_path; + + return $this; + } + + /** + * Gets url_query_params + * + * @return string|null + */ + public function getUrlQueryParams() + { + return $this->container['url_query_params']; + } + + /** + * Sets url_query_params + * + * @param string|null $url_query_params url_query_params + * + * @return self + */ + public function setUrlQueryParams($url_query_params) + { + if (is_null($url_query_params)) { + throw new \InvalidArgumentException('non-nullable url_query_params cannot be null'); + } + $this->container['url_query_params'] = $url_query_params; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreEventDeliveryStatus.php b/src/Client/Model/DatastoreEventDeliveryStatus.php new file mode 100644 index 0000000..eb72bea --- /dev/null +++ b/src/Client/Model/DatastoreEventDeliveryStatus.php @@ -0,0 +1,75 @@ + + */ +class DatastoreFilterConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.FilterConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'event_types' => 'string[]', + 'filter' => '\Convoy\Client\Model\DatastoreFilterSchema' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'event_types' => null, + 'filter' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'event_types' => false, + 'filter' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'event_types' => 'event_types', + 'filter' => 'filter' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'event_types' => 'setEventTypes', + 'filter' => 'setFilter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'event_types' => 'getEventTypes', + 'filter' => 'getFilter' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_types', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_types + * + * @return string[]|null + */ + public function getEventTypes() + { + return $this->container['event_types']; + } + + /** + * Sets event_types + * + * @param string[]|null $event_types event_types + * + * @return self + */ + public function setEventTypes($event_types) + { + if (is_null($event_types)) { + throw new \InvalidArgumentException('non-nullable event_types cannot be null'); + } + $this->container['event_types'] = $event_types; + + return $this; + } + + /** + * Gets filter + * + * @return \Convoy\Client\Model\DatastoreFilterSchema|null + */ + public function getFilter() + { + return $this->container['filter']; + } + + /** + * Sets filter + * + * @param \Convoy\Client\Model\DatastoreFilterSchema|null $filter filter + * + * @return self + */ + public function setFilter($filter) + { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } + $this->container['filter'] = $filter; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreFilterSchema.php b/src/Client/Model/DatastoreFilterSchema.php new file mode 100644 index 0000000..16c0cba --- /dev/null +++ b/src/Client/Model/DatastoreFilterSchema.php @@ -0,0 +1,546 @@ + + */ +class DatastoreFilterSchema implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.FilterSchema'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'body' => 'array', + 'headers' => 'array', + 'is_flattened' => 'bool', + 'path' => 'array', + 'query' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'body' => null, + 'headers' => null, + 'is_flattened' => null, + 'path' => null, + 'query' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'body' => false, + 'headers' => false, + 'is_flattened' => false, + 'path' => false, + 'query' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'body' => 'body', + 'headers' => 'headers', + 'is_flattened' => 'is_flattened', + 'path' => 'path', + 'query' => 'query' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'body' => 'setBody', + 'headers' => 'setHeaders', + 'is_flattened' => 'setIsFlattened', + 'path' => 'setPath', + 'query' => 'setQuery' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'body' => 'getBody', + 'headers' => 'getHeaders', + 'is_flattened' => 'getIsFlattened', + 'path' => 'getPath', + 'query' => 'getQuery' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('is_flattened', $data ?? [], null); + $this->setIfExists('path', $data ?? [], null); + $this->setIfExists('query', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets body + * + * @return array|null + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param array|null $body body + * + * @return self + */ + public function setBody($body) + { + if (is_null($body)) { + throw new \InvalidArgumentException('non-nullable body cannot be null'); + } + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets headers + * + * @return array|null + */ + public function getHeaders() + { + return $this->container['headers']; + } + + /** + * Sets headers + * + * @param array|null $headers headers + * + * @return self + */ + public function setHeaders($headers) + { + if (is_null($headers)) { + throw new \InvalidArgumentException('non-nullable headers cannot be null'); + } + $this->container['headers'] = $headers; + + return $this; + } + + /** + * Gets is_flattened + * + * @return bool|null + */ + public function getIsFlattened() + { + return $this->container['is_flattened']; + } + + /** + * Sets is_flattened + * + * @param bool|null $is_flattened is_flattened + * + * @return self + */ + public function setIsFlattened($is_flattened) + { + if (is_null($is_flattened)) { + throw new \InvalidArgumentException('non-nullable is_flattened cannot be null'); + } + $this->container['is_flattened'] = $is_flattened; + + return $this; + } + + /** + * Gets path + * + * @return array|null + */ + public function getPath() + { + return $this->container['path']; + } + + /** + * Sets path + * + * @param array|null $path path + * + * @return self + */ + public function setPath($path) + { + if (is_null($path)) { + throw new \InvalidArgumentException('non-nullable path cannot be null'); + } + $this->container['path'] = $path; + + return $this; + } + + /** + * Gets query + * + * @return array|null + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param array|null $query query + * + * @return self + */ + public function setQuery($query) + { + if (is_null($query)) { + throw new \InvalidArgumentException('non-nullable query cannot be null'); + } + $this->container['query'] = $query; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreGooglePubSubConfig.php b/src/Client/Model/DatastoreGooglePubSubConfig.php new file mode 100644 index 0000000..11e1353 --- /dev/null +++ b/src/Client/Model/DatastoreGooglePubSubConfig.php @@ -0,0 +1,478 @@ + + */ +class DatastoreGooglePubSubConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.GooglePubSubConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'project_id' => 'string', + 'service_account' => 'string', + 'subscription_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'project_id' => null, + 'service_account' => 'byte', + 'subscription_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'project_id' => false, + 'service_account' => false, + 'subscription_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'project_id' => 'project_id', + 'service_account' => 'service_account', + 'subscription_id' => 'subscription_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'project_id' => 'setProjectId', + 'service_account' => 'setServiceAccount', + 'subscription_id' => 'setSubscriptionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'project_id' => 'getProjectId', + 'service_account' => 'getServiceAccount', + 'subscription_id' => 'getSubscriptionId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('project_id', $data ?? [], null); + $this->setIfExists('service_account', $data ?? [], null); + $this->setIfExists('subscription_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets project_id + * + * @return string|null + */ + public function getProjectId() + { + return $this->container['project_id']; + } + + /** + * Sets project_id + * + * @param string|null $project_id project_id + * + * @return self + */ + public function setProjectId($project_id) + { + if (is_null($project_id)) { + throw new \InvalidArgumentException('non-nullable project_id cannot be null'); + } + $this->container['project_id'] = $project_id; + + return $this; + } + + /** + * Gets service_account + * + * @return string|null + */ + public function getServiceAccount() + { + return $this->container['service_account']; + } + + /** + * Sets service_account + * + * @param string|null $service_account encoding/json marshals []byte as a base64 string on the wire. + * + * @return self + */ + public function setServiceAccount($service_account) + { + if (is_null($service_account)) { + throw new \InvalidArgumentException('non-nullable service_account cannot be null'); + } + $this->container['service_account'] = $service_account; + + return $this; + } + + /** + * Gets subscription_id + * + * @return string|null + */ + public function getSubscriptionId() + { + return $this->container['subscription_id']; + } + + /** + * Sets subscription_id + * + * @param string|null $subscription_id subscription_id + * + * @return self + */ + public function setSubscriptionId($subscription_id) + { + if (is_null($subscription_id)) { + throw new \InvalidArgumentException('non-nullable subscription_id cannot be null'); + } + $this->container['subscription_id'] = $subscription_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreHMac.php b/src/Client/Model/DatastoreHMac.php new file mode 100644 index 0000000..ec8334e --- /dev/null +++ b/src/Client/Model/DatastoreHMac.php @@ -0,0 +1,512 @@ + + */ +class DatastoreHMac implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.HMac'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'encoding' => '\Convoy\Client\Model\DatastoreEncodingType', + 'hash' => 'string', + 'header' => 'string', + 'secret' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'encoding' => null, + 'hash' => null, + 'header' => null, + 'secret' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'encoding' => false, + 'hash' => false, + 'header' => false, + 'secret' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'encoding' => 'encoding', + 'hash' => 'hash', + 'header' => 'header', + 'secret' => 'secret' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'encoding' => 'setEncoding', + 'hash' => 'setHash', + 'header' => 'setHeader', + 'secret' => 'setSecret' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'encoding' => 'getEncoding', + 'hash' => 'getHash', + 'header' => 'getHeader', + 'secret' => 'getSecret' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('encoding', $data ?? [], null); + $this->setIfExists('hash', $data ?? [], null); + $this->setIfExists('header', $data ?? [], null); + $this->setIfExists('secret', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets encoding + * + * @return \Convoy\Client\Model\DatastoreEncodingType|null + */ + public function getEncoding() + { + return $this->container['encoding']; + } + + /** + * Sets encoding + * + * @param \Convoy\Client\Model\DatastoreEncodingType|null $encoding encoding + * + * @return self + */ + public function setEncoding($encoding) + { + if (is_null($encoding)) { + throw new \InvalidArgumentException('non-nullable encoding cannot be null'); + } + $this->container['encoding'] = $encoding; + + return $this; + } + + /** + * Gets hash + * + * @return string|null + */ + public function getHash() + { + return $this->container['hash']; + } + + /** + * Sets hash + * + * @param string|null $hash hash + * + * @return self + */ + public function setHash($hash) + { + if (is_null($hash)) { + throw new \InvalidArgumentException('non-nullable hash cannot be null'); + } + $this->container['hash'] = $hash; + + return $this; + } + + /** + * Gets header + * + * @return string|null + */ + public function getHeader() + { + return $this->container['header']; + } + + /** + * Sets header + * + * @param string|null $header header + * + * @return self + */ + public function setHeader($header) + { + if (is_null($header)) { + throw new \InvalidArgumentException('non-nullable header cannot be null'); + } + $this->container['header'] = $header; + + return $this; + } + + /** + * Gets secret + * + * @return string|null + */ + public function getSecret() + { + return $this->container['secret']; + } + + /** + * Sets secret + * + * @param string|null $secret secret + * + * @return self + */ + public function setSecret($secret) + { + if (is_null($secret)) { + throw new \InvalidArgumentException('non-nullable secret cannot be null'); + } + $this->container['secret'] = $secret; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreKafkaAuth.php b/src/Client/Model/DatastoreKafkaAuth.php new file mode 100644 index 0000000..725587a --- /dev/null +++ b/src/Client/Model/DatastoreKafkaAuth.php @@ -0,0 +1,546 @@ + + */ +class DatastoreKafkaAuth implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.KafkaAuth'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'hash' => 'string', + 'password' => 'string', + 'tls' => 'bool', + 'type' => 'string', + 'username' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'hash' => null, + 'password' => null, + 'tls' => null, + 'type' => null, + 'username' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'hash' => false, + 'password' => false, + 'tls' => false, + 'type' => false, + 'username' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'hash' => 'hash', + 'password' => 'password', + 'tls' => 'tls', + 'type' => 'type', + 'username' => 'username' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'hash' => 'setHash', + 'password' => 'setPassword', + 'tls' => 'setTls', + 'type' => 'setType', + 'username' => 'setUsername' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'hash' => 'getHash', + 'password' => 'getPassword', + 'tls' => 'getTls', + 'type' => 'getType', + 'username' => 'getUsername' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('hash', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('tls', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets hash + * + * @return string|null + */ + public function getHash() + { + return $this->container['hash']; + } + + /** + * Sets hash + * + * @param string|null $hash hash + * + * @return self + */ + public function setHash($hash) + { + if (is_null($hash)) { + throw new \InvalidArgumentException('non-nullable hash cannot be null'); + } + $this->container['hash'] = $hash; + + return $this; + } + + /** + * Gets password + * + * @return string|null + */ + public function getPassword() + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string|null $password password + * + * @return self + */ + public function setPassword($password) + { + if (is_null($password)) { + throw new \InvalidArgumentException('non-nullable password cannot be null'); + } + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets tls + * + * @return bool|null + */ + public function getTls() + { + return $this->container['tls']; + } + + /** + * Sets tls + * + * @param bool|null $tls tls + * + * @return self + */ + public function setTls($tls) + { + if (is_null($tls)) { + throw new \InvalidArgumentException('non-nullable tls cannot be null'); + } + $this->container['tls'] = $tls; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets username + * + * @return string|null + */ + public function getUsername() + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string|null $username username + * + * @return self + */ + public function setUsername($username) + { + if (is_null($username)) { + throw new \InvalidArgumentException('non-nullable username cannot be null'); + } + $this->container['username'] = $username; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreKafkaPubSubConfig.php b/src/Client/Model/DatastoreKafkaPubSubConfig.php new file mode 100644 index 0000000..3a1396e --- /dev/null +++ b/src/Client/Model/DatastoreKafkaPubSubConfig.php @@ -0,0 +1,512 @@ + + */ +class DatastoreKafkaPubSubConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.KafkaPubSubConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'auth' => '\Convoy\Client\Model\DatastoreKafkaAuth', + 'brokers' => 'string[]', + 'consumer_group_id' => 'string', + 'topic_name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'auth' => null, + 'brokers' => null, + 'consumer_group_id' => null, + 'topic_name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'auth' => false, + 'brokers' => false, + 'consumer_group_id' => false, + 'topic_name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'auth' => 'auth', + 'brokers' => 'brokers', + 'consumer_group_id' => 'consumer_group_id', + 'topic_name' => 'topic_name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'auth' => 'setAuth', + 'brokers' => 'setBrokers', + 'consumer_group_id' => 'setConsumerGroupId', + 'topic_name' => 'setTopicName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'auth' => 'getAuth', + 'brokers' => 'getBrokers', + 'consumer_group_id' => 'getConsumerGroupId', + 'topic_name' => 'getTopicName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('auth', $data ?? [], null); + $this->setIfExists('brokers', $data ?? [], null); + $this->setIfExists('consumer_group_id', $data ?? [], null); + $this->setIfExists('topic_name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets auth + * + * @return \Convoy\Client\Model\DatastoreKafkaAuth|null + */ + public function getAuth() + { + return $this->container['auth']; + } + + /** + * Sets auth + * + * @param \Convoy\Client\Model\DatastoreKafkaAuth|null $auth auth + * + * @return self + */ + public function setAuth($auth) + { + if (is_null($auth)) { + throw new \InvalidArgumentException('non-nullable auth cannot be null'); + } + $this->container['auth'] = $auth; + + return $this; + } + + /** + * Gets brokers + * + * @return string[]|null + */ + public function getBrokers() + { + return $this->container['brokers']; + } + + /** + * Sets brokers + * + * @param string[]|null $brokers brokers + * + * @return self + */ + public function setBrokers($brokers) + { + if (is_null($brokers)) { + throw new \InvalidArgumentException('non-nullable brokers cannot be null'); + } + $this->container['brokers'] = $brokers; + + return $this; + } + + /** + * Gets consumer_group_id + * + * @return string|null + */ + public function getConsumerGroupId() + { + return $this->container['consumer_group_id']; + } + + /** + * Sets consumer_group_id + * + * @param string|null $consumer_group_id consumer_group_id + * + * @return self + */ + public function setConsumerGroupId($consumer_group_id) + { + if (is_null($consumer_group_id)) { + throw new \InvalidArgumentException('non-nullable consumer_group_id cannot be null'); + } + $this->container['consumer_group_id'] = $consumer_group_id; + + return $this; + } + + /** + * Gets topic_name + * + * @return string|null + */ + public function getTopicName() + { + return $this->container['topic_name']; + } + + /** + * Sets topic_name + * + * @param string|null $topic_name topic_name + * + * @return self + */ + public function setTopicName($topic_name) + { + if (is_null($topic_name)) { + throw new \InvalidArgumentException('non-nullable topic_name cannot be null'); + } + $this->container['topic_name'] = $topic_name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreMetaEventAttempt.php b/src/Client/Model/DatastoreMetaEventAttempt.php new file mode 100644 index 0000000..a21e940 --- /dev/null +++ b/src/Client/Model/DatastoreMetaEventAttempt.php @@ -0,0 +1,478 @@ + + */ +class DatastoreMetaEventAttempt implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.MetaEventAttempt'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'request_http_header' => 'array', + 'response_data' => 'string', + 'response_http_header' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'request_http_header' => null, + 'response_data' => null, + 'response_http_header' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'request_http_header' => false, + 'response_data' => false, + 'response_http_header' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'request_http_header' => 'request_http_header', + 'response_data' => 'response_data', + 'response_http_header' => 'response_http_header' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'request_http_header' => 'setRequestHttpHeader', + 'response_data' => 'setResponseData', + 'response_http_header' => 'setResponseHttpHeader' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'request_http_header' => 'getRequestHttpHeader', + 'response_data' => 'getResponseData', + 'response_http_header' => 'getResponseHttpHeader' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('request_http_header', $data ?? [], null); + $this->setIfExists('response_data', $data ?? [], null); + $this->setIfExists('response_http_header', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets request_http_header + * + * @return array|null + */ + public function getRequestHttpHeader() + { + return $this->container['request_http_header']; + } + + /** + * Sets request_http_header + * + * @param array|null $request_http_header request_http_header + * + * @return self + */ + public function setRequestHttpHeader($request_http_header) + { + if (is_null($request_http_header)) { + throw new \InvalidArgumentException('non-nullable request_http_header cannot be null'); + } + $this->container['request_http_header'] = $request_http_header; + + return $this; + } + + /** + * Gets response_data + * + * @return string|null + */ + public function getResponseData() + { + return $this->container['response_data']; + } + + /** + * Sets response_data + * + * @param string|null $response_data response_data + * + * @return self + */ + public function setResponseData($response_data) + { + if (is_null($response_data)) { + throw new \InvalidArgumentException('non-nullable response_data cannot be null'); + } + $this->container['response_data'] = $response_data; + + return $this; + } + + /** + * Gets response_http_header + * + * @return array|null + */ + public function getResponseHttpHeader() + { + return $this->container['response_http_header']; + } + + /** + * Sets response_http_header + * + * @param array|null $response_http_header response_http_header + * + * @return self + */ + public function setResponseHttpHeader($response_http_header) + { + if (is_null($response_http_header)) { + throw new \InvalidArgumentException('non-nullable response_http_header cannot be null'); + } + $this->container['response_http_header'] = $response_http_header; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreMetaEventConfiguration.php b/src/Client/Model/DatastoreMetaEventConfiguration.php new file mode 100644 index 0000000..ccd0a0e --- /dev/null +++ b/src/Client/Model/DatastoreMetaEventConfiguration.php @@ -0,0 +1,580 @@ + + */ +class DatastoreMetaEventConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.MetaEventConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'event_type' => 'string[]', + 'is_enabled' => 'bool', + 'pub_sub' => '\Convoy\Client\Model\DatastorePubSubConfig', + 'secret' => 'string', + 'type' => '\Convoy\Client\Model\DatastoreMetaEventType', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'event_type' => null, + 'is_enabled' => null, + 'pub_sub' => null, + 'secret' => null, + 'type' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'is_enabled' => false, + 'pub_sub' => false, + 'secret' => false, + 'type' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'event_type' => 'event_type', + 'is_enabled' => 'is_enabled', + 'pub_sub' => 'pub_sub', + 'secret' => 'secret', + 'type' => 'type', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'event_type' => 'setEventType', + 'is_enabled' => 'setIsEnabled', + 'pub_sub' => 'setPubSub', + 'secret' => 'setSecret', + 'type' => 'setType', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'event_type' => 'getEventType', + 'is_enabled' => 'getIsEnabled', + 'pub_sub' => 'getPubSub', + 'secret' => 'getSecret', + 'type' => 'getType', + 'url' => 'getUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('is_enabled', $data ?? [], null); + $this->setIfExists('pub_sub', $data ?? [], null); + $this->setIfExists('secret', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string[]|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string[]|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets is_enabled + * + * @return bool|null + */ + public function getIsEnabled() + { + return $this->container['is_enabled']; + } + + /** + * Sets is_enabled + * + * @param bool|null $is_enabled is_enabled + * + * @return self + */ + public function setIsEnabled($is_enabled) + { + if (is_null($is_enabled)) { + throw new \InvalidArgumentException('non-nullable is_enabled cannot be null'); + } + $this->container['is_enabled'] = $is_enabled; + + return $this; + } + + /** + * Gets pub_sub + * + * @return \Convoy\Client\Model\DatastorePubSubConfig|null + */ + public function getPubSub() + { + return $this->container['pub_sub']; + } + + /** + * Sets pub_sub + * + * @param \Convoy\Client\Model\DatastorePubSubConfig|null $pub_sub pub_sub + * + * @return self + */ + public function setPubSub($pub_sub) + { + if (is_null($pub_sub)) { + throw new \InvalidArgumentException('non-nullable pub_sub cannot be null'); + } + $this->container['pub_sub'] = $pub_sub; + + return $this; + } + + /** + * Gets secret + * + * @return string|null + */ + public function getSecret() + { + return $this->container['secret']; + } + + /** + * Sets secret + * + * @param string|null $secret secret + * + * @return self + */ + public function setSecret($secret) + { + if (is_null($secret)) { + throw new \InvalidArgumentException('non-nullable secret cannot be null'); + } + $this->container['secret'] = $secret; + + return $this; + } + + /** + * Gets type + * + * @return \Convoy\Client\Model\DatastoreMetaEventType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Convoy\Client\Model\DatastoreMetaEventType|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url url + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreMetaEventType.php b/src/Client/Model/DatastoreMetaEventType.php new file mode 100644 index 0000000..b63e651 --- /dev/null +++ b/src/Client/Model/DatastoreMetaEventType.php @@ -0,0 +1,63 @@ + + */ +class DatastoreMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.Metadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'data' => 'array', + 'interval_seconds' => 'int', + 'max_retry_seconds' => 'int', + 'next_send_time' => 'string', + 'num_trials' => 'int', + 'raw' => 'string', + 'retry_limit' => 'int', + 'strategy' => '\Convoy\Client\Model\DatastoreStrategyProvider' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'interval_seconds' => null, + 'max_retry_seconds' => null, + 'next_send_time' => null, + 'num_trials' => null, + 'raw' => null, + 'retry_limit' => null, + 'strategy' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'interval_seconds' => false, + 'max_retry_seconds' => false, + 'next_send_time' => false, + 'num_trials' => false, + 'raw' => false, + 'retry_limit' => false, + 'strategy' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'data' => 'data', + 'interval_seconds' => 'interval_seconds', + 'max_retry_seconds' => 'max_retry_seconds', + 'next_send_time' => 'next_send_time', + 'num_trials' => 'num_trials', + 'raw' => 'raw', + 'retry_limit' => 'retry_limit', + 'strategy' => 'strategy' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'interval_seconds' => 'setIntervalSeconds', + 'max_retry_seconds' => 'setMaxRetrySeconds', + 'next_send_time' => 'setNextSendTime', + 'num_trials' => 'setNumTrials', + 'raw' => 'setRaw', + 'retry_limit' => 'setRetryLimit', + 'strategy' => 'setStrategy' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'interval_seconds' => 'getIntervalSeconds', + 'max_retry_seconds' => 'getMaxRetrySeconds', + 'next_send_time' => 'getNextSendTime', + 'num_trials' => 'getNumTrials', + 'raw' => 'getRaw', + 'retry_limit' => 'getRetryLimit', + 'strategy' => 'getStrategy' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('interval_seconds', $data ?? [], null); + $this->setIfExists('max_retry_seconds', $data ?? [], null); + $this->setIfExists('next_send_time', $data ?? [], null); + $this->setIfExists('num_trials', $data ?? [], null); + $this->setIfExists('raw', $data ?? [], null); + $this->setIfExists('retry_limit', $data ?? [], null); + $this->setIfExists('strategy', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets data + * + * @return array|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param array|null $data Data to be sent to endpoint. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets interval_seconds + * + * @return int|null + */ + public function getIntervalSeconds() + { + return $this->container['interval_seconds']; + } + + /** + * Sets interval_seconds + * + * @param int|null $interval_seconds interval_seconds + * + * @return self + */ + public function setIntervalSeconds($interval_seconds) + { + if (is_null($interval_seconds)) { + throw new \InvalidArgumentException('non-nullable interval_seconds cannot be null'); + } + $this->container['interval_seconds'] = $interval_seconds; + + return $this; + } + + /** + * Gets max_retry_seconds + * + * @return int|null + */ + public function getMaxRetrySeconds() + { + return $this->container['max_retry_seconds']; + } + + /** + * Sets max_retry_seconds + * + * @param int|null $max_retry_seconds max_retry_seconds + * + * @return self + */ + public function setMaxRetrySeconds($max_retry_seconds) + { + if (is_null($max_retry_seconds)) { + throw new \InvalidArgumentException('non-nullable max_retry_seconds cannot be null'); + } + $this->container['max_retry_seconds'] = $max_retry_seconds; + + return $this; + } + + /** + * Gets next_send_time + * + * @return string|null + */ + public function getNextSendTime() + { + return $this->container['next_send_time']; + } + + /** + * Sets next_send_time + * + * @param string|null $next_send_time next_send_time + * + * @return self + */ + public function setNextSendTime($next_send_time) + { + if (is_null($next_send_time)) { + throw new \InvalidArgumentException('non-nullable next_send_time cannot be null'); + } + $this->container['next_send_time'] = $next_send_time; + + return $this; + } + + /** + * Gets num_trials + * + * @return int|null + */ + public function getNumTrials() + { + return $this->container['num_trials']; + } + + /** + * Sets num_trials + * + * @param int|null $num_trials NumTrials: number of times we have tried to deliver this Event to an application + * + * @return self + */ + public function setNumTrials($num_trials) + { + if (is_null($num_trials)) { + throw new \InvalidArgumentException('non-nullable num_trials cannot be null'); + } + $this->container['num_trials'] = $num_trials; + + return $this; + } + + /** + * Gets raw + * + * @return string|null + */ + public function getRaw() + { + return $this->container['raw']; + } + + /** + * Sets raw + * + * @param string|null $raw raw + * + * @return self + */ + public function setRaw($raw) + { + if (is_null($raw)) { + throw new \InvalidArgumentException('non-nullable raw cannot be null'); + } + $this->container['raw'] = $raw; + + return $this; + } + + /** + * Gets retry_limit + * + * @return int|null + */ + public function getRetryLimit() + { + return $this->container['retry_limit']; + } + + /** + * Sets retry_limit + * + * @param int|null $retry_limit retry_limit + * + * @return self + */ + public function setRetryLimit($retry_limit) + { + if (is_null($retry_limit)) { + throw new \InvalidArgumentException('non-nullable retry_limit cannot be null'); + } + $this->container['retry_limit'] = $retry_limit; + + return $this; + } + + /** + * Gets strategy + * + * @return \Convoy\Client\Model\DatastoreStrategyProvider|null + */ + public function getStrategy() + { + return $this->container['strategy']; + } + + /** + * Sets strategy + * + * @param \Convoy\Client\Model\DatastoreStrategyProvider|null $strategy strategy + * + * @return self + */ + public function setStrategy($strategy) + { + if (is_null($strategy)) { + throw new \InvalidArgumentException('non-nullable strategy cannot be null'); + } + $this->container['strategy'] = $strategy; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreMtlsClientCert.php b/src/Client/Model/DatastoreMtlsClientCert.php new file mode 100644 index 0000000..c5e3103 --- /dev/null +++ b/src/Client/Model/DatastoreMtlsClientCert.php @@ -0,0 +1,444 @@ + + */ +class DatastoreMtlsClientCert implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.MtlsClientCert'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'client_cert' => 'string', + 'client_key' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'client_cert' => null, + 'client_key' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'client_cert' => false, + 'client_key' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'client_cert' => 'client_cert', + 'client_key' => 'client_key' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'client_cert' => 'setClientCert', + 'client_key' => 'setClientKey' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'client_cert' => 'getClientCert', + 'client_key' => 'getClientKey' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('client_cert', $data ?? [], null); + $this->setIfExists('client_key', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets client_cert + * + * @return string|null + */ + public function getClientCert() + { + return $this->container['client_cert']; + } + + /** + * Sets client_cert + * + * @param string|null $client_cert ClientCert is the client certificate PEM string + * + * @return self + */ + public function setClientCert($client_cert) + { + if (is_null($client_cert)) { + throw new \InvalidArgumentException('non-nullable client_cert cannot be null'); + } + $this->container['client_cert'] = $client_cert; + + return $this; + } + + /** + * Gets client_key + * + * @return string|null + */ + public function getClientKey() + { + return $this->container['client_key']; + } + + /** + * Sets client_key + * + * @param string|null $client_key ClientKey is the client private key PEM string + * + * @return self + */ + public function setClientKey($client_key) + { + if (is_null($client_key)) { + throw new \InvalidArgumentException('non-nullable client_key cannot be null'); + } + $this->container['client_key'] = $client_key; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreOAuth2.php b/src/Client/Model/DatastoreOAuth2.php new file mode 100644 index 0000000..d7c49a1 --- /dev/null +++ b/src/Client/Model/DatastoreOAuth2.php @@ -0,0 +1,818 @@ + + */ +class DatastoreOAuth2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.OAuth2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'audience' => 'string', + 'authentication_type' => '\Convoy\Client\Model\DatastoreOAuth2AuthenticationType', + 'client_id' => 'string', + 'client_secret' => 'string', + 'expiry_time_unit' => '\Convoy\Client\Model\DatastoreOAuth2ExpiryTimeUnit', + 'field_mapping' => '\Convoy\Client\Model\DatastoreOAuth2FieldMapping', + 'grant_type' => 'string', + 'issuer' => 'string', + 'scope' => 'string', + 'signing_algorithm' => 'string', + 'signing_key' => '\Convoy\Client\Model\DatastoreOAuth2SigningKey', + 'subject' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'audience' => null, + 'authentication_type' => null, + 'client_id' => null, + 'client_secret' => null, + 'expiry_time_unit' => null, + 'field_mapping' => null, + 'grant_type' => null, + 'issuer' => null, + 'scope' => null, + 'signing_algorithm' => null, + 'signing_key' => null, + 'subject' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'audience' => false, + 'authentication_type' => false, + 'client_id' => false, + 'client_secret' => false, + 'expiry_time_unit' => false, + 'field_mapping' => false, + 'grant_type' => false, + 'issuer' => false, + 'scope' => false, + 'signing_algorithm' => false, + 'signing_key' => false, + 'subject' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'audience' => 'audience', + 'authentication_type' => 'authentication_type', + 'client_id' => 'client_id', + 'client_secret' => 'client_secret', + 'expiry_time_unit' => 'expiry_time_unit', + 'field_mapping' => 'field_mapping', + 'grant_type' => 'grant_type', + 'issuer' => 'issuer', + 'scope' => 'scope', + 'signing_algorithm' => 'signing_algorithm', + 'signing_key' => 'signing_key', + 'subject' => 'subject', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'audience' => 'setAudience', + 'authentication_type' => 'setAuthenticationType', + 'client_id' => 'setClientId', + 'client_secret' => 'setClientSecret', + 'expiry_time_unit' => 'setExpiryTimeUnit', + 'field_mapping' => 'setFieldMapping', + 'grant_type' => 'setGrantType', + 'issuer' => 'setIssuer', + 'scope' => 'setScope', + 'signing_algorithm' => 'setSigningAlgorithm', + 'signing_key' => 'setSigningKey', + 'subject' => 'setSubject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'audience' => 'getAudience', + 'authentication_type' => 'getAuthenticationType', + 'client_id' => 'getClientId', + 'client_secret' => 'getClientSecret', + 'expiry_time_unit' => 'getExpiryTimeUnit', + 'field_mapping' => 'getFieldMapping', + 'grant_type' => 'getGrantType', + 'issuer' => 'getIssuer', + 'scope' => 'getScope', + 'signing_algorithm' => 'getSigningAlgorithm', + 'signing_key' => 'getSigningKey', + 'subject' => 'getSubject', + 'url' => 'getUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('audience', $data ?? [], null); + $this->setIfExists('authentication_type', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('client_secret', $data ?? [], null); + $this->setIfExists('expiry_time_unit', $data ?? [], null); + $this->setIfExists('field_mapping', $data ?? [], null); + $this->setIfExists('grant_type', $data ?? [], null); + $this->setIfExists('issuer', $data ?? [], null); + $this->setIfExists('scope', $data ?? [], null); + $this->setIfExists('signing_algorithm', $data ?? [], null); + $this->setIfExists('signing_key', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets audience + * + * @return string|null + */ + public function getAudience() + { + return $this->container['audience']; + } + + /** + * Sets audience + * + * @param string|null $audience audience + * + * @return self + */ + public function setAudience($audience) + { + if (is_null($audience)) { + throw new \InvalidArgumentException('non-nullable audience cannot be null'); + } + $this->container['audience'] = $audience; + + return $this; + } + + /** + * Gets authentication_type + * + * @return \Convoy\Client\Model\DatastoreOAuth2AuthenticationType|null + */ + public function getAuthenticationType() + { + return $this->container['authentication_type']; + } + + /** + * Sets authentication_type + * + * @param \Convoy\Client\Model\DatastoreOAuth2AuthenticationType|null $authentication_type authentication_type + * + * @return self + */ + public function setAuthenticationType($authentication_type) + { + if (is_null($authentication_type)) { + throw new \InvalidArgumentException('non-nullable authentication_type cannot be null'); + } + $this->container['authentication_type'] = $authentication_type; + + return $this; + } + + /** + * Gets client_id + * + * @return string|null + */ + public function getClientId() + { + return $this->container['client_id']; + } + + /** + * Sets client_id + * + * @param string|null $client_id client_id + * + * @return self + */ + public function setClientId($client_id) + { + if (is_null($client_id)) { + throw new \InvalidArgumentException('non-nullable client_id cannot be null'); + } + $this->container['client_id'] = $client_id; + + return $this; + } + + /** + * Gets client_secret + * + * @return string|null + */ + public function getClientSecret() + { + return $this->container['client_secret']; + } + + /** + * Sets client_secret + * + * @param string|null $client_secret Encrypted at rest + * + * @return self + */ + public function setClientSecret($client_secret) + { + if (is_null($client_secret)) { + throw new \InvalidArgumentException('non-nullable client_secret cannot be null'); + } + $this->container['client_secret'] = $client_secret; + + return $this; + } + + /** + * Gets expiry_time_unit + * + * @return \Convoy\Client\Model\DatastoreOAuth2ExpiryTimeUnit|null + */ + public function getExpiryTimeUnit() + { + return $this->container['expiry_time_unit']; + } + + /** + * Sets expiry_time_unit + * + * @param \Convoy\Client\Model\DatastoreOAuth2ExpiryTimeUnit|null $expiry_time_unit Expiry time unit (seconds, milliseconds, minutes, hours) + * + * @return self + */ + public function setExpiryTimeUnit($expiry_time_unit) + { + if (is_null($expiry_time_unit)) { + throw new \InvalidArgumentException('non-nullable expiry_time_unit cannot be null'); + } + $this->container['expiry_time_unit'] = $expiry_time_unit; + + return $this; + } + + /** + * Gets field_mapping + * + * @return \Convoy\Client\Model\DatastoreOAuth2FieldMapping|null + */ + public function getFieldMapping() + { + return $this->container['field_mapping']; + } + + /** + * Sets field_mapping + * + * @param \Convoy\Client\Model\DatastoreOAuth2FieldMapping|null $field_mapping Field mapping for flexible token response parsing + * + * @return self + */ + public function setFieldMapping($field_mapping) + { + if (is_null($field_mapping)) { + throw new \InvalidArgumentException('non-nullable field_mapping cannot be null'); + } + $this->container['field_mapping'] = $field_mapping; + + return $this; + } + + /** + * Gets grant_type + * + * @return string|null + */ + public function getGrantType() + { + return $this->container['grant_type']; + } + + /** + * Sets grant_type + * + * @param string|null $grant_type grant_type + * + * @return self + */ + public function setGrantType($grant_type) + { + if (is_null($grant_type)) { + throw new \InvalidArgumentException('non-nullable grant_type cannot be null'); + } + $this->container['grant_type'] = $grant_type; + + return $this; + } + + /** + * Gets issuer + * + * @return string|null + */ + public function getIssuer() + { + return $this->container['issuer']; + } + + /** + * Sets issuer + * + * @param string|null $issuer issuer + * + * @return self + */ + public function setIssuer($issuer) + { + if (is_null($issuer)) { + throw new \InvalidArgumentException('non-nullable issuer cannot be null'); + } + $this->container['issuer'] = $issuer; + + return $this; + } + + /** + * Gets scope + * + * @return string|null + */ + public function getScope() + { + return $this->container['scope']; + } + + /** + * Sets scope + * + * @param string|null $scope scope + * + * @return self + */ + public function setScope($scope) + { + if (is_null($scope)) { + throw new \InvalidArgumentException('non-nullable scope cannot be null'); + } + $this->container['scope'] = $scope; + + return $this; + } + + /** + * Gets signing_algorithm + * + * @return string|null + */ + public function getSigningAlgorithm() + { + return $this->container['signing_algorithm']; + } + + /** + * Sets signing_algorithm + * + * @param string|null $signing_algorithm signing_algorithm + * + * @return self + */ + public function setSigningAlgorithm($signing_algorithm) + { + if (is_null($signing_algorithm)) { + throw new \InvalidArgumentException('non-nullable signing_algorithm cannot be null'); + } + $this->container['signing_algorithm'] = $signing_algorithm; + + return $this; + } + + /** + * Gets signing_key + * + * @return \Convoy\Client\Model\DatastoreOAuth2SigningKey|null + */ + public function getSigningKey() + { + return $this->container['signing_key']; + } + + /** + * Sets signing_key + * + * @param \Convoy\Client\Model\DatastoreOAuth2SigningKey|null $signing_key Encrypted at rest + * + * @return self + */ + public function setSigningKey($signing_key) + { + if (is_null($signing_key)) { + throw new \InvalidArgumentException('non-nullable signing_key cannot be null'); + } + $this->container['signing_key'] = $signing_key; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject subject + * + * @return self + */ + public function setSubject($subject) + { + if (is_null($subject)) { + throw new \InvalidArgumentException('non-nullable subject cannot be null'); + } + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url url + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreOAuth2AuthenticationType.php b/src/Client/Model/DatastoreOAuth2AuthenticationType.php new file mode 100644 index 0000000..9f87c62 --- /dev/null +++ b/src/Client/Model/DatastoreOAuth2AuthenticationType.php @@ -0,0 +1,63 @@ + + */ +class DatastoreOAuth2FieldMapping implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.OAuth2FieldMapping'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'access_token' => 'string', + 'expires_in' => 'string', + 'token_type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'access_token' => null, + 'expires_in' => null, + 'token_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'access_token' => false, + 'expires_in' => false, + 'token_type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'access_token' => 'access_token', + 'expires_in' => 'expires_in', + 'token_type' => 'token_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'access_token' => 'setAccessToken', + 'expires_in' => 'setExpiresIn', + 'token_type' => 'setTokenType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'access_token' => 'getAccessToken', + 'expires_in' => 'getExpiresIn', + 'token_type' => 'getTokenType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('access_token', $data ?? [], null); + $this->setIfExists('expires_in', $data ?? [], null); + $this->setIfExists('token_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets access_token + * + * @return string|null + */ + public function getAccessToken() + { + return $this->container['access_token']; + } + + /** + * Sets access_token + * + * @param string|null $access_token Field name for access token (e.g., \"accessToken\", \"access_token\", \"token\") + * + * @return self + */ + public function setAccessToken($access_token) + { + if (is_null($access_token)) { + throw new \InvalidArgumentException('non-nullable access_token cannot be null'); + } + $this->container['access_token'] = $access_token; + + return $this; + } + + /** + * Gets expires_in + * + * @return string|null + */ + public function getExpiresIn() + { + return $this->container['expires_in']; + } + + /** + * Sets expires_in + * + * @param string|null $expires_in Field name for expiry time (e.g., \"expiresIn\", \"expires_in\", \"expiresAt\") + * + * @return self + */ + public function setExpiresIn($expires_in) + { + if (is_null($expires_in)) { + throw new \InvalidArgumentException('non-nullable expires_in cannot be null'); + } + $this->container['expires_in'] = $expires_in; + + return $this; + } + + /** + * Gets token_type + * + * @return string|null + */ + public function getTokenType() + { + return $this->container['token_type']; + } + + /** + * Sets token_type + * + * @param string|null $token_type Field name for token type (e.g., \"tokenType\", \"token_type\") + * + * @return self + */ + public function setTokenType($token_type) + { + if (is_null($token_type)) { + throw new \InvalidArgumentException('non-nullable token_type cannot be null'); + } + $this->container['token_type'] = $token_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreOAuth2SigningKey.php b/src/Client/Model/DatastoreOAuth2SigningKey.php new file mode 100644 index 0000000..106137a --- /dev/null +++ b/src/Client/Model/DatastoreOAuth2SigningKey.php @@ -0,0 +1,818 @@ + + */ +class DatastoreOAuth2SigningKey implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.OAuth2SigningKey'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'crv' => 'string', + 'd' => 'string', + 'dp' => 'string', + 'dq' => 'string', + 'e' => 'string', + 'kid' => 'string', + 'kty' => 'string', + 'n' => 'string', + 'p' => 'string', + 'q' => 'string', + 'qi' => 'string', + 'x' => 'string', + 'y' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'crv' => null, + 'd' => null, + 'dp' => null, + 'dq' => null, + 'e' => null, + 'kid' => null, + 'kty' => null, + 'n' => null, + 'p' => null, + 'q' => null, + 'qi' => null, + 'x' => null, + 'y' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'crv' => false, + 'd' => false, + 'dp' => false, + 'dq' => false, + 'e' => false, + 'kid' => false, + 'kty' => false, + 'n' => false, + 'p' => false, + 'q' => false, + 'qi' => false, + 'x' => false, + 'y' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'crv' => 'crv', + 'd' => 'd', + 'dp' => 'dp', + 'dq' => 'dq', + 'e' => 'e', + 'kid' => 'kid', + 'kty' => 'kty', + 'n' => 'n', + 'p' => 'p', + 'q' => 'q', + 'qi' => 'qi', + 'x' => 'x', + 'y' => 'y' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'crv' => 'setCrv', + 'd' => 'setD', + 'dp' => 'setDp', + 'dq' => 'setDq', + 'e' => 'setE', + 'kid' => 'setKid', + 'kty' => 'setKty', + 'n' => 'setN', + 'p' => 'setP', + 'q' => 'setQ', + 'qi' => 'setQi', + 'x' => 'setX', + 'y' => 'setY' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'crv' => 'getCrv', + 'd' => 'getD', + 'dp' => 'getDp', + 'dq' => 'getDq', + 'e' => 'getE', + 'kid' => 'getKid', + 'kty' => 'getKty', + 'n' => 'getN', + 'p' => 'getP', + 'q' => 'getQ', + 'qi' => 'getQi', + 'x' => 'getX', + 'y' => 'getY' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('crv', $data ?? [], null); + $this->setIfExists('d', $data ?? [], null); + $this->setIfExists('dp', $data ?? [], null); + $this->setIfExists('dq', $data ?? [], null); + $this->setIfExists('e', $data ?? [], null); + $this->setIfExists('kid', $data ?? [], null); + $this->setIfExists('kty', $data ?? [], null); + $this->setIfExists('n', $data ?? [], null); + $this->setIfExists('p', $data ?? [], null); + $this->setIfExists('q', $data ?? [], null); + $this->setIfExists('qi', $data ?? [], null); + $this->setIfExists('x', $data ?? [], null); + $this->setIfExists('y', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets crv + * + * @return string|null + */ + public function getCrv() + { + return $this->container['crv']; + } + + /** + * Sets crv + * + * @param string|null $crv EC (Elliptic Curve) key fields + * + * @return self + */ + public function setCrv($crv) + { + if (is_null($crv)) { + throw new \InvalidArgumentException('non-nullable crv cannot be null'); + } + $this->container['crv'] = $crv; + + return $this; + } + + /** + * Gets d + * + * @return string|null + */ + public function getD() + { + return $this->container['d']; + } + + /** + * Sets d + * + * @param string|null $d Private key (EC only) + * + * @return self + */ + public function setD($d) + { + if (is_null($d)) { + throw new \InvalidArgumentException('non-nullable d cannot be null'); + } + $this->container['d'] = $d; + + return $this; + } + + /** + * Gets dp + * + * @return string|null + */ + public function getDp() + { + return $this->container['dp']; + } + + /** + * Sets dp + * + * @param string|null $dp RSA first factor CRT exponent (RSA private key only) + * + * @return self + */ + public function setDp($dp) + { + if (is_null($dp)) { + throw new \InvalidArgumentException('non-nullable dp cannot be null'); + } + $this->container['dp'] = $dp; + + return $this; + } + + /** + * Gets dq + * + * @return string|null + */ + public function getDq() + { + return $this->container['dq']; + } + + /** + * Sets dq + * + * @param string|null $dq RSA second factor CRT exponent (RSA private key only) + * + * @return self + */ + public function setDq($dq) + { + if (is_null($dq)) { + throw new \InvalidArgumentException('non-nullable dq cannot be null'); + } + $this->container['dq'] = $dq; + + return $this; + } + + /** + * Gets e + * + * @return string|null + */ + public function getE() + { + return $this->container['e']; + } + + /** + * Sets e + * + * @param string|null $e RSA public exponent (RSA only) + * + * @return self + */ + public function setE($e) + { + if (is_null($e)) { + throw new \InvalidArgumentException('non-nullable e cannot be null'); + } + $this->container['e'] = $e; + + return $this; + } + + /** + * Gets kid + * + * @return string|null + */ + public function getKid() + { + return $this->container['kid']; + } + + /** + * Sets kid + * + * @param string|null $kid Key ID + * + * @return self + */ + public function setKid($kid) + { + if (is_null($kid)) { + throw new \InvalidArgumentException('non-nullable kid cannot be null'); + } + $this->container['kid'] = $kid; + + return $this; + } + + /** + * Gets kty + * + * @return string|null + */ + public function getKty() + { + return $this->container['kty']; + } + + /** + * Sets kty + * + * @param string|null $kty Key type: \"EC\" or \"RSA\" + * + * @return self + */ + public function setKty($kty) + { + if (is_null($kty)) { + throw new \InvalidArgumentException('non-nullable kty cannot be null'); + } + $this->container['kty'] = $kty; + + return $this; + } + + /** + * Gets n + * + * @return string|null + */ + public function getN() + { + return $this->container['n']; + } + + /** + * Sets n + * + * @param string|null $n RSA key fields + * + * @return self + */ + public function setN($n) + { + if (is_null($n)) { + throw new \InvalidArgumentException('non-nullable n cannot be null'); + } + $this->container['n'] = $n; + + return $this; + } + + /** + * Gets p + * + * @return string|null + */ + public function getP() + { + return $this->container['p']; + } + + /** + * Sets p + * + * @param string|null $p RSA first prime factor (RSA private key only) + * + * @return self + */ + public function setP($p) + { + if (is_null($p)) { + throw new \InvalidArgumentException('non-nullable p cannot be null'); + } + $this->container['p'] = $p; + + return $this; + } + + /** + * Gets q + * + * @return string|null + */ + public function getQ() + { + return $this->container['q']; + } + + /** + * Sets q + * + * @param string|null $q RSA second prime factor (RSA private key only) + * + * @return self + */ + public function setQ($q) + { + if (is_null($q)) { + throw new \InvalidArgumentException('non-nullable q cannot be null'); + } + $this->container['q'] = $q; + + return $this; + } + + /** + * Gets qi + * + * @return string|null + */ + public function getQi() + { + return $this->container['qi']; + } + + /** + * Sets qi + * + * @param string|null $qi RSA first CRT coefficient (RSA private key only) + * + * @return self + */ + public function setQi($qi) + { + if (is_null($qi)) { + throw new \InvalidArgumentException('non-nullable qi cannot be null'); + } + $this->container['qi'] = $qi; + + return $this; + } + + /** + * Gets x + * + * @return string|null + */ + public function getX() + { + return $this->container['x']; + } + + /** + * Sets x + * + * @param string|null $x X coordinate (EC only) + * + * @return self + */ + public function setX($x) + { + if (is_null($x)) { + throw new \InvalidArgumentException('non-nullable x cannot be null'); + } + $this->container['x'] = $x; + + return $this; + } + + /** + * Gets y + * + * @return string|null + */ + public function getY() + { + return $this->container['y']; + } + + /** + * Sets y + * + * @param string|null $y Y coordinate (EC only) + * + * @return self + */ + public function setY($y) + { + if (is_null($y)) { + throw new \InvalidArgumentException('non-nullable y cannot be null'); + } + $this->container['y'] = $y; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastorePageDirection.php b/src/Client/Model/DatastorePageDirection.php new file mode 100644 index 0000000..30e869e --- /dev/null +++ b/src/Client/Model/DatastorePageDirection.php @@ -0,0 +1,63 @@ + + */ +class DatastorePaginationData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.PaginationData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'has_next_page' => 'bool', + 'has_prev_page' => 'bool', + 'next_page_cursor' => 'string', + 'per_page' => 'int', + 'prev_page_cursor' => 'string', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'has_next_page' => null, + 'has_prev_page' => null, + 'next_page_cursor' => null, + 'per_page' => null, + 'prev_page_cursor' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'has_next_page' => false, + 'has_prev_page' => false, + 'next_page_cursor' => false, + 'per_page' => false, + 'prev_page_cursor' => false, + 'total' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'has_next_page' => 'has_next_page', + 'has_prev_page' => 'has_prev_page', + 'next_page_cursor' => 'next_page_cursor', + 'per_page' => 'per_page', + 'prev_page_cursor' => 'prev_page_cursor', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'has_next_page' => 'setHasNextPage', + 'has_prev_page' => 'setHasPrevPage', + 'next_page_cursor' => 'setNextPageCursor', + 'per_page' => 'setPerPage', + 'prev_page_cursor' => 'setPrevPageCursor', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'has_next_page' => 'getHasNextPage', + 'has_prev_page' => 'getHasPrevPage', + 'next_page_cursor' => 'getNextPageCursor', + 'per_page' => 'getPerPage', + 'prev_page_cursor' => 'getPrevPageCursor', + 'total' => 'getTotal' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('has_next_page', $data ?? [], null); + $this->setIfExists('has_prev_page', $data ?? [], null); + $this->setIfExists('next_page_cursor', $data ?? [], null); + $this->setIfExists('per_page', $data ?? [], null); + $this->setIfExists('prev_page_cursor', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets has_next_page + * + * @return bool|null + */ + public function getHasNextPage() + { + return $this->container['has_next_page']; + } + + /** + * Sets has_next_page + * + * @param bool|null $has_next_page has_next_page + * + * @return self + */ + public function setHasNextPage($has_next_page) + { + if (is_null($has_next_page)) { + throw new \InvalidArgumentException('non-nullable has_next_page cannot be null'); + } + $this->container['has_next_page'] = $has_next_page; + + return $this; + } + + /** + * Gets has_prev_page + * + * @return bool|null + */ + public function getHasPrevPage() + { + return $this->container['has_prev_page']; + } + + /** + * Sets has_prev_page + * + * @param bool|null $has_prev_page has_prev_page + * + * @return self + */ + public function setHasPrevPage($has_prev_page) + { + if (is_null($has_prev_page)) { + throw new \InvalidArgumentException('non-nullable has_prev_page cannot be null'); + } + $this->container['has_prev_page'] = $has_prev_page; + + return $this; + } + + /** + * Gets next_page_cursor + * + * @return string|null + */ + public function getNextPageCursor() + { + return $this->container['next_page_cursor']; + } + + /** + * Sets next_page_cursor + * + * @param string|null $next_page_cursor next_page_cursor + * + * @return self + */ + public function setNextPageCursor($next_page_cursor) + { + if (is_null($next_page_cursor)) { + throw new \InvalidArgumentException('non-nullable next_page_cursor cannot be null'); + } + $this->container['next_page_cursor'] = $next_page_cursor; + + return $this; + } + + /** + * Gets per_page + * + * @return int|null + */ + public function getPerPage() + { + return $this->container['per_page']; + } + + /** + * Sets per_page + * + * @param int|null $per_page per_page + * + * @return self + */ + public function setPerPage($per_page) + { + if (is_null($per_page)) { + throw new \InvalidArgumentException('non-nullable per_page cannot be null'); + } + $this->container['per_page'] = $per_page; + + return $this; + } + + /** + * Gets prev_page_cursor + * + * @return string|null + */ + public function getPrevPageCursor() + { + return $this->container['prev_page_cursor']; + } + + /** + * Sets prev_page_cursor + * + * @param string|null $prev_page_cursor prev_page_cursor + * + * @return self + */ + public function setPrevPageCursor($prev_page_cursor) + { + if (is_null($prev_page_cursor)) { + throw new \InvalidArgumentException('non-nullable prev_page_cursor cannot be null'); + } + $this->container['prev_page_cursor'] = $prev_page_cursor; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total total + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + $this->container['total'] = $total; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastorePortalAuthType.php b/src/Client/Model/DatastorePortalAuthType.php new file mode 100644 index 0000000..c7c4f73 --- /dev/null +++ b/src/Client/Model/DatastorePortalAuthType.php @@ -0,0 +1,63 @@ + + */ +class DatastorePortalLinkResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.PortalLinkResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'auth_key' => 'string', + 'auth_type' => '\Convoy\Client\Model\DatastorePortalAuthType', + 'can_manage_endpoint' => 'bool', + 'created_at' => 'string', + 'deleted_at' => 'string', + 'endpoint_count' => 'int', + 'endpoints' => 'string[]', + 'endpoints_metadata' => '\Convoy\Client\Model\DatastoreEndpoint[]', + 'name' => 'string', + 'owner_id' => 'string', + 'project_id' => 'string', + 'token' => 'string', + 'uid' => 'string', + 'updated_at' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'auth_key' => null, + 'auth_type' => null, + 'can_manage_endpoint' => null, + 'created_at' => null, + 'deleted_at' => null, + 'endpoint_count' => null, + 'endpoints' => null, + 'endpoints_metadata' => null, + 'name' => null, + 'owner_id' => null, + 'project_id' => null, + 'token' => null, + 'uid' => null, + 'updated_at' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'auth_key' => false, + 'auth_type' => false, + 'can_manage_endpoint' => false, + 'created_at' => false, + 'deleted_at' => false, + 'endpoint_count' => false, + 'endpoints' => false, + 'endpoints_metadata' => false, + 'name' => false, + 'owner_id' => false, + 'project_id' => false, + 'token' => false, + 'uid' => false, + 'updated_at' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'auth_key' => 'auth_key', + 'auth_type' => 'auth_type', + 'can_manage_endpoint' => 'can_manage_endpoint', + 'created_at' => 'created_at', + 'deleted_at' => 'deleted_at', + 'endpoint_count' => 'endpoint_count', + 'endpoints' => 'endpoints', + 'endpoints_metadata' => 'endpoints_metadata', + 'name' => 'name', + 'owner_id' => 'owner_id', + 'project_id' => 'project_id', + 'token' => 'token', + 'uid' => 'uid', + 'updated_at' => 'updated_at', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'auth_key' => 'setAuthKey', + 'auth_type' => 'setAuthType', + 'can_manage_endpoint' => 'setCanManageEndpoint', + 'created_at' => 'setCreatedAt', + 'deleted_at' => 'setDeletedAt', + 'endpoint_count' => 'setEndpointCount', + 'endpoints' => 'setEndpoints', + 'endpoints_metadata' => 'setEndpointsMetadata', + 'name' => 'setName', + 'owner_id' => 'setOwnerId', + 'project_id' => 'setProjectId', + 'token' => 'setToken', + 'uid' => 'setUid', + 'updated_at' => 'setUpdatedAt', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'auth_key' => 'getAuthKey', + 'auth_type' => 'getAuthType', + 'can_manage_endpoint' => 'getCanManageEndpoint', + 'created_at' => 'getCreatedAt', + 'deleted_at' => 'getDeletedAt', + 'endpoint_count' => 'getEndpointCount', + 'endpoints' => 'getEndpoints', + 'endpoints_metadata' => 'getEndpointsMetadata', + 'name' => 'getName', + 'owner_id' => 'getOwnerId', + 'project_id' => 'getProjectId', + 'token' => 'getToken', + 'uid' => 'getUid', + 'updated_at' => 'getUpdatedAt', + 'url' => 'getUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('auth_key', $data ?? [], null); + $this->setIfExists('auth_type', $data ?? [], null); + $this->setIfExists('can_manage_endpoint', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('deleted_at', $data ?? [], null); + $this->setIfExists('endpoint_count', $data ?? [], null); + $this->setIfExists('endpoints', $data ?? [], null); + $this->setIfExists('endpoints_metadata', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('owner_id', $data ?? [], null); + $this->setIfExists('project_id', $data ?? [], null); + $this->setIfExists('token', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets auth_key + * + * @return string|null + */ + public function getAuthKey() + { + return $this->container['auth_key']; + } + + /** + * Sets auth_key + * + * @param string|null $auth_key auth_key + * + * @return self + */ + public function setAuthKey($auth_key) + { + if (is_null($auth_key)) { + throw new \InvalidArgumentException('non-nullable auth_key cannot be null'); + } + $this->container['auth_key'] = $auth_key; + + return $this; + } + + /** + * Gets auth_type + * + * @return \Convoy\Client\Model\DatastorePortalAuthType|null + */ + public function getAuthType() + { + return $this->container['auth_type']; + } + + /** + * Sets auth_type + * + * @param \Convoy\Client\Model\DatastorePortalAuthType|null $auth_type auth_type + * + * @return self + */ + public function setAuthType($auth_type) + { + if (is_null($auth_type)) { + throw new \InvalidArgumentException('non-nullable auth_type cannot be null'); + } + $this->container['auth_type'] = $auth_type; + + return $this; + } + + /** + * Gets can_manage_endpoint + * + * @return bool|null + */ + public function getCanManageEndpoint() + { + return $this->container['can_manage_endpoint']; + } + + /** + * Sets can_manage_endpoint + * + * @param bool|null $can_manage_endpoint can_manage_endpoint + * + * @return self + */ + public function setCanManageEndpoint($can_manage_endpoint) + { + if (is_null($can_manage_endpoint)) { + throw new \InvalidArgumentException('non-nullable can_manage_endpoint cannot be null'); + } + $this->container['can_manage_endpoint'] = $can_manage_endpoint; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets deleted_at + * + * @return string|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param string|null $deleted_at deleted_at + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + if (is_null($deleted_at)) { + throw new \InvalidArgumentException('non-nullable deleted_at cannot be null'); + } + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets endpoint_count + * + * @return int|null + */ + public function getEndpointCount() + { + return $this->container['endpoint_count']; + } + + /** + * Sets endpoint_count + * + * @param int|null $endpoint_count endpoint_count + * + * @return self + */ + public function setEndpointCount($endpoint_count) + { + if (is_null($endpoint_count)) { + throw new \InvalidArgumentException('non-nullable endpoint_count cannot be null'); + } + $this->container['endpoint_count'] = $endpoint_count; + + return $this; + } + + /** + * Gets endpoints + * + * @return string[]|null + */ + public function getEndpoints() + { + return $this->container['endpoints']; + } + + /** + * Sets endpoints + * + * @param string[]|null $endpoints endpoints + * + * @return self + */ + public function setEndpoints($endpoints) + { + if (is_null($endpoints)) { + throw new \InvalidArgumentException('non-nullable endpoints cannot be null'); + } + $this->container['endpoints'] = $endpoints; + + return $this; + } + + /** + * Gets endpoints_metadata + * + * @return \Convoy\Client\Model\DatastoreEndpoint[]|null + */ + public function getEndpointsMetadata() + { + return $this->container['endpoints_metadata']; + } + + /** + * Sets endpoints_metadata + * + * @param \Convoy\Client\Model\DatastoreEndpoint[]|null $endpoints_metadata endpoints_metadata + * + * @return self + */ + public function setEndpointsMetadata($endpoints_metadata) + { + if (is_null($endpoints_metadata)) { + throw new \InvalidArgumentException('non-nullable endpoints_metadata cannot be null'); + } + $this->container['endpoints_metadata'] = $endpoints_metadata; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets owner_id + * + * @return string|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param string|null $owner_id owner_id + * + * @return self + */ + public function setOwnerId($owner_id) + { + if (is_null($owner_id)) { + throw new \InvalidArgumentException('non-nullable owner_id cannot be null'); + } + $this->container['owner_id'] = $owner_id; + + return $this; + } + + /** + * Gets project_id + * + * @return string|null + */ + public function getProjectId() + { + return $this->container['project_id']; + } + + /** + * Sets project_id + * + * @param string|null $project_id project_id + * + * @return self + */ + public function setProjectId($project_id) + { + if (is_null($project_id)) { + throw new \InvalidArgumentException('non-nullable project_id cannot be null'); + } + $this->container['project_id'] = $project_id; + + return $this; + } + + /** + * Gets token + * + * @return string|null + */ + public function getToken() + { + return $this->container['token']; + } + + /** + * Sets token + * + * @param string|null $token token + * + * @return self + */ + public function setToken($token) + { + if (is_null($token)) { + throw new \InvalidArgumentException('non-nullable token cannot be null'); + } + $this->container['token'] = $token; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url url + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreProjectConfig.php b/src/Client/Model/DatastoreProjectConfig.php new file mode 100644 index 0000000..52c2b82 --- /dev/null +++ b/src/Client/Model/DatastoreProjectConfig.php @@ -0,0 +1,818 @@ + + */ +class DatastoreProjectConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.ProjectConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'add_event_id_trace_headers' => 'bool', + 'circuit_breaker' => '\Convoy\Client\Model\DatastoreCircuitBreakerConfiguration', + 'disable_endpoint' => 'bool', + 'max_payload_read_size' => 'int', + 'meta_event' => '\Convoy\Client\Model\DatastoreMetaEventConfiguration', + 'multiple_endpoint_subscriptions' => 'bool', + 'ratelimit' => '\Convoy\Client\Model\DatastoreRateLimitConfiguration', + 'replay_attacks_prevention_enabled' => 'bool', + 'request_id_header' => '\Convoy\Client\Model\ConfigRequestIDHeaderProvider', + 'search_policy' => 'string', + 'signature' => '\Convoy\Client\Model\DatastoreSignatureConfiguration', + 'ssl' => '\Convoy\Client\Model\DatastoreSSLConfiguration', + 'strategy' => '\Convoy\Client\Model\DatastoreStrategyConfiguration' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'add_event_id_trace_headers' => null, + 'circuit_breaker' => null, + 'disable_endpoint' => null, + 'max_payload_read_size' => null, + 'meta_event' => null, + 'multiple_endpoint_subscriptions' => null, + 'ratelimit' => null, + 'replay_attacks_prevention_enabled' => null, + 'request_id_header' => null, + 'search_policy' => null, + 'signature' => null, + 'ssl' => null, + 'strategy' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'add_event_id_trace_headers' => false, + 'circuit_breaker' => false, + 'disable_endpoint' => false, + 'max_payload_read_size' => false, + 'meta_event' => false, + 'multiple_endpoint_subscriptions' => false, + 'ratelimit' => false, + 'replay_attacks_prevention_enabled' => false, + 'request_id_header' => false, + 'search_policy' => false, + 'signature' => false, + 'ssl' => false, + 'strategy' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'add_event_id_trace_headers' => 'add_event_id_trace_headers', + 'circuit_breaker' => 'circuit_breaker', + 'disable_endpoint' => 'disable_endpoint', + 'max_payload_read_size' => 'max_payload_read_size', + 'meta_event' => 'meta_event', + 'multiple_endpoint_subscriptions' => 'multiple_endpoint_subscriptions', + 'ratelimit' => 'ratelimit', + 'replay_attacks_prevention_enabled' => 'replay_attacks_prevention_enabled', + 'request_id_header' => 'request_id_header', + 'search_policy' => 'search_policy', + 'signature' => 'signature', + 'ssl' => 'ssl', + 'strategy' => 'strategy' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'add_event_id_trace_headers' => 'setAddEventIdTraceHeaders', + 'circuit_breaker' => 'setCircuitBreaker', + 'disable_endpoint' => 'setDisableEndpoint', + 'max_payload_read_size' => 'setMaxPayloadReadSize', + 'meta_event' => 'setMetaEvent', + 'multiple_endpoint_subscriptions' => 'setMultipleEndpointSubscriptions', + 'ratelimit' => 'setRatelimit', + 'replay_attacks_prevention_enabled' => 'setReplayAttacksPreventionEnabled', + 'request_id_header' => 'setRequestIdHeader', + 'search_policy' => 'setSearchPolicy', + 'signature' => 'setSignature', + 'ssl' => 'setSsl', + 'strategy' => 'setStrategy' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'add_event_id_trace_headers' => 'getAddEventIdTraceHeaders', + 'circuit_breaker' => 'getCircuitBreaker', + 'disable_endpoint' => 'getDisableEndpoint', + 'max_payload_read_size' => 'getMaxPayloadReadSize', + 'meta_event' => 'getMetaEvent', + 'multiple_endpoint_subscriptions' => 'getMultipleEndpointSubscriptions', + 'ratelimit' => 'getRatelimit', + 'replay_attacks_prevention_enabled' => 'getReplayAttacksPreventionEnabled', + 'request_id_header' => 'getRequestIdHeader', + 'search_policy' => 'getSearchPolicy', + 'signature' => 'getSignature', + 'ssl' => 'getSsl', + 'strategy' => 'getStrategy' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('add_event_id_trace_headers', $data ?? [], null); + $this->setIfExists('circuit_breaker', $data ?? [], null); + $this->setIfExists('disable_endpoint', $data ?? [], null); + $this->setIfExists('max_payload_read_size', $data ?? [], null); + $this->setIfExists('meta_event', $data ?? [], null); + $this->setIfExists('multiple_endpoint_subscriptions', $data ?? [], null); + $this->setIfExists('ratelimit', $data ?? [], null); + $this->setIfExists('replay_attacks_prevention_enabled', $data ?? [], null); + $this->setIfExists('request_id_header', $data ?? [], null); + $this->setIfExists('search_policy', $data ?? [], null); + $this->setIfExists('signature', $data ?? [], null); + $this->setIfExists('ssl', $data ?? [], null); + $this->setIfExists('strategy', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets add_event_id_trace_headers + * + * @return bool|null + */ + public function getAddEventIdTraceHeaders() + { + return $this->container['add_event_id_trace_headers']; + } + + /** + * Sets add_event_id_trace_headers + * + * @param bool|null $add_event_id_trace_headers add_event_id_trace_headers + * + * @return self + */ + public function setAddEventIdTraceHeaders($add_event_id_trace_headers) + { + if (is_null($add_event_id_trace_headers)) { + throw new \InvalidArgumentException('non-nullable add_event_id_trace_headers cannot be null'); + } + $this->container['add_event_id_trace_headers'] = $add_event_id_trace_headers; + + return $this; + } + + /** + * Gets circuit_breaker + * + * @return \Convoy\Client\Model\DatastoreCircuitBreakerConfiguration|null + */ + public function getCircuitBreaker() + { + return $this->container['circuit_breaker']; + } + + /** + * Sets circuit_breaker + * + * @param \Convoy\Client\Model\DatastoreCircuitBreakerConfiguration|null $circuit_breaker circuit_breaker + * + * @return self + */ + public function setCircuitBreaker($circuit_breaker) + { + if (is_null($circuit_breaker)) { + throw new \InvalidArgumentException('non-nullable circuit_breaker cannot be null'); + } + $this->container['circuit_breaker'] = $circuit_breaker; + + return $this; + } + + /** + * Gets disable_endpoint + * + * @return bool|null + */ + public function getDisableEndpoint() + { + return $this->container['disable_endpoint']; + } + + /** + * Sets disable_endpoint + * + * @param bool|null $disable_endpoint disable_endpoint + * + * @return self + */ + public function setDisableEndpoint($disable_endpoint) + { + if (is_null($disable_endpoint)) { + throw new \InvalidArgumentException('non-nullable disable_endpoint cannot be null'); + } + $this->container['disable_endpoint'] = $disable_endpoint; + + return $this; + } + + /** + * Gets max_payload_read_size + * + * @return int|null + */ + public function getMaxPayloadReadSize() + { + return $this->container['max_payload_read_size']; + } + + /** + * Sets max_payload_read_size + * + * @param int|null $max_payload_read_size max_payload_read_size + * + * @return self + */ + public function setMaxPayloadReadSize($max_payload_read_size) + { + if (is_null($max_payload_read_size)) { + throw new \InvalidArgumentException('non-nullable max_payload_read_size cannot be null'); + } + $this->container['max_payload_read_size'] = $max_payload_read_size; + + return $this; + } + + /** + * Gets meta_event + * + * @return \Convoy\Client\Model\DatastoreMetaEventConfiguration|null + */ + public function getMetaEvent() + { + return $this->container['meta_event']; + } + + /** + * Sets meta_event + * + * @param \Convoy\Client\Model\DatastoreMetaEventConfiguration|null $meta_event meta_event + * + * @return self + */ + public function setMetaEvent($meta_event) + { + if (is_null($meta_event)) { + throw new \InvalidArgumentException('non-nullable meta_event cannot be null'); + } + $this->container['meta_event'] = $meta_event; + + return $this; + } + + /** + * Gets multiple_endpoint_subscriptions + * + * @return bool|null + */ + public function getMultipleEndpointSubscriptions() + { + return $this->container['multiple_endpoint_subscriptions']; + } + + /** + * Sets multiple_endpoint_subscriptions + * + * @param bool|null $multiple_endpoint_subscriptions multiple_endpoint_subscriptions + * + * @return self + */ + public function setMultipleEndpointSubscriptions($multiple_endpoint_subscriptions) + { + if (is_null($multiple_endpoint_subscriptions)) { + throw new \InvalidArgumentException('non-nullable multiple_endpoint_subscriptions cannot be null'); + } + $this->container['multiple_endpoint_subscriptions'] = $multiple_endpoint_subscriptions; + + return $this; + } + + /** + * Gets ratelimit + * + * @return \Convoy\Client\Model\DatastoreRateLimitConfiguration|null + */ + public function getRatelimit() + { + return $this->container['ratelimit']; + } + + /** + * Sets ratelimit + * + * @param \Convoy\Client\Model\DatastoreRateLimitConfiguration|null $ratelimit ratelimit + * + * @return self + */ + public function setRatelimit($ratelimit) + { + if (is_null($ratelimit)) { + throw new \InvalidArgumentException('non-nullable ratelimit cannot be null'); + } + $this->container['ratelimit'] = $ratelimit; + + return $this; + } + + /** + * Gets replay_attacks_prevention_enabled + * + * @return bool|null + */ + public function getReplayAttacksPreventionEnabled() + { + return $this->container['replay_attacks_prevention_enabled']; + } + + /** + * Sets replay_attacks_prevention_enabled + * + * @param bool|null $replay_attacks_prevention_enabled replay_attacks_prevention_enabled + * + * @return self + */ + public function setReplayAttacksPreventionEnabled($replay_attacks_prevention_enabled) + { + if (is_null($replay_attacks_prevention_enabled)) { + throw new \InvalidArgumentException('non-nullable replay_attacks_prevention_enabled cannot be null'); + } + $this->container['replay_attacks_prevention_enabled'] = $replay_attacks_prevention_enabled; + + return $this; + } + + /** + * Gets request_id_header + * + * @return \Convoy\Client\Model\ConfigRequestIDHeaderProvider|null + */ + public function getRequestIdHeader() + { + return $this->container['request_id_header']; + } + + /** + * Sets request_id_header + * + * @param \Convoy\Client\Model\ConfigRequestIDHeaderProvider|null $request_id_header request_id_header + * + * @return self + */ + public function setRequestIdHeader($request_id_header) + { + if (is_null($request_id_header)) { + throw new \InvalidArgumentException('non-nullable request_id_header cannot be null'); + } + $this->container['request_id_header'] = $request_id_header; + + return $this; + } + + /** + * Gets search_policy + * + * @return string|null + */ + public function getSearchPolicy() + { + return $this->container['search_policy']; + } + + /** + * Sets search_policy + * + * @param string|null $search_policy search_policy + * + * @return self + */ + public function setSearchPolicy($search_policy) + { + if (is_null($search_policy)) { + throw new \InvalidArgumentException('non-nullable search_policy cannot be null'); + } + $this->container['search_policy'] = $search_policy; + + return $this; + } + + /** + * Gets signature + * + * @return \Convoy\Client\Model\DatastoreSignatureConfiguration|null + */ + public function getSignature() + { + return $this->container['signature']; + } + + /** + * Sets signature + * + * @param \Convoy\Client\Model\DatastoreSignatureConfiguration|null $signature signature + * + * @return self + */ + public function setSignature($signature) + { + if (is_null($signature)) { + throw new \InvalidArgumentException('non-nullable signature cannot be null'); + } + $this->container['signature'] = $signature; + + return $this; + } + + /** + * Gets ssl + * + * @return \Convoy\Client\Model\DatastoreSSLConfiguration|null + */ + public function getSsl() + { + return $this->container['ssl']; + } + + /** + * Sets ssl + * + * @param \Convoy\Client\Model\DatastoreSSLConfiguration|null $ssl ssl + * + * @return self + */ + public function setSsl($ssl) + { + if (is_null($ssl)) { + throw new \InvalidArgumentException('non-nullable ssl cannot be null'); + } + $this->container['ssl'] = $ssl; + + return $this; + } + + /** + * Gets strategy + * + * @return \Convoy\Client\Model\DatastoreStrategyConfiguration|null + */ + public function getStrategy() + { + return $this->container['strategy']; + } + + /** + * Sets strategy + * + * @param \Convoy\Client\Model\DatastoreStrategyConfiguration|null $strategy strategy + * + * @return self + */ + public function setStrategy($strategy) + { + if (is_null($strategy)) { + throw new \InvalidArgumentException('non-nullable strategy cannot be null'); + } + $this->container['strategy'] = $strategy; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreProjectStatistics.php b/src/Client/Model/DatastoreProjectStatistics.php new file mode 100644 index 0000000..d850ec7 --- /dev/null +++ b/src/Client/Model/DatastoreProjectStatistics.php @@ -0,0 +1,512 @@ + + */ +class DatastoreProjectStatistics implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.ProjectStatistics'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'endpoints_exist' => 'bool', + 'events_exist' => 'bool', + 'sources_exist' => 'bool', + 'subscriptions_exist' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'endpoints_exist' => null, + 'events_exist' => null, + 'sources_exist' => null, + 'subscriptions_exist' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'endpoints_exist' => false, + 'events_exist' => false, + 'sources_exist' => false, + 'subscriptions_exist' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'endpoints_exist' => 'endpoints_exist', + 'events_exist' => 'events_exist', + 'sources_exist' => 'sources_exist', + 'subscriptions_exist' => 'subscriptions_exist' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'endpoints_exist' => 'setEndpointsExist', + 'events_exist' => 'setEventsExist', + 'sources_exist' => 'setSourcesExist', + 'subscriptions_exist' => 'setSubscriptionsExist' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'endpoints_exist' => 'getEndpointsExist', + 'events_exist' => 'getEventsExist', + 'sources_exist' => 'getSourcesExist', + 'subscriptions_exist' => 'getSubscriptionsExist' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('endpoints_exist', $data ?? [], null); + $this->setIfExists('events_exist', $data ?? [], null); + $this->setIfExists('sources_exist', $data ?? [], null); + $this->setIfExists('subscriptions_exist', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets endpoints_exist + * + * @return bool|null + */ + public function getEndpointsExist() + { + return $this->container['endpoints_exist']; + } + + /** + * Sets endpoints_exist + * + * @param bool|null $endpoints_exist endpoints_exist + * + * @return self + */ + public function setEndpointsExist($endpoints_exist) + { + if (is_null($endpoints_exist)) { + throw new \InvalidArgumentException('non-nullable endpoints_exist cannot be null'); + } + $this->container['endpoints_exist'] = $endpoints_exist; + + return $this; + } + + /** + * Gets events_exist + * + * @return bool|null + */ + public function getEventsExist() + { + return $this->container['events_exist']; + } + + /** + * Sets events_exist + * + * @param bool|null $events_exist events_exist + * + * @return self + */ + public function setEventsExist($events_exist) + { + if (is_null($events_exist)) { + throw new \InvalidArgumentException('non-nullable events_exist cannot be null'); + } + $this->container['events_exist'] = $events_exist; + + return $this; + } + + /** + * Gets sources_exist + * + * @return bool|null + */ + public function getSourcesExist() + { + return $this->container['sources_exist']; + } + + /** + * Sets sources_exist + * + * @param bool|null $sources_exist sources_exist + * + * @return self + */ + public function setSourcesExist($sources_exist) + { + if (is_null($sources_exist)) { + throw new \InvalidArgumentException('non-nullable sources_exist cannot be null'); + } + $this->container['sources_exist'] = $sources_exist; + + return $this; + } + + /** + * Gets subscriptions_exist + * + * @return bool|null + */ + public function getSubscriptionsExist() + { + return $this->container['subscriptions_exist']; + } + + /** + * Sets subscriptions_exist + * + * @param bool|null $subscriptions_exist subscriptions_exist + * + * @return self + */ + public function setSubscriptionsExist($subscriptions_exist) + { + if (is_null($subscriptions_exist)) { + throw new \InvalidArgumentException('non-nullable subscriptions_exist cannot be null'); + } + $this->container['subscriptions_exist'] = $subscriptions_exist; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreProjectType.php b/src/Client/Model/DatastoreProjectType.php new file mode 100644 index 0000000..03a854c --- /dev/null +++ b/src/Client/Model/DatastoreProjectType.php @@ -0,0 +1,63 @@ + + */ +class DatastoreProviderConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.ProviderConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'twitter' => '\Convoy\Client\Model\DatastoreTwitterProviderConfig' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'twitter' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'twitter' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'twitter' => 'twitter' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'twitter' => 'setTwitter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'twitter' => 'getTwitter' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('twitter', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets twitter + * + * @return \Convoy\Client\Model\DatastoreTwitterProviderConfig|null + */ + public function getTwitter() + { + return $this->container['twitter']; + } + + /** + * Sets twitter + * + * @param \Convoy\Client\Model\DatastoreTwitterProviderConfig|null $twitter twitter + * + * @return self + */ + public function setTwitter($twitter) + { + if (is_null($twitter)) { + throw new \InvalidArgumentException('non-nullable twitter cannot be null'); + } + $this->container['twitter'] = $twitter; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastorePubSubConfig.php b/src/Client/Model/DatastorePubSubConfig.php new file mode 100644 index 0000000..71e8246 --- /dev/null +++ b/src/Client/Model/DatastorePubSubConfig.php @@ -0,0 +1,580 @@ + + */ +class DatastorePubSubConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.PubSubConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amqp' => '\Convoy\Client\Model\DatastoreAmqpPubSubConfig', + 'google' => '\Convoy\Client\Model\DatastoreGooglePubSubConfig', + 'kafka' => '\Convoy\Client\Model\DatastoreKafkaPubSubConfig', + 'sqs' => '\Convoy\Client\Model\DatastoreSQSPubSubConfig', + 'type' => '\Convoy\Client\Model\DatastorePubSubType', + 'workers' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amqp' => null, + 'google' => null, + 'kafka' => null, + 'sqs' => null, + 'type' => null, + 'workers' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amqp' => false, + 'google' => false, + 'kafka' => false, + 'sqs' => false, + 'type' => false, + 'workers' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'amqp' => 'amqp', + 'google' => 'google', + 'kafka' => 'kafka', + 'sqs' => 'sqs', + 'type' => 'type', + 'workers' => 'workers' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amqp' => 'setAmqp', + 'google' => 'setGoogle', + 'kafka' => 'setKafka', + 'sqs' => 'setSqs', + 'type' => 'setType', + 'workers' => 'setWorkers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amqp' => 'getAmqp', + 'google' => 'getGoogle', + 'kafka' => 'getKafka', + 'sqs' => 'getSqs', + 'type' => 'getType', + 'workers' => 'getWorkers' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('amqp', $data ?? [], null); + $this->setIfExists('google', $data ?? [], null); + $this->setIfExists('kafka', $data ?? [], null); + $this->setIfExists('sqs', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('workers', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amqp + * + * @return \Convoy\Client\Model\DatastoreAmqpPubSubConfig|null + */ + public function getAmqp() + { + return $this->container['amqp']; + } + + /** + * Sets amqp + * + * @param \Convoy\Client\Model\DatastoreAmqpPubSubConfig|null $amqp amqp + * + * @return self + */ + public function setAmqp($amqp) + { + if (is_null($amqp)) { + throw new \InvalidArgumentException('non-nullable amqp cannot be null'); + } + $this->container['amqp'] = $amqp; + + return $this; + } + + /** + * Gets google + * + * @return \Convoy\Client\Model\DatastoreGooglePubSubConfig|null + */ + public function getGoogle() + { + return $this->container['google']; + } + + /** + * Sets google + * + * @param \Convoy\Client\Model\DatastoreGooglePubSubConfig|null $google google + * + * @return self + */ + public function setGoogle($google) + { + if (is_null($google)) { + throw new \InvalidArgumentException('non-nullable google cannot be null'); + } + $this->container['google'] = $google; + + return $this; + } + + /** + * Gets kafka + * + * @return \Convoy\Client\Model\DatastoreKafkaPubSubConfig|null + */ + public function getKafka() + { + return $this->container['kafka']; + } + + /** + * Sets kafka + * + * @param \Convoy\Client\Model\DatastoreKafkaPubSubConfig|null $kafka kafka + * + * @return self + */ + public function setKafka($kafka) + { + if (is_null($kafka)) { + throw new \InvalidArgumentException('non-nullable kafka cannot be null'); + } + $this->container['kafka'] = $kafka; + + return $this; + } + + /** + * Gets sqs + * + * @return \Convoy\Client\Model\DatastoreSQSPubSubConfig|null + */ + public function getSqs() + { + return $this->container['sqs']; + } + + /** + * Sets sqs + * + * @param \Convoy\Client\Model\DatastoreSQSPubSubConfig|null $sqs sqs + * + * @return self + */ + public function setSqs($sqs) + { + if (is_null($sqs)) { + throw new \InvalidArgumentException('non-nullable sqs cannot be null'); + } + $this->container['sqs'] = $sqs; + + return $this; + } + + /** + * Gets type + * + * @return \Convoy\Client\Model\DatastorePubSubType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Convoy\Client\Model\DatastorePubSubType|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets workers + * + * @return int|null + */ + public function getWorkers() + { + return $this->container['workers']; + } + + /** + * Sets workers + * + * @param int|null $workers workers + * + * @return self + */ + public function setWorkers($workers) + { + if (is_null($workers)) { + throw new \InvalidArgumentException('non-nullable workers cannot be null'); + } + $this->container['workers'] = $workers; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastorePubSubType.php b/src/Client/Model/DatastorePubSubType.php new file mode 100644 index 0000000..f61abb9 --- /dev/null +++ b/src/Client/Model/DatastorePubSubType.php @@ -0,0 +1,69 @@ + + */ +class DatastoreRateLimitConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.RateLimitConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'count' => 'int', + 'duration' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'count' => null, + 'duration' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'count' => false, + 'duration' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'count' => 'count', + 'duration' => 'duration' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'count' => 'setCount', + 'duration' => 'setDuration' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'count' => 'getCount', + 'duration' => 'getDuration' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('duration', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count count + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + throw new \InvalidArgumentException('non-nullable count cannot be null'); + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets duration + * + * @return int|null + */ + public function getDuration() + { + return $this->container['duration']; + } + + /** + * Sets duration + * + * @param int|null $duration duration + * + * @return self + */ + public function setDuration($duration) + { + if (is_null($duration)) { + throw new \InvalidArgumentException('non-nullable duration cannot be null'); + } + $this->container['duration'] = $duration; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreRetryConfiguration.php b/src/Client/Model/DatastoreRetryConfiguration.php new file mode 100644 index 0000000..66863e7 --- /dev/null +++ b/src/Client/Model/DatastoreRetryConfiguration.php @@ -0,0 +1,478 @@ + + */ +class DatastoreRetryConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.RetryConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'duration' => 'int', + 'retry_count' => 'int', + 'type' => '\Convoy\Client\Model\DatastoreStrategyProvider' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'duration' => null, + 'retry_count' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'duration' => false, + 'retry_count' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'duration' => 'duration', + 'retry_count' => 'retry_count', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'duration' => 'setDuration', + 'retry_count' => 'setRetryCount', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'duration' => 'getDuration', + 'retry_count' => 'getRetryCount', + 'type' => 'getType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('duration', $data ?? [], null); + $this->setIfExists('retry_count', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets duration + * + * @return int|null + */ + public function getDuration() + { + return $this->container['duration']; + } + + /** + * Sets duration + * + * @param int|null $duration duration + * + * @return self + */ + public function setDuration($duration) + { + if (is_null($duration)) { + throw new \InvalidArgumentException('non-nullable duration cannot be null'); + } + $this->container['duration'] = $duration; + + return $this; + } + + /** + * Gets retry_count + * + * @return int|null + */ + public function getRetryCount() + { + return $this->container['retry_count']; + } + + /** + * Sets retry_count + * + * @param int|null $retry_count retry_count + * + * @return self + */ + public function setRetryCount($retry_count) + { + if (is_null($retry_count)) { + throw new \InvalidArgumentException('non-nullable retry_count cannot be null'); + } + $this->container['retry_count'] = $retry_count; + + return $this; + } + + /** + * Gets type + * + * @return \Convoy\Client\Model\DatastoreStrategyProvider|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Convoy\Client\Model\DatastoreStrategyProvider|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreRole.php b/src/Client/Model/DatastoreRole.php new file mode 100644 index 0000000..b4967c7 --- /dev/null +++ b/src/Client/Model/DatastoreRole.php @@ -0,0 +1,478 @@ + + */ +class DatastoreRole implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.Role'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'app' => 'string', + 'project' => 'string', + 'type' => '\Convoy\Client\Model\AuthRoleType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'app' => null, + 'project' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'app' => false, + 'project' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'app' => 'app', + 'project' => 'project', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'app' => 'setApp', + 'project' => 'setProject', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'app' => 'getApp', + 'project' => 'getProject', + 'type' => 'getType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('app', $data ?? [], null); + $this->setIfExists('project', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets app + * + * @return string|null + */ + public function getApp() + { + return $this->container['app']; + } + + /** + * Sets app + * + * @param string|null $app app + * + * @return self + */ + public function setApp($app) + { + if (is_null($app)) { + throw new \InvalidArgumentException('non-nullable app cannot be null'); + } + $this->container['app'] = $app; + + return $this; + } + + /** + * Gets project + * + * @return string|null + */ + public function getProject() + { + return $this->container['project']; + } + + /** + * Sets project + * + * @param string|null $project project + * + * @return self + */ + public function setProject($project) + { + if (is_null($project)) { + throw new \InvalidArgumentException('non-nullable project cannot be null'); + } + $this->container['project'] = $project; + + return $this; + } + + /** + * Gets type + * + * @return \Convoy\Client\Model\AuthRoleType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Convoy\Client\Model\AuthRoleType|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreSQSPubSubConfig.php b/src/Client/Model/DatastoreSQSPubSubConfig.php new file mode 100644 index 0000000..8c6b17e --- /dev/null +++ b/src/Client/Model/DatastoreSQSPubSubConfig.php @@ -0,0 +1,546 @@ + + */ +class DatastoreSQSPubSubConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.SQSPubSubConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'access_key_id' => 'string', + 'default_region' => 'string', + 'endpoint' => 'string', + 'queue_name' => 'string', + 'secret_key' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'access_key_id' => null, + 'default_region' => null, + 'endpoint' => null, + 'queue_name' => null, + 'secret_key' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'access_key_id' => false, + 'default_region' => false, + 'endpoint' => false, + 'queue_name' => false, + 'secret_key' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'access_key_id' => 'access_key_id', + 'default_region' => 'default_region', + 'endpoint' => 'endpoint', + 'queue_name' => 'queue_name', + 'secret_key' => 'secret_key' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'access_key_id' => 'setAccessKeyId', + 'default_region' => 'setDefaultRegion', + 'endpoint' => 'setEndpoint', + 'queue_name' => 'setQueueName', + 'secret_key' => 'setSecretKey' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'access_key_id' => 'getAccessKeyId', + 'default_region' => 'getDefaultRegion', + 'endpoint' => 'getEndpoint', + 'queue_name' => 'getQueueName', + 'secret_key' => 'getSecretKey' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('access_key_id', $data ?? [], null); + $this->setIfExists('default_region', $data ?? [], null); + $this->setIfExists('endpoint', $data ?? [], null); + $this->setIfExists('queue_name', $data ?? [], null); + $this->setIfExists('secret_key', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets access_key_id + * + * @return string|null + */ + public function getAccessKeyId() + { + return $this->container['access_key_id']; + } + + /** + * Sets access_key_id + * + * @param string|null $access_key_id access_key_id + * + * @return self + */ + public function setAccessKeyId($access_key_id) + { + if (is_null($access_key_id)) { + throw new \InvalidArgumentException('non-nullable access_key_id cannot be null'); + } + $this->container['access_key_id'] = $access_key_id; + + return $this; + } + + /** + * Gets default_region + * + * @return string|null + */ + public function getDefaultRegion() + { + return $this->container['default_region']; + } + + /** + * Sets default_region + * + * @param string|null $default_region default_region + * + * @return self + */ + public function setDefaultRegion($default_region) + { + if (is_null($default_region)) { + throw new \InvalidArgumentException('non-nullable default_region cannot be null'); + } + $this->container['default_region'] = $default_region; + + return $this; + } + + /** + * Gets endpoint + * + * @return string|null + */ + public function getEndpoint() + { + return $this->container['endpoint']; + } + + /** + * Sets endpoint + * + * @param string|null $endpoint Optional: for LocalStack testing + * + * @return self + */ + public function setEndpoint($endpoint) + { + if (is_null($endpoint)) { + throw new \InvalidArgumentException('non-nullable endpoint cannot be null'); + } + $this->container['endpoint'] = $endpoint; + + return $this; + } + + /** + * Gets queue_name + * + * @return string|null + */ + public function getQueueName() + { + return $this->container['queue_name']; + } + + /** + * Sets queue_name + * + * @param string|null $queue_name queue_name + * + * @return self + */ + public function setQueueName($queue_name) + { + if (is_null($queue_name)) { + throw new \InvalidArgumentException('non-nullable queue_name cannot be null'); + } + $this->container['queue_name'] = $queue_name; + + return $this; + } + + /** + * Gets secret_key + * + * @return string|null + */ + public function getSecretKey() + { + return $this->container['secret_key']; + } + + /** + * Sets secret_key + * + * @param string|null $secret_key secret_key + * + * @return self + */ + public function setSecretKey($secret_key) + { + if (is_null($secret_key)) { + throw new \InvalidArgumentException('non-nullable secret_key cannot be null'); + } + $this->container['secret_key'] = $secret_key; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreSSLConfiguration.php b/src/Client/Model/DatastoreSSLConfiguration.php new file mode 100644 index 0000000..33bb394 --- /dev/null +++ b/src/Client/Model/DatastoreSSLConfiguration.php @@ -0,0 +1,410 @@ + + */ +class DatastoreSSLConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.SSLConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'enforce_secure_endpoints' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'enforce_secure_endpoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'enforce_secure_endpoints' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'enforce_secure_endpoints' => 'enforce_secure_endpoints' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'enforce_secure_endpoints' => 'setEnforceSecureEndpoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'enforce_secure_endpoints' => 'getEnforceSecureEndpoints' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('enforce_secure_endpoints', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets enforce_secure_endpoints + * + * @return bool|null + */ + public function getEnforceSecureEndpoints() + { + return $this->container['enforce_secure_endpoints']; + } + + /** + * Sets enforce_secure_endpoints + * + * @param bool|null $enforce_secure_endpoints enforce_secure_endpoints + * + * @return self + */ + public function setEnforceSecureEndpoints($enforce_secure_endpoints) + { + if (is_null($enforce_secure_endpoints)) { + throw new \InvalidArgumentException('non-nullable enforce_secure_endpoints cannot be null'); + } + $this->container['enforce_secure_endpoints'] = $enforce_secure_endpoints; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreSecret.php b/src/Client/Model/DatastoreSecret.php new file mode 100644 index 0000000..a8f5db4 --- /dev/null +++ b/src/Client/Model/DatastoreSecret.php @@ -0,0 +1,580 @@ + + */ +class DatastoreSecret implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.Secret'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'created_at' => 'string', + 'deleted_at' => 'string', + 'expires_at' => 'string', + 'uid' => 'string', + 'updated_at' => 'string', + 'value' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'created_at' => null, + 'deleted_at' => null, + 'expires_at' => null, + 'uid' => null, + 'updated_at' => null, + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'deleted_at' => false, + 'expires_at' => false, + 'uid' => false, + 'updated_at' => false, + 'value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'created_at' => 'created_at', + 'deleted_at' => 'deleted_at', + 'expires_at' => 'expires_at', + 'uid' => 'uid', + 'updated_at' => 'updated_at', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'created_at' => 'setCreatedAt', + 'deleted_at' => 'setDeletedAt', + 'expires_at' => 'setExpiresAt', + 'uid' => 'setUid', + 'updated_at' => 'setUpdatedAt', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'created_at' => 'getCreatedAt', + 'deleted_at' => 'getDeletedAt', + 'expires_at' => 'getExpiresAt', + 'uid' => 'getUid', + 'updated_at' => 'getUpdatedAt', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('deleted_at', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets deleted_at + * + * @return string|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param string|null $deleted_at deleted_at + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + if (is_null($deleted_at)) { + throw new \InvalidArgumentException('non-nullable deleted_at cannot be null'); + } + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets expires_at + * + * @return string|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param string|null $expires_at expires_at + * + * @return self + */ + public function setExpiresAt($expires_at) + { + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + } + $this->container['expires_at'] = $expires_at; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets value + * + * @return string|null + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string|null $value value + * + * @return self + */ + public function setValue($value) + { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreSignatureConfiguration.php b/src/Client/Model/DatastoreSignatureConfiguration.php new file mode 100644 index 0000000..b8a2b7c --- /dev/null +++ b/src/Client/Model/DatastoreSignatureConfiguration.php @@ -0,0 +1,444 @@ + + */ +class DatastoreSignatureConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.SignatureConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'header' => '\Convoy\Client\Model\ConfigSignatureHeaderProvider', + 'versions' => '\Convoy\Client\Model\DatastoreSignatureVersion[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'header' => null, + 'versions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'header' => false, + 'versions' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'header' => 'header', + 'versions' => 'versions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'header' => 'setHeader', + 'versions' => 'setVersions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'header' => 'getHeader', + 'versions' => 'getVersions' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('header', $data ?? [], null); + $this->setIfExists('versions', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets header + * + * @return \Convoy\Client\Model\ConfigSignatureHeaderProvider|null + */ + public function getHeader() + { + return $this->container['header']; + } + + /** + * Sets header + * + * @param \Convoy\Client\Model\ConfigSignatureHeaderProvider|null $header header + * + * @return self + */ + public function setHeader($header) + { + if (is_null($header)) { + throw new \InvalidArgumentException('non-nullable header cannot be null'); + } + $this->container['header'] = $header; + + return $this; + } + + /** + * Gets versions + * + * @return \Convoy\Client\Model\DatastoreSignatureVersion[]|null + */ + public function getVersions() + { + return $this->container['versions']; + } + + /** + * Sets versions + * + * @param \Convoy\Client\Model\DatastoreSignatureVersion[]|null $versions versions + * + * @return self + */ + public function setVersions($versions) + { + if (is_null($versions)) { + throw new \InvalidArgumentException('non-nullable versions cannot be null'); + } + $this->container['versions'] = $versions; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreSignatureVersion.php b/src/Client/Model/DatastoreSignatureVersion.php new file mode 100644 index 0000000..1252f35 --- /dev/null +++ b/src/Client/Model/DatastoreSignatureVersion.php @@ -0,0 +1,512 @@ + + */ +class DatastoreSignatureVersion implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.SignatureVersion'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'created_at' => 'string', + 'encoding' => '\Convoy\Client\Model\DatastoreEncodingType', + 'hash' => 'string', + 'uid' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'created_at' => null, + 'encoding' => null, + 'hash' => null, + 'uid' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'encoding' => false, + 'hash' => false, + 'uid' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'created_at' => 'created_at', + 'encoding' => 'encoding', + 'hash' => 'hash', + 'uid' => 'uid' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'created_at' => 'setCreatedAt', + 'encoding' => 'setEncoding', + 'hash' => 'setHash', + 'uid' => 'setUid' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'created_at' => 'getCreatedAt', + 'encoding' => 'getEncoding', + 'hash' => 'getHash', + 'uid' => 'getUid' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('encoding', $data ?? [], null); + $this->setIfExists('hash', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets encoding + * + * @return \Convoy\Client\Model\DatastoreEncodingType|null + */ + public function getEncoding() + { + return $this->container['encoding']; + } + + /** + * Sets encoding + * + * @param \Convoy\Client\Model\DatastoreEncodingType|null $encoding encoding + * + * @return self + */ + public function setEncoding($encoding) + { + if (is_null($encoding)) { + throw new \InvalidArgumentException('non-nullable encoding cannot be null'); + } + $this->container['encoding'] = $encoding; + + return $this; + } + + /** + * Gets hash + * + * @return string|null + */ + public function getHash() + { + return $this->container['hash']; + } + + /** + * Sets hash + * + * @param string|null $hash hash + * + * @return self + */ + public function setHash($hash) + { + if (is_null($hash)) { + throw new \InvalidArgumentException('non-nullable hash cannot be null'); + } + $this->container['hash'] = $hash; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreSource.php b/src/Client/Model/DatastoreSource.php new file mode 100644 index 0000000..bba8f61 --- /dev/null +++ b/src/Client/Model/DatastoreSource.php @@ -0,0 +1,1056 @@ + + */ +class DatastoreSource implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.Source'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'body_function' => 'string', + 'created_at' => 'string', + 'custom_response' => '\Convoy\Client\Model\DatastoreCustomResponse', + 'deleted_at' => 'string', + 'event_type_location' => 'string', + 'forward_headers' => 'string[]', + 'header_function' => 'string', + 'idempotency_keys' => 'string[]', + 'is_disabled' => 'bool', + 'mask_id' => 'string', + 'name' => 'string', + 'project_id' => 'string', + 'provider' => '\Convoy\Client\Model\DatastoreSourceProvider', + 'provider_config' => '\Convoy\Client\Model\DatastoreProviderConfig', + 'pub_sub' => '\Convoy\Client\Model\DatastorePubSubConfig', + 'type' => '\Convoy\Client\Model\DatastoreSourceType', + 'uid' => 'string', + 'updated_at' => 'string', + 'url' => 'string', + 'verifier' => '\Convoy\Client\Model\DatastoreVerifierConfig' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'body_function' => null, + 'created_at' => null, + 'custom_response' => null, + 'deleted_at' => null, + 'event_type_location' => null, + 'forward_headers' => null, + 'header_function' => null, + 'idempotency_keys' => null, + 'is_disabled' => null, + 'mask_id' => null, + 'name' => null, + 'project_id' => null, + 'provider' => null, + 'provider_config' => null, + 'pub_sub' => null, + 'type' => null, + 'uid' => null, + 'updated_at' => null, + 'url' => null, + 'verifier' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'body_function' => false, + 'created_at' => false, + 'custom_response' => false, + 'deleted_at' => false, + 'event_type_location' => false, + 'forward_headers' => false, + 'header_function' => false, + 'idempotency_keys' => false, + 'is_disabled' => false, + 'mask_id' => false, + 'name' => false, + 'project_id' => false, + 'provider' => false, + 'provider_config' => false, + 'pub_sub' => false, + 'type' => false, + 'uid' => false, + 'updated_at' => false, + 'url' => false, + 'verifier' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'body_function' => 'body_function', + 'created_at' => 'created_at', + 'custom_response' => 'custom_response', + 'deleted_at' => 'deleted_at', + 'event_type_location' => 'event_type_location', + 'forward_headers' => 'forward_headers', + 'header_function' => 'header_function', + 'idempotency_keys' => 'idempotency_keys', + 'is_disabled' => 'is_disabled', + 'mask_id' => 'mask_id', + 'name' => 'name', + 'project_id' => 'project_id', + 'provider' => 'provider', + 'provider_config' => 'provider_config', + 'pub_sub' => 'pub_sub', + 'type' => 'type', + 'uid' => 'uid', + 'updated_at' => 'updated_at', + 'url' => 'url', + 'verifier' => 'verifier' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'body_function' => 'setBodyFunction', + 'created_at' => 'setCreatedAt', + 'custom_response' => 'setCustomResponse', + 'deleted_at' => 'setDeletedAt', + 'event_type_location' => 'setEventTypeLocation', + 'forward_headers' => 'setForwardHeaders', + 'header_function' => 'setHeaderFunction', + 'idempotency_keys' => 'setIdempotencyKeys', + 'is_disabled' => 'setIsDisabled', + 'mask_id' => 'setMaskId', + 'name' => 'setName', + 'project_id' => 'setProjectId', + 'provider' => 'setProvider', + 'provider_config' => 'setProviderConfig', + 'pub_sub' => 'setPubSub', + 'type' => 'setType', + 'uid' => 'setUid', + 'updated_at' => 'setUpdatedAt', + 'url' => 'setUrl', + 'verifier' => 'setVerifier' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'body_function' => 'getBodyFunction', + 'created_at' => 'getCreatedAt', + 'custom_response' => 'getCustomResponse', + 'deleted_at' => 'getDeletedAt', + 'event_type_location' => 'getEventTypeLocation', + 'forward_headers' => 'getForwardHeaders', + 'header_function' => 'getHeaderFunction', + 'idempotency_keys' => 'getIdempotencyKeys', + 'is_disabled' => 'getIsDisabled', + 'mask_id' => 'getMaskId', + 'name' => 'getName', + 'project_id' => 'getProjectId', + 'provider' => 'getProvider', + 'provider_config' => 'getProviderConfig', + 'pub_sub' => 'getPubSub', + 'type' => 'getType', + 'uid' => 'getUid', + 'updated_at' => 'getUpdatedAt', + 'url' => 'getUrl', + 'verifier' => 'getVerifier' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('body_function', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('custom_response', $data ?? [], null); + $this->setIfExists('deleted_at', $data ?? [], null); + $this->setIfExists('event_type_location', $data ?? [], null); + $this->setIfExists('forward_headers', $data ?? [], null); + $this->setIfExists('header_function', $data ?? [], null); + $this->setIfExists('idempotency_keys', $data ?? [], null); + $this->setIfExists('is_disabled', $data ?? [], null); + $this->setIfExists('mask_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('project_id', $data ?? [], null); + $this->setIfExists('provider', $data ?? [], null); + $this->setIfExists('provider_config', $data ?? [], null); + $this->setIfExists('pub_sub', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('verifier', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets body_function + * + * @return string|null + */ + public function getBodyFunction() + { + return $this->container['body_function']; + } + + /** + * Sets body_function + * + * @param string|null $body_function body_function + * + * @return self + */ + public function setBodyFunction($body_function) + { + if (is_null($body_function)) { + throw new \InvalidArgumentException('non-nullable body_function cannot be null'); + } + $this->container['body_function'] = $body_function; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets custom_response + * + * @return \Convoy\Client\Model\DatastoreCustomResponse|null + */ + public function getCustomResponse() + { + return $this->container['custom_response']; + } + + /** + * Sets custom_response + * + * @param \Convoy\Client\Model\DatastoreCustomResponse|null $custom_response custom_response + * + * @return self + */ + public function setCustomResponse($custom_response) + { + if (is_null($custom_response)) { + throw new \InvalidArgumentException('non-nullable custom_response cannot be null'); + } + $this->container['custom_response'] = $custom_response; + + return $this; + } + + /** + * Gets deleted_at + * + * @return string|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param string|null $deleted_at deleted_at + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + if (is_null($deleted_at)) { + throw new \InvalidArgumentException('non-nullable deleted_at cannot be null'); + } + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets event_type_location + * + * @return string|null + */ + public function getEventTypeLocation() + { + return $this->container['event_type_location']; + } + + /** + * Sets event_type_location + * + * @param string|null $event_type_location event_type_location + * + * @return self + */ + public function setEventTypeLocation($event_type_location) + { + if (is_null($event_type_location)) { + throw new \InvalidArgumentException('non-nullable event_type_location cannot be null'); + } + $this->container['event_type_location'] = $event_type_location; + + return $this; + } + + /** + * Gets forward_headers + * + * @return string[]|null + */ + public function getForwardHeaders() + { + return $this->container['forward_headers']; + } + + /** + * Sets forward_headers + * + * @param string[]|null $forward_headers forward_headers + * + * @return self + */ + public function setForwardHeaders($forward_headers) + { + if (is_null($forward_headers)) { + throw new \InvalidArgumentException('non-nullable forward_headers cannot be null'); + } + $this->container['forward_headers'] = $forward_headers; + + return $this; + } + + /** + * Gets header_function + * + * @return string|null + */ + public function getHeaderFunction() + { + return $this->container['header_function']; + } + + /** + * Sets header_function + * + * @param string|null $header_function header_function + * + * @return self + */ + public function setHeaderFunction($header_function) + { + if (is_null($header_function)) { + throw new \InvalidArgumentException('non-nullable header_function cannot be null'); + } + $this->container['header_function'] = $header_function; + + return $this; + } + + /** + * Gets idempotency_keys + * + * @return string[]|null + */ + public function getIdempotencyKeys() + { + return $this->container['idempotency_keys']; + } + + /** + * Sets idempotency_keys + * + * @param string[]|null $idempotency_keys idempotency_keys + * + * @return self + */ + public function setIdempotencyKeys($idempotency_keys) + { + if (is_null($idempotency_keys)) { + throw new \InvalidArgumentException('non-nullable idempotency_keys cannot be null'); + } + $this->container['idempotency_keys'] = $idempotency_keys; + + return $this; + } + + /** + * Gets is_disabled + * + * @return bool|null + */ + public function getIsDisabled() + { + return $this->container['is_disabled']; + } + + /** + * Sets is_disabled + * + * @param bool|null $is_disabled is_disabled + * + * @return self + */ + public function setIsDisabled($is_disabled) + { + if (is_null($is_disabled)) { + throw new \InvalidArgumentException('non-nullable is_disabled cannot be null'); + } + $this->container['is_disabled'] = $is_disabled; + + return $this; + } + + /** + * Gets mask_id + * + * @return string|null + */ + public function getMaskId() + { + return $this->container['mask_id']; + } + + /** + * Sets mask_id + * + * @param string|null $mask_id mask_id + * + * @return self + */ + public function setMaskId($mask_id) + { + if (is_null($mask_id)) { + throw new \InvalidArgumentException('non-nullable mask_id cannot be null'); + } + $this->container['mask_id'] = $mask_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets project_id + * + * @return string|null + */ + public function getProjectId() + { + return $this->container['project_id']; + } + + /** + * Sets project_id + * + * @param string|null $project_id project_id + * + * @return self + */ + public function setProjectId($project_id) + { + if (is_null($project_id)) { + throw new \InvalidArgumentException('non-nullable project_id cannot be null'); + } + $this->container['project_id'] = $project_id; + + return $this; + } + + /** + * Gets provider + * + * @return \Convoy\Client\Model\DatastoreSourceProvider|null + */ + public function getProvider() + { + return $this->container['provider']; + } + + /** + * Sets provider + * + * @param \Convoy\Client\Model\DatastoreSourceProvider|null $provider provider + * + * @return self + */ + public function setProvider($provider) + { + if (is_null($provider)) { + throw new \InvalidArgumentException('non-nullable provider cannot be null'); + } + $this->container['provider'] = $provider; + + return $this; + } + + /** + * Gets provider_config + * + * @return \Convoy\Client\Model\DatastoreProviderConfig|null + */ + public function getProviderConfig() + { + return $this->container['provider_config']; + } + + /** + * Sets provider_config + * + * @param \Convoy\Client\Model\DatastoreProviderConfig|null $provider_config provider_config + * + * @return self + */ + public function setProviderConfig($provider_config) + { + if (is_null($provider_config)) { + throw new \InvalidArgumentException('non-nullable provider_config cannot be null'); + } + $this->container['provider_config'] = $provider_config; + + return $this; + } + + /** + * Gets pub_sub + * + * @return \Convoy\Client\Model\DatastorePubSubConfig|null + */ + public function getPubSub() + { + return $this->container['pub_sub']; + } + + /** + * Sets pub_sub + * + * @param \Convoy\Client\Model\DatastorePubSubConfig|null $pub_sub pub_sub + * + * @return self + */ + public function setPubSub($pub_sub) + { + if (is_null($pub_sub)) { + throw new \InvalidArgumentException('non-nullable pub_sub cannot be null'); + } + $this->container['pub_sub'] = $pub_sub; + + return $this; + } + + /** + * Gets type + * + * @return \Convoy\Client\Model\DatastoreSourceType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Convoy\Client\Model\DatastoreSourceType|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url url + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets verifier + * + * @return \Convoy\Client\Model\DatastoreVerifierConfig|null + */ + public function getVerifier() + { + return $this->container['verifier']; + } + + /** + * Sets verifier + * + * @param \Convoy\Client\Model\DatastoreVerifierConfig|null $verifier verifier + * + * @return self + */ + public function setVerifier($verifier) + { + if (is_null($verifier)) { + throw new \InvalidArgumentException('non-nullable verifier cannot be null'); + } + $this->container['verifier'] = $verifier; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreSourceProvider.php b/src/Client/Model/DatastoreSourceProvider.php new file mode 100644 index 0000000..c2fa9ff --- /dev/null +++ b/src/Client/Model/DatastoreSourceProvider.php @@ -0,0 +1,66 @@ + + */ +class DatastoreStrategyConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.StrategyConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'duration' => 'int', + 'retry_count' => 'int', + 'type' => '\Convoy\Client\Model\DatastoreStrategyProvider' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'duration' => null, + 'retry_count' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'duration' => false, + 'retry_count' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'duration' => 'duration', + 'retry_count' => 'retry_count', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'duration' => 'setDuration', + 'retry_count' => 'setRetryCount', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'duration' => 'getDuration', + 'retry_count' => 'getRetryCount', + 'type' => 'getType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('duration', $data ?? [], null); + $this->setIfExists('retry_count', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets duration + * + * @return int|null + */ + public function getDuration() + { + return $this->container['duration']; + } + + /** + * Sets duration + * + * @param int|null $duration duration + * + * @return self + */ + public function setDuration($duration) + { + if (is_null($duration)) { + throw new \InvalidArgumentException('non-nullable duration cannot be null'); + } + $this->container['duration'] = $duration; + + return $this; + } + + /** + * Gets retry_count + * + * @return int|null + */ + public function getRetryCount() + { + return $this->container['retry_count']; + } + + /** + * Sets retry_count + * + * @param int|null $retry_count retry_count + * + * @return self + */ + public function setRetryCount($retry_count) + { + if (is_null($retry_count)) { + throw new \InvalidArgumentException('non-nullable retry_count cannot be null'); + } + $this->container['retry_count'] = $retry_count; + + return $this; + } + + /** + * Gets type + * + * @return \Convoy\Client\Model\DatastoreStrategyProvider|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Convoy\Client\Model\DatastoreStrategyProvider|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreStrategyProvider.php b/src/Client/Model/DatastoreStrategyProvider.php new file mode 100644 index 0000000..a81aba6 --- /dev/null +++ b/src/Client/Model/DatastoreStrategyProvider.php @@ -0,0 +1,63 @@ + + */ +class DatastoreTwitterProviderConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.TwitterProviderConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'crc_verified_at' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'crc_verified_at' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'crc_verified_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'crc_verified_at' => 'crc_verified_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'crc_verified_at' => 'setCrcVerifiedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'crc_verified_at' => 'getCrcVerifiedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('crc_verified_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets crc_verified_at + * + * @return string|null + */ + public function getCrcVerifiedAt() + { + return $this->container['crc_verified_at']; + } + + /** + * Sets crc_verified_at + * + * @param string|null $crc_verified_at crc_verified_at + * + * @return self + */ + public function setCrcVerifiedAt($crc_verified_at) + { + if (is_null($crc_verified_at)) { + throw new \InvalidArgumentException('non-nullable crc_verified_at cannot be null'); + } + $this->container['crc_verified_at'] = $crc_verified_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreUpdatePortalLinkRequest.php b/src/Client/Model/DatastoreUpdatePortalLinkRequest.php new file mode 100644 index 0000000..a3e6fad --- /dev/null +++ b/src/Client/Model/DatastoreUpdatePortalLinkRequest.php @@ -0,0 +1,546 @@ + + */ +class DatastoreUpdatePortalLinkRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.UpdatePortalLinkRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'auth_type' => 'string', + 'can_manage_endpoint' => 'bool', + 'endpoints' => 'string[]', + 'name' => 'string', + 'owner_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'auth_type' => null, + 'can_manage_endpoint' => null, + 'endpoints' => null, + 'name' => null, + 'owner_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'auth_type' => false, + 'can_manage_endpoint' => false, + 'endpoints' => false, + 'name' => false, + 'owner_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'auth_type' => 'auth_type', + 'can_manage_endpoint' => 'can_manage_endpoint', + 'endpoints' => 'endpoints', + 'name' => 'name', + 'owner_id' => 'owner_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'auth_type' => 'setAuthType', + 'can_manage_endpoint' => 'setCanManageEndpoint', + 'endpoints' => 'setEndpoints', + 'name' => 'setName', + 'owner_id' => 'setOwnerId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'auth_type' => 'getAuthType', + 'can_manage_endpoint' => 'getCanManageEndpoint', + 'endpoints' => 'getEndpoints', + 'name' => 'getName', + 'owner_id' => 'getOwnerId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('auth_type', $data ?? [], null); + $this->setIfExists('can_manage_endpoint', $data ?? [], null); + $this->setIfExists('endpoints', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('owner_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets auth_type + * + * @return string|null + */ + public function getAuthType() + { + return $this->container['auth_type']; + } + + /** + * Sets auth_type + * + * @param string|null $auth_type auth_type + * + * @return self + */ + public function setAuthType($auth_type) + { + if (is_null($auth_type)) { + throw new \InvalidArgumentException('non-nullable auth_type cannot be null'); + } + $this->container['auth_type'] = $auth_type; + + return $this; + } + + /** + * Gets can_manage_endpoint + * + * @return bool|null + */ + public function getCanManageEndpoint() + { + return $this->container['can_manage_endpoint']; + } + + /** + * Sets can_manage_endpoint + * + * @param bool|null $can_manage_endpoint Specify whether endpoint management can be done through the Portal Link UI + * + * @return self + */ + public function setCanManageEndpoint($can_manage_endpoint) + { + if (is_null($can_manage_endpoint)) { + throw new \InvalidArgumentException('non-nullable can_manage_endpoint cannot be null'); + } + $this->container['can_manage_endpoint'] = $can_manage_endpoint; + + return $this; + } + + /** + * Gets endpoints + * + * @return string[]|null + */ + public function getEndpoints() + { + return $this->container['endpoints']; + } + + /** + * Sets endpoints + * + * @param string[]|null $endpoints Deprecated IDs of endpoints in this portal link + * + * @return self + */ + public function setEndpoints($endpoints) + { + if (is_null($endpoints)) { + throw new \InvalidArgumentException('non-nullable endpoints cannot be null'); + } + $this->container['endpoints'] = $endpoints; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Portal Link Name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets owner_id + * + * @return string|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param string|null $owner_id OwnerID, the portal link will inherit all the endpoints with this owner ID + * + * @return self + */ + public function setOwnerId($owner_id) + { + if (is_null($owner_id)) { + throw new \InvalidArgumentException('non-nullable owner_id cannot be null'); + } + $this->container['owner_id'] = $owner_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreVerifierConfig.php b/src/Client/Model/DatastoreVerifierConfig.php new file mode 100644 index 0000000..1d0c3e5 --- /dev/null +++ b/src/Client/Model/DatastoreVerifierConfig.php @@ -0,0 +1,512 @@ + + */ +class DatastoreVerifierConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'datastore.VerifierConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'api_key' => '\Convoy\Client\Model\DatastoreApiKey', + 'basic_auth' => '\Convoy\Client\Model\DatastoreBasicAuth', + 'hmac' => '\Convoy\Client\Model\DatastoreHMac', + 'type' => '\Convoy\Client\Model\DatastoreVerifierType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'api_key' => null, + 'basic_auth' => null, + 'hmac' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'api_key' => false, + 'basic_auth' => false, + 'hmac' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'api_key' => 'api_key', + 'basic_auth' => 'basic_auth', + 'hmac' => 'hmac', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'api_key' => 'setApiKey', + 'basic_auth' => 'setBasicAuth', + 'hmac' => 'setHmac', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'api_key' => 'getApiKey', + 'basic_auth' => 'getBasicAuth', + 'hmac' => 'getHmac', + 'type' => 'getType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('api_key', $data ?? [], null); + $this->setIfExists('basic_auth', $data ?? [], null); + $this->setIfExists('hmac', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets api_key + * + * @return \Convoy\Client\Model\DatastoreApiKey|null + */ + public function getApiKey() + { + return $this->container['api_key']; + } + + /** + * Sets api_key + * + * @param \Convoy\Client\Model\DatastoreApiKey|null $api_key api_key + * + * @return self + */ + public function setApiKey($api_key) + { + if (is_null($api_key)) { + throw new \InvalidArgumentException('non-nullable api_key cannot be null'); + } + $this->container['api_key'] = $api_key; + + return $this; + } + + /** + * Gets basic_auth + * + * @return \Convoy\Client\Model\DatastoreBasicAuth|null + */ + public function getBasicAuth() + { + return $this->container['basic_auth']; + } + + /** + * Sets basic_auth + * + * @param \Convoy\Client\Model\DatastoreBasicAuth|null $basic_auth basic_auth + * + * @return self + */ + public function setBasicAuth($basic_auth) + { + if (is_null($basic_auth)) { + throw new \InvalidArgumentException('non-nullable basic_auth cannot be null'); + } + $this->container['basic_auth'] = $basic_auth; + + return $this; + } + + /** + * Gets hmac + * + * @return \Convoy\Client\Model\DatastoreHMac|null + */ + public function getHmac() + { + return $this->container['hmac']; + } + + /** + * Sets hmac + * + * @param \Convoy\Client\Model\DatastoreHMac|null $hmac hmac + * + * @return self + */ + public function setHmac($hmac) + { + if (is_null($hmac)) { + throw new \InvalidArgumentException('non-nullable hmac cannot be null'); + } + $this->container['hmac'] = $hmac; + + return $this; + } + + /** + * Gets type + * + * @return \Convoy\Client\Model\DatastoreVerifierType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Convoy\Client\Model\DatastoreVerifierType|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/DatastoreVerifierType.php b/src/Client/Model/DatastoreVerifierType.php new file mode 100644 index 0000000..8f7fb3b --- /dev/null +++ b/src/Client/Model/DatastoreVerifierType.php @@ -0,0 +1,69 @@ + + */ +class GetDeliveryAttempt200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetDeliveryAttempt_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\DatastoreDeliveryAttempt' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\DatastoreDeliveryAttempt|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\DatastoreDeliveryAttempt|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetDeliveryAttempts200Response.php b/src/Client/Model/GetDeliveryAttempts200Response.php new file mode 100644 index 0000000..3a1412f --- /dev/null +++ b/src/Client/Model/GetDeliveryAttempts200Response.php @@ -0,0 +1,478 @@ + + */ +class GetDeliveryAttempts200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetDeliveryAttempts_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\DatastoreDeliveryAttempt[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\DatastoreDeliveryAttempt[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\DatastoreDeliveryAttempt[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetEndpoints200Response.php b/src/Client/Model/GetEndpoints200Response.php new file mode 100644 index 0000000..248d560 --- /dev/null +++ b/src/Client/Model/GetEndpoints200Response.php @@ -0,0 +1,478 @@ + + */ +class GetEndpoints200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetEndpoints_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\GetEndpoints200ResponseAllOfData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\GetEndpoints200ResponseAllOfData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\GetEndpoints200ResponseAllOfData|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetEndpoints200ResponseAllOfData.php b/src/Client/Model/GetEndpoints200ResponseAllOfData.php new file mode 100644 index 0000000..c45ce8f --- /dev/null +++ b/src/Client/Model/GetEndpoints200ResponseAllOfData.php @@ -0,0 +1,451 @@ + + */ +class GetEndpoints200ResponseAllOfData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetEndpoints_200_response_allOf_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\Convoy\Client\Model\ModelsEndpointResponse[]', + 'pagination' => '\Convoy\Client\Model\DatastorePaginationData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pagination' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pagination' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pagination' => 'pagination' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pagination' => 'setPagination' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pagination' => 'getPagination' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pagination', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \Convoy\Client\Model\ModelsEndpointResponse[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \Convoy\Client\Model\ModelsEndpointResponse[]|null $content content + * + * @return self + */ + public function setContent($content) + { + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pagination + * + * @return \Convoy\Client\Model\DatastorePaginationData|null + */ + public function getPagination() + { + return $this->container['pagination']; + } + + /** + * Sets pagination + * + * @param \Convoy\Client\Model\DatastorePaginationData|null $pagination pagination + * + * @return self + */ + public function setPagination($pagination) + { + if (is_null($pagination)) { + array_push($this->openAPINullablesSetToNull, 'pagination'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('pagination', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['pagination'] = $pagination; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetEventDeliveriesPaged200Response.php b/src/Client/Model/GetEventDeliveriesPaged200Response.php new file mode 100644 index 0000000..7b12183 --- /dev/null +++ b/src/Client/Model/GetEventDeliveriesPaged200Response.php @@ -0,0 +1,478 @@ + + */ +class GetEventDeliveriesPaged200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetEventDeliveriesPaged_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\GetEventDeliveriesPaged200ResponseAllOfData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\GetEventDeliveriesPaged200ResponseAllOfData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\GetEventDeliveriesPaged200ResponseAllOfData|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetEventDeliveriesPaged200ResponseAllOfData.php b/src/Client/Model/GetEventDeliveriesPaged200ResponseAllOfData.php new file mode 100644 index 0000000..8636ee0 --- /dev/null +++ b/src/Client/Model/GetEventDeliveriesPaged200ResponseAllOfData.php @@ -0,0 +1,451 @@ + + */ +class GetEventDeliveriesPaged200ResponseAllOfData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetEventDeliveriesPaged_200_response_allOf_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\Convoy\Client\Model\ModelsEventDeliveryResponse[]', + 'pagination' => '\Convoy\Client\Model\DatastorePaginationData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pagination' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pagination' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pagination' => 'pagination' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pagination' => 'setPagination' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pagination' => 'getPagination' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pagination', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \Convoy\Client\Model\ModelsEventDeliveryResponse[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \Convoy\Client\Model\ModelsEventDeliveryResponse[]|null $content content + * + * @return self + */ + public function setContent($content) + { + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pagination + * + * @return \Convoy\Client\Model\DatastorePaginationData|null + */ + public function getPagination() + { + return $this->container['pagination']; + } + + /** + * Sets pagination + * + * @param \Convoy\Client\Model\DatastorePaginationData|null $pagination pagination + * + * @return self + */ + public function setPagination($pagination) + { + if (is_null($pagination)) { + array_push($this->openAPINullablesSetToNull, 'pagination'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('pagination', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['pagination'] = $pagination; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetEventDelivery200Response.php b/src/Client/Model/GetEventDelivery200Response.php new file mode 100644 index 0000000..751dd8e --- /dev/null +++ b/src/Client/Model/GetEventDelivery200Response.php @@ -0,0 +1,478 @@ + + */ +class GetEventDelivery200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetEventDelivery_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsEventDeliveryResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsEventDeliveryResponse|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsEventDeliveryResponse|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetEventTypes200Response.php b/src/Client/Model/GetEventTypes200Response.php new file mode 100644 index 0000000..0fe7f6a --- /dev/null +++ b/src/Client/Model/GetEventTypes200Response.php @@ -0,0 +1,478 @@ + + */ +class GetEventTypes200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetEventTypes_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsEventTypeResponse[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsEventTypeResponse[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsEventTypeResponse[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetEventsPaged200Response.php b/src/Client/Model/GetEventsPaged200Response.php new file mode 100644 index 0000000..ab120ab --- /dev/null +++ b/src/Client/Model/GetEventsPaged200Response.php @@ -0,0 +1,478 @@ + + */ +class GetEventsPaged200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetEventsPaged_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\GetEventsPaged200ResponseAllOfData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\GetEventsPaged200ResponseAllOfData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\GetEventsPaged200ResponseAllOfData|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetEventsPaged200ResponseAllOfData.php b/src/Client/Model/GetEventsPaged200ResponseAllOfData.php new file mode 100644 index 0000000..b662d9c --- /dev/null +++ b/src/Client/Model/GetEventsPaged200ResponseAllOfData.php @@ -0,0 +1,451 @@ + + */ +class GetEventsPaged200ResponseAllOfData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetEventsPaged_200_response_allOf_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\Convoy\Client\Model\ModelsEventResponse[]', + 'pagination' => '\Convoy\Client\Model\DatastorePaginationData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pagination' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pagination' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pagination' => 'pagination' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pagination' => 'setPagination' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pagination' => 'getPagination' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pagination', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \Convoy\Client\Model\ModelsEventResponse[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \Convoy\Client\Model\ModelsEventResponse[]|null $content content + * + * @return self + */ + public function setContent($content) + { + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pagination + * + * @return \Convoy\Client\Model\DatastorePaginationData|null + */ + public function getPagination() + { + return $this->container['pagination']; + } + + /** + * Sets pagination + * + * @param \Convoy\Client\Model\DatastorePaginationData|null $pagination pagination + * + * @return self + */ + public function setPagination($pagination) + { + if (is_null($pagination)) { + array_push($this->openAPINullablesSetToNull, 'pagination'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('pagination', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['pagination'] = $pagination; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetFilters200Response.php b/src/Client/Model/GetFilters200Response.php new file mode 100644 index 0000000..2541588 --- /dev/null +++ b/src/Client/Model/GetFilters200Response.php @@ -0,0 +1,478 @@ + + */ +class GetFilters200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetFilters_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsFilterResponse[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsFilterResponse[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsFilterResponse[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetMetaEvent200Response.php b/src/Client/Model/GetMetaEvent200Response.php new file mode 100644 index 0000000..f5a63a5 --- /dev/null +++ b/src/Client/Model/GetMetaEvent200Response.php @@ -0,0 +1,478 @@ + + */ +class GetMetaEvent200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetMetaEvent_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsMetaEventResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsMetaEventResponse|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsMetaEventResponse|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetMetaEventsPaged200Response.php b/src/Client/Model/GetMetaEventsPaged200Response.php new file mode 100644 index 0000000..0fa18cd --- /dev/null +++ b/src/Client/Model/GetMetaEventsPaged200Response.php @@ -0,0 +1,478 @@ + + */ +class GetMetaEventsPaged200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetMetaEventsPaged_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\GetMetaEventsPaged200ResponseAllOfData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\GetMetaEventsPaged200ResponseAllOfData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\GetMetaEventsPaged200ResponseAllOfData|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetMetaEventsPaged200ResponseAllOfData.php b/src/Client/Model/GetMetaEventsPaged200ResponseAllOfData.php new file mode 100644 index 0000000..d2c9d0f --- /dev/null +++ b/src/Client/Model/GetMetaEventsPaged200ResponseAllOfData.php @@ -0,0 +1,451 @@ + + */ +class GetMetaEventsPaged200ResponseAllOfData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetMetaEventsPaged_200_response_allOf_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\Convoy\Client\Model\ModelsMetaEventResponse[]', + 'pagination' => '\Convoy\Client\Model\DatastorePaginationData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pagination' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pagination' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pagination' => 'pagination' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pagination' => 'setPagination' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pagination' => 'getPagination' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pagination', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \Convoy\Client\Model\ModelsMetaEventResponse[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \Convoy\Client\Model\ModelsMetaEventResponse[]|null $content content + * + * @return self + */ + public function setContent($content) + { + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pagination + * + * @return \Convoy\Client\Model\DatastorePaginationData|null + */ + public function getPagination() + { + return $this->container['pagination']; + } + + /** + * Sets pagination + * + * @param \Convoy\Client\Model\DatastorePaginationData|null $pagination pagination + * + * @return self + */ + public function setPagination($pagination) + { + if (is_null($pagination)) { + array_push($this->openAPINullablesSetToNull, 'pagination'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('pagination', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['pagination'] = $pagination; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetProject200Response.php b/src/Client/Model/GetProject200Response.php new file mode 100644 index 0000000..d7987b1 --- /dev/null +++ b/src/Client/Model/GetProject200Response.php @@ -0,0 +1,478 @@ + + */ +class GetProject200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetProject_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsProjectResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsProjectResponse|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsProjectResponse|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetProjects200Response.php b/src/Client/Model/GetProjects200Response.php new file mode 100644 index 0000000..86bcb37 --- /dev/null +++ b/src/Client/Model/GetProjects200Response.php @@ -0,0 +1,478 @@ + + */ +class GetProjects200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetProjects_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsProjectResponse[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsProjectResponse[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsProjectResponse[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetProjects400Response.php b/src/Client/Model/GetProjects400Response.php new file mode 100644 index 0000000..2c10f8c --- /dev/null +++ b/src/Client/Model/GetProjects400Response.php @@ -0,0 +1,478 @@ + + */ +class GetProjects400Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetProjects_400_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return object|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param object|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetSubscriptions200Response.php b/src/Client/Model/GetSubscriptions200Response.php new file mode 100644 index 0000000..72db016 --- /dev/null +++ b/src/Client/Model/GetSubscriptions200Response.php @@ -0,0 +1,478 @@ + + */ +class GetSubscriptions200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetSubscriptions_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\GetSubscriptions200ResponseAllOfData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\GetSubscriptions200ResponseAllOfData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\GetSubscriptions200ResponseAllOfData|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/GetSubscriptions200ResponseAllOfData.php b/src/Client/Model/GetSubscriptions200ResponseAllOfData.php new file mode 100644 index 0000000..005d544 --- /dev/null +++ b/src/Client/Model/GetSubscriptions200ResponseAllOfData.php @@ -0,0 +1,451 @@ + + */ +class GetSubscriptions200ResponseAllOfData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetSubscriptions_200_response_allOf_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\Convoy\Client\Model\ModelsSubscriptionResponse[]', + 'pagination' => '\Convoy\Client\Model\DatastorePaginationData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pagination' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pagination' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pagination' => 'pagination' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pagination' => 'setPagination' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pagination' => 'getPagination' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pagination', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \Convoy\Client\Model\ModelsSubscriptionResponse[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \Convoy\Client\Model\ModelsSubscriptionResponse[]|null $content content + * + * @return self + */ + public function setContent($content) + { + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pagination + * + * @return \Convoy\Client\Model\DatastorePaginationData|null + */ + public function getPagination() + { + return $this->container['pagination']; + } + + /** + * Sets pagination + * + * @param \Convoy\Client\Model\DatastorePaginationData|null $pagination pagination + * + * @return self + */ + public function setPagination($pagination) + { + if (is_null($pagination)) { + array_push($this->openAPINullablesSetToNull, 'pagination'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('pagination', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['pagination'] = $pagination; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/LoadPortalLinksPaged200Response.php b/src/Client/Model/LoadPortalLinksPaged200Response.php new file mode 100644 index 0000000..4669b3d --- /dev/null +++ b/src/Client/Model/LoadPortalLinksPaged200Response.php @@ -0,0 +1,478 @@ + + */ +class LoadPortalLinksPaged200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoadPortalLinksPaged_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\LoadPortalLinksPaged200ResponseAllOfData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\LoadPortalLinksPaged200ResponseAllOfData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\LoadPortalLinksPaged200ResponseAllOfData|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/LoadPortalLinksPaged200ResponseAllOfData.php b/src/Client/Model/LoadPortalLinksPaged200ResponseAllOfData.php new file mode 100644 index 0000000..e7f0b97 --- /dev/null +++ b/src/Client/Model/LoadPortalLinksPaged200ResponseAllOfData.php @@ -0,0 +1,451 @@ + + */ +class LoadPortalLinksPaged200ResponseAllOfData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoadPortalLinksPaged_200_response_allOf_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\Convoy\Client\Model\DatastorePortalLinkResponse[]', + 'pagination' => '\Convoy\Client\Model\DatastorePaginationData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pagination' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pagination' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pagination' => 'pagination' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pagination' => 'setPagination' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pagination' => 'getPagination' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pagination', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \Convoy\Client\Model\DatastorePortalLinkResponse[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \Convoy\Client\Model\DatastorePortalLinkResponse[]|null $content content + * + * @return self + */ + public function setContent($content) + { + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pagination + * + * @return \Convoy\Client\Model\DatastorePaginationData|null + */ + public function getPagination() + { + return $this->container['pagination']; + } + + /** + * Sets pagination + * + * @param \Convoy\Client\Model\DatastorePaginationData|null $pagination pagination + * + * @return self + */ + public function setPagination($pagination) + { + if (is_null($pagination)) { + array_push($this->openAPINullablesSetToNull, 'pagination'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('pagination', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['pagination'] = $pagination; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/LoadSourcesPaged200Response.php b/src/Client/Model/LoadSourcesPaged200Response.php new file mode 100644 index 0000000..15ed70a --- /dev/null +++ b/src/Client/Model/LoadSourcesPaged200Response.php @@ -0,0 +1,478 @@ + + */ +class LoadSourcesPaged200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoadSourcesPaged_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\LoadSourcesPaged200ResponseAllOfData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\LoadSourcesPaged200ResponseAllOfData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\LoadSourcesPaged200ResponseAllOfData|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/LoadSourcesPaged200ResponseAllOfData.php b/src/Client/Model/LoadSourcesPaged200ResponseAllOfData.php new file mode 100644 index 0000000..1fcfec5 --- /dev/null +++ b/src/Client/Model/LoadSourcesPaged200ResponseAllOfData.php @@ -0,0 +1,451 @@ + + */ +class LoadSourcesPaged200ResponseAllOfData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoadSourcesPaged_200_response_allOf_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => '\Convoy\Client\Model\ModelsSourceResponse[]', + 'pagination' => '\Convoy\Client\Model\DatastorePaginationData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pagination' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => false, + 'pagination' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pagination' => 'pagination' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pagination' => 'setPagination' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pagination' => 'getPagination' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pagination', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return \Convoy\Client\Model\ModelsSourceResponse[]|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \Convoy\Client\Model\ModelsSourceResponse[]|null $content content + * + * @return self + */ + public function setContent($content) + { + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pagination + * + * @return \Convoy\Client\Model\DatastorePaginationData|null + */ + public function getPagination() + { + return $this->container['pagination']; + } + + /** + * Sets pagination + * + * @param \Convoy\Client\Model\DatastorePaginationData|null $pagination pagination + * + * @return self + */ + public function setPagination($pagination) + { + if (is_null($pagination)) { + array_push($this->openAPINullablesSetToNull, 'pagination'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('pagination', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['pagination'] = $pagination; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelInterface.php b/src/Client/Model/ModelInterface.php new file mode 100644 index 0000000..bda790a --- /dev/null +++ b/src/Client/Model/ModelInterface.php @@ -0,0 +1,112 @@ + + */ +class ModelsAlertConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.AlertConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'count' => 'int', + 'threshold' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'count' => null, + 'threshold' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'count' => false, + 'threshold' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'count' => 'count', + 'threshold' => 'threshold' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'count' => 'setCount', + 'threshold' => 'setThreshold' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'count' => 'getCount', + 'threshold' => 'getThreshold' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('threshold', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Count + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + throw new \InvalidArgumentException('non-nullable count cannot be null'); + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets threshold + * + * @return string|null + */ + public function getThreshold() + { + return $this->container['threshold']; + } + + /** + * Sets threshold + * + * @param string|null $threshold Threshold + * + * @return self + */ + public function setThreshold($threshold) + { + if (is_null($threshold)) { + throw new \InvalidArgumentException('non-nullable threshold cannot be null'); + } + $this->container['threshold'] = $threshold; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsAmqpAuth.php b/src/Client/Model/ModelsAmqpAuth.php new file mode 100644 index 0000000..7f67504 --- /dev/null +++ b/src/Client/Model/ModelsAmqpAuth.php @@ -0,0 +1,444 @@ + + */ +class ModelsAmqpAuth implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.AmqpAuth'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'password' => 'string', + 'user' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'password' => null, + 'user' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'password' => false, + 'user' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'password' => 'password', + 'user' => 'user' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'password' => 'setPassword', + 'user' => 'setUser' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'password' => 'getPassword', + 'user' => 'getUser' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('user', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets password + * + * @return string|null + */ + public function getPassword() + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string|null $password password + * + * @return self + */ + public function setPassword($password) + { + if (is_null($password)) { + throw new \InvalidArgumentException('non-nullable password cannot be null'); + } + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets user + * + * @return string|null + */ + public function getUser() + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param string|null $user user + * + * @return self + */ + public function setUser($user) + { + if (is_null($user)) { + throw new \InvalidArgumentException('non-nullable user cannot be null'); + } + $this->container['user'] = $user; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsAmqpExchange.php b/src/Client/Model/ModelsAmqpExchange.php new file mode 100644 index 0000000..8b77731 --- /dev/null +++ b/src/Client/Model/ModelsAmqpExchange.php @@ -0,0 +1,444 @@ + + */ +class ModelsAmqpExchange implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.AmqpExchange'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'exchange' => 'string', + 'routing_key' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'exchange' => null, + 'routing_key' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'exchange' => false, + 'routing_key' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'exchange' => 'exchange', + 'routing_key' => 'routingKey' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'exchange' => 'setExchange', + 'routing_key' => 'setRoutingKey' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'exchange' => 'getExchange', + 'routing_key' => 'getRoutingKey' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('exchange', $data ?? [], null); + $this->setIfExists('routing_key', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets exchange + * + * @return string|null + */ + public function getExchange() + { + return $this->container['exchange']; + } + + /** + * Sets exchange + * + * @param string|null $exchange exchange + * + * @return self + */ + public function setExchange($exchange) + { + if (is_null($exchange)) { + throw new \InvalidArgumentException('non-nullable exchange cannot be null'); + } + $this->container['exchange'] = $exchange; + + return $this; + } + + /** + * Gets routing_key + * + * @return string|null + */ + public function getRoutingKey() + { + return $this->container['routing_key']; + } + + /** + * Sets routing_key + * + * @param string|null $routing_key routing_key + * + * @return self + */ + public function setRoutingKey($routing_key) + { + if (is_null($routing_key)) { + throw new \InvalidArgumentException('non-nullable routing_key cannot be null'); + } + $this->container['routing_key'] = $routing_key; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsAmqpPubSubconfig.php b/src/Client/Model/ModelsAmqpPubSubconfig.php new file mode 100644 index 0000000..aa69b78 --- /dev/null +++ b/src/Client/Model/ModelsAmqpPubSubconfig.php @@ -0,0 +1,648 @@ + + */ +class ModelsAmqpPubSubconfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.AmqpPubSubconfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'host' => 'string', + 'auth' => '\Convoy\Client\Model\ModelsAmqpAuth', + 'bind_exchange' => '\Convoy\Client\Model\ModelsAmqpExchange', + 'dead_letter_exchange' => 'string', + 'port' => 'string', + 'queue' => 'string', + 'schema' => 'string', + 'vhost' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'host' => null, + 'auth' => null, + 'bind_exchange' => null, + 'dead_letter_exchange' => null, + 'port' => null, + 'queue' => null, + 'schema' => null, + 'vhost' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'host' => false, + 'auth' => false, + 'bind_exchange' => false, + 'dead_letter_exchange' => false, + 'port' => false, + 'queue' => false, + 'schema' => false, + 'vhost' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'host' => 'host', + 'auth' => 'auth', + 'bind_exchange' => 'bindExchange', + 'dead_letter_exchange' => 'deadLetterExchange', + 'port' => 'port', + 'queue' => 'queue', + 'schema' => 'schema', + 'vhost' => 'vhost' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'host' => 'setHost', + 'auth' => 'setAuth', + 'bind_exchange' => 'setBindExchange', + 'dead_letter_exchange' => 'setDeadLetterExchange', + 'port' => 'setPort', + 'queue' => 'setQueue', + 'schema' => 'setSchema', + 'vhost' => 'setVhost' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'host' => 'getHost', + 'auth' => 'getAuth', + 'bind_exchange' => 'getBindExchange', + 'dead_letter_exchange' => 'getDeadLetterExchange', + 'port' => 'getPort', + 'queue' => 'getQueue', + 'schema' => 'getSchema', + 'vhost' => 'getVhost' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('host', $data ?? [], null); + $this->setIfExists('auth', $data ?? [], null); + $this->setIfExists('bind_exchange', $data ?? [], null); + $this->setIfExists('dead_letter_exchange', $data ?? [], null); + $this->setIfExists('port', $data ?? [], null); + $this->setIfExists('queue', $data ?? [], null); + $this->setIfExists('schema', $data ?? [], null); + $this->setIfExists('vhost', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets host + * + * @return string|null + */ + public function getHost() + { + return $this->container['host']; + } + + /** + * Sets host + * + * @param string|null $host host + * + * @return self + */ + public function setHost($host) + { + if (is_null($host)) { + throw new \InvalidArgumentException('non-nullable host cannot be null'); + } + $this->container['host'] = $host; + + return $this; + } + + /** + * Gets auth + * + * @return \Convoy\Client\Model\ModelsAmqpAuth|null + */ + public function getAuth() + { + return $this->container['auth']; + } + + /** + * Sets auth + * + * @param \Convoy\Client\Model\ModelsAmqpAuth|null $auth auth + * + * @return self + */ + public function setAuth($auth) + { + if (is_null($auth)) { + throw new \InvalidArgumentException('non-nullable auth cannot be null'); + } + $this->container['auth'] = $auth; + + return $this; + } + + /** + * Gets bind_exchange + * + * @return \Convoy\Client\Model\ModelsAmqpExchange|null + */ + public function getBindExchange() + { + return $this->container['bind_exchange']; + } + + /** + * Sets bind_exchange + * + * @param \Convoy\Client\Model\ModelsAmqpExchange|null $bind_exchange bind_exchange + * + * @return self + */ + public function setBindExchange($bind_exchange) + { + if (is_null($bind_exchange)) { + throw new \InvalidArgumentException('non-nullable bind_exchange cannot be null'); + } + $this->container['bind_exchange'] = $bind_exchange; + + return $this; + } + + /** + * Gets dead_letter_exchange + * + * @return string|null + */ + public function getDeadLetterExchange() + { + return $this->container['dead_letter_exchange']; + } + + /** + * Sets dead_letter_exchange + * + * @param string|null $dead_letter_exchange dead_letter_exchange + * + * @return self + */ + public function setDeadLetterExchange($dead_letter_exchange) + { + if (is_null($dead_letter_exchange)) { + throw new \InvalidArgumentException('non-nullable dead_letter_exchange cannot be null'); + } + $this->container['dead_letter_exchange'] = $dead_letter_exchange; + + return $this; + } + + /** + * Gets port + * + * @return string|null + */ + public function getPort() + { + return $this->container['port']; + } + + /** + * Sets port + * + * @param string|null $port port + * + * @return self + */ + public function setPort($port) + { + if (is_null($port)) { + throw new \InvalidArgumentException('non-nullable port cannot be null'); + } + $this->container['port'] = $port; + + return $this; + } + + /** + * Gets queue + * + * @return string|null + */ + public function getQueue() + { + return $this->container['queue']; + } + + /** + * Sets queue + * + * @param string|null $queue queue + * + * @return self + */ + public function setQueue($queue) + { + if (is_null($queue)) { + throw new \InvalidArgumentException('non-nullable queue cannot be null'); + } + $this->container['queue'] = $queue; + + return $this; + } + + /** + * Gets schema + * + * @return string|null + */ + public function getSchema() + { + return $this->container['schema']; + } + + /** + * Sets schema + * + * @param string|null $schema schema + * + * @return self + */ + public function setSchema($schema) + { + if (is_null($schema)) { + throw new \InvalidArgumentException('non-nullable schema cannot be null'); + } + $this->container['schema'] = $schema; + + return $this; + } + + /** + * Gets vhost + * + * @return string|null + */ + public function getVhost() + { + return $this->container['vhost']; + } + + /** + * Sets vhost + * + * @param string|null $vhost vhost + * + * @return self + */ + public function setVhost($vhost) + { + if (is_null($vhost)) { + throw new \InvalidArgumentException('non-nullable vhost cannot be null'); + } + $this->container['vhost'] = $vhost; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsApiKey.php b/src/Client/Model/ModelsApiKey.php new file mode 100644 index 0000000..994a9d1 --- /dev/null +++ b/src/Client/Model/ModelsApiKey.php @@ -0,0 +1,450 @@ + + */ +class ModelsApiKey implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.ApiKey'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'header_name' => 'string', + 'header_value' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'header_name' => null, + 'header_value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'header_name' => false, + 'header_value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'header_name' => 'header_name', + 'header_value' => 'header_value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'header_name' => 'setHeaderName', + 'header_value' => 'setHeaderValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'header_name' => 'getHeaderName', + 'header_value' => 'getHeaderValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('header_name', $data ?? [], null); + $this->setIfExists('header_value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['header_name'] === null) { + $invalidProperties[] = "'header_name' can't be null"; + } + if ($this->container['header_value'] === null) { + $invalidProperties[] = "'header_value' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets header_name + * + * @return string + */ + public function getHeaderName() + { + return $this->container['header_name']; + } + + /** + * Sets header_name + * + * @param string $header_name header_name + * + * @return self + */ + public function setHeaderName($header_name) + { + if (is_null($header_name)) { + throw new \InvalidArgumentException('non-nullable header_name cannot be null'); + } + $this->container['header_name'] = $header_name; + + return $this; + } + + /** + * Gets header_value + * + * @return string + */ + public function getHeaderValue() + { + return $this->container['header_value']; + } + + /** + * Sets header_value + * + * @param string $header_value header_value + * + * @return self + */ + public function setHeaderValue($header_value) + { + if (is_null($header_value)) { + throw new \InvalidArgumentException('non-nullable header_value cannot be null'); + } + $this->container['header_value'] = $header_value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsBasicAuth.php b/src/Client/Model/ModelsBasicAuth.php new file mode 100644 index 0000000..4afc4f0 --- /dev/null +++ b/src/Client/Model/ModelsBasicAuth.php @@ -0,0 +1,450 @@ + + */ +class ModelsBasicAuth implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.BasicAuth'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'password' => 'string', + 'username' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'password' => null, + 'username' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'password' => false, + 'username' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'password' => 'password', + 'username' => 'username' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'password' => 'setPassword', + 'username' => 'setUsername' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'password' => 'getPassword', + 'username' => 'getUsername' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['password'] === null) { + $invalidProperties[] = "'password' can't be null"; + } + if ($this->container['username'] === null) { + $invalidProperties[] = "'username' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets password + * + * @return string + */ + public function getPassword() + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string $password password + * + * @return self + */ + public function setPassword($password) + { + if (is_null($password)) { + throw new \InvalidArgumentException('non-nullable password cannot be null'); + } + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets username + * + * @return string + */ + public function getUsername() + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string $username username + * + * @return self + */ + public function setUsername($username) + { + if (is_null($username)) { + throw new \InvalidArgumentException('non-nullable username cannot be null'); + } + $this->container['username'] = $username; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsBroadcastEvent.php b/src/Client/Model/ModelsBroadcastEvent.php new file mode 100644 index 0000000..9e6bb3e --- /dev/null +++ b/src/Client/Model/ModelsBroadcastEvent.php @@ -0,0 +1,546 @@ + + */ +class ModelsBroadcastEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.BroadcastEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'acknowledged_at' => 'string', + 'custom_headers' => 'array', + 'data' => 'array', + 'event_type' => 'string', + 'idempotency_key' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'acknowledged_at' => null, + 'custom_headers' => null, + 'data' => null, + 'event_type' => null, + 'idempotency_key' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'acknowledged_at' => false, + 'custom_headers' => false, + 'data' => false, + 'event_type' => false, + 'idempotency_key' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'acknowledged_at' => 'acknowledged_at', + 'custom_headers' => 'custom_headers', + 'data' => 'data', + 'event_type' => 'event_type', + 'idempotency_key' => 'idempotency_key' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'acknowledged_at' => 'setAcknowledgedAt', + 'custom_headers' => 'setCustomHeaders', + 'data' => 'setData', + 'event_type' => 'setEventType', + 'idempotency_key' => 'setIdempotencyKey' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'acknowledged_at' => 'getAcknowledgedAt', + 'custom_headers' => 'getCustomHeaders', + 'data' => 'getData', + 'event_type' => 'getEventType', + 'idempotency_key' => 'getIdempotencyKey' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('acknowledged_at', $data ?? [], null); + $this->setIfExists('custom_headers', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('idempotency_key', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets acknowledged_at + * + * @return string|null + */ + public function getAcknowledgedAt() + { + return $this->container['acknowledged_at']; + } + + /** + * Sets acknowledged_at + * + * @param string|null $acknowledged_at acknowledged_at + * + * @return self + */ + public function setAcknowledgedAt($acknowledged_at) + { + if (is_null($acknowledged_at)) { + throw new \InvalidArgumentException('non-nullable acknowledged_at cannot be null'); + } + $this->container['acknowledged_at'] = $acknowledged_at; + + return $this; + } + + /** + * Gets custom_headers + * + * @return array|null + */ + public function getCustomHeaders() + { + return $this->container['custom_headers']; + } + + /** + * Sets custom_headers + * + * @param array|null $custom_headers Specifies custom headers you want convoy to add when the event is dispatched to your endpoint + * + * @return self + */ + public function setCustomHeaders($custom_headers) + { + if (is_null($custom_headers)) { + throw new \InvalidArgumentException('non-nullable custom_headers cannot be null'); + } + $this->container['custom_headers'] = $custom_headers; + + return $this; + } + + /** + * Gets data + * + * @return array|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param array|null $data Data is an arbitrary JSON value that gets sent as the body of the webhook to the endpoints + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type Event Type is used for filtering and debugging e.g invoice.paid + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets idempotency_key + * + * @return string|null + */ + public function getIdempotencyKey() + { + return $this->container['idempotency_key']; + } + + /** + * Sets idempotency_key + * + * @param string|null $idempotency_key Specify a key for event deduplication + * + * @return self + */ + public function setIdempotencyKey($idempotency_key) + { + if (is_null($idempotency_key)) { + throw new \InvalidArgumentException('non-nullable idempotency_key cannot be null'); + } + $this->container['idempotency_key'] = $idempotency_key; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsBulkOnboardAcceptedResponse.php b/src/Client/Model/ModelsBulkOnboardAcceptedResponse.php new file mode 100644 index 0000000..aff4782 --- /dev/null +++ b/src/Client/Model/ModelsBulkOnboardAcceptedResponse.php @@ -0,0 +1,478 @@ + + */ +class ModelsBulkOnboardAcceptedResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.BulkOnboardAcceptedResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'batch_count' => 'int', + 'message' => 'string', + 'total_items' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'batch_count' => null, + 'message' => null, + 'total_items' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'batch_count' => false, + 'message' => false, + 'total_items' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'batch_count' => 'batch_count', + 'message' => 'message', + 'total_items' => 'total_items' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'batch_count' => 'setBatchCount', + 'message' => 'setMessage', + 'total_items' => 'setTotalItems' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'batch_count' => 'getBatchCount', + 'message' => 'getMessage', + 'total_items' => 'getTotalItems' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('batch_count', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('total_items', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets batch_count + * + * @return int|null + */ + public function getBatchCount() + { + return $this->container['batch_count']; + } + + /** + * Sets batch_count + * + * @param int|null $batch_count batch_count + * + * @return self + */ + public function setBatchCount($batch_count) + { + if (is_null($batch_count)) { + throw new \InvalidArgumentException('non-nullable batch_count cannot be null'); + } + $this->container['batch_count'] = $batch_count; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets total_items + * + * @return int|null + */ + public function getTotalItems() + { + return $this->container['total_items']; + } + + /** + * Sets total_items + * + * @param int|null $total_items total_items + * + * @return self + */ + public function setTotalItems($total_items) + { + if (is_null($total_items)) { + throw new \InvalidArgumentException('non-nullable total_items cannot be null'); + } + $this->container['total_items'] = $total_items; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsBulkOnboardDryRunResponse.php b/src/Client/Model/ModelsBulkOnboardDryRunResponse.php new file mode 100644 index 0000000..3361c24 --- /dev/null +++ b/src/Client/Model/ModelsBulkOnboardDryRunResponse.php @@ -0,0 +1,478 @@ + + */ +class ModelsBulkOnboardDryRunResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.BulkOnboardDryRunResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'errors' => '\Convoy\Client\Model\ModelsOnboardValidationError[]', + 'total_rows' => 'int', + 'valid_count' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'errors' => null, + 'total_rows' => null, + 'valid_count' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'errors' => false, + 'total_rows' => false, + 'valid_count' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'errors' => 'errors', + 'total_rows' => 'total_rows', + 'valid_count' => 'valid_count' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'errors' => 'setErrors', + 'total_rows' => 'setTotalRows', + 'valid_count' => 'setValidCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'errors' => 'getErrors', + 'total_rows' => 'getTotalRows', + 'valid_count' => 'getValidCount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('total_rows', $data ?? [], null); + $this->setIfExists('valid_count', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets errors + * + * @return \Convoy\Client\Model\ModelsOnboardValidationError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Convoy\Client\Model\ModelsOnboardValidationError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets total_rows + * + * @return int|null + */ + public function getTotalRows() + { + return $this->container['total_rows']; + } + + /** + * Sets total_rows + * + * @param int|null $total_rows total_rows + * + * @return self + */ + public function setTotalRows($total_rows) + { + if (is_null($total_rows)) { + throw new \InvalidArgumentException('non-nullable total_rows cannot be null'); + } + $this->container['total_rows'] = $total_rows; + + return $this; + } + + /** + * Gets valid_count + * + * @return int|null + */ + public function getValidCount() + { + return $this->container['valid_count']; + } + + /** + * Sets valid_count + * + * @param int|null $valid_count valid_count + * + * @return self + */ + public function setValidCount($valid_count) + { + if (is_null($valid_count)) { + throw new \InvalidArgumentException('non-nullable valid_count cannot be null'); + } + $this->container['valid_count'] = $valid_count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsBulkOnboardRequest.php b/src/Client/Model/ModelsBulkOnboardRequest.php new file mode 100644 index 0000000..f44b056 --- /dev/null +++ b/src/Client/Model/ModelsBulkOnboardRequest.php @@ -0,0 +1,410 @@ + + */ +class ModelsBulkOnboardRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.BulkOnboardRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'items' => '\Convoy\Client\Model\ModelsOnboardItem[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'items' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'items' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'items' => 'items' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'items' => 'setItems' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'items' => 'getItems' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('items', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets items + * + * @return \Convoy\Client\Model\ModelsOnboardItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Convoy\Client\Model\ModelsOnboardItem[]|null $items items + * + * @return self + */ + public function setItems($items) + { + if (is_null($items)) { + throw new \InvalidArgumentException('non-nullable items cannot be null'); + } + $this->container['items'] = $items; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsBulkUpdateFilterRequest.php b/src/Client/Model/ModelsBulkUpdateFilterRequest.php new file mode 100644 index 0000000..3727604 --- /dev/null +++ b/src/Client/Model/ModelsBulkUpdateFilterRequest.php @@ -0,0 +1,617 @@ + + */ +class ModelsBulkUpdateFilterRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.BulkUpdateFilterRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'body' => 'array', + 'enabled_at' => '\Convoy\Client\Model\ModelsOptionalTime', + 'event_type' => 'string', + 'headers' => 'array', + 'path' => 'array', + 'query' => 'array', + 'uid' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'body' => null, + 'enabled_at' => null, + 'event_type' => null, + 'headers' => null, + 'path' => null, + 'query' => null, + 'uid' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'body' => false, + 'enabled_at' => false, + 'event_type' => false, + 'headers' => false, + 'path' => false, + 'query' => false, + 'uid' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'body' => 'body', + 'enabled_at' => 'enabled_at', + 'event_type' => 'event_type', + 'headers' => 'headers', + 'path' => 'path', + 'query' => 'query', + 'uid' => 'uid' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'body' => 'setBody', + 'enabled_at' => 'setEnabledAt', + 'event_type' => 'setEventType', + 'headers' => 'setHeaders', + 'path' => 'setPath', + 'query' => 'setQuery', + 'uid' => 'setUid' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'body' => 'getBody', + 'enabled_at' => 'getEnabledAt', + 'event_type' => 'getEventType', + 'headers' => 'getHeaders', + 'path' => 'getPath', + 'query' => 'getQuery', + 'uid' => 'getUid' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('enabled_at', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('path', $data ?? [], null); + $this->setIfExists('query', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['uid'] === null) { + $invalidProperties[] = "'uid' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets body + * + * @return array|null + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param array|null $body body + * + * @return self + */ + public function setBody($body) + { + if (is_null($body)) { + throw new \InvalidArgumentException('non-nullable body cannot be null'); + } + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets enabled_at + * + * @return \Convoy\Client\Model\ModelsOptionalTime|null + */ + public function getEnabledAt() + { + return $this->container['enabled_at']; + } + + /** + * Sets enabled_at + * + * @param \Convoy\Client\Model\ModelsOptionalTime|null $enabled_at enabled_at + * + * @return self + */ + public function setEnabledAt($enabled_at) + { + if (is_null($enabled_at)) { + throw new \InvalidArgumentException('non-nullable enabled_at cannot be null'); + } + $this->container['enabled_at'] = $enabled_at; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets headers + * + * @return array|null + */ + public function getHeaders() + { + return $this->container['headers']; + } + + /** + * Sets headers + * + * @param array|null $headers headers + * + * @return self + */ + public function setHeaders($headers) + { + if (is_null($headers)) { + throw new \InvalidArgumentException('non-nullable headers cannot be null'); + } + $this->container['headers'] = $headers; + + return $this; + } + + /** + * Gets path + * + * @return array|null + */ + public function getPath() + { + return $this->container['path']; + } + + /** + * Sets path + * + * @param array|null $path path + * + * @return self + */ + public function setPath($path) + { + if (is_null($path)) { + throw new \InvalidArgumentException('non-nullable path cannot be null'); + } + $this->container['path'] = $path; + + return $this; + } + + /** + * Gets query + * + * @return array|null + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param array|null $query query + * + * @return self + */ + public function setQuery($query) + { + if (is_null($query)) { + throw new \InvalidArgumentException('non-nullable query cannot be null'); + } + $this->container['query'] = $query; + + return $this; + } + + /** + * Gets uid + * + * @return string + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsCountResponse.php b/src/Client/Model/ModelsCountResponse.php new file mode 100644 index 0000000..500e6d6 --- /dev/null +++ b/src/Client/Model/ModelsCountResponse.php @@ -0,0 +1,410 @@ + + */ +class ModelsCountResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.CountResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'num' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'num' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'num' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'num' => 'num' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'num' => 'setNum' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'num' => 'getNum' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('num', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets num + * + * @return int|null + */ + public function getNum() + { + return $this->container['num']; + } + + /** + * Sets num + * + * @param int|null $num num + * + * @return self + */ + public function setNum($num) + { + if (is_null($num)) { + throw new \InvalidArgumentException('non-nullable num cannot be null'); + } + $this->container['num'] = $num; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsCreateEndpoint.php b/src/Client/Model/ModelsCreateEndpoint.php new file mode 100644 index 0000000..2db85d3 --- /dev/null +++ b/src/Client/Model/ModelsCreateEndpoint.php @@ -0,0 +1,920 @@ + + */ +class ModelsCreateEndpoint implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.CreateEndpoint'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'advanced_signatures' => 'bool', + 'app_id' => 'string', + 'authentication' => '\Convoy\Client\Model\ModelsEndpointAuthentication', + 'content_type' => 'string', + 'description' => 'string', + 'http_timeout' => 'int', + 'is_disabled' => 'bool', + 'mtls_client_cert' => '\Convoy\Client\Model\ModelsMtlsClientCert', + 'name' => 'string', + 'owner_id' => 'string', + 'rate_limit' => 'int', + 'rate_limit_duration' => 'int', + 'secret' => 'string', + 'slack_webhook_url' => 'string', + 'support_email' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'advanced_signatures' => null, + 'app_id' => null, + 'authentication' => null, + 'content_type' => null, + 'description' => null, + 'http_timeout' => null, + 'is_disabled' => null, + 'mtls_client_cert' => null, + 'name' => null, + 'owner_id' => null, + 'rate_limit' => null, + 'rate_limit_duration' => null, + 'secret' => null, + 'slack_webhook_url' => null, + 'support_email' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'advanced_signatures' => false, + 'app_id' => false, + 'authentication' => false, + 'content_type' => false, + 'description' => false, + 'http_timeout' => false, + 'is_disabled' => false, + 'mtls_client_cert' => false, + 'name' => false, + 'owner_id' => false, + 'rate_limit' => false, + 'rate_limit_duration' => false, + 'secret' => false, + 'slack_webhook_url' => false, + 'support_email' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'advanced_signatures' => 'advanced_signatures', + 'app_id' => 'appID', + 'authentication' => 'authentication', + 'content_type' => 'content_type', + 'description' => 'description', + 'http_timeout' => 'http_timeout', + 'is_disabled' => 'is_disabled', + 'mtls_client_cert' => 'mtls_client_cert', + 'name' => 'name', + 'owner_id' => 'owner_id', + 'rate_limit' => 'rate_limit', + 'rate_limit_duration' => 'rate_limit_duration', + 'secret' => 'secret', + 'slack_webhook_url' => 'slack_webhook_url', + 'support_email' => 'support_email', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'advanced_signatures' => 'setAdvancedSignatures', + 'app_id' => 'setAppId', + 'authentication' => 'setAuthentication', + 'content_type' => 'setContentType', + 'description' => 'setDescription', + 'http_timeout' => 'setHttpTimeout', + 'is_disabled' => 'setIsDisabled', + 'mtls_client_cert' => 'setMtlsClientCert', + 'name' => 'setName', + 'owner_id' => 'setOwnerId', + 'rate_limit' => 'setRateLimit', + 'rate_limit_duration' => 'setRateLimitDuration', + 'secret' => 'setSecret', + 'slack_webhook_url' => 'setSlackWebhookUrl', + 'support_email' => 'setSupportEmail', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'advanced_signatures' => 'getAdvancedSignatures', + 'app_id' => 'getAppId', + 'authentication' => 'getAuthentication', + 'content_type' => 'getContentType', + 'description' => 'getDescription', + 'http_timeout' => 'getHttpTimeout', + 'is_disabled' => 'getIsDisabled', + 'mtls_client_cert' => 'getMtlsClientCert', + 'name' => 'getName', + 'owner_id' => 'getOwnerId', + 'rate_limit' => 'getRateLimit', + 'rate_limit_duration' => 'getRateLimitDuration', + 'secret' => 'getSecret', + 'slack_webhook_url' => 'getSlackWebhookUrl', + 'support_email' => 'getSupportEmail', + 'url' => 'getUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('advanced_signatures', $data ?? [], null); + $this->setIfExists('app_id', $data ?? [], null); + $this->setIfExists('authentication', $data ?? [], null); + $this->setIfExists('content_type', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('http_timeout', $data ?? [], null); + $this->setIfExists('is_disabled', $data ?? [], null); + $this->setIfExists('mtls_client_cert', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('owner_id', $data ?? [], null); + $this->setIfExists('rate_limit', $data ?? [], null); + $this->setIfExists('rate_limit_duration', $data ?? [], null); + $this->setIfExists('secret', $data ?? [], null); + $this->setIfExists('slack_webhook_url', $data ?? [], null); + $this->setIfExists('support_email', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets advanced_signatures + * + * @return bool|null + */ + public function getAdvancedSignatures() + { + return $this->container['advanced_signatures']; + } + + /** + * Sets advanced_signatures + * + * @param bool|null $advanced_signatures Convoy supports two [signature formats](https://getconvoy.io/docs/product-manual/signatures) -- simple or advanced. If left unspecified, we default to false. + * + * @return self + */ + public function setAdvancedSignatures($advanced_signatures) + { + if (is_null($advanced_signatures)) { + throw new \InvalidArgumentException('non-nullable advanced_signatures cannot be null'); + } + $this->container['advanced_signatures'] = $advanced_signatures; + + return $this; + } + + /** + * Gets app_id + * + * @return string|null + */ + public function getAppId() + { + return $this->container['app_id']; + } + + /** + * Sets app_id + * + * @param string|null $app_id Deprecated but necessary for backward compatibility + * + * @return self + */ + public function setAppId($app_id) + { + if (is_null($app_id)) { + throw new \InvalidArgumentException('non-nullable app_id cannot be null'); + } + $this->container['app_id'] = $app_id; + + return $this; + } + + /** + * Gets authentication + * + * @return \Convoy\Client\Model\ModelsEndpointAuthentication|null + */ + public function getAuthentication() + { + return $this->container['authentication']; + } + + /** + * Sets authentication + * + * @param \Convoy\Client\Model\ModelsEndpointAuthentication|null $authentication This is used to define any custom authentication required by the endpoint. This shouldn't be needed often because webhook endpoints usually should be exposed to the internet. + * + * @return self + */ + public function setAuthentication($authentication) + { + if (is_null($authentication)) { + throw new \InvalidArgumentException('non-nullable authentication cannot be null'); + } + $this->container['authentication'] = $authentication; + + return $this; + } + + /** + * Gets content_type + * + * @return string|null + */ + public function getContentType() + { + return $this->container['content_type']; + } + + /** + * Sets content_type + * + * @param string|null $content_type Content type for the endpoint. Defaults to application/json if not specified. + * + * @return self + */ + public function setContentType($content_type) + { + if (is_null($content_type)) { + throw new \InvalidArgumentException('non-nullable content_type cannot be null'); + } + $this->container['content_type'] = $content_type; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Human-readable description of the endpoint. Think of this as metadata describing the endpoint + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets http_timeout + * + * @return int|null + */ + public function getHttpTimeout() + { + return $this->container['http_timeout']; + } + + /** + * Sets http_timeout + * + * @param int|null $http_timeout Define endpoint http timeout in seconds. + * + * @return self + */ + public function setHttpTimeout($http_timeout) + { + if (is_null($http_timeout)) { + throw new \InvalidArgumentException('non-nullable http_timeout cannot be null'); + } + $this->container['http_timeout'] = $http_timeout; + + return $this; + } + + /** + * Gets is_disabled + * + * @return bool|null + */ + public function getIsDisabled() + { + return $this->container['is_disabled']; + } + + /** + * Sets is_disabled + * + * @param bool|null $is_disabled This is used to manually enable/disable the endpoint. + * + * @return self + */ + public function setIsDisabled($is_disabled) + { + if (is_null($is_disabled)) { + throw new \InvalidArgumentException('non-nullable is_disabled cannot be null'); + } + $this->container['is_disabled'] = $is_disabled; + + return $this; + } + + /** + * Gets mtls_client_cert + * + * @return \Convoy\Client\Model\ModelsMtlsClientCert|null + */ + public function getMtlsClientCert() + { + return $this->container['mtls_client_cert']; + } + + /** + * Sets mtls_client_cert + * + * @param \Convoy\Client\Model\ModelsMtlsClientCert|null $mtls_client_cert mTLS client certificate configuration for the endpoint + * + * @return self + */ + public function setMtlsClientCert($mtls_client_cert) + { + if (is_null($mtls_client_cert)) { + throw new \InvalidArgumentException('non-nullable mtls_client_cert cannot be null'); + } + $this->container['mtls_client_cert'] = $mtls_client_cert; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Endpoint name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets owner_id + * + * @return string|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param string|null $owner_id The OwnerID is used to group more than one endpoint together to achieve [fanout](https://getconvoy.io/docs/manual/endpoints#Endpoint%20Owner%20ID) + * + * @return self + */ + public function setOwnerId($owner_id) + { + if (is_null($owner_id)) { + throw new \InvalidArgumentException('non-nullable owner_id cannot be null'); + } + $this->container['owner_id'] = $owner_id; + + return $this; + } + + /** + * Gets rate_limit + * + * @return int|null + */ + public function getRateLimit() + { + return $this->container['rate_limit']; + } + + /** + * Sets rate_limit + * + * @param int|null $rate_limit Rate limit is the total number of requests to be sent to an endpoint in the time duration specified in RateLimitDuration + * + * @return self + */ + public function setRateLimit($rate_limit) + { + if (is_null($rate_limit)) { + throw new \InvalidArgumentException('non-nullable rate_limit cannot be null'); + } + $this->container['rate_limit'] = $rate_limit; + + return $this; + } + + /** + * Gets rate_limit_duration + * + * @return int|null + */ + public function getRateLimitDuration() + { + return $this->container['rate_limit_duration']; + } + + /** + * Sets rate_limit_duration + * + * @param int|null $rate_limit_duration Rate limit duration specifies the time range for the rate limit. + * + * @return self + */ + public function setRateLimitDuration($rate_limit_duration) + { + if (is_null($rate_limit_duration)) { + throw new \InvalidArgumentException('non-nullable rate_limit_duration cannot be null'); + } + $this->container['rate_limit_duration'] = $rate_limit_duration; + + return $this; + } + + /** + * Gets secret + * + * @return string|null + */ + public function getSecret() + { + return $this->container['secret']; + } + + /** + * Sets secret + * + * @param string|null $secret Endpoint's webhook secret. If not provided, Convoy autogenerates one for the endpoint. + * + * @return self + */ + public function setSecret($secret) + { + if (is_null($secret)) { + throw new \InvalidArgumentException('non-nullable secret cannot be null'); + } + $this->container['secret'] = $secret; + + return $this; + } + + /** + * Gets slack_webhook_url + * + * @return string|null + */ + public function getSlackWebhookUrl() + { + return $this->container['slack_webhook_url']; + } + + /** + * Sets slack_webhook_url + * + * @param string|null $slack_webhook_url Slack webhook URL is an alternative method to support email where endpoint developers can receive failure notifications on a slack channel. + * + * @return self + */ + public function setSlackWebhookUrl($slack_webhook_url) + { + if (is_null($slack_webhook_url)) { + throw new \InvalidArgumentException('non-nullable slack_webhook_url cannot be null'); + } + $this->container['slack_webhook_url'] = $slack_webhook_url; + + return $this; + } + + /** + * Gets support_email + * + * @return string|null + */ + public function getSupportEmail() + { + return $this->container['support_email']; + } + + /** + * Sets support_email + * + * @param string|null $support_email Endpoint developers support email. This is used for communicating endpoint state changes. You should always turn this on when disabling endpoints are enabled. + * + * @return self + */ + public function setSupportEmail($support_email) + { + if (is_null($support_email)) { + throw new \InvalidArgumentException('non-nullable support_email cannot be null'); + } + $this->container['support_email'] = $support_email; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url URL is the endpoint's URL prefixed with https. non-https urls are currently not supported. + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsCreateEvent.php b/src/Client/Model/ModelsCreateEvent.php new file mode 100644 index 0000000..93cc605 --- /dev/null +++ b/src/Client/Model/ModelsCreateEvent.php @@ -0,0 +1,580 @@ + + */ +class ModelsCreateEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.CreateEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'app_id' => 'string', + 'custom_headers' => 'array', + 'data' => 'array', + 'endpoint_id' => 'string', + 'event_type' => 'string', + 'idempotency_key' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'app_id' => null, + 'custom_headers' => null, + 'data' => null, + 'endpoint_id' => null, + 'event_type' => null, + 'idempotency_key' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'app_id' => false, + 'custom_headers' => false, + 'data' => false, + 'endpoint_id' => false, + 'event_type' => false, + 'idempotency_key' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'app_id' => 'app_id', + 'custom_headers' => 'custom_headers', + 'data' => 'data', + 'endpoint_id' => 'endpoint_id', + 'event_type' => 'event_type', + 'idempotency_key' => 'idempotency_key' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'app_id' => 'setAppId', + 'custom_headers' => 'setCustomHeaders', + 'data' => 'setData', + 'endpoint_id' => 'setEndpointId', + 'event_type' => 'setEventType', + 'idempotency_key' => 'setIdempotencyKey' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'app_id' => 'getAppId', + 'custom_headers' => 'getCustomHeaders', + 'data' => 'getData', + 'endpoint_id' => 'getEndpointId', + 'event_type' => 'getEventType', + 'idempotency_key' => 'getIdempotencyKey' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('app_id', $data ?? [], null); + $this->setIfExists('custom_headers', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('endpoint_id', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('idempotency_key', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets app_id + * + * @return string|null + */ + public function getAppId() + { + return $this->container['app_id']; + } + + /** + * Sets app_id + * + * @param string|null $app_id Deprecated but necessary for backward compatibility. + * + * @return self + */ + public function setAppId($app_id) + { + if (is_null($app_id)) { + throw new \InvalidArgumentException('non-nullable app_id cannot be null'); + } + $this->container['app_id'] = $app_id; + + return $this; + } + + /** + * Gets custom_headers + * + * @return array|null + */ + public function getCustomHeaders() + { + return $this->container['custom_headers']; + } + + /** + * Sets custom_headers + * + * @param array|null $custom_headers Specifies custom headers you want convoy to add when the event is dispatched to your endpoint + * + * @return self + */ + public function setCustomHeaders($custom_headers) + { + if (is_null($custom_headers)) { + throw new \InvalidArgumentException('non-nullable custom_headers cannot be null'); + } + $this->container['custom_headers'] = $custom_headers; + + return $this; + } + + /** + * Gets data + * + * @return array|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param array|null $data Data is an arbitrary JSON value that gets sent as the body of the webhook to the endpoints + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets endpoint_id + * + * @return string|null + */ + public function getEndpointId() + { + return $this->container['endpoint_id']; + } + + /** + * Sets endpoint_id + * + * @param string|null $endpoint_id Specifies the endpoint to send this event to. + * + * @return self + */ + public function setEndpointId($endpoint_id) + { + if (is_null($endpoint_id)) { + throw new \InvalidArgumentException('non-nullable endpoint_id cannot be null'); + } + $this->container['endpoint_id'] = $endpoint_id; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type Event Type is used for filtering and debugging e.g invoice.paid + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets idempotency_key + * + * @return string|null + */ + public function getIdempotencyKey() + { + return $this->container['idempotency_key']; + } + + /** + * Sets idempotency_key + * + * @param string|null $idempotency_key Specify a key for event deduplication + * + * @return self + */ + public function setIdempotencyKey($idempotency_key) + { + if (is_null($idempotency_key)) { + throw new \InvalidArgumentException('non-nullable idempotency_key cannot be null'); + } + $this->container['idempotency_key'] = $idempotency_key; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsCreateEventType.php b/src/Client/Model/ModelsCreateEventType.php new file mode 100644 index 0000000..b451099 --- /dev/null +++ b/src/Client/Model/ModelsCreateEventType.php @@ -0,0 +1,512 @@ + + */ +class ModelsCreateEventType implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.CreateEventType'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'description' => 'string', + 'json_schema' => 'array', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'description' => null, + 'json_schema' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'category' => false, + 'description' => false, + 'json_schema' => false, + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'description' => 'description', + 'json_schema' => 'json_schema', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'description' => 'setDescription', + 'json_schema' => 'setJsonSchema', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'description' => 'getDescription', + 'json_schema' => 'getJsonSchema', + 'name' => 'getName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('json_schema', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Category is a product-specific grouping for the event type + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Description is used to describe what the event type does + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets json_schema + * + * @return array|null + */ + public function getJsonSchema() + { + return $this->container['json_schema']; + } + + /** + * Sets json_schema + * + * @param array|null $json_schema JSONSchema is the JSON structure of the event type + * + * @return self + */ + public function setJsonSchema($json_schema) + { + if (is_null($json_schema)) { + throw new \InvalidArgumentException('non-nullable json_schema cannot be null'); + } + $this->container['json_schema'] = $json_schema; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name is the event type name. E.g., invoice.created + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsCreateFilterRequest.php b/src/Client/Model/ModelsCreateFilterRequest.php new file mode 100644 index 0000000..5baa449 --- /dev/null +++ b/src/Client/Model/ModelsCreateFilterRequest.php @@ -0,0 +1,583 @@ + + */ +class ModelsCreateFilterRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.CreateFilterRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'body' => 'array', + 'enabled_at' => '\Convoy\Client\Model\ModelsOptionalTime', + 'event_type' => 'string', + 'headers' => 'array', + 'path' => 'array', + 'query' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'body' => null, + 'enabled_at' => null, + 'event_type' => null, + 'headers' => null, + 'path' => null, + 'query' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'body' => false, + 'enabled_at' => false, + 'event_type' => false, + 'headers' => false, + 'path' => false, + 'query' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'body' => 'body', + 'enabled_at' => 'enabled_at', + 'event_type' => 'event_type', + 'headers' => 'headers', + 'path' => 'path', + 'query' => 'query' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'body' => 'setBody', + 'enabled_at' => 'setEnabledAt', + 'event_type' => 'setEventType', + 'headers' => 'setHeaders', + 'path' => 'setPath', + 'query' => 'setQuery' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'body' => 'getBody', + 'enabled_at' => 'getEnabledAt', + 'event_type' => 'getEventType', + 'headers' => 'getHeaders', + 'path' => 'getPath', + 'query' => 'getQuery' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('enabled_at', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('path', $data ?? [], null); + $this->setIfExists('query', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['event_type'] === null) { + $invalidProperties[] = "'event_type' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets body + * + * @return array|null + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param array|null $body Body matching criteria (optional) + * + * @return self + */ + public function setBody($body) + { + if (is_null($body)) { + throw new \InvalidArgumentException('non-nullable body cannot be null'); + } + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets enabled_at + * + * @return \Convoy\Client\Model\ModelsOptionalTime|null + */ + public function getEnabledAt() + { + return $this->container['enabled_at']; + } + + /** + * Sets enabled_at + * + * @param \Convoy\Client\Model\ModelsOptionalTime|null $enabled_at Non-null when this filter is active. Defaults to now when omitted. + * + * @return self + */ + public function setEnabledAt($enabled_at) + { + if (is_null($enabled_at)) { + throw new \InvalidArgumentException('non-nullable enabled_at cannot be null'); + } + $this->container['enabled_at'] = $enabled_at; + + return $this; + } + + /** + * Gets event_type + * + * @return string + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string $event_type Type of event this filter applies to (required) + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets headers + * + * @return array|null + */ + public function getHeaders() + { + return $this->container['headers']; + } + + /** + * Sets headers + * + * @param array|null $headers Header matching criteria (optional) + * + * @return self + */ + public function setHeaders($headers) + { + if (is_null($headers)) { + throw new \InvalidArgumentException('non-nullable headers cannot be null'); + } + $this->container['headers'] = $headers; + + return $this; + } + + /** + * Gets path + * + * @return array|null + */ + public function getPath() + { + return $this->container['path']; + } + + /** + * Sets path + * + * @param array|null $path Path matching criteria (optional) + * + * @return self + */ + public function setPath($path) + { + if (is_null($path)) { + throw new \InvalidArgumentException('non-nullable path cannot be null'); + } + $this->container['path'] = $path; + + return $this; + } + + /** + * Gets query + * + * @return array|null + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param array|null $query Query matching criteria (optional) + * + * @return self + */ + public function setQuery($query) + { + if (is_null($query)) { + throw new \InvalidArgumentException('non-nullable query cannot be null'); + } + $this->container['query'] = $query; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsCreateProject.php b/src/Client/Model/ModelsCreateProject.php new file mode 100644 index 0000000..bee6477 --- /dev/null +++ b/src/Client/Model/ModelsCreateProject.php @@ -0,0 +1,512 @@ + + */ +class ModelsCreateProject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.CreateProject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'config' => '\Convoy\Client\Model\ModelsProjectConfig', + 'logo_url' => 'string', + 'name' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'config' => null, + 'logo_url' => null, + 'name' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'config' => false, + 'logo_url' => false, + 'name' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'config' => 'config', + 'logo_url' => 'logo_url', + 'name' => 'name', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'config' => 'setConfig', + 'logo_url' => 'setLogoUrl', + 'name' => 'setName', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'config' => 'getConfig', + 'logo_url' => 'getLogoUrl', + 'name' => 'getName', + 'type' => 'getType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('config', $data ?? [], null); + $this->setIfExists('logo_url', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets config + * + * @return \Convoy\Client\Model\ModelsProjectConfig|null + */ + public function getConfig() + { + return $this->container['config']; + } + + /** + * Sets config + * + * @param \Convoy\Client\Model\ModelsProjectConfig|null $config Project Config + * + * @return self + */ + public function setConfig($config) + { + if (is_null($config)) { + throw new \InvalidArgumentException('non-nullable config cannot be null'); + } + $this->container['config'] = $config; + + return $this; + } + + /** + * Gets logo_url + * + * @return string|null + */ + public function getLogoUrl() + { + return $this->container['logo_url']; + } + + /** + * Sets logo_url + * + * @param string|null $logo_url logo_url + * + * @return self + */ + public function setLogoUrl($logo_url) + { + if (is_null($logo_url)) { + throw new \InvalidArgumentException('non-nullable logo_url cannot be null'); + } + $this->container['logo_url'] = $logo_url; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Project Name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Project Type, supported values are `outgoing`, `incoming` + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsCreateProjectResponse.php b/src/Client/Model/ModelsCreateProjectResponse.php new file mode 100644 index 0000000..032af2c --- /dev/null +++ b/src/Client/Model/ModelsCreateProjectResponse.php @@ -0,0 +1,458 @@ + + */ +class ModelsCreateProjectResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.CreateProjectResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'api_key' => '\Convoy\Client\Model\DatastoreAPIKeyResponse', + 'project' => '\Convoy\Client\Model\ModelsProjectResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'api_key' => null, + 'project' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'api_key' => true, + 'project' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'api_key' => 'api_key', + 'project' => 'project' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'api_key' => 'setApiKey', + 'project' => 'setProject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'api_key' => 'getApiKey', + 'project' => 'getProject' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('api_key', $data ?? [], null); + $this->setIfExists('project', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets api_key + * + * @return \Convoy\Client\Model\DatastoreAPIKeyResponse|null + */ + public function getApiKey() + { + return $this->container['api_key']; + } + + /** + * Sets api_key + * + * @param \Convoy\Client\Model\DatastoreAPIKeyResponse|null $api_key api_key + * + * @return self + */ + public function setApiKey($api_key) + { + if (is_null($api_key)) { + array_push($this->openAPINullablesSetToNull, 'api_key'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('api_key', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['api_key'] = $api_key; + + return $this; + } + + /** + * Gets project + * + * @return \Convoy\Client\Model\ModelsProjectResponse|null + */ + public function getProject() + { + return $this->container['project']; + } + + /** + * Sets project + * + * @param \Convoy\Client\Model\ModelsProjectResponse|null $project project + * + * @return self + */ + public function setProject($project) + { + if (is_null($project)) { + array_push($this->openAPINullablesSetToNull, 'project'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('project', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['project'] = $project; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsCreateSource.php b/src/Client/Model/ModelsCreateSource.php new file mode 100644 index 0000000..8e462ec --- /dev/null +++ b/src/Client/Model/ModelsCreateSource.php @@ -0,0 +1,716 @@ + + */ +class ModelsCreateSource implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.CreateSource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'body_function' => 'string', + 'custom_response' => '\Convoy\Client\Model\ModelsCustomResponse', + 'event_type_location' => 'string', + 'header_function' => 'string', + 'idempotency_keys' => 'string[]', + 'name' => 'string', + 'provider' => '\Convoy\Client\Model\DatastoreSourceProvider', + 'pub_sub' => '\Convoy\Client\Model\ModelsPubSubConfig', + 'type' => '\Convoy\Client\Model\DatastoreSourceType', + 'verifier' => '\Convoy\Client\Model\ModelsVerifierConfig' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'body_function' => null, + 'custom_response' => null, + 'event_type_location' => null, + 'header_function' => null, + 'idempotency_keys' => null, + 'name' => null, + 'provider' => null, + 'pub_sub' => null, + 'type' => null, + 'verifier' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'body_function' => false, + 'custom_response' => false, + 'event_type_location' => false, + 'header_function' => false, + 'idempotency_keys' => false, + 'name' => false, + 'provider' => false, + 'pub_sub' => false, + 'type' => false, + 'verifier' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'body_function' => 'body_function', + 'custom_response' => 'custom_response', + 'event_type_location' => 'event_type_location', + 'header_function' => 'header_function', + 'idempotency_keys' => 'idempotency_keys', + 'name' => 'name', + 'provider' => 'provider', + 'pub_sub' => 'pub_sub', + 'type' => 'type', + 'verifier' => 'verifier' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'body_function' => 'setBodyFunction', + 'custom_response' => 'setCustomResponse', + 'event_type_location' => 'setEventTypeLocation', + 'header_function' => 'setHeaderFunction', + 'idempotency_keys' => 'setIdempotencyKeys', + 'name' => 'setName', + 'provider' => 'setProvider', + 'pub_sub' => 'setPubSub', + 'type' => 'setType', + 'verifier' => 'setVerifier' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'body_function' => 'getBodyFunction', + 'custom_response' => 'getCustomResponse', + 'event_type_location' => 'getEventTypeLocation', + 'header_function' => 'getHeaderFunction', + 'idempotency_keys' => 'getIdempotencyKeys', + 'name' => 'getName', + 'provider' => 'getProvider', + 'pub_sub' => 'getPubSub', + 'type' => 'getType', + 'verifier' => 'getVerifier' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('body_function', $data ?? [], null); + $this->setIfExists('custom_response', $data ?? [], null); + $this->setIfExists('event_type_location', $data ?? [], null); + $this->setIfExists('header_function', $data ?? [], null); + $this->setIfExists('idempotency_keys', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('provider', $data ?? [], null); + $this->setIfExists('pub_sub', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('verifier', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets body_function + * + * @return string|null + */ + public function getBodyFunction() + { + return $this->container['body_function']; + } + + /** + * Sets body_function + * + * @param string|null $body_function Function is a javascript function used to mutate the payload immediately after ingesting an event + * + * @return self + */ + public function setBodyFunction($body_function) + { + if (is_null($body_function)) { + throw new \InvalidArgumentException('non-nullable body_function cannot be null'); + } + $this->container['body_function'] = $body_function; + + return $this; + } + + /** + * Gets custom_response + * + * @return \Convoy\Client\Model\ModelsCustomResponse|null + */ + public function getCustomResponse() + { + return $this->container['custom_response']; + } + + /** + * Sets custom_response + * + * @param \Convoy\Client\Model\ModelsCustomResponse|null $custom_response Custom response is used to define a custom response for incoming webhooks project sources only. + * + * @return self + */ + public function setCustomResponse($custom_response) + { + if (is_null($custom_response)) { + throw new \InvalidArgumentException('non-nullable custom_response cannot be null'); + } + $this->container['custom_response'] = $custom_response; + + return $this; + } + + /** + * Gets event_type_location + * + * @return string|null + */ + public function getEventTypeLocation() + { + return $this->container['event_type_location']; + } + + /** + * Sets event_type_location + * + * @param string|null $event_type_location EventTypeLocation is used to specify where Convoy should read the event type from an incoming webhook request. + * + * @return self + */ + public function setEventTypeLocation($event_type_location) + { + if (is_null($event_type_location)) { + throw new \InvalidArgumentException('non-nullable event_type_location cannot be null'); + } + $this->container['event_type_location'] = $event_type_location; + + return $this; + } + + /** + * Gets header_function + * + * @return string|null + */ + public function getHeaderFunction() + { + return $this->container['header_function']; + } + + /** + * Sets header_function + * + * @param string|null $header_function Function is a javascript function used to mutate the headers immediately after ingesting an event + * + * @return self + */ + public function setHeaderFunction($header_function) + { + if (is_null($header_function)) { + throw new \InvalidArgumentException('non-nullable header_function cannot be null'); + } + $this->container['header_function'] = $header_function; + + return $this; + } + + /** + * Gets idempotency_keys + * + * @return string[]|null + */ + public function getIdempotencyKeys() + { + return $this->container['idempotency_keys']; + } + + /** + * Sets idempotency_keys + * + * @param string[]|null $idempotency_keys IdempotencyKeys are used to specify parts of a webhook request to uniquely identify the event in an incoming webhooks project. + * + * @return self + */ + public function setIdempotencyKeys($idempotency_keys) + { + if (is_null($idempotency_keys)) { + throw new \InvalidArgumentException('non-nullable idempotency_keys cannot be null'); + } + $this->container['idempotency_keys'] = $idempotency_keys; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Source name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets provider + * + * @return \Convoy\Client\Model\DatastoreSourceProvider|null + */ + public function getProvider() + { + return $this->container['provider']; + } + + /** + * Sets provider + * + * @param \Convoy\Client\Model\DatastoreSourceProvider|null $provider Use this to specify one of our predefined source types. + * + * @return self + */ + public function setProvider($provider) + { + if (is_null($provider)) { + throw new \InvalidArgumentException('non-nullable provider cannot be null'); + } + $this->container['provider'] = $provider; + + return $this; + } + + /** + * Gets pub_sub + * + * @return \Convoy\Client\Model\ModelsPubSubConfig|null + */ + public function getPubSub() + { + return $this->container['pub_sub']; + } + + /** + * Sets pub_sub + * + * @param \Convoy\Client\Model\ModelsPubSubConfig|null $pub_sub PubSub are used to specify message broker sources for outgoing webhooks projects. + * + * @return self + */ + public function setPubSub($pub_sub) + { + if (is_null($pub_sub)) { + throw new \InvalidArgumentException('non-nullable pub_sub cannot be null'); + } + $this->container['pub_sub'] = $pub_sub; + + return $this; + } + + /** + * Gets type + * + * @return \Convoy\Client\Model\DatastoreSourceType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Convoy\Client\Model\DatastoreSourceType|null $type Source Type. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets verifier + * + * @return \Convoy\Client\Model\ModelsVerifierConfig|null + */ + public function getVerifier() + { + return $this->container['verifier']; + } + + /** + * Sets verifier + * + * @param \Convoy\Client\Model\ModelsVerifierConfig|null $verifier Verifiers are used to verify webhook events ingested in incoming webhooks projects. If set, type is required and match the verifier type object you choose. + * + * @return self + */ + public function setVerifier($verifier) + { + if (is_null($verifier)) { + throw new \InvalidArgumentException('non-nullable verifier cannot be null'); + } + $this->container['verifier'] = $verifier; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsCreateSubscription.php b/src/Client/Model/ModelsCreateSubscription.php new file mode 100644 index 0000000..48c8f96 --- /dev/null +++ b/src/Client/Model/ModelsCreateSubscription.php @@ -0,0 +1,682 @@ + + */ +class ModelsCreateSubscription implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.CreateSubscription'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'alert_config' => '\Convoy\Client\Model\ModelsAlertConfiguration', + 'app_id' => 'string', + 'delivery_mode' => '\Convoy\Client\Model\DatastoreDeliveryMode', + 'endpoint_id' => 'string', + 'filter_config' => '\Convoy\Client\Model\ModelsFilterConfiguration', + 'function' => 'string', + 'name' => 'string', + 'rate_limit_config' => '\Convoy\Client\Model\ModelsRateLimitConfiguration', + 'source_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'alert_config' => null, + 'app_id' => null, + 'delivery_mode' => null, + 'endpoint_id' => null, + 'filter_config' => null, + 'function' => null, + 'name' => null, + 'rate_limit_config' => null, + 'source_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'alert_config' => false, + 'app_id' => false, + 'delivery_mode' => false, + 'endpoint_id' => false, + 'filter_config' => false, + 'function' => false, + 'name' => false, + 'rate_limit_config' => false, + 'source_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'alert_config' => 'alert_config', + 'app_id' => 'app_id', + 'delivery_mode' => 'delivery_mode', + 'endpoint_id' => 'endpoint_id', + 'filter_config' => 'filter_config', + 'function' => 'function', + 'name' => 'name', + 'rate_limit_config' => 'rate_limit_config', + 'source_id' => 'source_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'alert_config' => 'setAlertConfig', + 'app_id' => 'setAppId', + 'delivery_mode' => 'setDeliveryMode', + 'endpoint_id' => 'setEndpointId', + 'filter_config' => 'setFilterConfig', + 'function' => 'setFunction', + 'name' => 'setName', + 'rate_limit_config' => 'setRateLimitConfig', + 'source_id' => 'setSourceId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'alert_config' => 'getAlertConfig', + 'app_id' => 'getAppId', + 'delivery_mode' => 'getDeliveryMode', + 'endpoint_id' => 'getEndpointId', + 'filter_config' => 'getFilterConfig', + 'function' => 'getFunction', + 'name' => 'getName', + 'rate_limit_config' => 'getRateLimitConfig', + 'source_id' => 'getSourceId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('alert_config', $data ?? [], null); + $this->setIfExists('app_id', $data ?? [], null); + $this->setIfExists('delivery_mode', $data ?? [], null); + $this->setIfExists('endpoint_id', $data ?? [], null); + $this->setIfExists('filter_config', $data ?? [], null); + $this->setIfExists('function', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('rate_limit_config', $data ?? [], null); + $this->setIfExists('source_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets alert_config + * + * @return \Convoy\Client\Model\ModelsAlertConfiguration|null + */ + public function getAlertConfig() + { + return $this->container['alert_config']; + } + + /** + * Sets alert_config + * + * @param \Convoy\Client\Model\ModelsAlertConfiguration|null $alert_config Alert configuration + * + * @return self + */ + public function setAlertConfig($alert_config) + { + if (is_null($alert_config)) { + throw new \InvalidArgumentException('non-nullable alert_config cannot be null'); + } + $this->container['alert_config'] = $alert_config; + + return $this; + } + + /** + * Gets app_id + * + * @return string|null + */ + public function getAppId() + { + return $this->container['app_id']; + } + + /** + * Sets app_id + * + * @param string|null $app_id Deprecated but necessary for backward compatibility + * + * @return self + */ + public function setAppId($app_id) + { + if (is_null($app_id)) { + throw new \InvalidArgumentException('non-nullable app_id cannot be null'); + } + $this->container['app_id'] = $app_id; + + return $this; + } + + /** + * Gets delivery_mode + * + * @return \Convoy\Client\Model\DatastoreDeliveryMode|null + */ + public function getDeliveryMode() + { + return $this->container['delivery_mode']; + } + + /** + * Sets delivery_mode + * + * @param \Convoy\Client\Model\DatastoreDeliveryMode|null $delivery_mode Delivery mode configuration + * + * @return self + */ + public function setDeliveryMode($delivery_mode) + { + if (is_null($delivery_mode)) { + throw new \InvalidArgumentException('non-nullable delivery_mode cannot be null'); + } + $this->container['delivery_mode'] = $delivery_mode; + + return $this; + } + + /** + * Gets endpoint_id + * + * @return string|null + */ + public function getEndpointId() + { + return $this->container['endpoint_id']; + } + + /** + * Sets endpoint_id + * + * @param string|null $endpoint_id Destination endpoint ID + * + * @return self + */ + public function setEndpointId($endpoint_id) + { + if (is_null($endpoint_id)) { + throw new \InvalidArgumentException('non-nullable endpoint_id cannot be null'); + } + $this->container['endpoint_id'] = $endpoint_id; + + return $this; + } + + /** + * Gets filter_config + * + * @return \Convoy\Client\Model\ModelsFilterConfiguration|null + */ + public function getFilterConfig() + { + return $this->container['filter_config']; + } + + /** + * Sets filter_config + * + * @param \Convoy\Client\Model\ModelsFilterConfiguration|null $filter_config Filter configuration + * + * @return self + */ + public function setFilterConfig($filter_config) + { + if (is_null($filter_config)) { + throw new \InvalidArgumentException('non-nullable filter_config cannot be null'); + } + $this->container['filter_config'] = $filter_config; + + return $this; + } + + /** + * Gets function + * + * @return string|null + */ + public function getFunction() + { + return $this->container['function']; + } + + /** + * Sets function + * + * @param string|null $function Convoy supports mutating your request payload using a js function. Use this field to specify a `transform` function for this purpose. See this[https://docs.getconvoy.io/product-manual/subscriptions#functions] for more + * + * @return self + */ + public function setFunction($function) + { + if (is_null($function)) { + throw new \InvalidArgumentException('non-nullable function cannot be null'); + } + $this->container['function'] = $function; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Subscription Nme + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets rate_limit_config + * + * @return \Convoy\Client\Model\ModelsRateLimitConfiguration|null + */ + public function getRateLimitConfig() + { + return $this->container['rate_limit_config']; + } + + /** + * Sets rate_limit_config + * + * @param \Convoy\Client\Model\ModelsRateLimitConfiguration|null $rate_limit_config Rate limit configuration + * + * @return self + */ + public function setRateLimitConfig($rate_limit_config) + { + if (is_null($rate_limit_config)) { + throw new \InvalidArgumentException('non-nullable rate_limit_config cannot be null'); + } + $this->container['rate_limit_config'] = $rate_limit_config; + + return $this; + } + + /** + * Gets source_id + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['source_id']; + } + + /** + * Sets source_id + * + * @param string|null $source_id Source Id + * + * @return self + */ + public function setSourceId($source_id) + { + if (is_null($source_id)) { + throw new \InvalidArgumentException('non-nullable source_id cannot be null'); + } + $this->container['source_id'] = $source_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsCustomResponse.php b/src/Client/Model/ModelsCustomResponse.php new file mode 100644 index 0000000..c228319 --- /dev/null +++ b/src/Client/Model/ModelsCustomResponse.php @@ -0,0 +1,444 @@ + + */ +class ModelsCustomResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.CustomResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'body' => 'string', + 'content_type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'body' => null, + 'content_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'body' => false, + 'content_type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'body' => 'body', + 'content_type' => 'content_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'body' => 'setBody', + 'content_type' => 'setContentType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'body' => 'getBody', + 'content_type' => 'getContentType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('content_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets body + * + * @return string|null + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param string|null $body body + * + * @return self + */ + public function setBody($body) + { + if (is_null($body)) { + throw new \InvalidArgumentException('non-nullable body cannot be null'); + } + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets content_type + * + * @return string|null + */ + public function getContentType() + { + return $this->container['content_type']; + } + + /** + * Sets content_type + * + * @param string|null $content_type content_type + * + * @return self + */ + public function setContentType($content_type) + { + if (is_null($content_type)) { + throw new \InvalidArgumentException('non-nullable content_type cannot be null'); + } + $this->container['content_type'] = $content_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsDynamicEvent.php b/src/Client/Model/ModelsDynamicEvent.php new file mode 100644 index 0000000..36f9ea2 --- /dev/null +++ b/src/Client/Model/ModelsDynamicEvent.php @@ -0,0 +1,614 @@ + + */ +class ModelsDynamicEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.DynamicEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'custom_headers' => 'array', + 'data' => 'array', + 'event_type' => 'string', + 'event_types' => 'string[]', + 'idempotency_key' => 'string', + 'secret' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'custom_headers' => null, + 'data' => null, + 'event_type' => null, + 'event_types' => null, + 'idempotency_key' => null, + 'secret' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'custom_headers' => false, + 'data' => false, + 'event_type' => false, + 'event_types' => false, + 'idempotency_key' => false, + 'secret' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'custom_headers' => 'custom_headers', + 'data' => 'data', + 'event_type' => 'event_type', + 'event_types' => 'event_types', + 'idempotency_key' => 'idempotency_key', + 'secret' => 'secret', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'custom_headers' => 'setCustomHeaders', + 'data' => 'setData', + 'event_type' => 'setEventType', + 'event_types' => 'setEventTypes', + 'idempotency_key' => 'setIdempotencyKey', + 'secret' => 'setSecret', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'custom_headers' => 'getCustomHeaders', + 'data' => 'getData', + 'event_type' => 'getEventType', + 'event_types' => 'getEventTypes', + 'idempotency_key' => 'getIdempotencyKey', + 'secret' => 'getSecret', + 'url' => 'getUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('custom_headers', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_types', $data ?? [], null); + $this->setIfExists('idempotency_key', $data ?? [], null); + $this->setIfExists('secret', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets custom_headers + * + * @return array|null + */ + public function getCustomHeaders() + { + return $this->container['custom_headers']; + } + + /** + * Sets custom_headers + * + * @param array|null $custom_headers Specifies custom headers you want convoy to add when the event is dispatched to your endpoint + * + * @return self + */ + public function setCustomHeaders($custom_headers) + { + if (is_null($custom_headers)) { + throw new \InvalidArgumentException('non-nullable custom_headers cannot be null'); + } + $this->container['custom_headers'] = $custom_headers; + + return $this; + } + + /** + * Gets data + * + * @return array|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param array|null $data Data is an arbitrary JSON value that gets sent as the body of the webhook to the endpoints + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type Event Type is used for filtering and debugging e.g invoice.paid + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_types + * + * @return string[]|null + */ + public function getEventTypes() + { + return $this->container['event_types']; + } + + /** + * Sets event_types + * + * @param string[]|null $event_types A list of event types for the subscription filter config + * + * @return self + */ + public function setEventTypes($event_types) + { + if (is_null($event_types)) { + throw new \InvalidArgumentException('non-nullable event_types cannot be null'); + } + $this->container['event_types'] = $event_types; + + return $this; + } + + /** + * Gets idempotency_key + * + * @return string|null + */ + public function getIdempotencyKey() + { + return $this->container['idempotency_key']; + } + + /** + * Sets idempotency_key + * + * @param string|null $idempotency_key Specify a key for event deduplication + * + * @return self + */ + public function setIdempotencyKey($idempotency_key) + { + if (is_null($idempotency_key)) { + throw new \InvalidArgumentException('non-nullable idempotency_key cannot be null'); + } + $this->container['idempotency_key'] = $idempotency_key; + + return $this; + } + + /** + * Gets secret + * + * @return string|null + */ + public function getSecret() + { + return $this->container['secret']; + } + + /** + * Sets secret + * + * @param string|null $secret Endpoint's webhook secret. If not provided, Convoy autogenerates one for the endpoint. + * + * @return self + */ + public function setSecret($secret) + { + if (is_null($secret)) { + throw new \InvalidArgumentException('non-nullable secret cannot be null'); + } + $this->container['secret'] = $secret; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url URL is the endpoint's URL prefixed with https. non-https urls are currently not supported. + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsEndpointAuthentication.php b/src/Client/Model/ModelsEndpointAuthentication.php new file mode 100644 index 0000000..198b9ed --- /dev/null +++ b/src/Client/Model/ModelsEndpointAuthentication.php @@ -0,0 +1,512 @@ + + */ +class ModelsEndpointAuthentication implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.EndpointAuthentication'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'api_key' => '\Convoy\Client\Model\ModelsApiKey', + 'basic_auth' => '\Convoy\Client\Model\ModelsBasicAuth', + 'oauth2' => '\Convoy\Client\Model\ModelsOAuth2', + 'type' => '\Convoy\Client\Model\DatastoreEndpointAuthenticationType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'api_key' => null, + 'basic_auth' => null, + 'oauth2' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'api_key' => false, + 'basic_auth' => false, + 'oauth2' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'api_key' => 'api_key', + 'basic_auth' => 'basic_auth', + 'oauth2' => 'oauth2', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'api_key' => 'setApiKey', + 'basic_auth' => 'setBasicAuth', + 'oauth2' => 'setOauth2', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'api_key' => 'getApiKey', + 'basic_auth' => 'getBasicAuth', + 'oauth2' => 'getOauth2', + 'type' => 'getType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('api_key', $data ?? [], null); + $this->setIfExists('basic_auth', $data ?? [], null); + $this->setIfExists('oauth2', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets api_key + * + * @return \Convoy\Client\Model\ModelsApiKey|null + */ + public function getApiKey() + { + return $this->container['api_key']; + } + + /** + * Sets api_key + * + * @param \Convoy\Client\Model\ModelsApiKey|null $api_key api_key + * + * @return self + */ + public function setApiKey($api_key) + { + if (is_null($api_key)) { + throw new \InvalidArgumentException('non-nullable api_key cannot be null'); + } + $this->container['api_key'] = $api_key; + + return $this; + } + + /** + * Gets basic_auth + * + * @return \Convoy\Client\Model\ModelsBasicAuth|null + */ + public function getBasicAuth() + { + return $this->container['basic_auth']; + } + + /** + * Sets basic_auth + * + * @param \Convoy\Client\Model\ModelsBasicAuth|null $basic_auth basic_auth + * + * @return self + */ + public function setBasicAuth($basic_auth) + { + if (is_null($basic_auth)) { + throw new \InvalidArgumentException('non-nullable basic_auth cannot be null'); + } + $this->container['basic_auth'] = $basic_auth; + + return $this; + } + + /** + * Gets oauth2 + * + * @return \Convoy\Client\Model\ModelsOAuth2|null + */ + public function getOauth2() + { + return $this->container['oauth2']; + } + + /** + * Sets oauth2 + * + * @param \Convoy\Client\Model\ModelsOAuth2|null $oauth2 oauth2 + * + * @return self + */ + public function setOauth2($oauth2) + { + if (is_null($oauth2)) { + throw new \InvalidArgumentException('non-nullable oauth2 cannot be null'); + } + $this->container['oauth2'] = $oauth2; + + return $this; + } + + /** + * Gets type + * + * @return \Convoy\Client\Model\DatastoreEndpointAuthenticationType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Convoy\Client\Model\DatastoreEndpointAuthenticationType|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsEndpointResponse.php b/src/Client/Model/ModelsEndpointResponse.php new file mode 100644 index 0000000..0c56242 --- /dev/null +++ b/src/Client/Model/ModelsEndpointResponse.php @@ -0,0 +1,1294 @@ + + */ +class ModelsEndpointResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.EndpointResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'advanced_signatures' => 'bool', + 'authentication' => '\Convoy\Client\Model\DatastoreEndpointAuthentication', + 'cb_state' => 'string', + 'content_type' => 'string', + 'created_at' => 'string', + 'deleted_at' => 'string', + 'description' => 'string', + 'events' => 'int', + 'failure_count' => 'int', + 'failure_rate' => 'float', + 'http_timeout' => 'int', + 'mtls_client_cert' => '\Convoy\Client\Model\DatastoreMtlsClientCert', + 'name' => 'string', + 'owner_id' => 'string', + 'period_failure_rate' => 'float', + 'project_id' => 'string', + 'rate_limit' => 'int', + 'rate_limit_duration' => 'int', + 'retry_count' => 'int', + 'secrets' => '\Convoy\Client\Model\DatastoreSecret[]', + 'slack_webhook_url' => 'string', + 'status' => '\Convoy\Client\Model\DatastoreEndpointStatus', + 'success_count' => 'int', + 'support_email' => 'string', + 'uid' => 'string', + 'updated_at' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'advanced_signatures' => null, + 'authentication' => null, + 'cb_state' => null, + 'content_type' => null, + 'created_at' => null, + 'deleted_at' => null, + 'description' => null, + 'events' => null, + 'failure_count' => null, + 'failure_rate' => null, + 'http_timeout' => null, + 'mtls_client_cert' => null, + 'name' => null, + 'owner_id' => null, + 'period_failure_rate' => null, + 'project_id' => null, + 'rate_limit' => null, + 'rate_limit_duration' => null, + 'retry_count' => null, + 'secrets' => null, + 'slack_webhook_url' => null, + 'status' => null, + 'success_count' => null, + 'support_email' => null, + 'uid' => null, + 'updated_at' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'advanced_signatures' => false, + 'authentication' => false, + 'cb_state' => false, + 'content_type' => false, + 'created_at' => false, + 'deleted_at' => false, + 'description' => false, + 'events' => false, + 'failure_count' => false, + 'failure_rate' => false, + 'http_timeout' => false, + 'mtls_client_cert' => false, + 'name' => false, + 'owner_id' => false, + 'period_failure_rate' => false, + 'project_id' => false, + 'rate_limit' => false, + 'rate_limit_duration' => false, + 'retry_count' => false, + 'secrets' => false, + 'slack_webhook_url' => false, + 'status' => false, + 'success_count' => false, + 'support_email' => false, + 'uid' => false, + 'updated_at' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'advanced_signatures' => 'advanced_signatures', + 'authentication' => 'authentication', + 'cb_state' => 'cb_state', + 'content_type' => 'content_type', + 'created_at' => 'created_at', + 'deleted_at' => 'deleted_at', + 'description' => 'description', + 'events' => 'events', + 'failure_count' => 'failure_count', + 'failure_rate' => 'failure_rate', + 'http_timeout' => 'http_timeout', + 'mtls_client_cert' => 'mtls_client_cert', + 'name' => 'name', + 'owner_id' => 'owner_id', + 'period_failure_rate' => 'period_failure_rate', + 'project_id' => 'project_id', + 'rate_limit' => 'rate_limit', + 'rate_limit_duration' => 'rate_limit_duration', + 'retry_count' => 'retry_count', + 'secrets' => 'secrets', + 'slack_webhook_url' => 'slack_webhook_url', + 'status' => 'status', + 'success_count' => 'success_count', + 'support_email' => 'support_email', + 'uid' => 'uid', + 'updated_at' => 'updated_at', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'advanced_signatures' => 'setAdvancedSignatures', + 'authentication' => 'setAuthentication', + 'cb_state' => 'setCbState', + 'content_type' => 'setContentType', + 'created_at' => 'setCreatedAt', + 'deleted_at' => 'setDeletedAt', + 'description' => 'setDescription', + 'events' => 'setEvents', + 'failure_count' => 'setFailureCount', + 'failure_rate' => 'setFailureRate', + 'http_timeout' => 'setHttpTimeout', + 'mtls_client_cert' => 'setMtlsClientCert', + 'name' => 'setName', + 'owner_id' => 'setOwnerId', + 'period_failure_rate' => 'setPeriodFailureRate', + 'project_id' => 'setProjectId', + 'rate_limit' => 'setRateLimit', + 'rate_limit_duration' => 'setRateLimitDuration', + 'retry_count' => 'setRetryCount', + 'secrets' => 'setSecrets', + 'slack_webhook_url' => 'setSlackWebhookUrl', + 'status' => 'setStatus', + 'success_count' => 'setSuccessCount', + 'support_email' => 'setSupportEmail', + 'uid' => 'setUid', + 'updated_at' => 'setUpdatedAt', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'advanced_signatures' => 'getAdvancedSignatures', + 'authentication' => 'getAuthentication', + 'cb_state' => 'getCbState', + 'content_type' => 'getContentType', + 'created_at' => 'getCreatedAt', + 'deleted_at' => 'getDeletedAt', + 'description' => 'getDescription', + 'events' => 'getEvents', + 'failure_count' => 'getFailureCount', + 'failure_rate' => 'getFailureRate', + 'http_timeout' => 'getHttpTimeout', + 'mtls_client_cert' => 'getMtlsClientCert', + 'name' => 'getName', + 'owner_id' => 'getOwnerId', + 'period_failure_rate' => 'getPeriodFailureRate', + 'project_id' => 'getProjectId', + 'rate_limit' => 'getRateLimit', + 'rate_limit_duration' => 'getRateLimitDuration', + 'retry_count' => 'getRetryCount', + 'secrets' => 'getSecrets', + 'slack_webhook_url' => 'getSlackWebhookUrl', + 'status' => 'getStatus', + 'success_count' => 'getSuccessCount', + 'support_email' => 'getSupportEmail', + 'uid' => 'getUid', + 'updated_at' => 'getUpdatedAt', + 'url' => 'getUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('advanced_signatures', $data ?? [], null); + $this->setIfExists('authentication', $data ?? [], null); + $this->setIfExists('cb_state', $data ?? [], null); + $this->setIfExists('content_type', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('deleted_at', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('events', $data ?? [], null); + $this->setIfExists('failure_count', $data ?? [], null); + $this->setIfExists('failure_rate', $data ?? [], null); + $this->setIfExists('http_timeout', $data ?? [], null); + $this->setIfExists('mtls_client_cert', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('owner_id', $data ?? [], null); + $this->setIfExists('period_failure_rate', $data ?? [], null); + $this->setIfExists('project_id', $data ?? [], null); + $this->setIfExists('rate_limit', $data ?? [], null); + $this->setIfExists('rate_limit_duration', $data ?? [], null); + $this->setIfExists('retry_count', $data ?? [], null); + $this->setIfExists('secrets', $data ?? [], null); + $this->setIfExists('slack_webhook_url', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('success_count', $data ?? [], null); + $this->setIfExists('support_email', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets advanced_signatures + * + * @return bool|null + */ + public function getAdvancedSignatures() + { + return $this->container['advanced_signatures']; + } + + /** + * Sets advanced_signatures + * + * @param bool|null $advanced_signatures advanced_signatures + * + * @return self + */ + public function setAdvancedSignatures($advanced_signatures) + { + if (is_null($advanced_signatures)) { + throw new \InvalidArgumentException('non-nullable advanced_signatures cannot be null'); + } + $this->container['advanced_signatures'] = $advanced_signatures; + + return $this; + } + + /** + * Gets authentication + * + * @return \Convoy\Client\Model\DatastoreEndpointAuthentication|null + */ + public function getAuthentication() + { + return $this->container['authentication']; + } + + /** + * Sets authentication + * + * @param \Convoy\Client\Model\DatastoreEndpointAuthentication|null $authentication authentication + * + * @return self + */ + public function setAuthentication($authentication) + { + if (is_null($authentication)) { + throw new \InvalidArgumentException('non-nullable authentication cannot be null'); + } + $this->container['authentication'] = $authentication; + + return $this; + } + + /** + * Gets cb_state + * + * @return string|null + */ + public function getCbState() + { + return $this->container['cb_state']; + } + + /** + * Sets cb_state + * + * @param string|null $cb_state CBState is the circuit breaker state (\"open\", \"half-open\", \"closed\") so the UI can reflect a tripped breaker on the endpoint status. Nil when CB is off/unlicensed or has no sample for this endpoint. + * + * @return self + */ + public function setCbState($cb_state) + { + if (is_null($cb_state)) { + throw new \InvalidArgumentException('non-nullable cb_state cannot be null'); + } + $this->container['cb_state'] = $cb_state; + + return $this; + } + + /** + * Gets content_type + * + * @return string|null + */ + public function getContentType() + { + return $this->container['content_type']; + } + + /** + * Sets content_type + * + * @param string|null $content_type content_type + * + * @return self + */ + public function setContentType($content_type) + { + if (is_null($content_type)) { + throw new \InvalidArgumentException('non-nullable content_type cannot be null'); + } + $this->container['content_type'] = $content_type; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets deleted_at + * + * @return string|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param string|null $deleted_at deleted_at + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + if (is_null($deleted_at)) { + throw new \InvalidArgumentException('non-nullable deleted_at cannot be null'); + } + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets events + * + * @return int|null + */ + public function getEvents() + { + return $this->container['events']; + } + + /** + * Sets events + * + * @param int|null $events events + * + * @return self + */ + public function setEvents($events) + { + if (is_null($events)) { + throw new \InvalidArgumentException('non-nullable events cannot be null'); + } + $this->container['events'] = $events; + + return $this; + } + + /** + * Gets failure_count + * + * @return int|null + */ + public function getFailureCount() + { + return $this->container['failure_count']; + } + + /** + * Sets failure_count + * + * @param int|null $failure_count failure_count + * + * @return self + */ + public function setFailureCount($failure_count) + { + if (is_null($failure_count)) { + throw new \InvalidArgumentException('non-nullable failure_count cannot be null'); + } + $this->container['failure_count'] = $failure_count; + + return $this; + } + + /** + * Gets failure_rate + * + * @return float|null + */ + public function getFailureRate() + { + return $this->container['failure_rate']; + } + + /** + * Sets failure_rate + * + * @param float|null $failure_rate FailureRate is the circuit breaker's rolling failure rate for this endpoint. It is a pointer so the API can return null when no rate was computed (circuit breaker feature off, or sampler not running), distinct from a genuine 0%. + * + * @return self + */ + public function setFailureRate($failure_rate) + { + if (is_null($failure_rate)) { + throw new \InvalidArgumentException('non-nullable failure_rate cannot be null'); + } + $this->container['failure_rate'] = $failure_rate; + + return $this; + } + + /** + * Gets http_timeout + * + * @return int|null + */ + public function getHttpTimeout() + { + return $this->container['http_timeout']; + } + + /** + * Sets http_timeout + * + * @param int|null $http_timeout http_timeout + * + * @return self + */ + public function setHttpTimeout($http_timeout) + { + if (is_null($http_timeout)) { + throw new \InvalidArgumentException('non-nullable http_timeout cannot be null'); + } + $this->container['http_timeout'] = $http_timeout; + + return $this; + } + + /** + * Gets mtls_client_cert + * + * @return \Convoy\Client\Model\DatastoreMtlsClientCert|null + */ + public function getMtlsClientCert() + { + return $this->container['mtls_client_cert']; + } + + /** + * Sets mtls_client_cert + * + * @param \Convoy\Client\Model\DatastoreMtlsClientCert|null $mtls_client_cert mTLS client certificate configuration + * + * @return self + */ + public function setMtlsClientCert($mtls_client_cert) + { + if (is_null($mtls_client_cert)) { + throw new \InvalidArgumentException('non-nullable mtls_client_cert cannot be null'); + } + $this->container['mtls_client_cert'] = $mtls_client_cert; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets owner_id + * + * @return string|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param string|null $owner_id owner_id + * + * @return self + */ + public function setOwnerId($owner_id) + { + if (is_null($owner_id)) { + throw new \InvalidArgumentException('non-nullable owner_id cannot be null'); + } + $this->container['owner_id'] = $owner_id; + + return $this; + } + + /** + * Gets period_failure_rate + * + * @return float|null + */ + public function getPeriodFailureRate() + { + return $this->container['period_failure_rate']; + } + + /** + * Sets period_failure_rate + * + * @param float|null $period_failure_rate PeriodFailureRate is the period failure rate from event_deliveries, (Failure+Retry)/(Success+Failure+Retry). Retry counts as failed-so-far. Nil when the range has no counted deliveries; sibling counts are transient. + * + * @return self + */ + public function setPeriodFailureRate($period_failure_rate) + { + if (is_null($period_failure_rate)) { + throw new \InvalidArgumentException('non-nullable period_failure_rate cannot be null'); + } + $this->container['period_failure_rate'] = $period_failure_rate; + + return $this; + } + + /** + * Gets project_id + * + * @return string|null + */ + public function getProjectId() + { + return $this->container['project_id']; + } + + /** + * Sets project_id + * + * @param string|null $project_id project_id + * + * @return self + */ + public function setProjectId($project_id) + { + if (is_null($project_id)) { + throw new \InvalidArgumentException('non-nullable project_id cannot be null'); + } + $this->container['project_id'] = $project_id; + + return $this; + } + + /** + * Gets rate_limit + * + * @return int|null + */ + public function getRateLimit() + { + return $this->container['rate_limit']; + } + + /** + * Sets rate_limit + * + * @param int|null $rate_limit rate_limit + * + * @return self + */ + public function setRateLimit($rate_limit) + { + if (is_null($rate_limit)) { + throw new \InvalidArgumentException('non-nullable rate_limit cannot be null'); + } + $this->container['rate_limit'] = $rate_limit; + + return $this; + } + + /** + * Gets rate_limit_duration + * + * @return int|null + */ + public function getRateLimitDuration() + { + return $this->container['rate_limit_duration']; + } + + /** + * Sets rate_limit_duration + * + * @param int|null $rate_limit_duration rate_limit_duration + * + * @return self + */ + public function setRateLimitDuration($rate_limit_duration) + { + if (is_null($rate_limit_duration)) { + throw new \InvalidArgumentException('non-nullable rate_limit_duration cannot be null'); + } + $this->container['rate_limit_duration'] = $rate_limit_duration; + + return $this; + } + + /** + * Gets retry_count + * + * @return int|null + */ + public function getRetryCount() + { + return $this->container['retry_count']; + } + + /** + * Sets retry_count + * + * @param int|null $retry_count retry_count + * + * @return self + */ + public function setRetryCount($retry_count) + { + if (is_null($retry_count)) { + throw new \InvalidArgumentException('non-nullable retry_count cannot be null'); + } + $this->container['retry_count'] = $retry_count; + + return $this; + } + + /** + * Gets secrets + * + * @return \Convoy\Client\Model\DatastoreSecret[]|null + */ + public function getSecrets() + { + return $this->container['secrets']; + } + + /** + * Sets secrets + * + * @param \Convoy\Client\Model\DatastoreSecret[]|null $secrets secrets + * + * @return self + */ + public function setSecrets($secrets) + { + if (is_null($secrets)) { + throw new \InvalidArgumentException('non-nullable secrets cannot be null'); + } + $this->container['secrets'] = $secrets; + + return $this; + } + + /** + * Gets slack_webhook_url + * + * @return string|null + */ + public function getSlackWebhookUrl() + { + return $this->container['slack_webhook_url']; + } + + /** + * Sets slack_webhook_url + * + * @param string|null $slack_webhook_url slack_webhook_url + * + * @return self + */ + public function setSlackWebhookUrl($slack_webhook_url) + { + if (is_null($slack_webhook_url)) { + throw new \InvalidArgumentException('non-nullable slack_webhook_url cannot be null'); + } + $this->container['slack_webhook_url'] = $slack_webhook_url; + + return $this; + } + + /** + * Gets status + * + * @return \Convoy\Client\Model\DatastoreEndpointStatus|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Convoy\Client\Model\DatastoreEndpointStatus|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets success_count + * + * @return int|null + */ + public function getSuccessCount() + { + return $this->container['success_count']; + } + + /** + * Sets success_count + * + * @param int|null $success_count success_count + * + * @return self + */ + public function setSuccessCount($success_count) + { + if (is_null($success_count)) { + throw new \InvalidArgumentException('non-nullable success_count cannot be null'); + } + $this->container['success_count'] = $success_count; + + return $this; + } + + /** + * Gets support_email + * + * @return string|null + */ + public function getSupportEmail() + { + return $this->container['support_email']; + } + + /** + * Sets support_email + * + * @param string|null $support_email support_email + * + * @return self + */ + public function setSupportEmail($support_email) + { + if (is_null($support_email)) { + throw new \InvalidArgumentException('non-nullable support_email cannot be null'); + } + $this->container['support_email'] = $support_email; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url url + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsEventDeliveryResponse.php b/src/Client/Model/ModelsEventDeliveryResponse.php new file mode 100644 index 0000000..80f8aec --- /dev/null +++ b/src/Client/Model/ModelsEventDeliveryResponse.php @@ -0,0 +1,1260 @@ + + */ +class ModelsEventDeliveryResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.EventDeliveryResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'acknowledged_at' => 'string', + 'cli_metadata' => '\Convoy\Client\Model\DatastoreCLIMetadata', + 'created_at' => 'string', + 'deleted_at' => 'string', + 'delivery_mode' => '\Convoy\Client\Model\DatastoreDeliveryMode', + 'description' => 'string', + 'device_id' => 'string', + 'device_metadata' => '\Convoy\Client\Model\DatastoreDevice', + 'endpoint_id' => 'string', + 'endpoint_metadata' => '\Convoy\Client\Model\DatastoreEndpoint', + 'event_id' => 'string', + 'event_metadata' => '\Convoy\Client\Model\DatastoreEvent', + 'event_type' => 'string', + 'headers' => 'array', + 'idempotency_key' => 'string', + 'latency' => 'string', + 'latency_seconds' => 'float', + 'metadata' => '\Convoy\Client\Model\DatastoreMetadata', + 'project_id' => 'string', + 'source_metadata' => '\Convoy\Client\Model\DatastoreSource', + 'status' => '\Convoy\Client\Model\DatastoreEventDeliveryStatus', + 'subscription_id' => 'string', + 'target_url' => 'string', + 'uid' => 'string', + 'updated_at' => 'string', + 'url_query_params' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'acknowledged_at' => null, + 'cli_metadata' => null, + 'created_at' => null, + 'deleted_at' => null, + 'delivery_mode' => null, + 'description' => null, + 'device_id' => null, + 'device_metadata' => null, + 'endpoint_id' => null, + 'endpoint_metadata' => null, + 'event_id' => null, + 'event_metadata' => null, + 'event_type' => null, + 'headers' => null, + 'idempotency_key' => null, + 'latency' => null, + 'latency_seconds' => null, + 'metadata' => null, + 'project_id' => null, + 'source_metadata' => null, + 'status' => null, + 'subscription_id' => null, + 'target_url' => null, + 'uid' => null, + 'updated_at' => null, + 'url_query_params' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'acknowledged_at' => false, + 'cli_metadata' => false, + 'created_at' => false, + 'deleted_at' => false, + 'delivery_mode' => false, + 'description' => false, + 'device_id' => false, + 'device_metadata' => false, + 'endpoint_id' => false, + 'endpoint_metadata' => false, + 'event_id' => false, + 'event_metadata' => false, + 'event_type' => false, + 'headers' => false, + 'idempotency_key' => false, + 'latency' => false, + 'latency_seconds' => false, + 'metadata' => false, + 'project_id' => false, + 'source_metadata' => false, + 'status' => false, + 'subscription_id' => false, + 'target_url' => false, + 'uid' => false, + 'updated_at' => false, + 'url_query_params' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'acknowledged_at' => 'acknowledged_at', + 'cli_metadata' => 'cli_metadata', + 'created_at' => 'created_at', + 'deleted_at' => 'deleted_at', + 'delivery_mode' => 'delivery_mode', + 'description' => 'description', + 'device_id' => 'device_id', + 'device_metadata' => 'device_metadata', + 'endpoint_id' => 'endpoint_id', + 'endpoint_metadata' => 'endpoint_metadata', + 'event_id' => 'event_id', + 'event_metadata' => 'event_metadata', + 'event_type' => 'event_type', + 'headers' => 'headers', + 'idempotency_key' => 'idempotency_key', + 'latency' => 'latency', + 'latency_seconds' => 'latency_seconds', + 'metadata' => 'metadata', + 'project_id' => 'project_id', + 'source_metadata' => 'source_metadata', + 'status' => 'status', + 'subscription_id' => 'subscription_id', + 'target_url' => 'target_url', + 'uid' => 'uid', + 'updated_at' => 'updated_at', + 'url_query_params' => 'url_query_params' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'acknowledged_at' => 'setAcknowledgedAt', + 'cli_metadata' => 'setCliMetadata', + 'created_at' => 'setCreatedAt', + 'deleted_at' => 'setDeletedAt', + 'delivery_mode' => 'setDeliveryMode', + 'description' => 'setDescription', + 'device_id' => 'setDeviceId', + 'device_metadata' => 'setDeviceMetadata', + 'endpoint_id' => 'setEndpointId', + 'endpoint_metadata' => 'setEndpointMetadata', + 'event_id' => 'setEventId', + 'event_metadata' => 'setEventMetadata', + 'event_type' => 'setEventType', + 'headers' => 'setHeaders', + 'idempotency_key' => 'setIdempotencyKey', + 'latency' => 'setLatency', + 'latency_seconds' => 'setLatencySeconds', + 'metadata' => 'setMetadata', + 'project_id' => 'setProjectId', + 'source_metadata' => 'setSourceMetadata', + 'status' => 'setStatus', + 'subscription_id' => 'setSubscriptionId', + 'target_url' => 'setTargetUrl', + 'uid' => 'setUid', + 'updated_at' => 'setUpdatedAt', + 'url_query_params' => 'setUrlQueryParams' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'acknowledged_at' => 'getAcknowledgedAt', + 'cli_metadata' => 'getCliMetadata', + 'created_at' => 'getCreatedAt', + 'deleted_at' => 'getDeletedAt', + 'delivery_mode' => 'getDeliveryMode', + 'description' => 'getDescription', + 'device_id' => 'getDeviceId', + 'device_metadata' => 'getDeviceMetadata', + 'endpoint_id' => 'getEndpointId', + 'endpoint_metadata' => 'getEndpointMetadata', + 'event_id' => 'getEventId', + 'event_metadata' => 'getEventMetadata', + 'event_type' => 'getEventType', + 'headers' => 'getHeaders', + 'idempotency_key' => 'getIdempotencyKey', + 'latency' => 'getLatency', + 'latency_seconds' => 'getLatencySeconds', + 'metadata' => 'getMetadata', + 'project_id' => 'getProjectId', + 'source_metadata' => 'getSourceMetadata', + 'status' => 'getStatus', + 'subscription_id' => 'getSubscriptionId', + 'target_url' => 'getTargetUrl', + 'uid' => 'getUid', + 'updated_at' => 'getUpdatedAt', + 'url_query_params' => 'getUrlQueryParams' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('acknowledged_at', $data ?? [], null); + $this->setIfExists('cli_metadata', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('deleted_at', $data ?? [], null); + $this->setIfExists('delivery_mode', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('device_id', $data ?? [], null); + $this->setIfExists('device_metadata', $data ?? [], null); + $this->setIfExists('endpoint_id', $data ?? [], null); + $this->setIfExists('endpoint_metadata', $data ?? [], null); + $this->setIfExists('event_id', $data ?? [], null); + $this->setIfExists('event_metadata', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('idempotency_key', $data ?? [], null); + $this->setIfExists('latency', $data ?? [], null); + $this->setIfExists('latency_seconds', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('project_id', $data ?? [], null); + $this->setIfExists('source_metadata', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('subscription_id', $data ?? [], null); + $this->setIfExists('target_url', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('url_query_params', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets acknowledged_at + * + * @return string|null + */ + public function getAcknowledgedAt() + { + return $this->container['acknowledged_at']; + } + + /** + * Sets acknowledged_at + * + * @param string|null $acknowledged_at acknowledged_at + * + * @return self + */ + public function setAcknowledgedAt($acknowledged_at) + { + if (is_null($acknowledged_at)) { + throw new \InvalidArgumentException('non-nullable acknowledged_at cannot be null'); + } + $this->container['acknowledged_at'] = $acknowledged_at; + + return $this; + } + + /** + * Gets cli_metadata + * + * @return \Convoy\Client\Model\DatastoreCLIMetadata|null + */ + public function getCliMetadata() + { + return $this->container['cli_metadata']; + } + + /** + * Sets cli_metadata + * + * @param \Convoy\Client\Model\DatastoreCLIMetadata|null $cli_metadata cli_metadata + * + * @return self + */ + public function setCliMetadata($cli_metadata) + { + if (is_null($cli_metadata)) { + throw new \InvalidArgumentException('non-nullable cli_metadata cannot be null'); + } + $this->container['cli_metadata'] = $cli_metadata; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets deleted_at + * + * @return string|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param string|null $deleted_at deleted_at + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + if (is_null($deleted_at)) { + throw new \InvalidArgumentException('non-nullable deleted_at cannot be null'); + } + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets delivery_mode + * + * @return \Convoy\Client\Model\DatastoreDeliveryMode|null + */ + public function getDeliveryMode() + { + return $this->container['delivery_mode']; + } + + /** + * Sets delivery_mode + * + * @param \Convoy\Client\Model\DatastoreDeliveryMode|null $delivery_mode delivery_mode + * + * @return self + */ + public function setDeliveryMode($delivery_mode) + { + if (is_null($delivery_mode)) { + throw new \InvalidArgumentException('non-nullable delivery_mode cannot be null'); + } + $this->container['delivery_mode'] = $delivery_mode; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets device_id + * + * @return string|null + */ + public function getDeviceId() + { + return $this->container['device_id']; + } + + /** + * Sets device_id + * + * @param string|null $device_id device_id + * + * @return self + */ + public function setDeviceId($device_id) + { + if (is_null($device_id)) { + throw new \InvalidArgumentException('non-nullable device_id cannot be null'); + } + $this->container['device_id'] = $device_id; + + return $this; + } + + /** + * Gets device_metadata + * + * @return \Convoy\Client\Model\DatastoreDevice|null + */ + public function getDeviceMetadata() + { + return $this->container['device_metadata']; + } + + /** + * Sets device_metadata + * + * @param \Convoy\Client\Model\DatastoreDevice|null $device_metadata device_metadata + * + * @return self + */ + public function setDeviceMetadata($device_metadata) + { + if (is_null($device_metadata)) { + throw new \InvalidArgumentException('non-nullable device_metadata cannot be null'); + } + $this->container['device_metadata'] = $device_metadata; + + return $this; + } + + /** + * Gets endpoint_id + * + * @return string|null + */ + public function getEndpointId() + { + return $this->container['endpoint_id']; + } + + /** + * Sets endpoint_id + * + * @param string|null $endpoint_id endpoint_id + * + * @return self + */ + public function setEndpointId($endpoint_id) + { + if (is_null($endpoint_id)) { + throw new \InvalidArgumentException('non-nullable endpoint_id cannot be null'); + } + $this->container['endpoint_id'] = $endpoint_id; + + return $this; + } + + /** + * Gets endpoint_metadata + * + * @return \Convoy\Client\Model\DatastoreEndpoint|null + */ + public function getEndpointMetadata() + { + return $this->container['endpoint_metadata']; + } + + /** + * Sets endpoint_metadata + * + * @param \Convoy\Client\Model\DatastoreEndpoint|null $endpoint_metadata endpoint_metadata + * + * @return self + */ + public function setEndpointMetadata($endpoint_metadata) + { + if (is_null($endpoint_metadata)) { + throw new \InvalidArgumentException('non-nullable endpoint_metadata cannot be null'); + } + $this->container['endpoint_metadata'] = $endpoint_metadata; + + return $this; + } + + /** + * Gets event_id + * + * @return string|null + */ + public function getEventId() + { + return $this->container['event_id']; + } + + /** + * Sets event_id + * + * @param string|null $event_id event_id + * + * @return self + */ + public function setEventId($event_id) + { + if (is_null($event_id)) { + throw new \InvalidArgumentException('non-nullable event_id cannot be null'); + } + $this->container['event_id'] = $event_id; + + return $this; + } + + /** + * Gets event_metadata + * + * @return \Convoy\Client\Model\DatastoreEvent|null + */ + public function getEventMetadata() + { + return $this->container['event_metadata']; + } + + /** + * Sets event_metadata + * + * @param \Convoy\Client\Model\DatastoreEvent|null $event_metadata event_metadata + * + * @return self + */ + public function setEventMetadata($event_metadata) + { + if (is_null($event_metadata)) { + throw new \InvalidArgumentException('non-nullable event_metadata cannot be null'); + } + $this->container['event_metadata'] = $event_metadata; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets headers + * + * @return array|null + */ + public function getHeaders() + { + return $this->container['headers']; + } + + /** + * Sets headers + * + * @param array|null $headers headers + * + * @return self + */ + public function setHeaders($headers) + { + if (is_null($headers)) { + throw new \InvalidArgumentException('non-nullable headers cannot be null'); + } + $this->container['headers'] = $headers; + + return $this; + } + + /** + * Gets idempotency_key + * + * @return string|null + */ + public function getIdempotencyKey() + { + return $this->container['idempotency_key']; + } + + /** + * Sets idempotency_key + * + * @param string|null $idempotency_key idempotency_key + * + * @return self + */ + public function setIdempotencyKey($idempotency_key) + { + if (is_null($idempotency_key)) { + throw new \InvalidArgumentException('non-nullable idempotency_key cannot be null'); + } + $this->container['idempotency_key'] = $idempotency_key; + + return $this; + } + + /** + * Gets latency + * + * @return string|null + */ + public function getLatency() + { + return $this->container['latency']; + } + + /** + * Sets latency + * + * @param string|null $latency Deprecated: Latency is deprecated. + * + * @return self + */ + public function setLatency($latency) + { + if (is_null($latency)) { + throw new \InvalidArgumentException('non-nullable latency cannot be null'); + } + $this->container['latency'] = $latency; + + return $this; + } + + /** + * Gets latency_seconds + * + * @return float|null + */ + public function getLatencySeconds() + { + return $this->container['latency_seconds']; + } + + /** + * Sets latency_seconds + * + * @param float|null $latency_seconds latency_seconds + * + * @return self + */ + public function setLatencySeconds($latency_seconds) + { + if (is_null($latency_seconds)) { + throw new \InvalidArgumentException('non-nullable latency_seconds cannot be null'); + } + $this->container['latency_seconds'] = $latency_seconds; + + return $this; + } + + /** + * Gets metadata + * + * @return \Convoy\Client\Model\DatastoreMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \Convoy\Client\Model\DatastoreMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets project_id + * + * @return string|null + */ + public function getProjectId() + { + return $this->container['project_id']; + } + + /** + * Sets project_id + * + * @param string|null $project_id project_id + * + * @return self + */ + public function setProjectId($project_id) + { + if (is_null($project_id)) { + throw new \InvalidArgumentException('non-nullable project_id cannot be null'); + } + $this->container['project_id'] = $project_id; + + return $this; + } + + /** + * Gets source_metadata + * + * @return \Convoy\Client\Model\DatastoreSource|null + */ + public function getSourceMetadata() + { + return $this->container['source_metadata']; + } + + /** + * Sets source_metadata + * + * @param \Convoy\Client\Model\DatastoreSource|null $source_metadata source_metadata + * + * @return self + */ + public function setSourceMetadata($source_metadata) + { + if (is_null($source_metadata)) { + throw new \InvalidArgumentException('non-nullable source_metadata cannot be null'); + } + $this->container['source_metadata'] = $source_metadata; + + return $this; + } + + /** + * Gets status + * + * @return \Convoy\Client\Model\DatastoreEventDeliveryStatus|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Convoy\Client\Model\DatastoreEventDeliveryStatus|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets subscription_id + * + * @return string|null + */ + public function getSubscriptionId() + { + return $this->container['subscription_id']; + } + + /** + * Sets subscription_id + * + * @param string|null $subscription_id subscription_id + * + * @return self + */ + public function setSubscriptionId($subscription_id) + { + if (is_null($subscription_id)) { + throw new \InvalidArgumentException('non-nullable subscription_id cannot be null'); + } + $this->container['subscription_id'] = $subscription_id; + + return $this; + } + + /** + * Gets target_url + * + * @return string|null + */ + public function getTargetUrl() + { + return $this->container['target_url']; + } + + /** + * Sets target_url + * + * @param string|null $target_url target_url + * + * @return self + */ + public function setTargetUrl($target_url) + { + if (is_null($target_url)) { + throw new \InvalidArgumentException('non-nullable target_url cannot be null'); + } + $this->container['target_url'] = $target_url; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets url_query_params + * + * @return string|null + */ + public function getUrlQueryParams() + { + return $this->container['url_query_params']; + } + + /** + * Sets url_query_params + * + * @param string|null $url_query_params url_query_params + * + * @return self + */ + public function setUrlQueryParams($url_query_params) + { + if (is_null($url_query_params)) { + throw new \InvalidArgumentException('non-nullable url_query_params cannot be null'); + } + $this->container['url_query_params'] = $url_query_params; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsEventResponse.php b/src/Client/Model/ModelsEventResponse.php new file mode 100644 index 0000000..a3fab09 --- /dev/null +++ b/src/Client/Model/ModelsEventResponse.php @@ -0,0 +1,1090 @@ + + */ +class ModelsEventResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.EventResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'acknowledged_at' => 'string', + 'app_id' => 'string', + 'created_at' => 'string', + 'data' => 'array', + 'deleted_at' => 'string', + 'endpoint_metadata' => '\Convoy\Client\Model\DatastoreEndpoint[]', + 'endpoints' => 'string[]', + 'event_type' => 'string', + 'headers' => 'array', + 'idempotency_key' => 'string', + 'is_duplicate_event' => 'bool', + 'metadata' => 'string', + 'project_id' => 'string', + 'raw' => 'string', + 'source_id' => 'string', + 'source_metadata' => '\Convoy\Client\Model\DatastoreSource', + 'status' => '\Convoy\Client\Model\DatastoreEventStatus', + 'uid' => 'string', + 'updated_at' => 'string', + 'url_path' => 'string', + 'url_query_params' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'acknowledged_at' => null, + 'app_id' => null, + 'created_at' => null, + 'data' => null, + 'deleted_at' => null, + 'endpoint_metadata' => null, + 'endpoints' => null, + 'event_type' => null, + 'headers' => null, + 'idempotency_key' => null, + 'is_duplicate_event' => null, + 'metadata' => null, + 'project_id' => null, + 'raw' => null, + 'source_id' => null, + 'source_metadata' => null, + 'status' => null, + 'uid' => null, + 'updated_at' => null, + 'url_path' => null, + 'url_query_params' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'acknowledged_at' => false, + 'app_id' => false, + 'created_at' => false, + 'data' => false, + 'deleted_at' => false, + 'endpoint_metadata' => false, + 'endpoints' => false, + 'event_type' => false, + 'headers' => false, + 'idempotency_key' => false, + 'is_duplicate_event' => false, + 'metadata' => false, + 'project_id' => false, + 'raw' => false, + 'source_id' => false, + 'source_metadata' => false, + 'status' => false, + 'uid' => false, + 'updated_at' => false, + 'url_path' => false, + 'url_query_params' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'acknowledged_at' => 'acknowledged_at', + 'app_id' => 'app_id', + 'created_at' => 'created_at', + 'data' => 'data', + 'deleted_at' => 'deleted_at', + 'endpoint_metadata' => 'endpoint_metadata', + 'endpoints' => 'endpoints', + 'event_type' => 'event_type', + 'headers' => 'headers', + 'idempotency_key' => 'idempotency_key', + 'is_duplicate_event' => 'is_duplicate_event', + 'metadata' => 'metadata', + 'project_id' => 'project_id', + 'raw' => 'raw', + 'source_id' => 'source_id', + 'source_metadata' => 'source_metadata', + 'status' => 'status', + 'uid' => 'uid', + 'updated_at' => 'updated_at', + 'url_path' => 'url_path', + 'url_query_params' => 'url_query_params' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'acknowledged_at' => 'setAcknowledgedAt', + 'app_id' => 'setAppId', + 'created_at' => 'setCreatedAt', + 'data' => 'setData', + 'deleted_at' => 'setDeletedAt', + 'endpoint_metadata' => 'setEndpointMetadata', + 'endpoints' => 'setEndpoints', + 'event_type' => 'setEventType', + 'headers' => 'setHeaders', + 'idempotency_key' => 'setIdempotencyKey', + 'is_duplicate_event' => 'setIsDuplicateEvent', + 'metadata' => 'setMetadata', + 'project_id' => 'setProjectId', + 'raw' => 'setRaw', + 'source_id' => 'setSourceId', + 'source_metadata' => 'setSourceMetadata', + 'status' => 'setStatus', + 'uid' => 'setUid', + 'updated_at' => 'setUpdatedAt', + 'url_path' => 'setUrlPath', + 'url_query_params' => 'setUrlQueryParams' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'acknowledged_at' => 'getAcknowledgedAt', + 'app_id' => 'getAppId', + 'created_at' => 'getCreatedAt', + 'data' => 'getData', + 'deleted_at' => 'getDeletedAt', + 'endpoint_metadata' => 'getEndpointMetadata', + 'endpoints' => 'getEndpoints', + 'event_type' => 'getEventType', + 'headers' => 'getHeaders', + 'idempotency_key' => 'getIdempotencyKey', + 'is_duplicate_event' => 'getIsDuplicateEvent', + 'metadata' => 'getMetadata', + 'project_id' => 'getProjectId', + 'raw' => 'getRaw', + 'source_id' => 'getSourceId', + 'source_metadata' => 'getSourceMetadata', + 'status' => 'getStatus', + 'uid' => 'getUid', + 'updated_at' => 'getUpdatedAt', + 'url_path' => 'getUrlPath', + 'url_query_params' => 'getUrlQueryParams' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('acknowledged_at', $data ?? [], null); + $this->setIfExists('app_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('deleted_at', $data ?? [], null); + $this->setIfExists('endpoint_metadata', $data ?? [], null); + $this->setIfExists('endpoints', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('idempotency_key', $data ?? [], null); + $this->setIfExists('is_duplicate_event', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('project_id', $data ?? [], null); + $this->setIfExists('raw', $data ?? [], null); + $this->setIfExists('source_id', $data ?? [], null); + $this->setIfExists('source_metadata', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('url_path', $data ?? [], null); + $this->setIfExists('url_query_params', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets acknowledged_at + * + * @return string|null + */ + public function getAcknowledgedAt() + { + return $this->container['acknowledged_at']; + } + + /** + * Sets acknowledged_at + * + * @param string|null $acknowledged_at acknowledged_at + * + * @return self + */ + public function setAcknowledgedAt($acknowledged_at) + { + if (is_null($acknowledged_at)) { + throw new \InvalidArgumentException('non-nullable acknowledged_at cannot be null'); + } + $this->container['acknowledged_at'] = $acknowledged_at; + + return $this; + } + + /** + * Gets app_id + * + * @return string|null + */ + public function getAppId() + { + return $this->container['app_id']; + } + + /** + * Sets app_id + * + * @param string|null $app_id Deprecated + * + * @return self + */ + public function setAppId($app_id) + { + if (is_null($app_id)) { + throw new \InvalidArgumentException('non-nullable app_id cannot be null'); + } + $this->container['app_id'] = $app_id; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets data + * + * @return array|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param array|null $data Data is an arbitrary JSON value that gets sent as the body of the webhook to the endpoints + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets deleted_at + * + * @return string|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param string|null $deleted_at deleted_at + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + if (is_null($deleted_at)) { + throw new \InvalidArgumentException('non-nullable deleted_at cannot be null'); + } + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets endpoint_metadata + * + * @return \Convoy\Client\Model\DatastoreEndpoint[]|null + */ + public function getEndpointMetadata() + { + return $this->container['endpoint_metadata']; + } + + /** + * Sets endpoint_metadata + * + * @param \Convoy\Client\Model\DatastoreEndpoint[]|null $endpoint_metadata endpoint_metadata + * + * @return self + */ + public function setEndpointMetadata($endpoint_metadata) + { + if (is_null($endpoint_metadata)) { + throw new \InvalidArgumentException('non-nullable endpoint_metadata cannot be null'); + } + $this->container['endpoint_metadata'] = $endpoint_metadata; + + return $this; + } + + /** + * Gets endpoints + * + * @return string[]|null + */ + public function getEndpoints() + { + return $this->container['endpoints']; + } + + /** + * Sets endpoints + * + * @param string[]|null $endpoints endpoints + * + * @return self + */ + public function setEndpoints($endpoints) + { + if (is_null($endpoints)) { + throw new \InvalidArgumentException('non-nullable endpoints cannot be null'); + } + $this->container['endpoints'] = $endpoints; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets headers + * + * @return array|null + */ + public function getHeaders() + { + return $this->container['headers']; + } + + /** + * Sets headers + * + * @param array|null $headers headers + * + * @return self + */ + public function setHeaders($headers) + { + if (is_null($headers)) { + throw new \InvalidArgumentException('non-nullable headers cannot be null'); + } + $this->container['headers'] = $headers; + + return $this; + } + + /** + * Gets idempotency_key + * + * @return string|null + */ + public function getIdempotencyKey() + { + return $this->container['idempotency_key']; + } + + /** + * Sets idempotency_key + * + * @param string|null $idempotency_key idempotency_key + * + * @return self + */ + public function setIdempotencyKey($idempotency_key) + { + if (is_null($idempotency_key)) { + throw new \InvalidArgumentException('non-nullable idempotency_key cannot be null'); + } + $this->container['idempotency_key'] = $idempotency_key; + + return $this; + } + + /** + * Gets is_duplicate_event + * + * @return bool|null + */ + public function getIsDuplicateEvent() + { + return $this->container['is_duplicate_event']; + } + + /** + * Sets is_duplicate_event + * + * @param bool|null $is_duplicate_event is_duplicate_event + * + * @return self + */ + public function setIsDuplicateEvent($is_duplicate_event) + { + if (is_null($is_duplicate_event)) { + throw new \InvalidArgumentException('non-nullable is_duplicate_event cannot be null'); + } + $this->container['is_duplicate_event'] = $is_duplicate_event; + + return $this; + } + + /** + * Gets metadata + * + * @return string|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param string|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets project_id + * + * @return string|null + */ + public function getProjectId() + { + return $this->container['project_id']; + } + + /** + * Sets project_id + * + * @param string|null $project_id project_id + * + * @return self + */ + public function setProjectId($project_id) + { + if (is_null($project_id)) { + throw new \InvalidArgumentException('non-nullable project_id cannot be null'); + } + $this->container['project_id'] = $project_id; + + return $this; + } + + /** + * Gets raw + * + * @return string|null + */ + public function getRaw() + { + return $this->container['raw']; + } + + /** + * Sets raw + * + * @param string|null $raw raw + * + * @return self + */ + public function setRaw($raw) + { + if (is_null($raw)) { + throw new \InvalidArgumentException('non-nullable raw cannot be null'); + } + $this->container['raw'] = $raw; + + return $this; + } + + /** + * Gets source_id + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['source_id']; + } + + /** + * Sets source_id + * + * @param string|null $source_id source_id + * + * @return self + */ + public function setSourceId($source_id) + { + if (is_null($source_id)) { + throw new \InvalidArgumentException('non-nullable source_id cannot be null'); + } + $this->container['source_id'] = $source_id; + + return $this; + } + + /** + * Gets source_metadata + * + * @return \Convoy\Client\Model\DatastoreSource|null + */ + public function getSourceMetadata() + { + return $this->container['source_metadata']; + } + + /** + * Sets source_metadata + * + * @param \Convoy\Client\Model\DatastoreSource|null $source_metadata source_metadata + * + * @return self + */ + public function setSourceMetadata($source_metadata) + { + if (is_null($source_metadata)) { + throw new \InvalidArgumentException('non-nullable source_metadata cannot be null'); + } + $this->container['source_metadata'] = $source_metadata; + + return $this; + } + + /** + * Gets status + * + * @return \Convoy\Client\Model\DatastoreEventStatus|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Convoy\Client\Model\DatastoreEventStatus|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets url_path + * + * @return string|null + */ + public function getUrlPath() + { + return $this->container['url_path']; + } + + /** + * Sets url_path + * + * @param string|null $url_path url_path + * + * @return self + */ + public function setUrlPath($url_path) + { + if (is_null($url_path)) { + throw new \InvalidArgumentException('non-nullable url_path cannot be null'); + } + $this->container['url_path'] = $url_path; + + return $this; + } + + /** + * Gets url_query_params + * + * @return string|null + */ + public function getUrlQueryParams() + { + return $this->container['url_query_params']; + } + + /** + * Sets url_query_params + * + * @param string|null $url_query_params url_query_params + * + * @return self + */ + public function setUrlQueryParams($url_query_params) + { + if (is_null($url_query_params)) { + throw new \InvalidArgumentException('non-nullable url_query_params cannot be null'); + } + $this->container['url_query_params'] = $url_query_params; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsEventTypeResponse.php b/src/Client/Model/ModelsEventTypeResponse.php new file mode 100644 index 0000000..66f18c3 --- /dev/null +++ b/src/Client/Model/ModelsEventTypeResponse.php @@ -0,0 +1,580 @@ + + */ +class ModelsEventTypeResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.EventTypeResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'deprecated_at' => 'string', + 'description' => 'string', + 'json_schema' => 'array', + 'name' => 'string', + 'uid' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'deprecated_at' => null, + 'description' => null, + 'json_schema' => null, + 'name' => null, + 'uid' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'category' => false, + 'deprecated_at' => false, + 'description' => false, + 'json_schema' => false, + 'name' => false, + 'uid' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'deprecated_at' => 'deprecated_at', + 'description' => 'description', + 'json_schema' => 'json_schema', + 'name' => 'name', + 'uid' => 'uid' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'deprecated_at' => 'setDeprecatedAt', + 'description' => 'setDescription', + 'json_schema' => 'setJsonSchema', + 'name' => 'setName', + 'uid' => 'setUid' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'deprecated_at' => 'getDeprecatedAt', + 'description' => 'getDescription', + 'json_schema' => 'getJsonSchema', + 'name' => 'getName', + 'uid' => 'getUid' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('deprecated_at', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('json_schema', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets deprecated_at + * + * @return string|null + */ + public function getDeprecatedAt() + { + return $this->container['deprecated_at']; + } + + /** + * Sets deprecated_at + * + * @param string|null $deprecated_at deprecated_at + * + * @return self + */ + public function setDeprecatedAt($deprecated_at) + { + if (is_null($deprecated_at)) { + throw new \InvalidArgumentException('non-nullable deprecated_at cannot be null'); + } + $this->container['deprecated_at'] = $deprecated_at; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets json_schema + * + * @return array|null + */ + public function getJsonSchema() + { + return $this->container['json_schema']; + } + + /** + * Sets json_schema + * + * @param array|null $json_schema json_schema + * + * @return self + */ + public function setJsonSchema($json_schema) + { + if (is_null($json_schema)) { + throw new \InvalidArgumentException('non-nullable json_schema cannot be null'); + } + $this->container['json_schema'] = $json_schema; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsExpireSecret.php b/src/Client/Model/ModelsExpireSecret.php new file mode 100644 index 0000000..4300a89 --- /dev/null +++ b/src/Client/Model/ModelsExpireSecret.php @@ -0,0 +1,444 @@ + + */ +class ModelsExpireSecret implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.ExpireSecret'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'expiration' => 'int', + 'secret' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'expiration' => null, + 'secret' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'expiration' => false, + 'secret' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'expiration' => 'expiration', + 'secret' => 'secret' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'expiration' => 'setExpiration', + 'secret' => 'setSecret' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'expiration' => 'getExpiration', + 'secret' => 'getSecret' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('expiration', $data ?? [], null); + $this->setIfExists('secret', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets expiration + * + * @return int|null + */ + public function getExpiration() + { + return $this->container['expiration']; + } + + /** + * Sets expiration + * + * @param int|null $expiration Amount of time to wait before expiring the old endpoint secret. If AdvancedSignatures is turned on for the project, signatures for both secrets will be generated up until the old signature is expired. + * + * @return self + */ + public function setExpiration($expiration) + { + if (is_null($expiration)) { + throw new \InvalidArgumentException('non-nullable expiration cannot be null'); + } + $this->container['expiration'] = $expiration; + + return $this; + } + + /** + * Gets secret + * + * @return string|null + */ + public function getSecret() + { + return $this->container['secret']; + } + + /** + * Sets secret + * + * @param string|null $secret New Endpoint secret value. + * + * @return self + */ + public function setSecret($secret) + { + if (is_null($secret)) { + throw new \InvalidArgumentException('non-nullable secret cannot be null'); + } + $this->container['secret'] = $secret; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsFS.php b/src/Client/Model/ModelsFS.php new file mode 100644 index 0000000..7894409 --- /dev/null +++ b/src/Client/Model/ModelsFS.php @@ -0,0 +1,512 @@ + + */ +class ModelsFS implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.FS'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'body' => 'array', + 'headers' => 'array', + 'path' => 'array', + 'query' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'body' => null, + 'headers' => null, + 'path' => null, + 'query' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'body' => false, + 'headers' => false, + 'path' => false, + 'query' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'body' => 'body', + 'headers' => 'headers', + 'path' => 'path', + 'query' => 'query' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'body' => 'setBody', + 'headers' => 'setHeaders', + 'path' => 'setPath', + 'query' => 'setQuery' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'body' => 'getBody', + 'headers' => 'getHeaders', + 'path' => 'getPath', + 'query' => 'getQuery' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('path', $data ?? [], null); + $this->setIfExists('query', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets body + * + * @return array|null + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param array|null $body body + * + * @return self + */ + public function setBody($body) + { + if (is_null($body)) { + throw new \InvalidArgumentException('non-nullable body cannot be null'); + } + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets headers + * + * @return array|null + */ + public function getHeaders() + { + return $this->container['headers']; + } + + /** + * Sets headers + * + * @param array|null $headers headers + * + * @return self + */ + public function setHeaders($headers) + { + if (is_null($headers)) { + throw new \InvalidArgumentException('non-nullable headers cannot be null'); + } + $this->container['headers'] = $headers; + + return $this; + } + + /** + * Gets path + * + * @return array|null + */ + public function getPath() + { + return $this->container['path']; + } + + /** + * Sets path + * + * @param array|null $path path + * + * @return self + */ + public function setPath($path) + { + if (is_null($path)) { + throw new \InvalidArgumentException('non-nullable path cannot be null'); + } + $this->container['path'] = $path; + + return $this; + } + + /** + * Gets query + * + * @return array|null + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param array|null $query query + * + * @return self + */ + public function setQuery($query) + { + if (is_null($query)) { + throw new \InvalidArgumentException('non-nullable query cannot be null'); + } + $this->container['query'] = $query; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsFanoutEvent.php b/src/Client/Model/ModelsFanoutEvent.php new file mode 100644 index 0000000..5370a79 --- /dev/null +++ b/src/Client/Model/ModelsFanoutEvent.php @@ -0,0 +1,546 @@ + + */ +class ModelsFanoutEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.FanoutEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'custom_headers' => 'array', + 'data' => 'array', + 'event_type' => 'string', + 'idempotency_key' => 'string', + 'owner_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'custom_headers' => null, + 'data' => null, + 'event_type' => null, + 'idempotency_key' => null, + 'owner_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'custom_headers' => false, + 'data' => false, + 'event_type' => false, + 'idempotency_key' => false, + 'owner_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'custom_headers' => 'custom_headers', + 'data' => 'data', + 'event_type' => 'event_type', + 'idempotency_key' => 'idempotency_key', + 'owner_id' => 'owner_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'custom_headers' => 'setCustomHeaders', + 'data' => 'setData', + 'event_type' => 'setEventType', + 'idempotency_key' => 'setIdempotencyKey', + 'owner_id' => 'setOwnerId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'custom_headers' => 'getCustomHeaders', + 'data' => 'getData', + 'event_type' => 'getEventType', + 'idempotency_key' => 'getIdempotencyKey', + 'owner_id' => 'getOwnerId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('custom_headers', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('idempotency_key', $data ?? [], null); + $this->setIfExists('owner_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets custom_headers + * + * @return array|null + */ + public function getCustomHeaders() + { + return $this->container['custom_headers']; + } + + /** + * Sets custom_headers + * + * @param array|null $custom_headers Specifies custom headers you want convoy to add when the event is dispatched to your endpoint + * + * @return self + */ + public function setCustomHeaders($custom_headers) + { + if (is_null($custom_headers)) { + throw new \InvalidArgumentException('non-nullable custom_headers cannot be null'); + } + $this->container['custom_headers'] = $custom_headers; + + return $this; + } + + /** + * Gets data + * + * @return array|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param array|null $data Data is an arbitrary JSON value that gets sent as the body of the webhook to the endpoints + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type Event Type is used for filtering and debugging e.g invoice.paid + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets idempotency_key + * + * @return string|null + */ + public function getIdempotencyKey() + { + return $this->container['idempotency_key']; + } + + /** + * Sets idempotency_key + * + * @param string|null $idempotency_key Specify a key for event deduplication + * + * @return self + */ + public function setIdempotencyKey($idempotency_key) + { + if (is_null($idempotency_key)) { + throw new \InvalidArgumentException('non-nullable idempotency_key cannot be null'); + } + $this->container['idempotency_key'] = $idempotency_key; + + return $this; + } + + /** + * Gets owner_id + * + * @return string|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param string|null $owner_id Used for fanout, sends this event to all endpoints with this OwnerID. + * + * @return self + */ + public function setOwnerId($owner_id) + { + if (is_null($owner_id)) { + throw new \InvalidArgumentException('non-nullable owner_id cannot be null'); + } + $this->container['owner_id'] = $owner_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsFilterConfiguration.php b/src/Client/Model/ModelsFilterConfiguration.php new file mode 100644 index 0000000..075b482 --- /dev/null +++ b/src/Client/Model/ModelsFilterConfiguration.php @@ -0,0 +1,444 @@ + + */ +class ModelsFilterConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.FilterConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'event_types' => 'string[]', + 'filter' => '\Convoy\Client\Model\ModelsFS' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'event_types' => null, + 'filter' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'event_types' => false, + 'filter' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'event_types' => 'event_types', + 'filter' => 'filter' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'event_types' => 'setEventTypes', + 'filter' => 'setFilter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'event_types' => 'getEventTypes', + 'filter' => 'getFilter' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_types', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_types + * + * @return string[]|null + */ + public function getEventTypes() + { + return $this->container['event_types']; + } + + /** + * Sets event_types + * + * @param string[]|null $event_types List of event types that the subscription should match + * + * @return self + */ + public function setEventTypes($event_types) + { + if (is_null($event_types)) { + throw new \InvalidArgumentException('non-nullable event_types cannot be null'); + } + $this->container['event_types'] = $event_types; + + return $this; + } + + /** + * Gets filter + * + * @return \Convoy\Client\Model\ModelsFS|null + */ + public function getFilter() + { + return $this->container['filter']; + } + + /** + * Sets filter + * + * @param \Convoy\Client\Model\ModelsFS|null $filter Body & Header filters + * + * @return self + */ + public function setFilter($filter) + { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } + $this->container['filter'] = $filter; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsFilterResponse.php b/src/Client/Model/ModelsFilterResponse.php new file mode 100644 index 0000000..3bd3d57 --- /dev/null +++ b/src/Client/Model/ModelsFilterResponse.php @@ -0,0 +1,784 @@ + + */ +class ModelsFilterResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.FilterResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'body' => 'array', + 'enabled_at' => 'string', + 'event_type' => 'string', + 'headers' => 'array', + 'path' => 'array', + 'query' => 'array', + 'raw_body' => 'array', + 'raw_headers' => 'array', + 'raw_path' => 'array', + 'raw_query' => 'array', + 'subscription_id' => 'string', + 'uid' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'body' => null, + 'enabled_at' => null, + 'event_type' => null, + 'headers' => null, + 'path' => null, + 'query' => null, + 'raw_body' => null, + 'raw_headers' => null, + 'raw_path' => null, + 'raw_query' => null, + 'subscription_id' => null, + 'uid' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'body' => false, + 'enabled_at' => false, + 'event_type' => false, + 'headers' => false, + 'path' => false, + 'query' => false, + 'raw_body' => false, + 'raw_headers' => false, + 'raw_path' => false, + 'raw_query' => false, + 'subscription_id' => false, + 'uid' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'body' => 'body', + 'enabled_at' => 'enabled_at', + 'event_type' => 'event_type', + 'headers' => 'headers', + 'path' => 'path', + 'query' => 'query', + 'raw_body' => 'raw_body', + 'raw_headers' => 'raw_headers', + 'raw_path' => 'raw_path', + 'raw_query' => 'raw_query', + 'subscription_id' => 'subscription_id', + 'uid' => 'uid' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'body' => 'setBody', + 'enabled_at' => 'setEnabledAt', + 'event_type' => 'setEventType', + 'headers' => 'setHeaders', + 'path' => 'setPath', + 'query' => 'setQuery', + 'raw_body' => 'setRawBody', + 'raw_headers' => 'setRawHeaders', + 'raw_path' => 'setRawPath', + 'raw_query' => 'setRawQuery', + 'subscription_id' => 'setSubscriptionId', + 'uid' => 'setUid' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'body' => 'getBody', + 'enabled_at' => 'getEnabledAt', + 'event_type' => 'getEventType', + 'headers' => 'getHeaders', + 'path' => 'getPath', + 'query' => 'getQuery', + 'raw_body' => 'getRawBody', + 'raw_headers' => 'getRawHeaders', + 'raw_path' => 'getRawPath', + 'raw_query' => 'getRawQuery', + 'subscription_id' => 'getSubscriptionId', + 'uid' => 'getUid' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('enabled_at', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('path', $data ?? [], null); + $this->setIfExists('query', $data ?? [], null); + $this->setIfExists('raw_body', $data ?? [], null); + $this->setIfExists('raw_headers', $data ?? [], null); + $this->setIfExists('raw_path', $data ?? [], null); + $this->setIfExists('raw_query', $data ?? [], null); + $this->setIfExists('subscription_id', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets body + * + * @return array|null + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param array|null $body body + * + * @return self + */ + public function setBody($body) + { + if (is_null($body)) { + throw new \InvalidArgumentException('non-nullable body cannot be null'); + } + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets enabled_at + * + * @return string|null + */ + public function getEnabledAt() + { + return $this->container['enabled_at']; + } + + /** + * Sets enabled_at + * + * @param string|null $enabled_at enabled_at + * + * @return self + */ + public function setEnabledAt($enabled_at) + { + if (is_null($enabled_at)) { + throw new \InvalidArgumentException('non-nullable enabled_at cannot be null'); + } + $this->container['enabled_at'] = $enabled_at; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets headers + * + * @return array|null + */ + public function getHeaders() + { + return $this->container['headers']; + } + + /** + * Sets headers + * + * @param array|null $headers headers + * + * @return self + */ + public function setHeaders($headers) + { + if (is_null($headers)) { + throw new \InvalidArgumentException('non-nullable headers cannot be null'); + } + $this->container['headers'] = $headers; + + return $this; + } + + /** + * Gets path + * + * @return array|null + */ + public function getPath() + { + return $this->container['path']; + } + + /** + * Sets path + * + * @param array|null $path path + * + * @return self + */ + public function setPath($path) + { + if (is_null($path)) { + throw new \InvalidArgumentException('non-nullable path cannot be null'); + } + $this->container['path'] = $path; + + return $this; + } + + /** + * Gets query + * + * @return array|null + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param array|null $query query + * + * @return self + */ + public function setQuery($query) + { + if (is_null($query)) { + throw new \InvalidArgumentException('non-nullable query cannot be null'); + } + $this->container['query'] = $query; + + return $this; + } + + /** + * Gets raw_body + * + * @return array|null + */ + public function getRawBody() + { + return $this->container['raw_body']; + } + + /** + * Sets raw_body + * + * @param array|null $raw_body raw_body + * + * @return self + */ + public function setRawBody($raw_body) + { + if (is_null($raw_body)) { + throw new \InvalidArgumentException('non-nullable raw_body cannot be null'); + } + $this->container['raw_body'] = $raw_body; + + return $this; + } + + /** + * Gets raw_headers + * + * @return array|null + */ + public function getRawHeaders() + { + return $this->container['raw_headers']; + } + + /** + * Sets raw_headers + * + * @param array|null $raw_headers raw_headers + * + * @return self + */ + public function setRawHeaders($raw_headers) + { + if (is_null($raw_headers)) { + throw new \InvalidArgumentException('non-nullable raw_headers cannot be null'); + } + $this->container['raw_headers'] = $raw_headers; + + return $this; + } + + /** + * Gets raw_path + * + * @return array|null + */ + public function getRawPath() + { + return $this->container['raw_path']; + } + + /** + * Sets raw_path + * + * @param array|null $raw_path raw_path + * + * @return self + */ + public function setRawPath($raw_path) + { + if (is_null($raw_path)) { + throw new \InvalidArgumentException('non-nullable raw_path cannot be null'); + } + $this->container['raw_path'] = $raw_path; + + return $this; + } + + /** + * Gets raw_query + * + * @return array|null + */ + public function getRawQuery() + { + return $this->container['raw_query']; + } + + /** + * Sets raw_query + * + * @param array|null $raw_query raw_query + * + * @return self + */ + public function setRawQuery($raw_query) + { + if (is_null($raw_query)) { + throw new \InvalidArgumentException('non-nullable raw_query cannot be null'); + } + $this->container['raw_query'] = $raw_query; + + return $this; + } + + /** + * Gets subscription_id + * + * @return string|null + */ + public function getSubscriptionId() + { + return $this->container['subscription_id']; + } + + /** + * Sets subscription_id + * + * @param string|null $subscription_id subscription_id + * + * @return self + */ + public function setSubscriptionId($subscription_id) + { + if (is_null($subscription_id)) { + throw new \InvalidArgumentException('non-nullable subscription_id cannot be null'); + } + $this->container['subscription_id'] = $subscription_id; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsFilterSchema.php b/src/Client/Model/ModelsFilterSchema.php new file mode 100644 index 0000000..f46783b --- /dev/null +++ b/src/Client/Model/ModelsFilterSchema.php @@ -0,0 +1,540 @@ + + */ +class ModelsFilterSchema implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.FilterSchema'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'body' => 'mixed', + 'header' => 'mixed', + 'path' => 'mixed', + 'query' => 'mixed' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'body' => null, + 'header' => null, + 'path' => null, + 'query' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'body' => true, + 'header' => true, + 'path' => true, + 'query' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'body' => 'body', + 'header' => 'header', + 'path' => 'path', + 'query' => 'query' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'body' => 'setBody', + 'header' => 'setHeader', + 'path' => 'setPath', + 'query' => 'setQuery' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'body' => 'getBody', + 'header' => 'getHeader', + 'path' => 'getPath', + 'query' => 'getQuery' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('header', $data ?? [], null); + $this->setIfExists('path', $data ?? [], null); + $this->setIfExists('query', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets body + * + * @return mixed|null + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param mixed|null $body body + * + * @return self + */ + public function setBody($body) + { + if (is_null($body)) { + array_push($this->openAPINullablesSetToNull, 'body'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('body', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets header + * + * @return mixed|null + */ + public function getHeader() + { + return $this->container['header']; + } + + /** + * Sets header + * + * @param mixed|null $header header + * + * @return self + */ + public function setHeader($header) + { + if (is_null($header)) { + array_push($this->openAPINullablesSetToNull, 'header'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('header', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['header'] = $header; + + return $this; + } + + /** + * Gets path + * + * @return mixed|null + */ + public function getPath() + { + return $this->container['path']; + } + + /** + * Sets path + * + * @param mixed|null $path path + * + * @return self + */ + public function setPath($path) + { + if (is_null($path)) { + array_push($this->openAPINullablesSetToNull, 'path'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('path', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['path'] = $path; + + return $this; + } + + /** + * Gets query + * + * @return mixed|null + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param mixed|null $query query + * + * @return self + */ + public function setQuery($query) + { + if (is_null($query)) { + array_push($this->openAPINullablesSetToNull, 'query'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('query', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['query'] = $query; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsFunctionRequest.php b/src/Client/Model/ModelsFunctionRequest.php new file mode 100644 index 0000000..44813a6 --- /dev/null +++ b/src/Client/Model/ModelsFunctionRequest.php @@ -0,0 +1,478 @@ + + */ +class ModelsFunctionRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.FunctionRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'function' => 'string', + 'payload' => 'array', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'function' => null, + 'payload' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'function' => false, + 'payload' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'function' => 'function', + 'payload' => 'payload', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'function' => 'setFunction', + 'payload' => 'setPayload', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'function' => 'getFunction', + 'payload' => 'getPayload', + 'type' => 'getType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('function', $data ?? [], null); + $this->setIfExists('payload', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets function + * + * @return string|null + */ + public function getFunction() + { + return $this->container['function']; + } + + /** + * Sets function + * + * @param string|null $function function + * + * @return self + */ + public function setFunction($function) + { + if (is_null($function)) { + throw new \InvalidArgumentException('non-nullable function cannot be null'); + } + $this->container['function'] = $function; + + return $this; + } + + /** + * Gets payload + * + * @return array|null + */ + public function getPayload() + { + return $this->container['payload']; + } + + /** + * Sets payload + * + * @param array|null $payload payload + * + * @return self + */ + public function setPayload($payload) + { + if (is_null($payload)) { + throw new \InvalidArgumentException('non-nullable payload cannot be null'); + } + $this->container['payload'] = $payload; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsFunctionResponse.php b/src/Client/Model/ModelsFunctionResponse.php new file mode 100644 index 0000000..ed756db --- /dev/null +++ b/src/Client/Model/ModelsFunctionResponse.php @@ -0,0 +1,451 @@ + + */ +class ModelsFunctionResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.FunctionResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'log' => 'string[]', + 'payload' => 'mixed' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'log' => null, + 'payload' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'log' => false, + 'payload' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'log' => 'log', + 'payload' => 'payload' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'log' => 'setLog', + 'payload' => 'setPayload' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'log' => 'getLog', + 'payload' => 'getPayload' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('log', $data ?? [], null); + $this->setIfExists('payload', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets log + * + * @return string[]|null + */ + public function getLog() + { + return $this->container['log']; + } + + /** + * Sets log + * + * @param string[]|null $log log + * + * @return self + */ + public function setLog($log) + { + if (is_null($log)) { + throw new \InvalidArgumentException('non-nullable log cannot be null'); + } + $this->container['log'] = $log; + + return $this; + } + + /** + * Gets payload + * + * @return mixed|null + */ + public function getPayload() + { + return $this->container['payload']; + } + + /** + * Sets payload + * + * @param mixed|null $payload payload + * + * @return self + */ + public function setPayload($payload) + { + if (is_null($payload)) { + array_push($this->openAPINullablesSetToNull, 'payload'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('payload', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['payload'] = $payload; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsGooglePubSubConfig.php b/src/Client/Model/ModelsGooglePubSubConfig.php new file mode 100644 index 0000000..9eb7f12 --- /dev/null +++ b/src/Client/Model/ModelsGooglePubSubConfig.php @@ -0,0 +1,478 @@ + + */ +class ModelsGooglePubSubConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.GooglePubSubConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'project_id' => 'string', + 'service_account' => 'string', + 'subscription_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'project_id' => null, + 'service_account' => 'byte', + 'subscription_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'project_id' => false, + 'service_account' => false, + 'subscription_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'project_id' => 'project_id', + 'service_account' => 'service_account', + 'subscription_id' => 'subscription_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'project_id' => 'setProjectId', + 'service_account' => 'setServiceAccount', + 'subscription_id' => 'setSubscriptionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'project_id' => 'getProjectId', + 'service_account' => 'getServiceAccount', + 'subscription_id' => 'getSubscriptionId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('project_id', $data ?? [], null); + $this->setIfExists('service_account', $data ?? [], null); + $this->setIfExists('subscription_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets project_id + * + * @return string|null + */ + public function getProjectId() + { + return $this->container['project_id']; + } + + /** + * Sets project_id + * + * @param string|null $project_id project_id + * + * @return self + */ + public function setProjectId($project_id) + { + if (is_null($project_id)) { + throw new \InvalidArgumentException('non-nullable project_id cannot be null'); + } + $this->container['project_id'] = $project_id; + + return $this; + } + + /** + * Gets service_account + * + * @return string|null + */ + public function getServiceAccount() + { + return $this->container['service_account']; + } + + /** + * Sets service_account + * + * @param string|null $service_account encoding/json marshals []byte as a base64 string on the wire. + * + * @return self + */ + public function setServiceAccount($service_account) + { + if (is_null($service_account)) { + throw new \InvalidArgumentException('non-nullable service_account cannot be null'); + } + $this->container['service_account'] = $service_account; + + return $this; + } + + /** + * Gets subscription_id + * + * @return string|null + */ + public function getSubscriptionId() + { + return $this->container['subscription_id']; + } + + /** + * Sets subscription_id + * + * @param string|null $subscription_id subscription_id + * + * @return self + */ + public function setSubscriptionId($subscription_id) + { + if (is_null($subscription_id)) { + throw new \InvalidArgumentException('non-nullable subscription_id cannot be null'); + } + $this->container['subscription_id'] = $subscription_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsHMac.php b/src/Client/Model/ModelsHMac.php new file mode 100644 index 0000000..81c54b2 --- /dev/null +++ b/src/Client/Model/ModelsHMac.php @@ -0,0 +1,524 @@ + + */ +class ModelsHMac implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.HMac'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'encoding' => '\Convoy\Client\Model\DatastoreEncodingType', + 'hash' => 'string', + 'header' => 'string', + 'secret' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'encoding' => null, + 'hash' => null, + 'header' => null, + 'secret' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'encoding' => false, + 'hash' => false, + 'header' => false, + 'secret' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'encoding' => 'encoding', + 'hash' => 'hash', + 'header' => 'header', + 'secret' => 'secret' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'encoding' => 'setEncoding', + 'hash' => 'setHash', + 'header' => 'setHeader', + 'secret' => 'setSecret' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'encoding' => 'getEncoding', + 'hash' => 'getHash', + 'header' => 'getHeader', + 'secret' => 'getSecret' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('encoding', $data ?? [], null); + $this->setIfExists('hash', $data ?? [], null); + $this->setIfExists('header', $data ?? [], null); + $this->setIfExists('secret', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['encoding'] === null) { + $invalidProperties[] = "'encoding' can't be null"; + } + if ($this->container['hash'] === null) { + $invalidProperties[] = "'hash' can't be null"; + } + if ($this->container['header'] === null) { + $invalidProperties[] = "'header' can't be null"; + } + if ($this->container['secret'] === null) { + $invalidProperties[] = "'secret' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets encoding + * + * @return \Convoy\Client\Model\DatastoreEncodingType + */ + public function getEncoding() + { + return $this->container['encoding']; + } + + /** + * Sets encoding + * + * @param \Convoy\Client\Model\DatastoreEncodingType $encoding encoding + * + * @return self + */ + public function setEncoding($encoding) + { + if (is_null($encoding)) { + throw new \InvalidArgumentException('non-nullable encoding cannot be null'); + } + $this->container['encoding'] = $encoding; + + return $this; + } + + /** + * Gets hash + * + * @return string + */ + public function getHash() + { + return $this->container['hash']; + } + + /** + * Sets hash + * + * @param string $hash hash + * + * @return self + */ + public function setHash($hash) + { + if (is_null($hash)) { + throw new \InvalidArgumentException('non-nullable hash cannot be null'); + } + $this->container['hash'] = $hash; + + return $this; + } + + /** + * Gets header + * + * @return string + */ + public function getHeader() + { + return $this->container['header']; + } + + /** + * Sets header + * + * @param string $header header + * + * @return self + */ + public function setHeader($header) + { + if (is_null($header)) { + throw new \InvalidArgumentException('non-nullable header cannot be null'); + } + $this->container['header'] = $header; + + return $this; + } + + /** + * Gets secret + * + * @return string + */ + public function getSecret() + { + return $this->container['secret']; + } + + /** + * Sets secret + * + * @param string $secret secret + * + * @return self + */ + public function setSecret($secret) + { + if (is_null($secret)) { + throw new \InvalidArgumentException('non-nullable secret cannot be null'); + } + $this->container['secret'] = $secret; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsIDs.php b/src/Client/Model/ModelsIDs.php new file mode 100644 index 0000000..758484d --- /dev/null +++ b/src/Client/Model/ModelsIDs.php @@ -0,0 +1,410 @@ + + */ +class ModelsIDs implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.IDs'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ids' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ids' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'ids' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'ids' => 'ids' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ids' => 'setIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ids' => 'getIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('ids', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets ids + * + * @return string[]|null + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param string[]|null $ids A list of event delivery IDs to forcefully resend. + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + throw new \InvalidArgumentException('non-nullable ids cannot be null'); + } + $this->container['ids'] = $ids; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsImportOpenAPISpec.php b/src/Client/Model/ModelsImportOpenAPISpec.php new file mode 100644 index 0000000..5b794be --- /dev/null +++ b/src/Client/Model/ModelsImportOpenAPISpec.php @@ -0,0 +1,410 @@ + + */ +class ModelsImportOpenAPISpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.ImportOpenAPISpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'spec' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'spec' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'spec' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'spec' => 'spec' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'spec' => 'setSpec' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'spec' => 'getSpec' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('spec', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets spec + * + * @return string|null + */ + public function getSpec() + { + return $this->container['spec']; + } + + /** + * Sets spec + * + * @param string|null $spec spec + * + * @return self + */ + public function setSpec($spec) + { + if (is_null($spec)) { + throw new \InvalidArgumentException('non-nullable spec cannot be null'); + } + $this->container['spec'] = $spec; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsKafkaAuth.php b/src/Client/Model/ModelsKafkaAuth.php new file mode 100644 index 0000000..dd4cc17 --- /dev/null +++ b/src/Client/Model/ModelsKafkaAuth.php @@ -0,0 +1,546 @@ + + */ +class ModelsKafkaAuth implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.KafkaAuth'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'hash' => 'string', + 'password' => 'string', + 'tls' => 'bool', + 'type' => 'string', + 'username' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'hash' => null, + 'password' => null, + 'tls' => null, + 'type' => null, + 'username' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'hash' => false, + 'password' => false, + 'tls' => false, + 'type' => false, + 'username' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'hash' => 'hash', + 'password' => 'password', + 'tls' => 'tls', + 'type' => 'type', + 'username' => 'username' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'hash' => 'setHash', + 'password' => 'setPassword', + 'tls' => 'setTls', + 'type' => 'setType', + 'username' => 'setUsername' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'hash' => 'getHash', + 'password' => 'getPassword', + 'tls' => 'getTls', + 'type' => 'getType', + 'username' => 'getUsername' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('hash', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('tls', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets hash + * + * @return string|null + */ + public function getHash() + { + return $this->container['hash']; + } + + /** + * Sets hash + * + * @param string|null $hash hash + * + * @return self + */ + public function setHash($hash) + { + if (is_null($hash)) { + throw new \InvalidArgumentException('non-nullable hash cannot be null'); + } + $this->container['hash'] = $hash; + + return $this; + } + + /** + * Gets password + * + * @return string|null + */ + public function getPassword() + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string|null $password password + * + * @return self + */ + public function setPassword($password) + { + if (is_null($password)) { + throw new \InvalidArgumentException('non-nullable password cannot be null'); + } + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets tls + * + * @return bool|null + */ + public function getTls() + { + return $this->container['tls']; + } + + /** + * Sets tls + * + * @param bool|null $tls tls + * + * @return self + */ + public function setTls($tls) + { + if (is_null($tls)) { + throw new \InvalidArgumentException('non-nullable tls cannot be null'); + } + $this->container['tls'] = $tls; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets username + * + * @return string|null + */ + public function getUsername() + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string|null $username username + * + * @return self + */ + public function setUsername($username) + { + if (is_null($username)) { + throw new \InvalidArgumentException('non-nullable username cannot be null'); + } + $this->container['username'] = $username; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsKafkaPubSubConfig.php b/src/Client/Model/ModelsKafkaPubSubConfig.php new file mode 100644 index 0000000..a894fb1 --- /dev/null +++ b/src/Client/Model/ModelsKafkaPubSubConfig.php @@ -0,0 +1,512 @@ + + */ +class ModelsKafkaPubSubConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.KafkaPubSubConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'auth' => '\Convoy\Client\Model\ModelsKafkaAuth', + 'brokers' => 'string[]', + 'consumer_group_id' => 'string', + 'topic_name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'auth' => null, + 'brokers' => null, + 'consumer_group_id' => null, + 'topic_name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'auth' => false, + 'brokers' => false, + 'consumer_group_id' => false, + 'topic_name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'auth' => 'auth', + 'brokers' => 'brokers', + 'consumer_group_id' => 'consumer_group_id', + 'topic_name' => 'topic_name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'auth' => 'setAuth', + 'brokers' => 'setBrokers', + 'consumer_group_id' => 'setConsumerGroupId', + 'topic_name' => 'setTopicName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'auth' => 'getAuth', + 'brokers' => 'getBrokers', + 'consumer_group_id' => 'getConsumerGroupId', + 'topic_name' => 'getTopicName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('auth', $data ?? [], null); + $this->setIfExists('brokers', $data ?? [], null); + $this->setIfExists('consumer_group_id', $data ?? [], null); + $this->setIfExists('topic_name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets auth + * + * @return \Convoy\Client\Model\ModelsKafkaAuth|null + */ + public function getAuth() + { + return $this->container['auth']; + } + + /** + * Sets auth + * + * @param \Convoy\Client\Model\ModelsKafkaAuth|null $auth auth + * + * @return self + */ + public function setAuth($auth) + { + if (is_null($auth)) { + throw new \InvalidArgumentException('non-nullable auth cannot be null'); + } + $this->container['auth'] = $auth; + + return $this; + } + + /** + * Gets brokers + * + * @return string[]|null + */ + public function getBrokers() + { + return $this->container['brokers']; + } + + /** + * Sets brokers + * + * @param string[]|null $brokers brokers + * + * @return self + */ + public function setBrokers($brokers) + { + if (is_null($brokers)) { + throw new \InvalidArgumentException('non-nullable brokers cannot be null'); + } + $this->container['brokers'] = $brokers; + + return $this; + } + + /** + * Gets consumer_group_id + * + * @return string|null + */ + public function getConsumerGroupId() + { + return $this->container['consumer_group_id']; + } + + /** + * Sets consumer_group_id + * + * @param string|null $consumer_group_id consumer_group_id + * + * @return self + */ + public function setConsumerGroupId($consumer_group_id) + { + if (is_null($consumer_group_id)) { + throw new \InvalidArgumentException('non-nullable consumer_group_id cannot be null'); + } + $this->container['consumer_group_id'] = $consumer_group_id; + + return $this; + } + + /** + * Gets topic_name + * + * @return string|null + */ + public function getTopicName() + { + return $this->container['topic_name']; + } + + /** + * Sets topic_name + * + * @param string|null $topic_name topic_name + * + * @return self + */ + public function setTopicName($topic_name) + { + if (is_null($topic_name)) { + throw new \InvalidArgumentException('non-nullable topic_name cannot be null'); + } + $this->container['topic_name'] = $topic_name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsMetaEventConfiguration.php b/src/Client/Model/ModelsMetaEventConfiguration.php new file mode 100644 index 0000000..2f2d727 --- /dev/null +++ b/src/Client/Model/ModelsMetaEventConfiguration.php @@ -0,0 +1,546 @@ + + */ +class ModelsMetaEventConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.MetaEventConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'event_type' => 'string[]', + 'is_enabled' => 'bool', + 'secret' => 'string', + 'type' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'event_type' => null, + 'is_enabled' => null, + 'secret' => null, + 'type' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'is_enabled' => false, + 'secret' => false, + 'type' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'event_type' => 'event_type', + 'is_enabled' => 'is_enabled', + 'secret' => 'secret', + 'type' => 'type', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'event_type' => 'setEventType', + 'is_enabled' => 'setIsEnabled', + 'secret' => 'setSecret', + 'type' => 'setType', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'event_type' => 'getEventType', + 'is_enabled' => 'getIsEnabled', + 'secret' => 'getSecret', + 'type' => 'getType', + 'url' => 'getUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('is_enabled', $data ?? [], null); + $this->setIfExists('secret', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string[]|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string[]|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets is_enabled + * + * @return bool|null + */ + public function getIsEnabled() + { + return $this->container['is_enabled']; + } + + /** + * Sets is_enabled + * + * @param bool|null $is_enabled is_enabled + * + * @return self + */ + public function setIsEnabled($is_enabled) + { + if (is_null($is_enabled)) { + throw new \InvalidArgumentException('non-nullable is_enabled cannot be null'); + } + $this->container['is_enabled'] = $is_enabled; + + return $this; + } + + /** + * Gets secret + * + * @return string|null + */ + public function getSecret() + { + return $this->container['secret']; + } + + /** + * Sets secret + * + * @param string|null $secret secret + * + * @return self + */ + public function setSecret($secret) + { + if (is_null($secret)) { + throw new \InvalidArgumentException('non-nullable secret cannot be null'); + } + $this->container['secret'] = $secret; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url url + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsMetaEventResponse.php b/src/Client/Model/ModelsMetaEventResponse.php new file mode 100644 index 0000000..33ff7ba --- /dev/null +++ b/src/Client/Model/ModelsMetaEventResponse.php @@ -0,0 +1,682 @@ + + */ +class ModelsMetaEventResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.MetaEventResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'attempt' => '\Convoy\Client\Model\DatastoreMetaEventAttempt', + 'created_at' => 'string', + 'deleted_at' => 'string', + 'event_type' => 'string', + 'metadata' => '\Convoy\Client\Model\DatastoreMetadata', + 'project_id' => 'string', + 'status' => '\Convoy\Client\Model\DatastoreEventDeliveryStatus', + 'uid' => 'string', + 'updated_at' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'attempt' => null, + 'created_at' => null, + 'deleted_at' => null, + 'event_type' => null, + 'metadata' => null, + 'project_id' => null, + 'status' => null, + 'uid' => null, + 'updated_at' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'attempt' => false, + 'created_at' => false, + 'deleted_at' => false, + 'event_type' => false, + 'metadata' => false, + 'project_id' => false, + 'status' => false, + 'uid' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'attempt' => 'attempt', + 'created_at' => 'created_at', + 'deleted_at' => 'deleted_at', + 'event_type' => 'event_type', + 'metadata' => 'metadata', + 'project_id' => 'project_id', + 'status' => 'status', + 'uid' => 'uid', + 'updated_at' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'attempt' => 'setAttempt', + 'created_at' => 'setCreatedAt', + 'deleted_at' => 'setDeletedAt', + 'event_type' => 'setEventType', + 'metadata' => 'setMetadata', + 'project_id' => 'setProjectId', + 'status' => 'setStatus', + 'uid' => 'setUid', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'attempt' => 'getAttempt', + 'created_at' => 'getCreatedAt', + 'deleted_at' => 'getDeletedAt', + 'event_type' => 'getEventType', + 'metadata' => 'getMetadata', + 'project_id' => 'getProjectId', + 'status' => 'getStatus', + 'uid' => 'getUid', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('attempt', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('deleted_at', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('project_id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets attempt + * + * @return \Convoy\Client\Model\DatastoreMetaEventAttempt|null + */ + public function getAttempt() + { + return $this->container['attempt']; + } + + /** + * Sets attempt + * + * @param \Convoy\Client\Model\DatastoreMetaEventAttempt|null $attempt attempt + * + * @return self + */ + public function setAttempt($attempt) + { + if (is_null($attempt)) { + throw new \InvalidArgumentException('non-nullable attempt cannot be null'); + } + $this->container['attempt'] = $attempt; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets deleted_at + * + * @return string|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param string|null $deleted_at deleted_at + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + if (is_null($deleted_at)) { + throw new \InvalidArgumentException('non-nullable deleted_at cannot be null'); + } + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets metadata + * + * @return \Convoy\Client\Model\DatastoreMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \Convoy\Client\Model\DatastoreMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets project_id + * + * @return string|null + */ + public function getProjectId() + { + return $this->container['project_id']; + } + + /** + * Sets project_id + * + * @param string|null $project_id project_id + * + * @return self + */ + public function setProjectId($project_id) + { + if (is_null($project_id)) { + throw new \InvalidArgumentException('non-nullable project_id cannot be null'); + } + $this->container['project_id'] = $project_id; + + return $this; + } + + /** + * Gets status + * + * @return \Convoy\Client\Model\DatastoreEventDeliveryStatus|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Convoy\Client\Model\DatastoreEventDeliveryStatus|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsMtlsClientCert.php b/src/Client/Model/ModelsMtlsClientCert.php new file mode 100644 index 0000000..c727e22 --- /dev/null +++ b/src/Client/Model/ModelsMtlsClientCert.php @@ -0,0 +1,444 @@ + + */ +class ModelsMtlsClientCert implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.MtlsClientCert'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'client_cert' => 'string', + 'client_key' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'client_cert' => null, + 'client_key' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'client_cert' => false, + 'client_key' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'client_cert' => 'client_cert', + 'client_key' => 'client_key' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'client_cert' => 'setClientCert', + 'client_key' => 'setClientKey' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'client_cert' => 'getClientCert', + 'client_key' => 'getClientKey' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('client_cert', $data ?? [], null); + $this->setIfExists('client_key', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets client_cert + * + * @return string|null + */ + public function getClientCert() + { + return $this->container['client_cert']; + } + + /** + * Sets client_cert + * + * @param string|null $client_cert ClientCert is the client certificate PEM string + * + * @return self + */ + public function setClientCert($client_cert) + { + if (is_null($client_cert)) { + throw new \InvalidArgumentException('non-nullable client_cert cannot be null'); + } + $this->container['client_cert'] = $client_cert; + + return $this; + } + + /** + * Gets client_key + * + * @return string|null + */ + public function getClientKey() + { + return $this->container['client_key']; + } + + /** + * Sets client_key + * + * @param string|null $client_key ClientKey is the client private key PEM string + * + * @return self + */ + public function setClientKey($client_key) + { + if (is_null($client_key)) { + throw new \InvalidArgumentException('non-nullable client_key cannot be null'); + } + $this->container['client_key'] = $client_key; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsOAuth2.php b/src/Client/Model/ModelsOAuth2.php new file mode 100644 index 0000000..f146769 --- /dev/null +++ b/src/Client/Model/ModelsOAuth2.php @@ -0,0 +1,818 @@ + + */ +class ModelsOAuth2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.OAuth2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'audience' => 'string', + 'authentication_type' => 'string', + 'client_id' => 'string', + 'client_secret' => 'string', + 'expiry_time_unit' => 'string', + 'field_mapping' => '\Convoy\Client\Model\ModelsOAuth2FieldMapping', + 'grant_type' => 'string', + 'issuer' => 'string', + 'scope' => 'string', + 'signing_algorithm' => 'string', + 'signing_key' => '\Convoy\Client\Model\ModelsOAuth2SigningKey', + 'subject' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'audience' => null, + 'authentication_type' => null, + 'client_id' => null, + 'client_secret' => null, + 'expiry_time_unit' => null, + 'field_mapping' => null, + 'grant_type' => null, + 'issuer' => null, + 'scope' => null, + 'signing_algorithm' => null, + 'signing_key' => null, + 'subject' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'audience' => false, + 'authentication_type' => false, + 'client_id' => false, + 'client_secret' => false, + 'expiry_time_unit' => false, + 'field_mapping' => false, + 'grant_type' => false, + 'issuer' => false, + 'scope' => false, + 'signing_algorithm' => false, + 'signing_key' => false, + 'subject' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'audience' => 'audience', + 'authentication_type' => 'authentication_type', + 'client_id' => 'client_id', + 'client_secret' => 'client_secret', + 'expiry_time_unit' => 'expiry_time_unit', + 'field_mapping' => 'field_mapping', + 'grant_type' => 'grant_type', + 'issuer' => 'issuer', + 'scope' => 'scope', + 'signing_algorithm' => 'signing_algorithm', + 'signing_key' => 'signing_key', + 'subject' => 'subject', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'audience' => 'setAudience', + 'authentication_type' => 'setAuthenticationType', + 'client_id' => 'setClientId', + 'client_secret' => 'setClientSecret', + 'expiry_time_unit' => 'setExpiryTimeUnit', + 'field_mapping' => 'setFieldMapping', + 'grant_type' => 'setGrantType', + 'issuer' => 'setIssuer', + 'scope' => 'setScope', + 'signing_algorithm' => 'setSigningAlgorithm', + 'signing_key' => 'setSigningKey', + 'subject' => 'setSubject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'audience' => 'getAudience', + 'authentication_type' => 'getAuthenticationType', + 'client_id' => 'getClientId', + 'client_secret' => 'getClientSecret', + 'expiry_time_unit' => 'getExpiryTimeUnit', + 'field_mapping' => 'getFieldMapping', + 'grant_type' => 'getGrantType', + 'issuer' => 'getIssuer', + 'scope' => 'getScope', + 'signing_algorithm' => 'getSigningAlgorithm', + 'signing_key' => 'getSigningKey', + 'subject' => 'getSubject', + 'url' => 'getUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('audience', $data ?? [], null); + $this->setIfExists('authentication_type', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('client_secret', $data ?? [], null); + $this->setIfExists('expiry_time_unit', $data ?? [], null); + $this->setIfExists('field_mapping', $data ?? [], null); + $this->setIfExists('grant_type', $data ?? [], null); + $this->setIfExists('issuer', $data ?? [], null); + $this->setIfExists('scope', $data ?? [], null); + $this->setIfExists('signing_algorithm', $data ?? [], null); + $this->setIfExists('signing_key', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets audience + * + * @return string|null + */ + public function getAudience() + { + return $this->container['audience']; + } + + /** + * Sets audience + * + * @param string|null $audience audience + * + * @return self + */ + public function setAudience($audience) + { + if (is_null($audience)) { + throw new \InvalidArgumentException('non-nullable audience cannot be null'); + } + $this->container['audience'] = $audience; + + return $this; + } + + /** + * Gets authentication_type + * + * @return string|null + */ + public function getAuthenticationType() + { + return $this->container['authentication_type']; + } + + /** + * Sets authentication_type + * + * @param string|null $authentication_type authentication_type + * + * @return self + */ + public function setAuthenticationType($authentication_type) + { + if (is_null($authentication_type)) { + throw new \InvalidArgumentException('non-nullable authentication_type cannot be null'); + } + $this->container['authentication_type'] = $authentication_type; + + return $this; + } + + /** + * Gets client_id + * + * @return string|null + */ + public function getClientId() + { + return $this->container['client_id']; + } + + /** + * Sets client_id + * + * @param string|null $client_id client_id + * + * @return self + */ + public function setClientId($client_id) + { + if (is_null($client_id)) { + throw new \InvalidArgumentException('non-nullable client_id cannot be null'); + } + $this->container['client_id'] = $client_id; + + return $this; + } + + /** + * Gets client_secret + * + * @return string|null + */ + public function getClientSecret() + { + return $this->container['client_secret']; + } + + /** + * Sets client_secret + * + * @param string|null $client_secret client_secret + * + * @return self + */ + public function setClientSecret($client_secret) + { + if (is_null($client_secret)) { + throw new \InvalidArgumentException('non-nullable client_secret cannot be null'); + } + $this->container['client_secret'] = $client_secret; + + return $this; + } + + /** + * Gets expiry_time_unit + * + * @return string|null + */ + public function getExpiryTimeUnit() + { + return $this->container['expiry_time_unit']; + } + + /** + * Sets expiry_time_unit + * + * @param string|null $expiry_time_unit Expiry time unit (seconds, milliseconds, minutes, hours) + * + * @return self + */ + public function setExpiryTimeUnit($expiry_time_unit) + { + if (is_null($expiry_time_unit)) { + throw new \InvalidArgumentException('non-nullable expiry_time_unit cannot be null'); + } + $this->container['expiry_time_unit'] = $expiry_time_unit; + + return $this; + } + + /** + * Gets field_mapping + * + * @return \Convoy\Client\Model\ModelsOAuth2FieldMapping|null + */ + public function getFieldMapping() + { + return $this->container['field_mapping']; + } + + /** + * Sets field_mapping + * + * @param \Convoy\Client\Model\ModelsOAuth2FieldMapping|null $field_mapping Field mapping for flexible token response parsing + * + * @return self + */ + public function setFieldMapping($field_mapping) + { + if (is_null($field_mapping)) { + throw new \InvalidArgumentException('non-nullable field_mapping cannot be null'); + } + $this->container['field_mapping'] = $field_mapping; + + return $this; + } + + /** + * Gets grant_type + * + * @return string|null + */ + public function getGrantType() + { + return $this->container['grant_type']; + } + + /** + * Sets grant_type + * + * @param string|null $grant_type grant_type + * + * @return self + */ + public function setGrantType($grant_type) + { + if (is_null($grant_type)) { + throw new \InvalidArgumentException('non-nullable grant_type cannot be null'); + } + $this->container['grant_type'] = $grant_type; + + return $this; + } + + /** + * Gets issuer + * + * @return string|null + */ + public function getIssuer() + { + return $this->container['issuer']; + } + + /** + * Sets issuer + * + * @param string|null $issuer issuer + * + * @return self + */ + public function setIssuer($issuer) + { + if (is_null($issuer)) { + throw new \InvalidArgumentException('non-nullable issuer cannot be null'); + } + $this->container['issuer'] = $issuer; + + return $this; + } + + /** + * Gets scope + * + * @return string|null + */ + public function getScope() + { + return $this->container['scope']; + } + + /** + * Sets scope + * + * @param string|null $scope scope + * + * @return self + */ + public function setScope($scope) + { + if (is_null($scope)) { + throw new \InvalidArgumentException('non-nullable scope cannot be null'); + } + $this->container['scope'] = $scope; + + return $this; + } + + /** + * Gets signing_algorithm + * + * @return string|null + */ + public function getSigningAlgorithm() + { + return $this->container['signing_algorithm']; + } + + /** + * Sets signing_algorithm + * + * @param string|null $signing_algorithm signing_algorithm + * + * @return self + */ + public function setSigningAlgorithm($signing_algorithm) + { + if (is_null($signing_algorithm)) { + throw new \InvalidArgumentException('non-nullable signing_algorithm cannot be null'); + } + $this->container['signing_algorithm'] = $signing_algorithm; + + return $this; + } + + /** + * Gets signing_key + * + * @return \Convoy\Client\Model\ModelsOAuth2SigningKey|null + */ + public function getSigningKey() + { + return $this->container['signing_key']; + } + + /** + * Sets signing_key + * + * @param \Convoy\Client\Model\ModelsOAuth2SigningKey|null $signing_key signing_key + * + * @return self + */ + public function setSigningKey($signing_key) + { + if (is_null($signing_key)) { + throw new \InvalidArgumentException('non-nullable signing_key cannot be null'); + } + $this->container['signing_key'] = $signing_key; + + return $this; + } + + /** + * Gets subject + * + * @return string|null + */ + public function getSubject() + { + return $this->container['subject']; + } + + /** + * Sets subject + * + * @param string|null $subject subject + * + * @return self + */ + public function setSubject($subject) + { + if (is_null($subject)) { + throw new \InvalidArgumentException('non-nullable subject cannot be null'); + } + $this->container['subject'] = $subject; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url url + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsOAuth2FieldMapping.php b/src/Client/Model/ModelsOAuth2FieldMapping.php new file mode 100644 index 0000000..8b6138d --- /dev/null +++ b/src/Client/Model/ModelsOAuth2FieldMapping.php @@ -0,0 +1,478 @@ + + */ +class ModelsOAuth2FieldMapping implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.OAuth2FieldMapping'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'access_token' => 'string', + 'expires_in' => 'string', + 'token_type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'access_token' => null, + 'expires_in' => null, + 'token_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'access_token' => false, + 'expires_in' => false, + 'token_type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'access_token' => 'access_token', + 'expires_in' => 'expires_in', + 'token_type' => 'token_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'access_token' => 'setAccessToken', + 'expires_in' => 'setExpiresIn', + 'token_type' => 'setTokenType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'access_token' => 'getAccessToken', + 'expires_in' => 'getExpiresIn', + 'token_type' => 'getTokenType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('access_token', $data ?? [], null); + $this->setIfExists('expires_in', $data ?? [], null); + $this->setIfExists('token_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets access_token + * + * @return string|null + */ + public function getAccessToken() + { + return $this->container['access_token']; + } + + /** + * Sets access_token + * + * @param string|null $access_token Field name for access token (e.g., \"accessToken\", \"access_token\", \"token\") + * + * @return self + */ + public function setAccessToken($access_token) + { + if (is_null($access_token)) { + throw new \InvalidArgumentException('non-nullable access_token cannot be null'); + } + $this->container['access_token'] = $access_token; + + return $this; + } + + /** + * Gets expires_in + * + * @return string|null + */ + public function getExpiresIn() + { + return $this->container['expires_in']; + } + + /** + * Sets expires_in + * + * @param string|null $expires_in Field name for expiry time (e.g., \"expiresIn\", \"expires_in\", \"expiresAt\") + * + * @return self + */ + public function setExpiresIn($expires_in) + { + if (is_null($expires_in)) { + throw new \InvalidArgumentException('non-nullable expires_in cannot be null'); + } + $this->container['expires_in'] = $expires_in; + + return $this; + } + + /** + * Gets token_type + * + * @return string|null + */ + public function getTokenType() + { + return $this->container['token_type']; + } + + /** + * Sets token_type + * + * @param string|null $token_type Field name for token type (e.g., \"tokenType\", \"token_type\") + * + * @return self + */ + public function setTokenType($token_type) + { + if (is_null($token_type)) { + throw new \InvalidArgumentException('non-nullable token_type cannot be null'); + } + $this->container['token_type'] = $token_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsOAuth2SigningKey.php b/src/Client/Model/ModelsOAuth2SigningKey.php new file mode 100644 index 0000000..4577f05 --- /dev/null +++ b/src/Client/Model/ModelsOAuth2SigningKey.php @@ -0,0 +1,818 @@ + + */ +class ModelsOAuth2SigningKey implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.OAuth2SigningKey'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'crv' => 'string', + 'd' => 'string', + 'dp' => 'string', + 'dq' => 'string', + 'e' => 'string', + 'kid' => 'string', + 'kty' => 'string', + 'n' => 'string', + 'p' => 'string', + 'q' => 'string', + 'qi' => 'string', + 'x' => 'string', + 'y' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'crv' => null, + 'd' => null, + 'dp' => null, + 'dq' => null, + 'e' => null, + 'kid' => null, + 'kty' => null, + 'n' => null, + 'p' => null, + 'q' => null, + 'qi' => null, + 'x' => null, + 'y' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'crv' => false, + 'd' => false, + 'dp' => false, + 'dq' => false, + 'e' => false, + 'kid' => false, + 'kty' => false, + 'n' => false, + 'p' => false, + 'q' => false, + 'qi' => false, + 'x' => false, + 'y' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'crv' => 'crv', + 'd' => 'd', + 'dp' => 'dp', + 'dq' => 'dq', + 'e' => 'e', + 'kid' => 'kid', + 'kty' => 'kty', + 'n' => 'n', + 'p' => 'p', + 'q' => 'q', + 'qi' => 'qi', + 'x' => 'x', + 'y' => 'y' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'crv' => 'setCrv', + 'd' => 'setD', + 'dp' => 'setDp', + 'dq' => 'setDq', + 'e' => 'setE', + 'kid' => 'setKid', + 'kty' => 'setKty', + 'n' => 'setN', + 'p' => 'setP', + 'q' => 'setQ', + 'qi' => 'setQi', + 'x' => 'setX', + 'y' => 'setY' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'crv' => 'getCrv', + 'd' => 'getD', + 'dp' => 'getDp', + 'dq' => 'getDq', + 'e' => 'getE', + 'kid' => 'getKid', + 'kty' => 'getKty', + 'n' => 'getN', + 'p' => 'getP', + 'q' => 'getQ', + 'qi' => 'getQi', + 'x' => 'getX', + 'y' => 'getY' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('crv', $data ?? [], null); + $this->setIfExists('d', $data ?? [], null); + $this->setIfExists('dp', $data ?? [], null); + $this->setIfExists('dq', $data ?? [], null); + $this->setIfExists('e', $data ?? [], null); + $this->setIfExists('kid', $data ?? [], null); + $this->setIfExists('kty', $data ?? [], null); + $this->setIfExists('n', $data ?? [], null); + $this->setIfExists('p', $data ?? [], null); + $this->setIfExists('q', $data ?? [], null); + $this->setIfExists('qi', $data ?? [], null); + $this->setIfExists('x', $data ?? [], null); + $this->setIfExists('y', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets crv + * + * @return string|null + */ + public function getCrv() + { + return $this->container['crv']; + } + + /** + * Sets crv + * + * @param string|null $crv EC (Elliptic Curve) key fields + * + * @return self + */ + public function setCrv($crv) + { + if (is_null($crv)) { + throw new \InvalidArgumentException('non-nullable crv cannot be null'); + } + $this->container['crv'] = $crv; + + return $this; + } + + /** + * Gets d + * + * @return string|null + */ + public function getD() + { + return $this->container['d']; + } + + /** + * Sets d + * + * @param string|null $d Private key (EC) or private exponent (RSA) + * + * @return self + */ + public function setD($d) + { + if (is_null($d)) { + throw new \InvalidArgumentException('non-nullable d cannot be null'); + } + $this->container['d'] = $d; + + return $this; + } + + /** + * Gets dp + * + * @return string|null + */ + public function getDp() + { + return $this->container['dp']; + } + + /** + * Sets dp + * + * @param string|null $dp RSA first factor CRT exponent (RSA private key only) + * + * @return self + */ + public function setDp($dp) + { + if (is_null($dp)) { + throw new \InvalidArgumentException('non-nullable dp cannot be null'); + } + $this->container['dp'] = $dp; + + return $this; + } + + /** + * Gets dq + * + * @return string|null + */ + public function getDq() + { + return $this->container['dq']; + } + + /** + * Sets dq + * + * @param string|null $dq RSA second factor CRT exponent (RSA private key only) + * + * @return self + */ + public function setDq($dq) + { + if (is_null($dq)) { + throw new \InvalidArgumentException('non-nullable dq cannot be null'); + } + $this->container['dq'] = $dq; + + return $this; + } + + /** + * Gets e + * + * @return string|null + */ + public function getE() + { + return $this->container['e']; + } + + /** + * Sets e + * + * @param string|null $e RSA public exponent (RSA only) + * + * @return self + */ + public function setE($e) + { + if (is_null($e)) { + throw new \InvalidArgumentException('non-nullable e cannot be null'); + } + $this->container['e'] = $e; + + return $this; + } + + /** + * Gets kid + * + * @return string|null + */ + public function getKid() + { + return $this->container['kid']; + } + + /** + * Sets kid + * + * @param string|null $kid Key ID + * + * @return self + */ + public function setKid($kid) + { + if (is_null($kid)) { + throw new \InvalidArgumentException('non-nullable kid cannot be null'); + } + $this->container['kid'] = $kid; + + return $this; + } + + /** + * Gets kty + * + * @return string|null + */ + public function getKty() + { + return $this->container['kty']; + } + + /** + * Sets kty + * + * @param string|null $kty Key type: \"EC\" or \"RSA\" + * + * @return self + */ + public function setKty($kty) + { + if (is_null($kty)) { + throw new \InvalidArgumentException('non-nullable kty cannot be null'); + } + $this->container['kty'] = $kty; + + return $this; + } + + /** + * Gets n + * + * @return string|null + */ + public function getN() + { + return $this->container['n']; + } + + /** + * Sets n + * + * @param string|null $n RSA key fields + * + * @return self + */ + public function setN($n) + { + if (is_null($n)) { + throw new \InvalidArgumentException('non-nullable n cannot be null'); + } + $this->container['n'] = $n; + + return $this; + } + + /** + * Gets p + * + * @return string|null + */ + public function getP() + { + return $this->container['p']; + } + + /** + * Sets p + * + * @param string|null $p RSA first prime factor (RSA private key only) + * + * @return self + */ + public function setP($p) + { + if (is_null($p)) { + throw new \InvalidArgumentException('non-nullable p cannot be null'); + } + $this->container['p'] = $p; + + return $this; + } + + /** + * Gets q + * + * @return string|null + */ + public function getQ() + { + return $this->container['q']; + } + + /** + * Sets q + * + * @param string|null $q RSA second prime factor (RSA private key only) + * + * @return self + */ + public function setQ($q) + { + if (is_null($q)) { + throw new \InvalidArgumentException('non-nullable q cannot be null'); + } + $this->container['q'] = $q; + + return $this; + } + + /** + * Gets qi + * + * @return string|null + */ + public function getQi() + { + return $this->container['qi']; + } + + /** + * Sets qi + * + * @param string|null $qi RSA first CRT coefficient (RSA private key only) + * + * @return self + */ + public function setQi($qi) + { + if (is_null($qi)) { + throw new \InvalidArgumentException('non-nullable qi cannot be null'); + } + $this->container['qi'] = $qi; + + return $this; + } + + /** + * Gets x + * + * @return string|null + */ + public function getX() + { + return $this->container['x']; + } + + /** + * Sets x + * + * @param string|null $x X coordinate (EC only) + * + * @return self + */ + public function setX($x) + { + if (is_null($x)) { + throw new \InvalidArgumentException('non-nullable x cannot be null'); + } + $this->container['x'] = $x; + + return $this; + } + + /** + * Gets y + * + * @return string|null + */ + public function getY() + { + return $this->container['y']; + } + + /** + * Sets y + * + * @param string|null $y Y coordinate (EC only) + * + * @return self + */ + public function setY($y) + { + if (is_null($y)) { + throw new \InvalidArgumentException('non-nullable y cannot be null'); + } + $this->container['y'] = $y; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsOnboardItem.php b/src/Client/Model/ModelsOnboardItem.php new file mode 100644 index 0000000..365d70c --- /dev/null +++ b/src/Client/Model/ModelsOnboardItem.php @@ -0,0 +1,546 @@ + + */ +class ModelsOnboardItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.OnboardItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'auth_password' => 'string', + 'auth_username' => 'string', + 'event_type' => 'string', + 'name' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'auth_password' => null, + 'auth_username' => null, + 'event_type' => null, + 'name' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'auth_password' => false, + 'auth_username' => false, + 'event_type' => false, + 'name' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'auth_password' => 'auth_password', + 'auth_username' => 'auth_username', + 'event_type' => 'event_type', + 'name' => 'name', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'auth_password' => 'setAuthPassword', + 'auth_username' => 'setAuthUsername', + 'event_type' => 'setEventType', + 'name' => 'setName', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'auth_password' => 'getAuthPassword', + 'auth_username' => 'getAuthUsername', + 'event_type' => 'getEventType', + 'name' => 'getName', + 'url' => 'getUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('auth_password', $data ?? [], null); + $this->setIfExists('auth_username', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets auth_password + * + * @return string|null + */ + public function getAuthPassword() + { + return $this->container['auth_password']; + } + + /** + * Sets auth_password + * + * @param string|null $auth_password auth_password + * + * @return self + */ + public function setAuthPassword($auth_password) + { + if (is_null($auth_password)) { + throw new \InvalidArgumentException('non-nullable auth_password cannot be null'); + } + $this->container['auth_password'] = $auth_password; + + return $this; + } + + /** + * Gets auth_username + * + * @return string|null + */ + public function getAuthUsername() + { + return $this->container['auth_username']; + } + + /** + * Sets auth_username + * + * @param string|null $auth_username auth_username + * + * @return self + */ + public function setAuthUsername($auth_username) + { + if (is_null($auth_username)) { + throw new \InvalidArgumentException('non-nullable auth_username cannot be null'); + } + $this->container['auth_username'] = $auth_username; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url url + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsOnboardValidationError.php b/src/Client/Model/ModelsOnboardValidationError.php new file mode 100644 index 0000000..75f67fd --- /dev/null +++ b/src/Client/Model/ModelsOnboardValidationError.php @@ -0,0 +1,478 @@ + + */ +class ModelsOnboardValidationError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.OnboardValidationError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'field' => 'string', + 'message' => 'string', + 'row' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'field' => null, + 'message' => null, + 'row' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'field' => false, + 'message' => false, + 'row' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'field' => 'field', + 'message' => 'message', + 'row' => 'row' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'field' => 'setField', + 'message' => 'setMessage', + 'row' => 'setRow' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'field' => 'getField', + 'message' => 'getMessage', + 'row' => 'getRow' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('field', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('row', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets field + * + * @return string|null + */ + public function getField() + { + return $this->container['field']; + } + + /** + * Sets field + * + * @param string|null $field field + * + * @return self + */ + public function setField($field) + { + if (is_null($field)) { + throw new \InvalidArgumentException('non-nullable field cannot be null'); + } + $this->container['field'] = $field; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets row + * + * @return int|null + */ + public function getRow() + { + return $this->container['row']; + } + + /** + * Sets row + * + * @param int|null $row row + * + * @return self + */ + public function setRow($row) + { + if (is_null($row)) { + throw new \InvalidArgumentException('non-nullable row cannot be null'); + } + $this->container['row'] = $row; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsOptionalTime.php b/src/Client/Model/ModelsOptionalTime.php new file mode 100644 index 0000000..bad20f1 --- /dev/null +++ b/src/Client/Model/ModelsOptionalTime.php @@ -0,0 +1,444 @@ + + */ +class ModelsOptionalTime implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.OptionalTime'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'set' => 'bool', + 'time' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'set' => null, + 'time' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'set' => false, + 'time' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'set' => 'set', + 'time' => 'time' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'set' => 'setSet', + 'time' => 'setTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'set' => 'getSet', + 'time' => 'getTime' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('set', $data ?? [], null); + $this->setIfExists('time', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets set + * + * @return bool|null + */ + public function getSet() + { + return $this->container['set']; + } + + /** + * Sets set + * + * @param bool|null $set set + * + * @return self + */ + public function setSet($set) + { + if (is_null($set)) { + throw new \InvalidArgumentException('non-nullable set cannot be null'); + } + $this->container['set'] = $set; + + return $this; + } + + /** + * Gets time + * + * @return string|null + */ + public function getTime() + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param string|null $time time + * + * @return self + */ + public function setTime($time) + { + if (is_null($time)) { + throw new \InvalidArgumentException('non-nullable time cannot be null'); + } + $this->container['time'] = $time; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsPagedResponse.php b/src/Client/Model/ModelsPagedResponse.php new file mode 100644 index 0000000..682c7fc --- /dev/null +++ b/src/Client/Model/ModelsPagedResponse.php @@ -0,0 +1,458 @@ + + */ +class ModelsPagedResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.PagedResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => 'mixed', + 'pagination' => '\Convoy\Client\Model\DatastorePaginationData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => null, + 'pagination' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content' => true, + 'pagination' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content', + 'pagination' => 'pagination' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'pagination' => 'setPagination' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'pagination' => 'getPagination' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('pagination', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return mixed|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param mixed|null $content content + * + * @return self + */ + public function setContent($content) + { + if (is_null($content)) { + array_push($this->openAPINullablesSetToNull, 'content'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('content', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets pagination + * + * @return \Convoy\Client\Model\DatastorePaginationData|null + */ + public function getPagination() + { + return $this->container['pagination']; + } + + /** + * Sets pagination + * + * @param \Convoy\Client\Model\DatastorePaginationData|null $pagination pagination + * + * @return self + */ + public function setPagination($pagination) + { + if (is_null($pagination)) { + array_push($this->openAPINullablesSetToNull, 'pagination'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('pagination', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['pagination'] = $pagination; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsProjectConfig.php b/src/Client/Model/ModelsProjectConfig.php new file mode 100644 index 0000000..e41df41 --- /dev/null +++ b/src/Client/Model/ModelsProjectConfig.php @@ -0,0 +1,818 @@ + + */ +class ModelsProjectConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.ProjectConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'add_event_id_trace_headers' => 'bool', + 'circuit_breaker' => '\Convoy\Client\Model\DatastoreCircuitBreakerConfiguration', + 'disable_endpoint' => 'bool', + 'max_payload_read_size' => 'int', + 'meta_event' => '\Convoy\Client\Model\ModelsMetaEventConfiguration', + 'multiple_endpoint_subscriptions' => 'bool', + 'ratelimit' => '\Convoy\Client\Model\ModelsRateLimitConfiguration', + 'replay_attacks_prevention_enabled' => 'bool', + 'request_id_header' => '\Convoy\Client\Model\ConfigRequestIDHeaderProvider', + 'search_policy' => 'string', + 'signature' => '\Convoy\Client\Model\ModelsSignatureConfiguration', + 'ssl' => '\Convoy\Client\Model\ModelsSSLConfiguration', + 'strategy' => '\Convoy\Client\Model\ModelsStrategyConfiguration' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'add_event_id_trace_headers' => null, + 'circuit_breaker' => null, + 'disable_endpoint' => null, + 'max_payload_read_size' => null, + 'meta_event' => null, + 'multiple_endpoint_subscriptions' => null, + 'ratelimit' => null, + 'replay_attacks_prevention_enabled' => null, + 'request_id_header' => null, + 'search_policy' => null, + 'signature' => null, + 'ssl' => null, + 'strategy' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'add_event_id_trace_headers' => false, + 'circuit_breaker' => false, + 'disable_endpoint' => false, + 'max_payload_read_size' => false, + 'meta_event' => false, + 'multiple_endpoint_subscriptions' => false, + 'ratelimit' => false, + 'replay_attacks_prevention_enabled' => false, + 'request_id_header' => false, + 'search_policy' => false, + 'signature' => false, + 'ssl' => false, + 'strategy' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'add_event_id_trace_headers' => 'add_event_id_trace_headers', + 'circuit_breaker' => 'circuit_breaker', + 'disable_endpoint' => 'disable_endpoint', + 'max_payload_read_size' => 'max_payload_read_size', + 'meta_event' => 'meta_event', + 'multiple_endpoint_subscriptions' => 'multiple_endpoint_subscriptions', + 'ratelimit' => 'ratelimit', + 'replay_attacks_prevention_enabled' => 'replay_attacks_prevention_enabled', + 'request_id_header' => 'request_id_header', + 'search_policy' => 'search_policy', + 'signature' => 'signature', + 'ssl' => 'ssl', + 'strategy' => 'strategy' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'add_event_id_trace_headers' => 'setAddEventIdTraceHeaders', + 'circuit_breaker' => 'setCircuitBreaker', + 'disable_endpoint' => 'setDisableEndpoint', + 'max_payload_read_size' => 'setMaxPayloadReadSize', + 'meta_event' => 'setMetaEvent', + 'multiple_endpoint_subscriptions' => 'setMultipleEndpointSubscriptions', + 'ratelimit' => 'setRatelimit', + 'replay_attacks_prevention_enabled' => 'setReplayAttacksPreventionEnabled', + 'request_id_header' => 'setRequestIdHeader', + 'search_policy' => 'setSearchPolicy', + 'signature' => 'setSignature', + 'ssl' => 'setSsl', + 'strategy' => 'setStrategy' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'add_event_id_trace_headers' => 'getAddEventIdTraceHeaders', + 'circuit_breaker' => 'getCircuitBreaker', + 'disable_endpoint' => 'getDisableEndpoint', + 'max_payload_read_size' => 'getMaxPayloadReadSize', + 'meta_event' => 'getMetaEvent', + 'multiple_endpoint_subscriptions' => 'getMultipleEndpointSubscriptions', + 'ratelimit' => 'getRatelimit', + 'replay_attacks_prevention_enabled' => 'getReplayAttacksPreventionEnabled', + 'request_id_header' => 'getRequestIdHeader', + 'search_policy' => 'getSearchPolicy', + 'signature' => 'getSignature', + 'ssl' => 'getSsl', + 'strategy' => 'getStrategy' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('add_event_id_trace_headers', $data ?? [], null); + $this->setIfExists('circuit_breaker', $data ?? [], null); + $this->setIfExists('disable_endpoint', $data ?? [], null); + $this->setIfExists('max_payload_read_size', $data ?? [], null); + $this->setIfExists('meta_event', $data ?? [], null); + $this->setIfExists('multiple_endpoint_subscriptions', $data ?? [], null); + $this->setIfExists('ratelimit', $data ?? [], null); + $this->setIfExists('replay_attacks_prevention_enabled', $data ?? [], null); + $this->setIfExists('request_id_header', $data ?? [], null); + $this->setIfExists('search_policy', $data ?? [], null); + $this->setIfExists('signature', $data ?? [], null); + $this->setIfExists('ssl', $data ?? [], null); + $this->setIfExists('strategy', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets add_event_id_trace_headers + * + * @return bool|null + */ + public function getAddEventIdTraceHeaders() + { + return $this->container['add_event_id_trace_headers']; + } + + /** + * Sets add_event_id_trace_headers + * + * @param bool|null $add_event_id_trace_headers Controls of the Event ID and Event Delivery ID Headers are added to the request when events are dispatched to endpoints + * + * @return self + */ + public function setAddEventIdTraceHeaders($add_event_id_trace_headers) + { + if (is_null($add_event_id_trace_headers)) { + throw new \InvalidArgumentException('non-nullable add_event_id_trace_headers cannot be null'); + } + $this->container['add_event_id_trace_headers'] = $add_event_id_trace_headers; + + return $this; + } + + /** + * Gets circuit_breaker + * + * @return \Convoy\Client\Model\DatastoreCircuitBreakerConfiguration|null + */ + public function getCircuitBreaker() + { + return $this->container['circuit_breaker']; + } + + /** + * Sets circuit_breaker + * + * @param \Convoy\Client\Model\DatastoreCircuitBreakerConfiguration|null $circuit_breaker CircuitBreaker is used to configure the project's circuit breaker settings + * + * @return self + */ + public function setCircuitBreaker($circuit_breaker) + { + if (is_null($circuit_breaker)) { + throw new \InvalidArgumentException('non-nullable circuit_breaker cannot be null'); + } + $this->container['circuit_breaker'] = $circuit_breaker; + + return $this; + } + + /** + * Gets disable_endpoint + * + * @return bool|null + */ + public function getDisableEndpoint() + { + return $this->container['disable_endpoint']; + } + + /** + * Sets disable_endpoint + * + * @param bool|null $disable_endpoint Controls if the project will disable and endpoint after the retry threshold for an event is reached + * + * @return self + */ + public function setDisableEndpoint($disable_endpoint) + { + if (is_null($disable_endpoint)) { + throw new \InvalidArgumentException('non-nullable disable_endpoint cannot be null'); + } + $this->container['disable_endpoint'] = $disable_endpoint; + + return $this; + } + + /** + * Gets max_payload_read_size + * + * @return int|null + */ + public function getMaxPayloadReadSize() + { + return $this->container['max_payload_read_size']; + } + + /** + * Sets max_payload_read_size + * + * @param int|null $max_payload_read_size Specifies how many bytes and incoming project should read from the ingest request, and how many bytes an outgoing project should from the response of your endpoints Defaults to 50KB. + * + * @return self + */ + public function setMaxPayloadReadSize($max_payload_read_size) + { + if (is_null($max_payload_read_size)) { + throw new \InvalidArgumentException('non-nullable max_payload_read_size cannot be null'); + } + $this->container['max_payload_read_size'] = $max_payload_read_size; + + return $this; + } + + /** + * Gets meta_event + * + * @return \Convoy\Client\Model\ModelsMetaEventConfiguration|null + */ + public function getMetaEvent() + { + return $this->container['meta_event']; + } + + /** + * Sets meta_event + * + * @param \Convoy\Client\Model\ModelsMetaEventConfiguration|null $meta_event MetaEvent is used to configure the project's meta events + * + * @return self + */ + public function setMetaEvent($meta_event) + { + if (is_null($meta_event)) { + throw new \InvalidArgumentException('non-nullable meta_event cannot be null'); + } + $this->container['meta_event'] = $meta_event; + + return $this; + } + + /** + * Gets multiple_endpoint_subscriptions + * + * @return bool|null + */ + public function getMultipleEndpointSubscriptions() + { + return $this->container['multiple_endpoint_subscriptions']; + } + + /** + * Sets multiple_endpoint_subscriptions + * + * @param bool|null $multiple_endpoint_subscriptions MultipleEndpointSubscriptions is used to configure if multiple subscriptions can be created for the endpoint in a project + * + * @return self + */ + public function setMultipleEndpointSubscriptions($multiple_endpoint_subscriptions) + { + if (is_null($multiple_endpoint_subscriptions)) { + throw new \InvalidArgumentException('non-nullable multiple_endpoint_subscriptions cannot be null'); + } + $this->container['multiple_endpoint_subscriptions'] = $multiple_endpoint_subscriptions; + + return $this; + } + + /** + * Gets ratelimit + * + * @return \Convoy\Client\Model\ModelsRateLimitConfiguration|null + */ + public function getRatelimit() + { + return $this->container['ratelimit']; + } + + /** + * Sets ratelimit + * + * @param \Convoy\Client\Model\ModelsRateLimitConfiguration|null $ratelimit RateLimit is used to configure the projects rate limiting config values + * + * @return self + */ + public function setRatelimit($ratelimit) + { + if (is_null($ratelimit)) { + throw new \InvalidArgumentException('non-nullable ratelimit cannot be null'); + } + $this->container['ratelimit'] = $ratelimit; + + return $this; + } + + /** + * Gets replay_attacks_prevention_enabled + * + * @return bool|null + */ + public function getReplayAttacksPreventionEnabled() + { + return $this->container['replay_attacks_prevention_enabled']; + } + + /** + * Sets replay_attacks_prevention_enabled + * + * @param bool|null $replay_attacks_prevention_enabled Controls if your project will add a timestamp to it's webhook signature header to prevent a replay attack, See this blog post[https://getconvoy.io/blog/generating-stripe-like-webhook-signatures] for more] + * + * @return self + */ + public function setReplayAttacksPreventionEnabled($replay_attacks_prevention_enabled) + { + if (is_null($replay_attacks_prevention_enabled)) { + throw new \InvalidArgumentException('non-nullable replay_attacks_prevention_enabled cannot be null'); + } + $this->container['replay_attacks_prevention_enabled'] = $replay_attacks_prevention_enabled; + + return $this; + } + + /** + * Gets request_id_header + * + * @return \Convoy\Client\Model\ConfigRequestIDHeaderProvider|null + */ + public function getRequestIdHeader() + { + return $this->container['request_id_header']; + } + + /** + * Sets request_id_header + * + * @param \Convoy\Client\Model\ConfigRequestIDHeaderProvider|null $request_id_header RequestIDHeader is the outbound header name for the stable request id sent on webhook deliveries. + * + * @return self + */ + public function setRequestIdHeader($request_id_header) + { + if (is_null($request_id_header)) { + throw new \InvalidArgumentException('non-nullable request_id_header cannot be null'); + } + $this->container['request_id_header'] = $request_id_header; + + return $this; + } + + /** + * Gets search_policy + * + * @return string|null + */ + public function getSearchPolicy() + { + return $this->container['search_policy']; + } + + /** + * Sets search_policy + * + * @param string|null $search_policy Specify the interval in hours for which the event tokenizer runs + * + * @return self + */ + public function setSearchPolicy($search_policy) + { + if (is_null($search_policy)) { + throw new \InvalidArgumentException('non-nullable search_policy cannot be null'); + } + $this->container['search_policy'] = $search_policy; + + return $this; + } + + /** + * Gets signature + * + * @return \Convoy\Client\Model\ModelsSignatureConfiguration|null + */ + public function getSignature() + { + return $this->container['signature']; + } + + /** + * Sets signature + * + * @param \Convoy\Client\Model\ModelsSignatureConfiguration|null $signature Signature is used to configure the project's signature header versions + * + * @return self + */ + public function setSignature($signature) + { + if (is_null($signature)) { + throw new \InvalidArgumentException('non-nullable signature cannot be null'); + } + $this->container['signature'] = $signature; + + return $this; + } + + /** + * Gets ssl + * + * @return \Convoy\Client\Model\ModelsSSLConfiguration|null + */ + public function getSsl() + { + return $this->container['ssl']; + } + + /** + * Sets ssl + * + * @param \Convoy\Client\Model\ModelsSSLConfiguration|null $ssl SSL is used to configure the project's endpoint ssl enforcement rules + * + * @return self + */ + public function setSsl($ssl) + { + if (is_null($ssl)) { + throw new \InvalidArgumentException('non-nullable ssl cannot be null'); + } + $this->container['ssl'] = $ssl; + + return $this; + } + + /** + * Gets strategy + * + * @return \Convoy\Client\Model\ModelsStrategyConfiguration|null + */ + public function getStrategy() + { + return $this->container['strategy']; + } + + /** + * Sets strategy + * + * @param \Convoy\Client\Model\ModelsStrategyConfiguration|null $strategy Strategy is used to configure the project's retry strategies for failing events. + * + * @return self + */ + public function setStrategy($strategy) + { + if (is_null($strategy)) { + throw new \InvalidArgumentException('non-nullable strategy cannot be null'); + } + $this->container['strategy'] = $strategy; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsProjectResponse.php b/src/Client/Model/ModelsProjectResponse.php new file mode 100644 index 0000000..f24f266 --- /dev/null +++ b/src/Client/Model/ModelsProjectResponse.php @@ -0,0 +1,750 @@ + + */ +class ModelsProjectResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.ProjectResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'config' => '\Convoy\Client\Model\DatastoreProjectConfig', + 'created_at' => 'string', + 'deleted_at' => 'string', + 'logo_url' => 'string', + 'name' => 'string', + 'organisation_id' => 'string', + 'retained_events' => 'int', + 'statistics' => '\Convoy\Client\Model\DatastoreProjectStatistics', + 'type' => '\Convoy\Client\Model\DatastoreProjectType', + 'uid' => 'string', + 'updated_at' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'config' => null, + 'created_at' => null, + 'deleted_at' => null, + 'logo_url' => null, + 'name' => null, + 'organisation_id' => null, + 'retained_events' => null, + 'statistics' => null, + 'type' => null, + 'uid' => null, + 'updated_at' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'config' => false, + 'created_at' => false, + 'deleted_at' => false, + 'logo_url' => false, + 'name' => false, + 'organisation_id' => false, + 'retained_events' => false, + 'statistics' => false, + 'type' => false, + 'uid' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'config' => 'config', + 'created_at' => 'created_at', + 'deleted_at' => 'deleted_at', + 'logo_url' => 'logo_url', + 'name' => 'name', + 'organisation_id' => 'organisation_id', + 'retained_events' => 'retained_events', + 'statistics' => 'statistics', + 'type' => 'type', + 'uid' => 'uid', + 'updated_at' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'config' => 'setConfig', + 'created_at' => 'setCreatedAt', + 'deleted_at' => 'setDeletedAt', + 'logo_url' => 'setLogoUrl', + 'name' => 'setName', + 'organisation_id' => 'setOrganisationId', + 'retained_events' => 'setRetainedEvents', + 'statistics' => 'setStatistics', + 'type' => 'setType', + 'uid' => 'setUid', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'config' => 'getConfig', + 'created_at' => 'getCreatedAt', + 'deleted_at' => 'getDeletedAt', + 'logo_url' => 'getLogoUrl', + 'name' => 'getName', + 'organisation_id' => 'getOrganisationId', + 'retained_events' => 'getRetainedEvents', + 'statistics' => 'getStatistics', + 'type' => 'getType', + 'uid' => 'getUid', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('config', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('deleted_at', $data ?? [], null); + $this->setIfExists('logo_url', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('organisation_id', $data ?? [], null); + $this->setIfExists('retained_events', $data ?? [], null); + $this->setIfExists('statistics', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets config + * + * @return \Convoy\Client\Model\DatastoreProjectConfig|null + */ + public function getConfig() + { + return $this->container['config']; + } + + /** + * Sets config + * + * @param \Convoy\Client\Model\DatastoreProjectConfig|null $config config + * + * @return self + */ + public function setConfig($config) + { + if (is_null($config)) { + throw new \InvalidArgumentException('non-nullable config cannot be null'); + } + $this->container['config'] = $config; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets deleted_at + * + * @return string|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param string|null $deleted_at deleted_at + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + if (is_null($deleted_at)) { + throw new \InvalidArgumentException('non-nullable deleted_at cannot be null'); + } + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets logo_url + * + * @return string|null + */ + public function getLogoUrl() + { + return $this->container['logo_url']; + } + + /** + * Sets logo_url + * + * @param string|null $logo_url logo_url + * + * @return self + */ + public function setLogoUrl($logo_url) + { + if (is_null($logo_url)) { + throw new \InvalidArgumentException('non-nullable logo_url cannot be null'); + } + $this->container['logo_url'] = $logo_url; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets organisation_id + * + * @return string|null + */ + public function getOrganisationId() + { + return $this->container['organisation_id']; + } + + /** + * Sets organisation_id + * + * @param string|null $organisation_id organisation_id + * + * @return self + */ + public function setOrganisationId($organisation_id) + { + if (is_null($organisation_id)) { + throw new \InvalidArgumentException('non-nullable organisation_id cannot be null'); + } + $this->container['organisation_id'] = $organisation_id; + + return $this; + } + + /** + * Gets retained_events + * + * @return int|null + */ + public function getRetainedEvents() + { + return $this->container['retained_events']; + } + + /** + * Sets retained_events + * + * @param int|null $retained_events retained_events + * + * @return self + */ + public function setRetainedEvents($retained_events) + { + if (is_null($retained_events)) { + throw new \InvalidArgumentException('non-nullable retained_events cannot be null'); + } + $this->container['retained_events'] = $retained_events; + + return $this; + } + + /** + * Gets statistics + * + * @return \Convoy\Client\Model\DatastoreProjectStatistics|null + */ + public function getStatistics() + { + return $this->container['statistics']; + } + + /** + * Sets statistics + * + * @param \Convoy\Client\Model\DatastoreProjectStatistics|null $statistics statistics + * + * @return self + */ + public function setStatistics($statistics) + { + if (is_null($statistics)) { + throw new \InvalidArgumentException('non-nullable statistics cannot be null'); + } + $this->container['statistics'] = $statistics; + + return $this; + } + + /** + * Gets type + * + * @return \Convoy\Client\Model\DatastoreProjectType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Convoy\Client\Model\DatastoreProjectType|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsPubSubConfig.php b/src/Client/Model/ModelsPubSubConfig.php new file mode 100644 index 0000000..c3da091 --- /dev/null +++ b/src/Client/Model/ModelsPubSubConfig.php @@ -0,0 +1,580 @@ + + */ +class ModelsPubSubConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.PubSubConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amqp' => '\Convoy\Client\Model\ModelsAmqpPubSubconfig', + 'google' => '\Convoy\Client\Model\ModelsGooglePubSubConfig', + 'kafka' => '\Convoy\Client\Model\ModelsKafkaPubSubConfig', + 'sqs' => '\Convoy\Client\Model\ModelsSQSPubSubConfig', + 'type' => '\Convoy\Client\Model\DatastorePubSubType', + 'workers' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amqp' => null, + 'google' => null, + 'kafka' => null, + 'sqs' => null, + 'type' => null, + 'workers' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amqp' => false, + 'google' => false, + 'kafka' => false, + 'sqs' => false, + 'type' => false, + 'workers' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'amqp' => 'amqp', + 'google' => 'google', + 'kafka' => 'kafka', + 'sqs' => 'sqs', + 'type' => 'type', + 'workers' => 'workers' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amqp' => 'setAmqp', + 'google' => 'setGoogle', + 'kafka' => 'setKafka', + 'sqs' => 'setSqs', + 'type' => 'setType', + 'workers' => 'setWorkers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amqp' => 'getAmqp', + 'google' => 'getGoogle', + 'kafka' => 'getKafka', + 'sqs' => 'getSqs', + 'type' => 'getType', + 'workers' => 'getWorkers' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('amqp', $data ?? [], null); + $this->setIfExists('google', $data ?? [], null); + $this->setIfExists('kafka', $data ?? [], null); + $this->setIfExists('sqs', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('workers', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amqp + * + * @return \Convoy\Client\Model\ModelsAmqpPubSubconfig|null + */ + public function getAmqp() + { + return $this->container['amqp']; + } + + /** + * Sets amqp + * + * @param \Convoy\Client\Model\ModelsAmqpPubSubconfig|null $amqp amqp + * + * @return self + */ + public function setAmqp($amqp) + { + if (is_null($amqp)) { + throw new \InvalidArgumentException('non-nullable amqp cannot be null'); + } + $this->container['amqp'] = $amqp; + + return $this; + } + + /** + * Gets google + * + * @return \Convoy\Client\Model\ModelsGooglePubSubConfig|null + */ + public function getGoogle() + { + return $this->container['google']; + } + + /** + * Sets google + * + * @param \Convoy\Client\Model\ModelsGooglePubSubConfig|null $google google + * + * @return self + */ + public function setGoogle($google) + { + if (is_null($google)) { + throw new \InvalidArgumentException('non-nullable google cannot be null'); + } + $this->container['google'] = $google; + + return $this; + } + + /** + * Gets kafka + * + * @return \Convoy\Client\Model\ModelsKafkaPubSubConfig|null + */ + public function getKafka() + { + return $this->container['kafka']; + } + + /** + * Sets kafka + * + * @param \Convoy\Client\Model\ModelsKafkaPubSubConfig|null $kafka kafka + * + * @return self + */ + public function setKafka($kafka) + { + if (is_null($kafka)) { + throw new \InvalidArgumentException('non-nullable kafka cannot be null'); + } + $this->container['kafka'] = $kafka; + + return $this; + } + + /** + * Gets sqs + * + * @return \Convoy\Client\Model\ModelsSQSPubSubConfig|null + */ + public function getSqs() + { + return $this->container['sqs']; + } + + /** + * Sets sqs + * + * @param \Convoy\Client\Model\ModelsSQSPubSubConfig|null $sqs sqs + * + * @return self + */ + public function setSqs($sqs) + { + if (is_null($sqs)) { + throw new \InvalidArgumentException('non-nullable sqs cannot be null'); + } + $this->container['sqs'] = $sqs; + + return $this; + } + + /** + * Gets type + * + * @return \Convoy\Client\Model\DatastorePubSubType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Convoy\Client\Model\DatastorePubSubType|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets workers + * + * @return int|null + */ + public function getWorkers() + { + return $this->container['workers']; + } + + /** + * Sets workers + * + * @param int|null $workers workers + * + * @return self + */ + public function setWorkers($workers) + { + if (is_null($workers)) { + throw new \InvalidArgumentException('non-nullable workers cannot be null'); + } + $this->container['workers'] = $workers; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsRateLimitConfiguration.php b/src/Client/Model/ModelsRateLimitConfiguration.php new file mode 100644 index 0000000..6bd84f3 --- /dev/null +++ b/src/Client/Model/ModelsRateLimitConfiguration.php @@ -0,0 +1,444 @@ + + */ +class ModelsRateLimitConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.RateLimitConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'count' => 'int', + 'duration' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'count' => null, + 'duration' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'count' => false, + 'duration' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'count' => 'count', + 'duration' => 'duration' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'count' => 'setCount', + 'duration' => 'setDuration' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'count' => 'getCount', + 'duration' => 'getDuration' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('duration', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count count + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + throw new \InvalidArgumentException('non-nullable count cannot be null'); + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets duration + * + * @return int|null + */ + public function getDuration() + { + return $this->container['duration']; + } + + /** + * Sets duration + * + * @param int|null $duration duration + * + * @return self + */ + public function setDuration($duration) + { + if (is_null($duration)) { + throw new \InvalidArgumentException('non-nullable duration cannot be null'); + } + $this->container['duration'] = $duration; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsRetryConfiguration.php b/src/Client/Model/ModelsRetryConfiguration.php new file mode 100644 index 0000000..dcbb601 --- /dev/null +++ b/src/Client/Model/ModelsRetryConfiguration.php @@ -0,0 +1,512 @@ + + */ +class ModelsRetryConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.RetryConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'duration' => 'string', + 'interval_seconds' => 'int', + 'retry_count' => 'int', + 'type' => '\Convoy\Client\Model\DatastoreStrategyProvider' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'duration' => null, + 'interval_seconds' => null, + 'retry_count' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'duration' => false, + 'interval_seconds' => false, + 'retry_count' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'duration' => 'duration', + 'interval_seconds' => 'interval_seconds', + 'retry_count' => 'retry_count', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'duration' => 'setDuration', + 'interval_seconds' => 'setIntervalSeconds', + 'retry_count' => 'setRetryCount', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'duration' => 'getDuration', + 'interval_seconds' => 'getIntervalSeconds', + 'retry_count' => 'getRetryCount', + 'type' => 'getType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('duration', $data ?? [], null); + $this->setIfExists('interval_seconds', $data ?? [], null); + $this->setIfExists('retry_count', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets duration + * + * @return string|null + */ + public function getDuration() + { + return $this->container['duration']; + } + + /** + * Sets duration + * + * @param string|null $duration Used to specify a valid Go time duration e.g 10s, 1h3m for how long to wait between event delivery retries + * + * @return self + */ + public function setDuration($duration) + { + if (is_null($duration)) { + throw new \InvalidArgumentException('non-nullable duration cannot be null'); + } + $this->container['duration'] = $duration; + + return $this; + } + + /** + * Gets interval_seconds + * + * @return int|null + */ + public function getIntervalSeconds() + { + return $this->container['interval_seconds']; + } + + /** + * Sets interval_seconds + * + * @param int|null $interval_seconds Used to specify a time in seconds for how long to wait between event delivery retries, + * + * @return self + */ + public function setIntervalSeconds($interval_seconds) + { + if (is_null($interval_seconds)) { + throw new \InvalidArgumentException('non-nullable interval_seconds cannot be null'); + } + $this->container['interval_seconds'] = $interval_seconds; + + return $this; + } + + /** + * Gets retry_count + * + * @return int|null + */ + public function getRetryCount() + { + return $this->container['retry_count']; + } + + /** + * Sets retry_count + * + * @param int|null $retry_count Used to specify the max number of retries + * + * @return self + */ + public function setRetryCount($retry_count) + { + if (is_null($retry_count)) { + throw new \InvalidArgumentException('non-nullable retry_count cannot be null'); + } + $this->container['retry_count'] = $retry_count; + + return $this; + } + + /** + * Gets type + * + * @return \Convoy\Client\Model\DatastoreStrategyProvider|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Convoy\Client\Model\DatastoreStrategyProvider|null $type Retry Strategy type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsSQSPubSubConfig.php b/src/Client/Model/ModelsSQSPubSubConfig.php new file mode 100644 index 0000000..342052c --- /dev/null +++ b/src/Client/Model/ModelsSQSPubSubConfig.php @@ -0,0 +1,512 @@ + + */ +class ModelsSQSPubSubConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.SQSPubSubConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'access_key_id' => 'string', + 'default_region' => 'string', + 'queue_name' => 'string', + 'secret_key' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'access_key_id' => null, + 'default_region' => null, + 'queue_name' => null, + 'secret_key' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'access_key_id' => false, + 'default_region' => false, + 'queue_name' => false, + 'secret_key' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'access_key_id' => 'access_key_id', + 'default_region' => 'default_region', + 'queue_name' => 'queue_name', + 'secret_key' => 'secret_key' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'access_key_id' => 'setAccessKeyId', + 'default_region' => 'setDefaultRegion', + 'queue_name' => 'setQueueName', + 'secret_key' => 'setSecretKey' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'access_key_id' => 'getAccessKeyId', + 'default_region' => 'getDefaultRegion', + 'queue_name' => 'getQueueName', + 'secret_key' => 'getSecretKey' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('access_key_id', $data ?? [], null); + $this->setIfExists('default_region', $data ?? [], null); + $this->setIfExists('queue_name', $data ?? [], null); + $this->setIfExists('secret_key', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets access_key_id + * + * @return string|null + */ + public function getAccessKeyId() + { + return $this->container['access_key_id']; + } + + /** + * Sets access_key_id + * + * @param string|null $access_key_id access_key_id + * + * @return self + */ + public function setAccessKeyId($access_key_id) + { + if (is_null($access_key_id)) { + throw new \InvalidArgumentException('non-nullable access_key_id cannot be null'); + } + $this->container['access_key_id'] = $access_key_id; + + return $this; + } + + /** + * Gets default_region + * + * @return string|null + */ + public function getDefaultRegion() + { + return $this->container['default_region']; + } + + /** + * Sets default_region + * + * @param string|null $default_region default_region + * + * @return self + */ + public function setDefaultRegion($default_region) + { + if (is_null($default_region)) { + throw new \InvalidArgumentException('non-nullable default_region cannot be null'); + } + $this->container['default_region'] = $default_region; + + return $this; + } + + /** + * Gets queue_name + * + * @return string|null + */ + public function getQueueName() + { + return $this->container['queue_name']; + } + + /** + * Sets queue_name + * + * @param string|null $queue_name queue_name + * + * @return self + */ + public function setQueueName($queue_name) + { + if (is_null($queue_name)) { + throw new \InvalidArgumentException('non-nullable queue_name cannot be null'); + } + $this->container['queue_name'] = $queue_name; + + return $this; + } + + /** + * Gets secret_key + * + * @return string|null + */ + public function getSecretKey() + { + return $this->container['secret_key']; + } + + /** + * Sets secret_key + * + * @param string|null $secret_key secret_key + * + * @return self + */ + public function setSecretKey($secret_key) + { + if (is_null($secret_key)) { + throw new \InvalidArgumentException('non-nullable secret_key cannot be null'); + } + $this->container['secret_key'] = $secret_key; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsSSLConfiguration.php b/src/Client/Model/ModelsSSLConfiguration.php new file mode 100644 index 0000000..1d5a1de --- /dev/null +++ b/src/Client/Model/ModelsSSLConfiguration.php @@ -0,0 +1,410 @@ + + */ +class ModelsSSLConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.SSLConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'enforce_secure_endpoints' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'enforce_secure_endpoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'enforce_secure_endpoints' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'enforce_secure_endpoints' => 'enforce_secure_endpoints' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'enforce_secure_endpoints' => 'setEnforceSecureEndpoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'enforce_secure_endpoints' => 'getEnforceSecureEndpoints' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('enforce_secure_endpoints', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets enforce_secure_endpoints + * + * @return bool|null + */ + public function getEnforceSecureEndpoints() + { + return $this->container['enforce_secure_endpoints']; + } + + /** + * Sets enforce_secure_endpoints + * + * @param bool|null $enforce_secure_endpoints enforce_secure_endpoints + * + * @return self + */ + public function setEnforceSecureEndpoints($enforce_secure_endpoints) + { + if (is_null($enforce_secure_endpoints)) { + throw new \InvalidArgumentException('non-nullable enforce_secure_endpoints cannot be null'); + } + $this->container['enforce_secure_endpoints'] = $enforce_secure_endpoints; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsSignatureConfiguration.php b/src/Client/Model/ModelsSignatureConfiguration.php new file mode 100644 index 0000000..6e267ac --- /dev/null +++ b/src/Client/Model/ModelsSignatureConfiguration.php @@ -0,0 +1,444 @@ + + */ +class ModelsSignatureConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.SignatureConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'header' => '\Convoy\Client\Model\ConfigSignatureHeaderProvider', + 'versions' => '\Convoy\Client\Model\ModelsSignatureVersion[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'header' => null, + 'versions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'header' => false, + 'versions' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'header' => 'header', + 'versions' => 'versions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'header' => 'setHeader', + 'versions' => 'setVersions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'header' => 'getHeader', + 'versions' => 'getVersions' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('header', $data ?? [], null); + $this->setIfExists('versions', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets header + * + * @return \Convoy\Client\Model\ConfigSignatureHeaderProvider|null + */ + public function getHeader() + { + return $this->container['header']; + } + + /** + * Sets header + * + * @param \Convoy\Client\Model\ConfigSignatureHeaderProvider|null $header header + * + * @return self + */ + public function setHeader($header) + { + if (is_null($header)) { + throw new \InvalidArgumentException('non-nullable header cannot be null'); + } + $this->container['header'] = $header; + + return $this; + } + + /** + * Gets versions + * + * @return \Convoy\Client\Model\ModelsSignatureVersion[]|null + */ + public function getVersions() + { + return $this->container['versions']; + } + + /** + * Sets versions + * + * @param \Convoy\Client\Model\ModelsSignatureVersion[]|null $versions versions + * + * @return self + */ + public function setVersions($versions) + { + if (is_null($versions)) { + throw new \InvalidArgumentException('non-nullable versions cannot be null'); + } + $this->container['versions'] = $versions; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsSignatureVersion.php b/src/Client/Model/ModelsSignatureVersion.php new file mode 100644 index 0000000..bfe1664 --- /dev/null +++ b/src/Client/Model/ModelsSignatureVersion.php @@ -0,0 +1,512 @@ + + */ +class ModelsSignatureVersion implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.SignatureVersion'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'created_at' => 'string', + 'encoding' => 'string', + 'hash' => 'string', + 'uid' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'created_at' => null, + 'encoding' => null, + 'hash' => null, + 'uid' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'encoding' => false, + 'hash' => false, + 'uid' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'created_at' => 'created_at', + 'encoding' => 'encoding', + 'hash' => 'hash', + 'uid' => 'uid' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'created_at' => 'setCreatedAt', + 'encoding' => 'setEncoding', + 'hash' => 'setHash', + 'uid' => 'setUid' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'created_at' => 'getCreatedAt', + 'encoding' => 'getEncoding', + 'hash' => 'getHash', + 'uid' => 'getUid' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('encoding', $data ?? [], null); + $this->setIfExists('hash', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets encoding + * + * @return string|null + */ + public function getEncoding() + { + return $this->container['encoding']; + } + + /** + * Sets encoding + * + * @param string|null $encoding encoding + * + * @return self + */ + public function setEncoding($encoding) + { + if (is_null($encoding)) { + throw new \InvalidArgumentException('non-nullable encoding cannot be null'); + } + $this->container['encoding'] = $encoding; + + return $this; + } + + /** + * Gets hash + * + * @return string|null + */ + public function getHash() + { + return $this->container['hash']; + } + + /** + * Sets hash + * + * @param string|null $hash hash + * + * @return self + */ + public function setHash($hash) + { + if (is_null($hash)) { + throw new \InvalidArgumentException('non-nullable hash cannot be null'); + } + $this->container['hash'] = $hash; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsSourceResponse.php b/src/Client/Model/ModelsSourceResponse.php new file mode 100644 index 0000000..87268c8 --- /dev/null +++ b/src/Client/Model/ModelsSourceResponse.php @@ -0,0 +1,1056 @@ + + */ +class ModelsSourceResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.SourceResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'body_function' => 'string', + 'created_at' => 'string', + 'custom_response' => '\Convoy\Client\Model\DatastoreCustomResponse', + 'deleted_at' => 'string', + 'event_type_location' => 'string', + 'forward_headers' => 'string[]', + 'header_function' => 'string', + 'idempotency_keys' => 'string[]', + 'is_disabled' => 'bool', + 'mask_id' => 'string', + 'name' => 'string', + 'project_id' => 'string', + 'provider' => '\Convoy\Client\Model\DatastoreSourceProvider', + 'provider_config' => '\Convoy\Client\Model\DatastoreProviderConfig', + 'pub_sub' => '\Convoy\Client\Model\DatastorePubSubConfig', + 'type' => '\Convoy\Client\Model\DatastoreSourceType', + 'uid' => 'string', + 'updated_at' => 'string', + 'url' => 'string', + 'verifier' => '\Convoy\Client\Model\DatastoreVerifierConfig' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'body_function' => null, + 'created_at' => null, + 'custom_response' => null, + 'deleted_at' => null, + 'event_type_location' => null, + 'forward_headers' => null, + 'header_function' => null, + 'idempotency_keys' => null, + 'is_disabled' => null, + 'mask_id' => null, + 'name' => null, + 'project_id' => null, + 'provider' => null, + 'provider_config' => null, + 'pub_sub' => null, + 'type' => null, + 'uid' => null, + 'updated_at' => null, + 'url' => null, + 'verifier' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'body_function' => false, + 'created_at' => false, + 'custom_response' => false, + 'deleted_at' => false, + 'event_type_location' => false, + 'forward_headers' => false, + 'header_function' => false, + 'idempotency_keys' => false, + 'is_disabled' => false, + 'mask_id' => false, + 'name' => false, + 'project_id' => false, + 'provider' => false, + 'provider_config' => false, + 'pub_sub' => false, + 'type' => false, + 'uid' => false, + 'updated_at' => false, + 'url' => false, + 'verifier' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'body_function' => 'body_function', + 'created_at' => 'created_at', + 'custom_response' => 'custom_response', + 'deleted_at' => 'deleted_at', + 'event_type_location' => 'event_type_location', + 'forward_headers' => 'forward_headers', + 'header_function' => 'header_function', + 'idempotency_keys' => 'idempotency_keys', + 'is_disabled' => 'is_disabled', + 'mask_id' => 'mask_id', + 'name' => 'name', + 'project_id' => 'project_id', + 'provider' => 'provider', + 'provider_config' => 'provider_config', + 'pub_sub' => 'pub_sub', + 'type' => 'type', + 'uid' => 'uid', + 'updated_at' => 'updated_at', + 'url' => 'url', + 'verifier' => 'verifier' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'body_function' => 'setBodyFunction', + 'created_at' => 'setCreatedAt', + 'custom_response' => 'setCustomResponse', + 'deleted_at' => 'setDeletedAt', + 'event_type_location' => 'setEventTypeLocation', + 'forward_headers' => 'setForwardHeaders', + 'header_function' => 'setHeaderFunction', + 'idempotency_keys' => 'setIdempotencyKeys', + 'is_disabled' => 'setIsDisabled', + 'mask_id' => 'setMaskId', + 'name' => 'setName', + 'project_id' => 'setProjectId', + 'provider' => 'setProvider', + 'provider_config' => 'setProviderConfig', + 'pub_sub' => 'setPubSub', + 'type' => 'setType', + 'uid' => 'setUid', + 'updated_at' => 'setUpdatedAt', + 'url' => 'setUrl', + 'verifier' => 'setVerifier' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'body_function' => 'getBodyFunction', + 'created_at' => 'getCreatedAt', + 'custom_response' => 'getCustomResponse', + 'deleted_at' => 'getDeletedAt', + 'event_type_location' => 'getEventTypeLocation', + 'forward_headers' => 'getForwardHeaders', + 'header_function' => 'getHeaderFunction', + 'idempotency_keys' => 'getIdempotencyKeys', + 'is_disabled' => 'getIsDisabled', + 'mask_id' => 'getMaskId', + 'name' => 'getName', + 'project_id' => 'getProjectId', + 'provider' => 'getProvider', + 'provider_config' => 'getProviderConfig', + 'pub_sub' => 'getPubSub', + 'type' => 'getType', + 'uid' => 'getUid', + 'updated_at' => 'getUpdatedAt', + 'url' => 'getUrl', + 'verifier' => 'getVerifier' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('body_function', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('custom_response', $data ?? [], null); + $this->setIfExists('deleted_at', $data ?? [], null); + $this->setIfExists('event_type_location', $data ?? [], null); + $this->setIfExists('forward_headers', $data ?? [], null); + $this->setIfExists('header_function', $data ?? [], null); + $this->setIfExists('idempotency_keys', $data ?? [], null); + $this->setIfExists('is_disabled', $data ?? [], null); + $this->setIfExists('mask_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('project_id', $data ?? [], null); + $this->setIfExists('provider', $data ?? [], null); + $this->setIfExists('provider_config', $data ?? [], null); + $this->setIfExists('pub_sub', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('verifier', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets body_function + * + * @return string|null + */ + public function getBodyFunction() + { + return $this->container['body_function']; + } + + /** + * Sets body_function + * + * @param string|null $body_function body_function + * + * @return self + */ + public function setBodyFunction($body_function) + { + if (is_null($body_function)) { + throw new \InvalidArgumentException('non-nullable body_function cannot be null'); + } + $this->container['body_function'] = $body_function; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets custom_response + * + * @return \Convoy\Client\Model\DatastoreCustomResponse|null + */ + public function getCustomResponse() + { + return $this->container['custom_response']; + } + + /** + * Sets custom_response + * + * @param \Convoy\Client\Model\DatastoreCustomResponse|null $custom_response custom_response + * + * @return self + */ + public function setCustomResponse($custom_response) + { + if (is_null($custom_response)) { + throw new \InvalidArgumentException('non-nullable custom_response cannot be null'); + } + $this->container['custom_response'] = $custom_response; + + return $this; + } + + /** + * Gets deleted_at + * + * @return string|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param string|null $deleted_at deleted_at + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + if (is_null($deleted_at)) { + throw new \InvalidArgumentException('non-nullable deleted_at cannot be null'); + } + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets event_type_location + * + * @return string|null + */ + public function getEventTypeLocation() + { + return $this->container['event_type_location']; + } + + /** + * Sets event_type_location + * + * @param string|null $event_type_location event_type_location + * + * @return self + */ + public function setEventTypeLocation($event_type_location) + { + if (is_null($event_type_location)) { + throw new \InvalidArgumentException('non-nullable event_type_location cannot be null'); + } + $this->container['event_type_location'] = $event_type_location; + + return $this; + } + + /** + * Gets forward_headers + * + * @return string[]|null + */ + public function getForwardHeaders() + { + return $this->container['forward_headers']; + } + + /** + * Sets forward_headers + * + * @param string[]|null $forward_headers forward_headers + * + * @return self + */ + public function setForwardHeaders($forward_headers) + { + if (is_null($forward_headers)) { + throw new \InvalidArgumentException('non-nullable forward_headers cannot be null'); + } + $this->container['forward_headers'] = $forward_headers; + + return $this; + } + + /** + * Gets header_function + * + * @return string|null + */ + public function getHeaderFunction() + { + return $this->container['header_function']; + } + + /** + * Sets header_function + * + * @param string|null $header_function header_function + * + * @return self + */ + public function setHeaderFunction($header_function) + { + if (is_null($header_function)) { + throw new \InvalidArgumentException('non-nullable header_function cannot be null'); + } + $this->container['header_function'] = $header_function; + + return $this; + } + + /** + * Gets idempotency_keys + * + * @return string[]|null + */ + public function getIdempotencyKeys() + { + return $this->container['idempotency_keys']; + } + + /** + * Sets idempotency_keys + * + * @param string[]|null $idempotency_keys idempotency_keys + * + * @return self + */ + public function setIdempotencyKeys($idempotency_keys) + { + if (is_null($idempotency_keys)) { + throw new \InvalidArgumentException('non-nullable idempotency_keys cannot be null'); + } + $this->container['idempotency_keys'] = $idempotency_keys; + + return $this; + } + + /** + * Gets is_disabled + * + * @return bool|null + */ + public function getIsDisabled() + { + return $this->container['is_disabled']; + } + + /** + * Sets is_disabled + * + * @param bool|null $is_disabled is_disabled + * + * @return self + */ + public function setIsDisabled($is_disabled) + { + if (is_null($is_disabled)) { + throw new \InvalidArgumentException('non-nullable is_disabled cannot be null'); + } + $this->container['is_disabled'] = $is_disabled; + + return $this; + } + + /** + * Gets mask_id + * + * @return string|null + */ + public function getMaskId() + { + return $this->container['mask_id']; + } + + /** + * Sets mask_id + * + * @param string|null $mask_id mask_id + * + * @return self + */ + public function setMaskId($mask_id) + { + if (is_null($mask_id)) { + throw new \InvalidArgumentException('non-nullable mask_id cannot be null'); + } + $this->container['mask_id'] = $mask_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets project_id + * + * @return string|null + */ + public function getProjectId() + { + return $this->container['project_id']; + } + + /** + * Sets project_id + * + * @param string|null $project_id project_id + * + * @return self + */ + public function setProjectId($project_id) + { + if (is_null($project_id)) { + throw new \InvalidArgumentException('non-nullable project_id cannot be null'); + } + $this->container['project_id'] = $project_id; + + return $this; + } + + /** + * Gets provider + * + * @return \Convoy\Client\Model\DatastoreSourceProvider|null + */ + public function getProvider() + { + return $this->container['provider']; + } + + /** + * Sets provider + * + * @param \Convoy\Client\Model\DatastoreSourceProvider|null $provider provider + * + * @return self + */ + public function setProvider($provider) + { + if (is_null($provider)) { + throw new \InvalidArgumentException('non-nullable provider cannot be null'); + } + $this->container['provider'] = $provider; + + return $this; + } + + /** + * Gets provider_config + * + * @return \Convoy\Client\Model\DatastoreProviderConfig|null + */ + public function getProviderConfig() + { + return $this->container['provider_config']; + } + + /** + * Sets provider_config + * + * @param \Convoy\Client\Model\DatastoreProviderConfig|null $provider_config provider_config + * + * @return self + */ + public function setProviderConfig($provider_config) + { + if (is_null($provider_config)) { + throw new \InvalidArgumentException('non-nullable provider_config cannot be null'); + } + $this->container['provider_config'] = $provider_config; + + return $this; + } + + /** + * Gets pub_sub + * + * @return \Convoy\Client\Model\DatastorePubSubConfig|null + */ + public function getPubSub() + { + return $this->container['pub_sub']; + } + + /** + * Sets pub_sub + * + * @param \Convoy\Client\Model\DatastorePubSubConfig|null $pub_sub pub_sub + * + * @return self + */ + public function setPubSub($pub_sub) + { + if (is_null($pub_sub)) { + throw new \InvalidArgumentException('non-nullable pub_sub cannot be null'); + } + $this->container['pub_sub'] = $pub_sub; + + return $this; + } + + /** + * Gets type + * + * @return \Convoy\Client\Model\DatastoreSourceType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Convoy\Client\Model\DatastoreSourceType|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url url + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets verifier + * + * @return \Convoy\Client\Model\DatastoreVerifierConfig|null + */ + public function getVerifier() + { + return $this->container['verifier']; + } + + /** + * Sets verifier + * + * @param \Convoy\Client\Model\DatastoreVerifierConfig|null $verifier verifier + * + * @return self + */ + public function setVerifier($verifier) + { + if (is_null($verifier)) { + throw new \InvalidArgumentException('non-nullable verifier cannot be null'); + } + $this->container['verifier'] = $verifier; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsStrategyConfiguration.php b/src/Client/Model/ModelsStrategyConfiguration.php new file mode 100644 index 0000000..5fe095f --- /dev/null +++ b/src/Client/Model/ModelsStrategyConfiguration.php @@ -0,0 +1,478 @@ + + */ +class ModelsStrategyConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.StrategyConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'duration' => 'int', + 'retry_count' => 'int', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'duration' => null, + 'retry_count' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'duration' => false, + 'retry_count' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'duration' => 'duration', + 'retry_count' => 'retry_count', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'duration' => 'setDuration', + 'retry_count' => 'setRetryCount', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'duration' => 'getDuration', + 'retry_count' => 'getRetryCount', + 'type' => 'getType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('duration', $data ?? [], null); + $this->setIfExists('retry_count', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets duration + * + * @return int|null + */ + public function getDuration() + { + return $this->container['duration']; + } + + /** + * Sets duration + * + * @param int|null $duration duration + * + * @return self + */ + public function setDuration($duration) + { + if (is_null($duration)) { + throw new \InvalidArgumentException('non-nullable duration cannot be null'); + } + $this->container['duration'] = $duration; + + return $this; + } + + /** + * Gets retry_count + * + * @return int|null + */ + public function getRetryCount() + { + return $this->container['retry_count']; + } + + /** + * Sets retry_count + * + * @param int|null $retry_count retry_count + * + * @return self + */ + public function setRetryCount($retry_count) + { + if (is_null($retry_count)) { + throw new \InvalidArgumentException('non-nullable retry_count cannot be null'); + } + $this->container['retry_count'] = $retry_count; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsSubscriptionResponse.php b/src/Client/Model/ModelsSubscriptionResponse.php new file mode 100644 index 0000000..4da8889 --- /dev/null +++ b/src/Client/Model/ModelsSubscriptionResponse.php @@ -0,0 +1,920 @@ + + */ +class ModelsSubscriptionResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.SubscriptionResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'alert_config' => '\Convoy\Client\Model\DatastoreAlertConfiguration', + 'created_at' => 'string', + 'deleted_at' => 'string', + 'delivery_mode' => '\Convoy\Client\Model\DatastoreDeliveryMode', + 'device_metadata' => '\Convoy\Client\Model\DatastoreDevice', + 'endpoint_metadata' => '\Convoy\Client\Model\DatastoreEndpoint', + 'filter_config' => '\Convoy\Client\Model\DatastoreFilterConfiguration', + 'function' => 'string', + 'name' => 'string', + 'project_id' => 'string', + 'rate_limit_config' => '\Convoy\Client\Model\DatastoreRateLimitConfiguration', + 'retry_config' => '\Convoy\Client\Model\DatastoreRetryConfiguration', + 'source_metadata' => '\Convoy\Client\Model\DatastoreSource', + 'type' => '\Convoy\Client\Model\DatastoreSubscriptionType', + 'uid' => 'string', + 'updated_at' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'alert_config' => null, + 'created_at' => null, + 'deleted_at' => null, + 'delivery_mode' => null, + 'device_metadata' => null, + 'endpoint_metadata' => null, + 'filter_config' => null, + 'function' => null, + 'name' => null, + 'project_id' => null, + 'rate_limit_config' => null, + 'retry_config' => null, + 'source_metadata' => null, + 'type' => null, + 'uid' => null, + 'updated_at' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'alert_config' => false, + 'created_at' => false, + 'deleted_at' => false, + 'delivery_mode' => false, + 'device_metadata' => false, + 'endpoint_metadata' => false, + 'filter_config' => false, + 'function' => false, + 'name' => false, + 'project_id' => false, + 'rate_limit_config' => false, + 'retry_config' => false, + 'source_metadata' => false, + 'type' => false, + 'uid' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'alert_config' => 'alert_config', + 'created_at' => 'created_at', + 'deleted_at' => 'deleted_at', + 'delivery_mode' => 'delivery_mode', + 'device_metadata' => 'device_metadata', + 'endpoint_metadata' => 'endpoint_metadata', + 'filter_config' => 'filter_config', + 'function' => 'function', + 'name' => 'name', + 'project_id' => 'project_id', + 'rate_limit_config' => 'rate_limit_config', + 'retry_config' => 'retry_config', + 'source_metadata' => 'source_metadata', + 'type' => 'type', + 'uid' => 'uid', + 'updated_at' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'alert_config' => 'setAlertConfig', + 'created_at' => 'setCreatedAt', + 'deleted_at' => 'setDeletedAt', + 'delivery_mode' => 'setDeliveryMode', + 'device_metadata' => 'setDeviceMetadata', + 'endpoint_metadata' => 'setEndpointMetadata', + 'filter_config' => 'setFilterConfig', + 'function' => 'setFunction', + 'name' => 'setName', + 'project_id' => 'setProjectId', + 'rate_limit_config' => 'setRateLimitConfig', + 'retry_config' => 'setRetryConfig', + 'source_metadata' => 'setSourceMetadata', + 'type' => 'setType', + 'uid' => 'setUid', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'alert_config' => 'getAlertConfig', + 'created_at' => 'getCreatedAt', + 'deleted_at' => 'getDeletedAt', + 'delivery_mode' => 'getDeliveryMode', + 'device_metadata' => 'getDeviceMetadata', + 'endpoint_metadata' => 'getEndpointMetadata', + 'filter_config' => 'getFilterConfig', + 'function' => 'getFunction', + 'name' => 'getName', + 'project_id' => 'getProjectId', + 'rate_limit_config' => 'getRateLimitConfig', + 'retry_config' => 'getRetryConfig', + 'source_metadata' => 'getSourceMetadata', + 'type' => 'getType', + 'uid' => 'getUid', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('alert_config', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('deleted_at', $data ?? [], null); + $this->setIfExists('delivery_mode', $data ?? [], null); + $this->setIfExists('device_metadata', $data ?? [], null); + $this->setIfExists('endpoint_metadata', $data ?? [], null); + $this->setIfExists('filter_config', $data ?? [], null); + $this->setIfExists('function', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('project_id', $data ?? [], null); + $this->setIfExists('rate_limit_config', $data ?? [], null); + $this->setIfExists('retry_config', $data ?? [], null); + $this->setIfExists('source_metadata', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('uid', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets alert_config + * + * @return \Convoy\Client\Model\DatastoreAlertConfiguration|null + */ + public function getAlertConfig() + { + return $this->container['alert_config']; + } + + /** + * Sets alert_config + * + * @param \Convoy\Client\Model\DatastoreAlertConfiguration|null $alert_config subscription config + * + * @return self + */ + public function setAlertConfig($alert_config) + { + if (is_null($alert_config)) { + throw new \InvalidArgumentException('non-nullable alert_config cannot be null'); + } + $this->container['alert_config'] = $alert_config; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets deleted_at + * + * @return string|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param string|null $deleted_at deleted_at + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + if (is_null($deleted_at)) { + throw new \InvalidArgumentException('non-nullable deleted_at cannot be null'); + } + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets delivery_mode + * + * @return \Convoy\Client\Model\DatastoreDeliveryMode|null + */ + public function getDeliveryMode() + { + return $this->container['delivery_mode']; + } + + /** + * Sets delivery_mode + * + * @param \Convoy\Client\Model\DatastoreDeliveryMode|null $delivery_mode delivery_mode + * + * @return self + */ + public function setDeliveryMode($delivery_mode) + { + if (is_null($delivery_mode)) { + throw new \InvalidArgumentException('non-nullable delivery_mode cannot be null'); + } + $this->container['delivery_mode'] = $delivery_mode; + + return $this; + } + + /** + * Gets device_metadata + * + * @return \Convoy\Client\Model\DatastoreDevice|null + */ + public function getDeviceMetadata() + { + return $this->container['device_metadata']; + } + + /** + * Sets device_metadata + * + * @param \Convoy\Client\Model\DatastoreDevice|null $device_metadata device_metadata + * + * @return self + */ + public function setDeviceMetadata($device_metadata) + { + if (is_null($device_metadata)) { + throw new \InvalidArgumentException('non-nullable device_metadata cannot be null'); + } + $this->container['device_metadata'] = $device_metadata; + + return $this; + } + + /** + * Gets endpoint_metadata + * + * @return \Convoy\Client\Model\DatastoreEndpoint|null + */ + public function getEndpointMetadata() + { + return $this->container['endpoint_metadata']; + } + + /** + * Sets endpoint_metadata + * + * @param \Convoy\Client\Model\DatastoreEndpoint|null $endpoint_metadata endpoint_metadata + * + * @return self + */ + public function setEndpointMetadata($endpoint_metadata) + { + if (is_null($endpoint_metadata)) { + throw new \InvalidArgumentException('non-nullable endpoint_metadata cannot be null'); + } + $this->container['endpoint_metadata'] = $endpoint_metadata; + + return $this; + } + + /** + * Gets filter_config + * + * @return \Convoy\Client\Model\DatastoreFilterConfiguration|null + */ + public function getFilterConfig() + { + return $this->container['filter_config']; + } + + /** + * Sets filter_config + * + * @param \Convoy\Client\Model\DatastoreFilterConfiguration|null $filter_config filter_config + * + * @return self + */ + public function setFilterConfig($filter_config) + { + if (is_null($filter_config)) { + throw new \InvalidArgumentException('non-nullable filter_config cannot be null'); + } + $this->container['filter_config'] = $filter_config; + + return $this; + } + + /** + * Gets function + * + * @return string|null + */ + public function getFunction() + { + return $this->container['function']; + } + + /** + * Sets function + * + * @param string|null $function function + * + * @return self + */ + public function setFunction($function) + { + if (is_null($function)) { + throw new \InvalidArgumentException('non-nullable function cannot be null'); + } + $this->container['function'] = $function; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets project_id + * + * @return string|null + */ + public function getProjectId() + { + return $this->container['project_id']; + } + + /** + * Sets project_id + * + * @param string|null $project_id project_id + * + * @return self + */ + public function setProjectId($project_id) + { + if (is_null($project_id)) { + throw new \InvalidArgumentException('non-nullable project_id cannot be null'); + } + $this->container['project_id'] = $project_id; + + return $this; + } + + /** + * Gets rate_limit_config + * + * @return \Convoy\Client\Model\DatastoreRateLimitConfiguration|null + */ + public function getRateLimitConfig() + { + return $this->container['rate_limit_config']; + } + + /** + * Sets rate_limit_config + * + * @param \Convoy\Client\Model\DatastoreRateLimitConfiguration|null $rate_limit_config rate_limit_config + * + * @return self + */ + public function setRateLimitConfig($rate_limit_config) + { + if (is_null($rate_limit_config)) { + throw new \InvalidArgumentException('non-nullable rate_limit_config cannot be null'); + } + $this->container['rate_limit_config'] = $rate_limit_config; + + return $this; + } + + /** + * Gets retry_config + * + * @return \Convoy\Client\Model\DatastoreRetryConfiguration|null + */ + public function getRetryConfig() + { + return $this->container['retry_config']; + } + + /** + * Sets retry_config + * + * @param \Convoy\Client\Model\DatastoreRetryConfiguration|null $retry_config retry_config + * + * @return self + */ + public function setRetryConfig($retry_config) + { + if (is_null($retry_config)) { + throw new \InvalidArgumentException('non-nullable retry_config cannot be null'); + } + $this->container['retry_config'] = $retry_config; + + return $this; + } + + /** + * Gets source_metadata + * + * @return \Convoy\Client\Model\DatastoreSource|null + */ + public function getSourceMetadata() + { + return $this->container['source_metadata']; + } + + /** + * Sets source_metadata + * + * @param \Convoy\Client\Model\DatastoreSource|null $source_metadata source_metadata + * + * @return self + */ + public function setSourceMetadata($source_metadata) + { + if (is_null($source_metadata)) { + throw new \InvalidArgumentException('non-nullable source_metadata cannot be null'); + } + $this->container['source_metadata'] = $source_metadata; + + return $this; + } + + /** + * Gets type + * + * @return \Convoy\Client\Model\DatastoreSubscriptionType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Convoy\Client\Model\DatastoreSubscriptionType|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid uid + * + * @return self + */ + public function setUid($uid) + { + if (is_null($uid)) { + throw new \InvalidArgumentException('non-nullable uid cannot be null'); + } + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsTestFilter.php b/src/Client/Model/ModelsTestFilter.php new file mode 100644 index 0000000..46060b0 --- /dev/null +++ b/src/Client/Model/ModelsTestFilter.php @@ -0,0 +1,444 @@ + + */ +class ModelsTestFilter implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.TestFilter'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'request' => '\Convoy\Client\Model\ModelsFilterSchema', + 'schema' => '\Convoy\Client\Model\ModelsFilterSchema' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'request' => null, + 'schema' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'request' => false, + 'schema' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'request' => 'request', + 'schema' => 'schema' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'request' => 'setRequest', + 'schema' => 'setSchema' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'request' => 'getRequest', + 'schema' => 'getSchema' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('schema', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets request + * + * @return \Convoy\Client\Model\ModelsFilterSchema|null + */ + public function getRequest() + { + return $this->container['request']; + } + + /** + * Sets request + * + * @param \Convoy\Client\Model\ModelsFilterSchema|null $request Same Request & Headers + * + * @return self + */ + public function setRequest($request) + { + if (is_null($request)) { + throw new \InvalidArgumentException('non-nullable request cannot be null'); + } + $this->container['request'] = $request; + + return $this; + } + + /** + * Gets schema + * + * @return \Convoy\Client\Model\ModelsFilterSchema|null + */ + public function getSchema() + { + return $this->container['schema']; + } + + /** + * Sets schema + * + * @param \Convoy\Client\Model\ModelsFilterSchema|null $schema Sample test schema + * + * @return self + */ + public function setSchema($schema) + { + if (is_null($schema)) { + throw new \InvalidArgumentException('non-nullable schema cannot be null'); + } + $this->container['schema'] = $schema; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsTestFilterRequest.php b/src/Client/Model/ModelsTestFilterRequest.php new file mode 100644 index 0000000..bcb8f8c --- /dev/null +++ b/src/Client/Model/ModelsTestFilterRequest.php @@ -0,0 +1,451 @@ + + */ +class ModelsTestFilterRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.TestFilterRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'payload' => 'mixed', + 'request' => '\Convoy\Client\Model\ModelsTestFilterRequestScopes' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'payload' => null, + 'request' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'payload' => true, + 'request' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'payload' => 'payload', + 'request' => 'request' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'payload' => 'setPayload', + 'request' => 'setRequest' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'payload' => 'getPayload', + 'request' => 'getRequest' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('payload', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets payload + * + * @return mixed|null + */ + public function getPayload() + { + return $this->container['payload']; + } + + /** + * Sets payload + * + * @param mixed|null $payload Sample payload to test against body filter rules. Optional when request scopes are supplied. + * + * @return self + */ + public function setPayload($payload) + { + if (is_null($payload)) { + array_push($this->openAPINullablesSetToNull, 'payload'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('payload', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['payload'] = $payload; + + return $this; + } + + /** + * Gets request + * + * @return \Convoy\Client\Model\ModelsTestFilterRequestScopes|null + */ + public function getRequest() + { + return $this->container['request']; + } + + /** + * Sets request + * + * @param \Convoy\Client\Model\ModelsTestFilterRequestScopes|null $request Request scopes to test against the filter. + * + * @return self + */ + public function setRequest($request) + { + if (is_null($request)) { + throw new \InvalidArgumentException('non-nullable request cannot be null'); + } + $this->container['request'] = $request; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsTestFilterRequestScopes.php b/src/Client/Model/ModelsTestFilterRequestScopes.php new file mode 100644 index 0000000..328a4ad --- /dev/null +++ b/src/Client/Model/ModelsTestFilterRequestScopes.php @@ -0,0 +1,553 @@ + + */ +class ModelsTestFilterRequestScopes implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.TestFilterRequestScopes'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'body' => 'mixed', + 'header' => 'array', + 'headers' => 'array', + 'path' => 'array', + 'query' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'body' => null, + 'header' => null, + 'headers' => null, + 'path' => null, + 'query' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'body' => true, + 'header' => false, + 'headers' => false, + 'path' => false, + 'query' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'body' => 'body', + 'header' => 'header', + 'headers' => 'headers', + 'path' => 'path', + 'query' => 'query' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'body' => 'setBody', + 'header' => 'setHeader', + 'headers' => 'setHeaders', + 'path' => 'setPath', + 'query' => 'setQuery' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'body' => 'getBody', + 'header' => 'getHeader', + 'headers' => 'getHeaders', + 'path' => 'getPath', + 'query' => 'getQuery' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('header', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('path', $data ?? [], null); + $this->setIfExists('query', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets body + * + * @return mixed|null + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param mixed|null $body body + * + * @return self + */ + public function setBody($body) + { + if (is_null($body)) { + array_push($this->openAPINullablesSetToNull, 'body'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('body', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets header + * + * @return array|null + */ + public function getHeader() + { + return $this->container['header']; + } + + /** + * Sets header + * + * @param array|null $header header + * + * @return self + */ + public function setHeader($header) + { + if (is_null($header)) { + throw new \InvalidArgumentException('non-nullable header cannot be null'); + } + $this->container['header'] = $header; + + return $this; + } + + /** + * Gets headers + * + * @return array|null + */ + public function getHeaders() + { + return $this->container['headers']; + } + + /** + * Sets headers + * + * @param array|null $headers Headers accepts either \"headers\" or \"header\" for compatibility with the subscription filter tester. + * + * @return self + */ + public function setHeaders($headers) + { + if (is_null($headers)) { + throw new \InvalidArgumentException('non-nullable headers cannot be null'); + } + $this->container['headers'] = $headers; + + return $this; + } + + /** + * Gets path + * + * @return array|null + */ + public function getPath() + { + return $this->container['path']; + } + + /** + * Sets path + * + * @param array|null $path path + * + * @return self + */ + public function setPath($path) + { + if (is_null($path)) { + throw new \InvalidArgumentException('non-nullable path cannot be null'); + } + $this->container['path'] = $path; + + return $this; + } + + /** + * Gets query + * + * @return array|null + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param array|null $query query + * + * @return self + */ + public function setQuery($query) + { + if (is_null($query)) { + throw new \InvalidArgumentException('non-nullable query cannot be null'); + } + $this->container['query'] = $query; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsTestFilterResponse.php b/src/Client/Model/ModelsTestFilterResponse.php new file mode 100644 index 0000000..614d97c --- /dev/null +++ b/src/Client/Model/ModelsTestFilterResponse.php @@ -0,0 +1,410 @@ + + */ +class ModelsTestFilterResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.TestFilterResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'is_match' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'is_match' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is_match' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'is_match' => 'is_match' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'is_match' => 'setIsMatch' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'is_match' => 'getIsMatch' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('is_match', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets is_match + * + * @return bool|null + */ + public function getIsMatch() + { + return $this->container['is_match']; + } + + /** + * Sets is_match + * + * @param bool|null $is_match Whether the payload matches the filter criteria + * + * @return self + */ + public function setIsMatch($is_match) + { + if (is_null($is_match)) { + throw new \InvalidArgumentException('non-nullable is_match cannot be null'); + } + $this->container['is_match'] = $is_match; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsTestOAuth2Request.php b/src/Client/Model/ModelsTestOAuth2Request.php new file mode 100644 index 0000000..6cc511d --- /dev/null +++ b/src/Client/Model/ModelsTestOAuth2Request.php @@ -0,0 +1,410 @@ + + */ +class ModelsTestOAuth2Request implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.TestOAuth2Request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'oauth2' => '\Convoy\Client\Model\ModelsOAuth2' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'oauth2' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'oauth2' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'oauth2' => 'oauth2' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'oauth2' => 'setOauth2' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'oauth2' => 'getOauth2' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('oauth2', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets oauth2 + * + * @return \Convoy\Client\Model\ModelsOAuth2|null + */ + public function getOauth2() + { + return $this->container['oauth2']; + } + + /** + * Sets oauth2 + * + * @param \Convoy\Client\Model\ModelsOAuth2|null $oauth2 oauth2 + * + * @return self + */ + public function setOauth2($oauth2) + { + if (is_null($oauth2)) { + throw new \InvalidArgumentException('non-nullable oauth2 cannot be null'); + } + $this->container['oauth2'] = $oauth2; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsTestOAuth2Response.php b/src/Client/Model/ModelsTestOAuth2Response.php new file mode 100644 index 0000000..f6b334a --- /dev/null +++ b/src/Client/Model/ModelsTestOAuth2Response.php @@ -0,0 +1,580 @@ + + */ +class ModelsTestOAuth2Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.TestOAuth2Response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'access_token' => 'string', + 'error' => 'string', + 'expires_at' => 'string', + 'message' => 'string', + 'success' => 'bool', + 'token_type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'access_token' => null, + 'error' => null, + 'expires_at' => null, + 'message' => null, + 'success' => null, + 'token_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'access_token' => false, + 'error' => false, + 'expires_at' => false, + 'message' => false, + 'success' => false, + 'token_type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'access_token' => 'access_token', + 'error' => 'error', + 'expires_at' => 'expires_at', + 'message' => 'message', + 'success' => 'success', + 'token_type' => 'token_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'access_token' => 'setAccessToken', + 'error' => 'setError', + 'expires_at' => 'setExpiresAt', + 'message' => 'setMessage', + 'success' => 'setSuccess', + 'token_type' => 'setTokenType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'access_token' => 'getAccessToken', + 'error' => 'getError', + 'expires_at' => 'getExpiresAt', + 'message' => 'getMessage', + 'success' => 'getSuccess', + 'token_type' => 'getTokenType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('access_token', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('success', $data ?? [], null); + $this->setIfExists('token_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets access_token + * + * @return string|null + */ + public function getAccessToken() + { + return $this->container['access_token']; + } + + /** + * Sets access_token + * + * @param string|null $access_token access_token + * + * @return self + */ + public function setAccessToken($access_token) + { + if (is_null($access_token)) { + throw new \InvalidArgumentException('non-nullable access_token cannot be null'); + } + $this->container['access_token'] = $access_token; + + return $this; + } + + /** + * Gets error + * + * @return string|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets expires_at + * + * @return string|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param string|null $expires_at expires_at + * + * @return self + */ + public function setExpiresAt($expires_at) + { + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + } + $this->container['expires_at'] = $expires_at; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success success + * + * @return self + */ + public function setSuccess($success) + { + if (is_null($success)) { + throw new \InvalidArgumentException('non-nullable success cannot be null'); + } + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets token_type + * + * @return string|null + */ + public function getTokenType() + { + return $this->container['token_type']; + } + + /** + * Sets token_type + * + * @param string|null $token_type token_type + * + * @return self + */ + public function setTokenType($token_type) + { + if (is_null($token_type)) { + throw new \InvalidArgumentException('non-nullable token_type cannot be null'); + } + $this->container['token_type'] = $token_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsUpdateCustomResponse.php b/src/Client/Model/ModelsUpdateCustomResponse.php new file mode 100644 index 0000000..3b2cb3a --- /dev/null +++ b/src/Client/Model/ModelsUpdateCustomResponse.php @@ -0,0 +1,458 @@ + + */ +class ModelsUpdateCustomResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.UpdateCustomResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'body' => 'string', + 'content_type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'body' => null, + 'content_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'body' => true, + 'content_type' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'body' => 'body', + 'content_type' => 'content_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'body' => 'setBody', + 'content_type' => 'setContentType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'body' => 'getBody', + 'content_type' => 'getContentType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('content_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets body + * + * @return string|null + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param string|null $body body + * + * @return self + */ + public function setBody($body) + { + if (is_null($body)) { + array_push($this->openAPINullablesSetToNull, 'body'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('body', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets content_type + * + * @return string|null + */ + public function getContentType() + { + return $this->container['content_type']; + } + + /** + * Sets content_type + * + * @param string|null $content_type content_type + * + * @return self + */ + public function setContentType($content_type) + { + if (is_null($content_type)) { + array_push($this->openAPINullablesSetToNull, 'content_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('content_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['content_type'] = $content_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsUpdateEndpoint.php b/src/Client/Model/ModelsUpdateEndpoint.php new file mode 100644 index 0000000..9c41909 --- /dev/null +++ b/src/Client/Model/ModelsUpdateEndpoint.php @@ -0,0 +1,886 @@ + + */ +class ModelsUpdateEndpoint implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.UpdateEndpoint'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'advanced_signatures' => 'bool', + 'authentication' => '\Convoy\Client\Model\ModelsEndpointAuthentication', + 'content_type' => 'string', + 'description' => 'string', + 'http_timeout' => 'int', + 'is_disabled' => 'bool', + 'mtls_client_cert' => '\Convoy\Client\Model\ModelsMtlsClientCert', + 'name' => 'string', + 'owner_id' => 'string', + 'rate_limit' => 'int', + 'rate_limit_duration' => 'int', + 'secret' => 'string', + 'slack_webhook_url' => 'string', + 'support_email' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'advanced_signatures' => null, + 'authentication' => null, + 'content_type' => null, + 'description' => null, + 'http_timeout' => null, + 'is_disabled' => null, + 'mtls_client_cert' => null, + 'name' => null, + 'owner_id' => null, + 'rate_limit' => null, + 'rate_limit_duration' => null, + 'secret' => null, + 'slack_webhook_url' => null, + 'support_email' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'advanced_signatures' => false, + 'authentication' => false, + 'content_type' => false, + 'description' => false, + 'http_timeout' => false, + 'is_disabled' => false, + 'mtls_client_cert' => false, + 'name' => false, + 'owner_id' => false, + 'rate_limit' => false, + 'rate_limit_duration' => false, + 'secret' => false, + 'slack_webhook_url' => false, + 'support_email' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'advanced_signatures' => 'advanced_signatures', + 'authentication' => 'authentication', + 'content_type' => 'content_type', + 'description' => 'description', + 'http_timeout' => 'http_timeout', + 'is_disabled' => 'is_disabled', + 'mtls_client_cert' => 'mtls_client_cert', + 'name' => 'name', + 'owner_id' => 'owner_id', + 'rate_limit' => 'rate_limit', + 'rate_limit_duration' => 'rate_limit_duration', + 'secret' => 'secret', + 'slack_webhook_url' => 'slack_webhook_url', + 'support_email' => 'support_email', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'advanced_signatures' => 'setAdvancedSignatures', + 'authentication' => 'setAuthentication', + 'content_type' => 'setContentType', + 'description' => 'setDescription', + 'http_timeout' => 'setHttpTimeout', + 'is_disabled' => 'setIsDisabled', + 'mtls_client_cert' => 'setMtlsClientCert', + 'name' => 'setName', + 'owner_id' => 'setOwnerId', + 'rate_limit' => 'setRateLimit', + 'rate_limit_duration' => 'setRateLimitDuration', + 'secret' => 'setSecret', + 'slack_webhook_url' => 'setSlackWebhookUrl', + 'support_email' => 'setSupportEmail', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'advanced_signatures' => 'getAdvancedSignatures', + 'authentication' => 'getAuthentication', + 'content_type' => 'getContentType', + 'description' => 'getDescription', + 'http_timeout' => 'getHttpTimeout', + 'is_disabled' => 'getIsDisabled', + 'mtls_client_cert' => 'getMtlsClientCert', + 'name' => 'getName', + 'owner_id' => 'getOwnerId', + 'rate_limit' => 'getRateLimit', + 'rate_limit_duration' => 'getRateLimitDuration', + 'secret' => 'getSecret', + 'slack_webhook_url' => 'getSlackWebhookUrl', + 'support_email' => 'getSupportEmail', + 'url' => 'getUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('advanced_signatures', $data ?? [], null); + $this->setIfExists('authentication', $data ?? [], null); + $this->setIfExists('content_type', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('http_timeout', $data ?? [], null); + $this->setIfExists('is_disabled', $data ?? [], null); + $this->setIfExists('mtls_client_cert', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('owner_id', $data ?? [], null); + $this->setIfExists('rate_limit', $data ?? [], null); + $this->setIfExists('rate_limit_duration', $data ?? [], null); + $this->setIfExists('secret', $data ?? [], null); + $this->setIfExists('slack_webhook_url', $data ?? [], null); + $this->setIfExists('support_email', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets advanced_signatures + * + * @return bool|null + */ + public function getAdvancedSignatures() + { + return $this->container['advanced_signatures']; + } + + /** + * Sets advanced_signatures + * + * @param bool|null $advanced_signatures Convoy supports two [signature formats](https://getconvoy.io/docs/product-manual/signatures) -- simple or advanced. If left unspecified, we default to false. + * + * @return self + */ + public function setAdvancedSignatures($advanced_signatures) + { + if (is_null($advanced_signatures)) { + throw new \InvalidArgumentException('non-nullable advanced_signatures cannot be null'); + } + $this->container['advanced_signatures'] = $advanced_signatures; + + return $this; + } + + /** + * Gets authentication + * + * @return \Convoy\Client\Model\ModelsEndpointAuthentication|null + */ + public function getAuthentication() + { + return $this->container['authentication']; + } + + /** + * Sets authentication + * + * @param \Convoy\Client\Model\ModelsEndpointAuthentication|null $authentication This is used to define any custom authentication required by the endpoint. This shouldn't be needed often because webhook endpoints usually should be exposed to the internet. + * + * @return self + */ + public function setAuthentication($authentication) + { + if (is_null($authentication)) { + throw new \InvalidArgumentException('non-nullable authentication cannot be null'); + } + $this->container['authentication'] = $authentication; + + return $this; + } + + /** + * Gets content_type + * + * @return string|null + */ + public function getContentType() + { + return $this->container['content_type']; + } + + /** + * Sets content_type + * + * @param string|null $content_type Content type for the endpoint. Defaults to application/json if not specified. + * + * @return self + */ + public function setContentType($content_type) + { + if (is_null($content_type)) { + throw new \InvalidArgumentException('non-nullable content_type cannot be null'); + } + $this->container['content_type'] = $content_type; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Human-readable description of the endpoint. Think of this as metadata describing the endpoint + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets http_timeout + * + * @return int|null + */ + public function getHttpTimeout() + { + return $this->container['http_timeout']; + } + + /** + * Sets http_timeout + * + * @param int|null $http_timeout Define endpoint http timeout in seconds. + * + * @return self + */ + public function setHttpTimeout($http_timeout) + { + if (is_null($http_timeout)) { + throw new \InvalidArgumentException('non-nullable http_timeout cannot be null'); + } + $this->container['http_timeout'] = $http_timeout; + + return $this; + } + + /** + * Gets is_disabled + * + * @return bool|null + */ + public function getIsDisabled() + { + return $this->container['is_disabled']; + } + + /** + * Sets is_disabled + * + * @param bool|null $is_disabled This is used to manually enable/disable the endpoint. + * + * @return self + */ + public function setIsDisabled($is_disabled) + { + if (is_null($is_disabled)) { + throw new \InvalidArgumentException('non-nullable is_disabled cannot be null'); + } + $this->container['is_disabled'] = $is_disabled; + + return $this; + } + + /** + * Gets mtls_client_cert + * + * @return \Convoy\Client\Model\ModelsMtlsClientCert|null + */ + public function getMtlsClientCert() + { + return $this->container['mtls_client_cert']; + } + + /** + * Sets mtls_client_cert + * + * @param \Convoy\Client\Model\ModelsMtlsClientCert|null $mtls_client_cert mTLS client certificate configuration for the endpoint + * + * @return self + */ + public function setMtlsClientCert($mtls_client_cert) + { + if (is_null($mtls_client_cert)) { + throw new \InvalidArgumentException('non-nullable mtls_client_cert cannot be null'); + } + $this->container['mtls_client_cert'] = $mtls_client_cert; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets owner_id + * + * @return string|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param string|null $owner_id The OwnerID is used to group more than one endpoint together to achieve [fanout](https://getconvoy.io/docs/manual/endpoints#Endpoint%20Owner%20ID) + * + * @return self + */ + public function setOwnerId($owner_id) + { + if (is_null($owner_id)) { + throw new \InvalidArgumentException('non-nullable owner_id cannot be null'); + } + $this->container['owner_id'] = $owner_id; + + return $this; + } + + /** + * Gets rate_limit + * + * @return int|null + */ + public function getRateLimit() + { + return $this->container['rate_limit']; + } + + /** + * Sets rate_limit + * + * @param int|null $rate_limit Rate limit is the total number of requests to be sent to an endpoint in the time duration specified in RateLimitDuration + * + * @return self + */ + public function setRateLimit($rate_limit) + { + if (is_null($rate_limit)) { + throw new \InvalidArgumentException('non-nullable rate_limit cannot be null'); + } + $this->container['rate_limit'] = $rate_limit; + + return $this; + } + + /** + * Gets rate_limit_duration + * + * @return int|null + */ + public function getRateLimitDuration() + { + return $this->container['rate_limit_duration']; + } + + /** + * Sets rate_limit_duration + * + * @param int|null $rate_limit_duration Rate limit duration specifies the time range for the rate limit. + * + * @return self + */ + public function setRateLimitDuration($rate_limit_duration) + { + if (is_null($rate_limit_duration)) { + throw new \InvalidArgumentException('non-nullable rate_limit_duration cannot be null'); + } + $this->container['rate_limit_duration'] = $rate_limit_duration; + + return $this; + } + + /** + * Gets secret + * + * @return string|null + */ + public function getSecret() + { + return $this->container['secret']; + } + + /** + * Sets secret + * + * @param string|null $secret Endpoint's webhook secret. If not provided, Convoy autogenerates one for the endpoint. + * + * @return self + */ + public function setSecret($secret) + { + if (is_null($secret)) { + throw new \InvalidArgumentException('non-nullable secret cannot be null'); + } + $this->container['secret'] = $secret; + + return $this; + } + + /** + * Gets slack_webhook_url + * + * @return string|null + */ + public function getSlackWebhookUrl() + { + return $this->container['slack_webhook_url']; + } + + /** + * Sets slack_webhook_url + * + * @param string|null $slack_webhook_url Slack webhook URL is an alternative method to support email where endpoint developers can receive failure notifications on a slack channel. + * + * @return self + */ + public function setSlackWebhookUrl($slack_webhook_url) + { + if (is_null($slack_webhook_url)) { + throw new \InvalidArgumentException('non-nullable slack_webhook_url cannot be null'); + } + $this->container['slack_webhook_url'] = $slack_webhook_url; + + return $this; + } + + /** + * Gets support_email + * + * @return string|null + */ + public function getSupportEmail() + { + return $this->container['support_email']; + } + + /** + * Sets support_email + * + * @param string|null $support_email Endpoint developers support email. This is used for communicating endpoint state changes. You should always turn this on when disabling endpoints are enabled. + * + * @return self + */ + public function setSupportEmail($support_email) + { + if (is_null($support_email)) { + throw new \InvalidArgumentException('non-nullable support_email cannot be null'); + } + $this->container['support_email'] = $support_email; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url URL is the endpoint's URL prefixed with https. non-https urls are currently not supported. + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsUpdateEventType.php b/src/Client/Model/ModelsUpdateEventType.php new file mode 100644 index 0000000..d4bbc25 --- /dev/null +++ b/src/Client/Model/ModelsUpdateEventType.php @@ -0,0 +1,478 @@ + + */ +class ModelsUpdateEventType implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.UpdateEventType'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'description' => 'string', + 'json_schema' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'description' => null, + 'json_schema' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'category' => false, + 'description' => false, + 'json_schema' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'description' => 'description', + 'json_schema' => 'json_schema' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'description' => 'setDescription', + 'json_schema' => 'setJsonSchema' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'description' => 'getDescription', + 'json_schema' => 'getJsonSchema' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('json_schema', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Category is a product-specific grouping for the event type + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Description is used to describe what the event type does + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets json_schema + * + * @return array|null + */ + public function getJsonSchema() + { + return $this->container['json_schema']; + } + + /** + * Sets json_schema + * + * @param array|null $json_schema JSONSchema is the JSON structure of the event type + * + * @return self + */ + public function setJsonSchema($json_schema) + { + if (is_null($json_schema)) { + throw new \InvalidArgumentException('non-nullable json_schema cannot be null'); + } + $this->container['json_schema'] = $json_schema; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsUpdateFilterRequest.php b/src/Client/Model/ModelsUpdateFilterRequest.php new file mode 100644 index 0000000..dec4538 --- /dev/null +++ b/src/Client/Model/ModelsUpdateFilterRequest.php @@ -0,0 +1,614 @@ + + */ +class ModelsUpdateFilterRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.UpdateFilterRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'body' => 'array', + 'enabled_at' => '\Convoy\Client\Model\ModelsOptionalTime', + 'event_type' => 'string', + 'headers' => 'array', + 'is_flattened' => 'bool', + 'path' => 'array', + 'query' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'body' => null, + 'enabled_at' => null, + 'event_type' => null, + 'headers' => null, + 'is_flattened' => null, + 'path' => null, + 'query' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'body' => false, + 'enabled_at' => false, + 'event_type' => false, + 'headers' => false, + 'is_flattened' => false, + 'path' => false, + 'query' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'body' => 'body', + 'enabled_at' => 'enabled_at', + 'event_type' => 'event_type', + 'headers' => 'headers', + 'is_flattened' => 'is_flattened', + 'path' => 'path', + 'query' => 'query' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'body' => 'setBody', + 'enabled_at' => 'setEnabledAt', + 'event_type' => 'setEventType', + 'headers' => 'setHeaders', + 'is_flattened' => 'setIsFlattened', + 'path' => 'setPath', + 'query' => 'setQuery' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'body' => 'getBody', + 'enabled_at' => 'getEnabledAt', + 'event_type' => 'getEventType', + 'headers' => 'getHeaders', + 'is_flattened' => 'getIsFlattened', + 'path' => 'getPath', + 'query' => 'getQuery' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('body', $data ?? [], null); + $this->setIfExists('enabled_at', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('is_flattened', $data ?? [], null); + $this->setIfExists('path', $data ?? [], null); + $this->setIfExists('query', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets body + * + * @return array|null + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param array|null $body Body matching criteria (optional) + * + * @return self + */ + public function setBody($body) + { + if (is_null($body)) { + throw new \InvalidArgumentException('non-nullable body cannot be null'); + } + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets enabled_at + * + * @return \Convoy\Client\Model\ModelsOptionalTime|null + */ + public function getEnabledAt() + { + return $this->container['enabled_at']; + } + + /** + * Sets enabled_at + * + * @param \Convoy\Client\Model\ModelsOptionalTime|null $enabled_at Non-null when this filter is active. + * + * @return self + */ + public function setEnabledAt($enabled_at) + { + if (is_null($enabled_at)) { + throw new \InvalidArgumentException('non-nullable enabled_at cannot be null'); + } + $this->container['enabled_at'] = $enabled_at; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type Type of event this filter applies to (optional) + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets headers + * + * @return array|null + */ + public function getHeaders() + { + return $this->container['headers']; + } + + /** + * Sets headers + * + * @param array|null $headers Header matching criteria (optional) + * + * @return self + */ + public function setHeaders($headers) + { + if (is_null($headers)) { + throw new \InvalidArgumentException('non-nullable headers cannot be null'); + } + $this->container['headers'] = $headers; + + return $this; + } + + /** + * Gets is_flattened + * + * @return bool|null + */ + public function getIsFlattened() + { + return $this->container['is_flattened']; + } + + /** + * Sets is_flattened + * + * @param bool|null $is_flattened Whether the filter uses flattened JSON paths (optional) + * + * @return self + */ + public function setIsFlattened($is_flattened) + { + if (is_null($is_flattened)) { + throw new \InvalidArgumentException('non-nullable is_flattened cannot be null'); + } + $this->container['is_flattened'] = $is_flattened; + + return $this; + } + + /** + * Gets path + * + * @return array|null + */ + public function getPath() + { + return $this->container['path']; + } + + /** + * Sets path + * + * @param array|null $path Path matching criteria (optional) + * + * @return self + */ + public function setPath($path) + { + if (is_null($path)) { + throw new \InvalidArgumentException('non-nullable path cannot be null'); + } + $this->container['path'] = $path; + + return $this; + } + + /** + * Gets query + * + * @return array|null + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param array|null $query Query matching criteria (optional) + * + * @return self + */ + public function setQuery($query) + { + if (is_null($query)) { + throw new \InvalidArgumentException('non-nullable query cannot be null'); + } + $this->container['query'] = $query; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsUpdateProject.php b/src/Client/Model/ModelsUpdateProject.php new file mode 100644 index 0000000..a086f6d --- /dev/null +++ b/src/Client/Model/ModelsUpdateProject.php @@ -0,0 +1,478 @@ + + */ +class ModelsUpdateProject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.UpdateProject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'config' => '\Convoy\Client\Model\ModelsProjectConfig', + 'logo_url' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'config' => null, + 'logo_url' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'config' => false, + 'logo_url' => false, + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'config' => 'config', + 'logo_url' => 'logo_url', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'config' => 'setConfig', + 'logo_url' => 'setLogoUrl', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'config' => 'getConfig', + 'logo_url' => 'getLogoUrl', + 'name' => 'getName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('config', $data ?? [], null); + $this->setIfExists('logo_url', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets config + * + * @return \Convoy\Client\Model\ModelsProjectConfig|null + */ + public function getConfig() + { + return $this->container['config']; + } + + /** + * Sets config + * + * @param \Convoy\Client\Model\ModelsProjectConfig|null $config Project Config + * + * @return self + */ + public function setConfig($config) + { + if (is_null($config)) { + throw new \InvalidArgumentException('non-nullable config cannot be null'); + } + $this->container['config'] = $config; + + return $this; + } + + /** + * Gets logo_url + * + * @return string|null + */ + public function getLogoUrl() + { + return $this->container['logo_url']; + } + + /** + * Sets logo_url + * + * @param string|null $logo_url logo_url + * + * @return self + */ + public function setLogoUrl($logo_url) + { + if (is_null($logo_url)) { + throw new \InvalidArgumentException('non-nullable logo_url cannot be null'); + } + $this->container['logo_url'] = $logo_url; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Project Name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsUpdateSource.php b/src/Client/Model/ModelsUpdateSource.php new file mode 100644 index 0000000..4eede76 --- /dev/null +++ b/src/Client/Model/ModelsUpdateSource.php @@ -0,0 +1,750 @@ + + */ +class ModelsUpdateSource implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.UpdateSource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'body_function' => 'string', + 'custom_response' => '\Convoy\Client\Model\ModelsUpdateCustomResponse', + 'event_type_location' => 'string', + 'forward_headers' => 'string[]', + 'header_function' => 'string', + 'idempotency_keys' => 'string[]', + 'is_disabled' => 'bool', + 'name' => 'string', + 'pub_sub' => '\Convoy\Client\Model\ModelsPubSubConfig', + 'type' => '\Convoy\Client\Model\DatastoreSourceType', + 'verifier' => '\Convoy\Client\Model\ModelsVerifierConfig' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'body_function' => null, + 'custom_response' => null, + 'event_type_location' => null, + 'forward_headers' => null, + 'header_function' => null, + 'idempotency_keys' => null, + 'is_disabled' => null, + 'name' => null, + 'pub_sub' => null, + 'type' => null, + 'verifier' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'body_function' => false, + 'custom_response' => false, + 'event_type_location' => false, + 'forward_headers' => false, + 'header_function' => false, + 'idempotency_keys' => false, + 'is_disabled' => false, + 'name' => false, + 'pub_sub' => false, + 'type' => false, + 'verifier' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'body_function' => 'body_function', + 'custom_response' => 'custom_response', + 'event_type_location' => 'event_type_location', + 'forward_headers' => 'forward_headers', + 'header_function' => 'header_function', + 'idempotency_keys' => 'idempotency_keys', + 'is_disabled' => 'is_disabled', + 'name' => 'name', + 'pub_sub' => 'pub_sub', + 'type' => 'type', + 'verifier' => 'verifier' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'body_function' => 'setBodyFunction', + 'custom_response' => 'setCustomResponse', + 'event_type_location' => 'setEventTypeLocation', + 'forward_headers' => 'setForwardHeaders', + 'header_function' => 'setHeaderFunction', + 'idempotency_keys' => 'setIdempotencyKeys', + 'is_disabled' => 'setIsDisabled', + 'name' => 'setName', + 'pub_sub' => 'setPubSub', + 'type' => 'setType', + 'verifier' => 'setVerifier' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'body_function' => 'getBodyFunction', + 'custom_response' => 'getCustomResponse', + 'event_type_location' => 'getEventTypeLocation', + 'forward_headers' => 'getForwardHeaders', + 'header_function' => 'getHeaderFunction', + 'idempotency_keys' => 'getIdempotencyKeys', + 'is_disabled' => 'getIsDisabled', + 'name' => 'getName', + 'pub_sub' => 'getPubSub', + 'type' => 'getType', + 'verifier' => 'getVerifier' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('body_function', $data ?? [], null); + $this->setIfExists('custom_response', $data ?? [], null); + $this->setIfExists('event_type_location', $data ?? [], null); + $this->setIfExists('forward_headers', $data ?? [], null); + $this->setIfExists('header_function', $data ?? [], null); + $this->setIfExists('idempotency_keys', $data ?? [], null); + $this->setIfExists('is_disabled', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('pub_sub', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('verifier', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets body_function + * + * @return string|null + */ + public function getBodyFunction() + { + return $this->container['body_function']; + } + + /** + * Sets body_function + * + * @param string|null $body_function Function is a javascript function used to mutate the payload immediately after ingesting an event + * + * @return self + */ + public function setBodyFunction($body_function) + { + if (is_null($body_function)) { + throw new \InvalidArgumentException('non-nullable body_function cannot be null'); + } + $this->container['body_function'] = $body_function; + + return $this; + } + + /** + * Gets custom_response + * + * @return \Convoy\Client\Model\ModelsUpdateCustomResponse|null + */ + public function getCustomResponse() + { + return $this->container['custom_response']; + } + + /** + * Sets custom_response + * + * @param \Convoy\Client\Model\ModelsUpdateCustomResponse|null $custom_response Custom response is used to define a custom response for incoming webhooks project sources only. + * + * @return self + */ + public function setCustomResponse($custom_response) + { + if (is_null($custom_response)) { + throw new \InvalidArgumentException('non-nullable custom_response cannot be null'); + } + $this->container['custom_response'] = $custom_response; + + return $this; + } + + /** + * Gets event_type_location + * + * @return string|null + */ + public function getEventTypeLocation() + { + return $this->container['event_type_location']; + } + + /** + * Sets event_type_location + * + * @param string|null $event_type_location EventTypeLocation is used to specify where Convoy should read the event type from an incoming webhook request. + * + * @return self + */ + public function setEventTypeLocation($event_type_location) + { + if (is_null($event_type_location)) { + throw new \InvalidArgumentException('non-nullable event_type_location cannot be null'); + } + $this->container['event_type_location'] = $event_type_location; + + return $this; + } + + /** + * Gets forward_headers + * + * @return string[]|null + */ + public function getForwardHeaders() + { + return $this->container['forward_headers']; + } + + /** + * Sets forward_headers + * + * @param string[]|null $forward_headers Soecfy header you want convoy to save from the ingest request and forward to your endpoints when the event is dispatched. + * + * @return self + */ + public function setForwardHeaders($forward_headers) + { + if (is_null($forward_headers)) { + throw new \InvalidArgumentException('non-nullable forward_headers cannot be null'); + } + $this->container['forward_headers'] = $forward_headers; + + return $this; + } + + /** + * Gets header_function + * + * @return string|null + */ + public function getHeaderFunction() + { + return $this->container['header_function']; + } + + /** + * Sets header_function + * + * @param string|null $header_function Function is a javascript function used to mutate the headers immediately after ingesting an event + * + * @return self + */ + public function setHeaderFunction($header_function) + { + if (is_null($header_function)) { + throw new \InvalidArgumentException('non-nullable header_function cannot be null'); + } + $this->container['header_function'] = $header_function; + + return $this; + } + + /** + * Gets idempotency_keys + * + * @return string[]|null + */ + public function getIdempotencyKeys() + { + return $this->container['idempotency_keys']; + } + + /** + * Sets idempotency_keys + * + * @param string[]|null $idempotency_keys IdempotencyKeys are used to specify parts of a webhook request to uniquely identify the event in an incoming webhooks project. + * + * @return self + */ + public function setIdempotencyKeys($idempotency_keys) + { + if (is_null($idempotency_keys)) { + throw new \InvalidArgumentException('non-nullable idempotency_keys cannot be null'); + } + $this->container['idempotency_keys'] = $idempotency_keys; + + return $this; + } + + /** + * Gets is_disabled + * + * @return bool|null + */ + public function getIsDisabled() + { + return $this->container['is_disabled']; + } + + /** + * Sets is_disabled + * + * @param bool|null $is_disabled This is used to manually enable/disable the source. + * + * @return self + */ + public function setIsDisabled($is_disabled) + { + if (is_null($is_disabled)) { + throw new \InvalidArgumentException('non-nullable is_disabled cannot be null'); + } + $this->container['is_disabled'] = $is_disabled; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Source name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets pub_sub + * + * @return \Convoy\Client\Model\ModelsPubSubConfig|null + */ + public function getPubSub() + { + return $this->container['pub_sub']; + } + + /** + * Sets pub_sub + * + * @param \Convoy\Client\Model\ModelsPubSubConfig|null $pub_sub PubSub are used to specify message broker sources for outgoing webhooks projects, you only need to specify this when the source type is `pub_sub`. + * + * @return self + */ + public function setPubSub($pub_sub) + { + if (is_null($pub_sub)) { + throw new \InvalidArgumentException('non-nullable pub_sub cannot be null'); + } + $this->container['pub_sub'] = $pub_sub; + + return $this; + } + + /** + * Gets type + * + * @return \Convoy\Client\Model\DatastoreSourceType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Convoy\Client\Model\DatastoreSourceType|null $type Source Type. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets verifier + * + * @return \Convoy\Client\Model\ModelsVerifierConfig|null + */ + public function getVerifier() + { + return $this->container['verifier']; + } + + /** + * Sets verifier + * + * @param \Convoy\Client\Model\ModelsVerifierConfig|null $verifier Verifiers are used to verify webhook events ingested in incoming webhooks projects. If set, type is required and match the verifier type object you choose. + * + * @return self + */ + public function setVerifier($verifier) + { + if (is_null($verifier)) { + throw new \InvalidArgumentException('non-nullable verifier cannot be null'); + } + $this->container['verifier'] = $verifier; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsUpdateSubscription.php b/src/Client/Model/ModelsUpdateSubscription.php new file mode 100644 index 0000000..a3c3fe0 --- /dev/null +++ b/src/Client/Model/ModelsUpdateSubscription.php @@ -0,0 +1,716 @@ + + */ +class ModelsUpdateSubscription implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.UpdateSubscription'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'alert_config' => '\Convoy\Client\Model\ModelsAlertConfiguration', + 'app_id' => 'string', + 'delivery_mode' => '\Convoy\Client\Model\DatastoreDeliveryMode', + 'endpoint_id' => 'string', + 'filter_config' => '\Convoy\Client\Model\ModelsFilterConfiguration', + 'function' => 'string', + 'name' => 'string', + 'rate_limit_config' => '\Convoy\Client\Model\ModelsRateLimitConfiguration', + 'retry_config' => '\Convoy\Client\Model\ModelsRetryConfiguration', + 'source_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'alert_config' => null, + 'app_id' => null, + 'delivery_mode' => null, + 'endpoint_id' => null, + 'filter_config' => null, + 'function' => null, + 'name' => null, + 'rate_limit_config' => null, + 'retry_config' => null, + 'source_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'alert_config' => false, + 'app_id' => false, + 'delivery_mode' => false, + 'endpoint_id' => false, + 'filter_config' => false, + 'function' => false, + 'name' => false, + 'rate_limit_config' => false, + 'retry_config' => false, + 'source_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'alert_config' => 'alert_config', + 'app_id' => 'app_id', + 'delivery_mode' => 'delivery_mode', + 'endpoint_id' => 'endpoint_id', + 'filter_config' => 'filter_config', + 'function' => 'function', + 'name' => 'name', + 'rate_limit_config' => 'rate_limit_config', + 'retry_config' => 'retry_config', + 'source_id' => 'source_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'alert_config' => 'setAlertConfig', + 'app_id' => 'setAppId', + 'delivery_mode' => 'setDeliveryMode', + 'endpoint_id' => 'setEndpointId', + 'filter_config' => 'setFilterConfig', + 'function' => 'setFunction', + 'name' => 'setName', + 'rate_limit_config' => 'setRateLimitConfig', + 'retry_config' => 'setRetryConfig', + 'source_id' => 'setSourceId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'alert_config' => 'getAlertConfig', + 'app_id' => 'getAppId', + 'delivery_mode' => 'getDeliveryMode', + 'endpoint_id' => 'getEndpointId', + 'filter_config' => 'getFilterConfig', + 'function' => 'getFunction', + 'name' => 'getName', + 'rate_limit_config' => 'getRateLimitConfig', + 'retry_config' => 'getRetryConfig', + 'source_id' => 'getSourceId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('alert_config', $data ?? [], null); + $this->setIfExists('app_id', $data ?? [], null); + $this->setIfExists('delivery_mode', $data ?? [], null); + $this->setIfExists('endpoint_id', $data ?? [], null); + $this->setIfExists('filter_config', $data ?? [], null); + $this->setIfExists('function', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('rate_limit_config', $data ?? [], null); + $this->setIfExists('retry_config', $data ?? [], null); + $this->setIfExists('source_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets alert_config + * + * @return \Convoy\Client\Model\ModelsAlertConfiguration|null + */ + public function getAlertConfig() + { + return $this->container['alert_config']; + } + + /** + * Sets alert_config + * + * @param \Convoy\Client\Model\ModelsAlertConfiguration|null $alert_config Alert configuration + * + * @return self + */ + public function setAlertConfig($alert_config) + { + if (is_null($alert_config)) { + throw new \InvalidArgumentException('non-nullable alert_config cannot be null'); + } + $this->container['alert_config'] = $alert_config; + + return $this; + } + + /** + * Gets app_id + * + * @return string|null + */ + public function getAppId() + { + return $this->container['app_id']; + } + + /** + * Sets app_id + * + * @param string|null $app_id Deprecated but necessary for backward compatibility + * + * @return self + */ + public function setAppId($app_id) + { + if (is_null($app_id)) { + throw new \InvalidArgumentException('non-nullable app_id cannot be null'); + } + $this->container['app_id'] = $app_id; + + return $this; + } + + /** + * Gets delivery_mode + * + * @return \Convoy\Client\Model\DatastoreDeliveryMode|null + */ + public function getDeliveryMode() + { + return $this->container['delivery_mode']; + } + + /** + * Sets delivery_mode + * + * @param \Convoy\Client\Model\DatastoreDeliveryMode|null $delivery_mode Delivery mode configuration + * + * @return self + */ + public function setDeliveryMode($delivery_mode) + { + if (is_null($delivery_mode)) { + throw new \InvalidArgumentException('non-nullable delivery_mode cannot be null'); + } + $this->container['delivery_mode'] = $delivery_mode; + + return $this; + } + + /** + * Gets endpoint_id + * + * @return string|null + */ + public function getEndpointId() + { + return $this->container['endpoint_id']; + } + + /** + * Sets endpoint_id + * + * @param string|null $endpoint_id Destination endpoint ID + * + * @return self + */ + public function setEndpointId($endpoint_id) + { + if (is_null($endpoint_id)) { + throw new \InvalidArgumentException('non-nullable endpoint_id cannot be null'); + } + $this->container['endpoint_id'] = $endpoint_id; + + return $this; + } + + /** + * Gets filter_config + * + * @return \Convoy\Client\Model\ModelsFilterConfiguration|null + */ + public function getFilterConfig() + { + return $this->container['filter_config']; + } + + /** + * Sets filter_config + * + * @param \Convoy\Client\Model\ModelsFilterConfiguration|null $filter_config Filter configuration + * + * @return self + */ + public function setFilterConfig($filter_config) + { + if (is_null($filter_config)) { + throw new \InvalidArgumentException('non-nullable filter_config cannot be null'); + } + $this->container['filter_config'] = $filter_config; + + return $this; + } + + /** + * Gets function + * + * @return string|null + */ + public function getFunction() + { + return $this->container['function']; + } + + /** + * Sets function + * + * @param string|null $function Convoy supports mutating your request payload using a js function. Use this field to specify a `transform` function for this purpose. See this[https://docs.getconvoy.io/product-manual/subscriptions#functions] for more + * + * @return self + */ + public function setFunction($function) + { + if (is_null($function)) { + throw new \InvalidArgumentException('non-nullable function cannot be null'); + } + $this->container['function'] = $function; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Subscription Nme + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets rate_limit_config + * + * @return \Convoy\Client\Model\ModelsRateLimitConfiguration|null + */ + public function getRateLimitConfig() + { + return $this->container['rate_limit_config']; + } + + /** + * Sets rate_limit_config + * + * @param \Convoy\Client\Model\ModelsRateLimitConfiguration|null $rate_limit_config Rate limit configuration + * + * @return self + */ + public function setRateLimitConfig($rate_limit_config) + { + if (is_null($rate_limit_config)) { + throw new \InvalidArgumentException('non-nullable rate_limit_config cannot be null'); + } + $this->container['rate_limit_config'] = $rate_limit_config; + + return $this; + } + + /** + * Gets retry_config + * + * @return \Convoy\Client\Model\ModelsRetryConfiguration|null + */ + public function getRetryConfig() + { + return $this->container['retry_config']; + } + + /** + * Sets retry_config + * + * @param \Convoy\Client\Model\ModelsRetryConfiguration|null $retry_config Retry configuration + * + * @return self + */ + public function setRetryConfig($retry_config) + { + if (is_null($retry_config)) { + throw new \InvalidArgumentException('non-nullable retry_config cannot be null'); + } + $this->container['retry_config'] = $retry_config; + + return $this; + } + + /** + * Gets source_id + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['source_id']; + } + + /** + * Sets source_id + * + * @param string|null $source_id Source Id + * + * @return self + */ + public function setSourceId($source_id) + { + if (is_null($source_id)) { + throw new \InvalidArgumentException('non-nullable source_id cannot be null'); + } + $this->container['source_id'] = $source_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/ModelsVerifierConfig.php b/src/Client/Model/ModelsVerifierConfig.php new file mode 100644 index 0000000..dd9f750 --- /dev/null +++ b/src/Client/Model/ModelsVerifierConfig.php @@ -0,0 +1,515 @@ + + */ +class ModelsVerifierConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'models.VerifierConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'api_key' => '\Convoy\Client\Model\ModelsApiKey', + 'basic_auth' => '\Convoy\Client\Model\ModelsBasicAuth', + 'hmac' => '\Convoy\Client\Model\ModelsHMac', + 'type' => '\Convoy\Client\Model\DatastoreVerifierType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'api_key' => null, + 'basic_auth' => null, + 'hmac' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'api_key' => false, + 'basic_auth' => false, + 'hmac' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'api_key' => 'api_key', + 'basic_auth' => 'basic_auth', + 'hmac' => 'hmac', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'api_key' => 'setApiKey', + 'basic_auth' => 'setBasicAuth', + 'hmac' => 'setHmac', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'api_key' => 'getApiKey', + 'basic_auth' => 'getBasicAuth', + 'hmac' => 'getHmac', + 'type' => 'getType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('api_key', $data ?? [], null); + $this->setIfExists('basic_auth', $data ?? [], null); + $this->setIfExists('hmac', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets api_key + * + * @return \Convoy\Client\Model\ModelsApiKey|null + */ + public function getApiKey() + { + return $this->container['api_key']; + } + + /** + * Sets api_key + * + * @param \Convoy\Client\Model\ModelsApiKey|null $api_key api_key + * + * @return self + */ + public function setApiKey($api_key) + { + if (is_null($api_key)) { + throw new \InvalidArgumentException('non-nullable api_key cannot be null'); + } + $this->container['api_key'] = $api_key; + + return $this; + } + + /** + * Gets basic_auth + * + * @return \Convoy\Client\Model\ModelsBasicAuth|null + */ + public function getBasicAuth() + { + return $this->container['basic_auth']; + } + + /** + * Sets basic_auth + * + * @param \Convoy\Client\Model\ModelsBasicAuth|null $basic_auth basic_auth + * + * @return self + */ + public function setBasicAuth($basic_auth) + { + if (is_null($basic_auth)) { + throw new \InvalidArgumentException('non-nullable basic_auth cannot be null'); + } + $this->container['basic_auth'] = $basic_auth; + + return $this; + } + + /** + * Gets hmac + * + * @return \Convoy\Client\Model\ModelsHMac|null + */ + public function getHmac() + { + return $this->container['hmac']; + } + + /** + * Sets hmac + * + * @param \Convoy\Client\Model\ModelsHMac|null $hmac hmac + * + * @return self + */ + public function setHmac($hmac) + { + if (is_null($hmac)) { + throw new \InvalidArgumentException('non-nullable hmac cannot be null'); + } + $this->container['hmac'] = $hmac; + + return $this; + } + + /** + * Gets type + * + * @return \Convoy\Client\Model\DatastoreVerifierType + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Convoy\Client\Model\DatastoreVerifierType $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/TestFilter200Response.php b/src/Client/Model/TestFilter200Response.php new file mode 100644 index 0000000..ac0794c --- /dev/null +++ b/src/Client/Model/TestFilter200Response.php @@ -0,0 +1,478 @@ + + */ +class TestFilter200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TestFilter_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsTestFilterResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsTestFilterResponse|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsTestFilterResponse|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/TestOAuth2Connection200Response.php b/src/Client/Model/TestOAuth2Connection200Response.php new file mode 100644 index 0000000..b919950 --- /dev/null +++ b/src/Client/Model/TestOAuth2Connection200Response.php @@ -0,0 +1,478 @@ + + */ +class TestOAuth2Connection200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TestOAuth2Connection_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsTestOAuth2Response' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsTestOAuth2Response|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsTestOAuth2Response|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/TestSubscriptionFilter200Response.php b/src/Client/Model/TestSubscriptionFilter200Response.php new file mode 100644 index 0000000..86d00c1 --- /dev/null +++ b/src/Client/Model/TestSubscriptionFilter200Response.php @@ -0,0 +1,478 @@ + + */ +class TestSubscriptionFilter200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TestSubscriptionFilter_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return bool|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param bool|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/UtilServerResponse.php b/src/Client/Model/UtilServerResponse.php new file mode 100644 index 0000000..26b8253 --- /dev/null +++ b/src/Client/Model/UtilServerResponse.php @@ -0,0 +1,444 @@ + + */ +class UtilServerResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'util.ServerResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/Model/V1ProjectsProjectIDSourcesTestFunctionPost200Response.php b/src/Client/Model/V1ProjectsProjectIDSourcesTestFunctionPost200Response.php new file mode 100644 index 0000000..4c56469 --- /dev/null +++ b/src/Client/Model/V1ProjectsProjectIDSourcesTestFunctionPost200Response.php @@ -0,0 +1,478 @@ + + */ +class V1ProjectsProjectIDSourcesTestFunctionPost200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_v1_projects__projectID__sources_test_function_post_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'status' => 'bool', + 'data' => '\Convoy\Client\Model\ModelsFunctionResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return bool|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets data + * + * @return \Convoy\Client\Model\ModelsFunctionResponse|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Convoy\Client\Model\ModelsFunctionResponse|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Client/ObjectSerializer.php b/src/Client/ObjectSerializer.php new file mode 100644 index 0000000..8b0a204 --- /dev/null +++ b/src/Client/ObjectSerializer.php @@ -0,0 +1,604 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + $callable = [$openAPIType, 'getAllowableEnumValues']; + if (is_callable($callable)) { + /** array $callable */ + $allowedEnumTypes = $callable(); + if (!in_array($value, $allowedEnumTypes, true)) { + $imploded = implode("', '", $allowedEnumTypes); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach ($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object) $values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp($timestamp) + { + if (!is_string($timestamp)) { + return $timestamp; + } + + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue($value, string $openApiType): bool + { + // If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + // Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + // For numeric values, false and '' are considered empty. + // This comparison is safe for floating point values, since the previous call to empty() will + // filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + // For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + // For string values, '' is considered empty. + case 'string': + return $value === ''; + + // For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType eg. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + + // Check if we should omit this parameter from the query. This should only happen when: + // - Parameter is NOT required; AND + // - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + // example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + // Handle DateTime objects in query + if ($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) { + return $arr; + } + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value) + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; + } + + return (int) $value; + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param float|int|bool|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return (string) $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($style) { + case 'pipeDelimited': + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'spaceDelimited': + case 'ssv': + return implode(' ', $collection); + + case 'simple': + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[]|null $httpHeaders HTTP headers + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some APIs return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new \DateTime($data); + } catch (\Exception $exception) { + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new \DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } + + + if (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object) $data; + } + + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\Convoy\Client\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } + + /** + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? substr($qs, 0, -1) : ''; + } +} diff --git a/tests/ApiClientContractTest.php b/tests/ApiClientContractTest.php new file mode 100644 index 0000000..8e4a1af --- /dev/null +++ b/tests/ApiClientContractTest.php @@ -0,0 +1,76 @@ + 'application/json'], + '{"status":true,"message":"ok","data":null}'), + ]); + $stack = HandlerStack::create($mock); + $stack->push(Middleware::history($captured)); + + $config = (new Configuration()) + ->setHost('https://us.getconvoy.cloud/api') + ->setApiKeyPrefix('Authorization', 'Bearer') + ->setApiKey('Authorization', 'test-key'); + + $event = (new ModelsCreateEvent()) + ->setEndpointId('ep-1') + ->setEventType('invoice.paid') + ->setData([ + 'amount' => 100, + 'currency' => 'USD', + 'nested' => ['customer' => 'cus_123'], + ]); + + // Guzzle applies default headers to sent requests only when the request + // doesn't already carry them; the version pin rides along this way. + $http = new Client([ + 'handler' => $stack, + 'headers' => ['X-Convoy-Version' => '2025-11-24'], + ]); + (new EventsApi($http, $config))->createEndpointEvent('proj-1', $event); + + expect($captured)->toHaveCount(1); + $request = $captured[0]['request']; + + expect($request->getMethod())->toBe('POST'); + expect($request->getUri()->getPath())->toBe('/api/v1/projects/proj-1/events'); + expect($request->getHeaderLine('Authorization'))->toBe('Bearer test-key'); + expect($request->getHeaderLine('X-Convoy-Version'))->toBe('2025-11-24'); + expect($request->getHeaderLine('Content-Type'))->toContain('application/json'); + + $sent = json_decode((string) $request->getBody(), true); + expect($sent['endpoint_id'])->toBe('ep-1'); + expect($sent['event_type'])->toBe('invoice.paid'); + expect($sent['data']['amount'])->toBe(100); + expect($sent['data']['currency'])->toBe('USD'); + expect($sent['data']['nested']['customer'])->toBe('cus_123'); +}); + +test('event data inbound keeps all keys', function () { + $raw = json_decode( + '{"uid":"evt-1","event_type":"invoice.paid",' + . '"data":{"amount":100,"nested":{"customer":"cus_123"}}}' + ); + + $event = ObjectSerializer::deserialize($raw, DatastoreEvent::class); + + $data = (array) $event->getData(); + expect($data['amount'])->toBe(100); + expect((array) $data['nested'])->toBe(['customer' => 'cus_123']); +});